Information:

Environment

  • Dynatrace Recorder
Question

How do I validate that a page did not generate a specific object return code?  For example, validate an object return code not equal to 500.

Use a Custom action and a Validate action.

Add the Custom action at the beginning of the step where the specific object will be downloaded. Use the JavaScript indexOf() function to specify the object that you want to capture the return code. The sample code below uses https://www.gomeznetworks.com/js/login.js.

Add the Validate action at the end of the step. Make sure the match text string in the Validate action does not exist in the source of the object. In the example below, the match text is the error message for a 500 error: '500 Error Found During Testing'.

If the object's return code is 500, the match text in the Validate action will be found and the the script will fail with a Content Match error.

For more information, see the help pages Editing Script Actions, Custom Actions, and Validate Actions.