This topic presents a variety of SOASTA CloudTest error detection scripts. The Scripts below can be copied and pasted directly into the SOASTA CloudTest Script Editor using Central > Scripts. Longer scripts have an accompanying image that can be clicked to pop out the full example script. Shorter scripts are presented inline (in the right column).
Set play count for all messages in a clip to 1 (note that this ignores any messages that might have other repeats set on them).
Set all play counts in clip = 0 if “authid” is not returned from the login POST.
This script can be added to the typical validation script. "BulkChain 1" is the name of the chain. There are 2 chains in the test, and they are named BulkChain 1 and 2. The script can find them by name and set them to a specific value. 0 = it will not play.
This example script checks the body of a response for errors and throws the error and message associated with the error.
This script compares response data (in this case something from a message header) to data that has been previously entered into a message property. This structure of a script is useful for error handling. If the response matches, continue with the test. If the response doesn’t match the expected response, output an error or stop the test.
This approach for error handling is powerful because it doesn’t rely on hard-coded values in the script. Instead, the matching is done on variables placed in individual messages.
Use this example script to develop an example of try/catch logic.