Conditional GoTo Test Step

Applies to ReadyAPI 3.53, last modified on June 07, 2024

About GoTo test step

The Conditional GoTo test step lets you define a number of XPath expression conditions to jump to the specified test steps if the condition evaluates to True.

The conditions refer to the response received by the latest Request test step in the test case.

You need to send a request at least once to have a response to work with.

The test step contains one or several conditions. For each condition, you specify a target test step to jump to. ReadyAPI evaluates conditions in the order they are specified in the list. When a condition returns True, the test execution jumps to the target test step, specified in that condition. The rest of conditions are not evaluated. If you need more complex behavior, use the Groovy Script test step.

If none of the conditions evaluates to True, the execution continues with the next test step in the test case.

ReadyAPI cannot parse XML documents that contain the byte order mark (BOM) character.

Editing conditional GoTo test step

You can modify settings of a test step in its editor:

Conditional GoTo test step editor

Click the image to enlarge it.

Here is a description of some panels:

Conditions list

The list of conditions to evaluate. The test step toolbar allows you to create and modify conditions:

  • – Adds a new condition to the list.

  • – Creates a copy of the selected condition.

  • – Removes the selected condition from the list.

  • – Renames the selected condition.

  • and – Move the selected condition up and down on the list respectively.

Test step toolbar

The main test step toolbar. It contains the following commands:

  • Declare namespace – Declares namespaces extracted from the response of the latest test step.

  • Run all conditions – Runs all conditions against the response in the latest test step.

Condition panel

  • Condition XPath Expression – The XPath Expression to be evaluated. It must return True for ReadyAPI to perform the target test step (see an example below).

    You can enter the XPath expression manually, or click Select XPath and use the Select XPath dialog to browse the last response for the element to be included.

    If your XPath expression uses namespaces, define them using the declare namespace statement:

    declare namespace soap='';
    declare namespace xml='';
    //soap:Text[1]/@xml:lang = 'myLang'

    You can type the declaration statement manually, or click in the test step toolbar to extract it from the response of the latest test step.

    To ignore a namespace, specify *. For example, the following statement checks the value of the foo element regardless of its namespace:

    //*:foo = 'bar'

  • Target step – The test step to go to, if the specified XPath expression returns True.

  • Run condition – Runs the current condition against the previous response and shows the result.

  • Select XPath – Opens the Select XPath dialog to select the desired node from the response of the latest test step.

Property list

Besides the test step editor, you can adjust the test step’s behavior by using its properties in the Goto Properties tab in the Navigator.

The Conditional Goto does not support custom properties.
Name Description

The test step’s name.


Text describing the test step.


While the test step editor is open, brief information on evaluated conditions is listed in the Log panel. If the test step is run as part of a test case, you can see evaluation results in the Transaction Log panel.

Working with

Below, you can find information on common tasks that you can perform with the Conditional Goto test step.

Specify condition XPath expression

The following sample shows how to specify Condition XPath Expression:

In this example, we assume that you have a Request test step preceding the Conditional Goto test step.
  • Click to add a new condition and specify its name.

  • Click Select XPath to select the node you are interested in via the Select XPath dialog.

    To be able to select the node, run the request test step at least once to obtain a response.
  • When you select the node, ReadyAPI specifies the XPath expression that returns the selected node. We need to modify the XPath expression to make it return True or False. For example, we can check if the specified node exists in the response. To do this, use the exists() function:


See Also

Test Steps

Highlight search results