Storing test case results into a variable

Test Case's results can also be stored into a variable and can be used in subsequent test cases. To extract the test case's results into a variable, please follow the steps below:

  1. Select the test case from which you want to extract result
  2. Go to Variable Extractor >> Store result into variable
  3. Provide the variable name in which you want to store the test case result
  4. A test case result is a JSON object with the following keys:
    • isPassed: Value of this key will be true if the test case is passed otherwise the value will be false.
    • isExecuted: Value of this key will be true if the test case is executed successfully irrespective of it's result otherwise the value will be false.

Use Case: This functionality is useful in storing the result of a test case into a variable then based on the result, execution of subsequent test cases can be controlled. Let us take an example, how we can store the test case result into a variable:

Suppose we have two test cases, first one creates a contact on server and second test case updates that contact on server. If the first test case fails then we want to prevent the execution of second test case.

Now store the result of first test case into a variable say "tcResult" as shown below:

Now, use the result variable of first test case as a condition of any subsequent test case.

Now, if we execute the test cases and if the first test case fails then second test case becomes not runnable and will not be executed.