Runtime Test Data is one of the Test Data types present in Testsigma along with other types such as Global Parameter, Environment Parameter, Function Parameter, Parameter Test Data, and Random Test Data.
More details about Test Data Types is available in this article - What are the different types of test data supported in Testsigma?
When we need to store temporary data from a Test Step for usage in a Test Step that comes later, we can make use of Runtime Test Data.
Unlike Global Parameters, Environment Parameters, and Parameter Test Data; Runtime Test Data doesn't have an Interface to manage it. This feature is deliberately avoided since its scope is limited to a Test Step and it is removed from Memory once the Test Case Execution completes.
Usage of Runtime Test Data
Let us take the help of a simple scenario to explain in detail about the usage of Runtime Test Data.
Example Use Case Scenario
We will be doing the following steps in our Test Case:
1. Go to Google Home page at http://www.google.co.in using the template - type testdata
2. Store the title of the page into a runtime test data variable named 'pagetitle' using template - store title of the current page into a variable testdata.
store title of the current page into a variable pagetitle
We can do this by replacing the testdata part with our desired variable name i.e. pagetitle.
3. Enter the value of pagetitle variable into search box using template - type testdata in ui identifier.
type $|pagetitle| in searchfield
Replace the testdata part with $|Runtime| to fetch the previously saved run-time variable.
4. Click on the Google Search button to submit using template - click ui identifier if visible
click searchbutton if visible
Here's a screenshot of the actual implementation:
The UI Identifiers used in the task are:
searchfield with an id = 'lst-ib"
searchbutton with an xpath = "//input[@value='Google Search'][@class='lsb']"
In the second step, we are storing the title of the page into a variable named 'pagetitle'. We may use any name that seems apt for the variable. For accessing the variable in a later step, as we see in third step, we can use the format '$|pagetitle|' where 'pagetitle' is the variable name.
- For storing the run-time variable, we only need to replace the 'testdata' part with our desired [variable_name] in the natural language template.
- Similarly, for retrieving the runtime variable, we only need to replace the 'testdata' part with the desired [variable_name] having a prefix '$|' and suffix '|' in the natural language template.
There are a number of Test step templates available for storing a runtime variable. Few of them are:
- Store tag name of the element UI-Identifier into a variable TestData
- Store text from the element UI-Identifier into a variable TestData
- Store the count of elements identified by locator UI-Identifier into a variable TestData
- Store the count of options from UI-Identifier into a variable TestData
- Store the text of the selected option from UI-Identifier into a variable TestData
- Store the url of the current page into a variable TestData Web Application
- Store the value displayed in the textbox UI-Identifier into a variable TestData
- Store the value for the attribute Attribute of the element UI-Identifier into a variable TestData
- Store title of the current page into a variable TestData
For a complete list of natural language queries, please refer this article - Natural Language Queries/Commands/Templates available in Testsigma