Excerpt |
---|
Variables can be extracted from Test Case's responses and can be used in subsequent HTTP requests (test cases). To extract the variable's values from test case's actual results, please follow the steps below: - Expand the test case from which you want to extract variables
- Go to "Variable Extractor" sub tab
- Define the variable's name and their corresponding path in the JSON response
Note |
---|
|
|
From vREST 1.3.1, variables having numeric values used in expected body (JSON Format), must be enclosed with double quotesFrom vREST 2.0.0, we have removed the JSON Path prefix `$.` or `$`.Let us take an example, how we can extract a variable from API response:
Note |
---|
|
- Variable extraction feature is only applicable for JSON / XML responses at present using JSON / XML path.
- For defining JSON path, follow the guide.
- For defining XML path, follow the guide.
- If you want to extract variables from responses other than JSON/XML, then you need to write your own utility method to extract data from either response body or response headers. For more information on this, please read this doc (Extracting variable via Utility Methods).
|