# 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:
- Select the test case from which you want to extract the result
- Go to
Store result into the variable
- Provide the variable name in which you want to store the test case result
- A test case result is a JSON object with the following keys:
- isPassed: The value of this key will be true if the test case is passed otherwise the value will be false.
- isExecuted: The value of this key will be true if the test case is executed successfully irrespective of its 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, the first one creates a contact on the server, and the second test case updates that contact on the server. If the first test case fails then we want to prevent the execution of the 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 the second test case becomes not runnable and will not be executed.