Extraction steps in Test Studio allow you to design the automated test scenarios to use data generated dynamically during the test execution. The extraction steps can take any text based value and store into a variable. The variable can be used to data drive a value in the upcoming steps in test.
Find out more about extraction steps in the and how you can use these in the below article.
- General notes about wait steps
- Add an extraction step
- Use the extracted variable in the next test steps
- Add an extraction step without recording session
- Extract the value of element attribute
The Test Studio extraction steps are using the implementation for verification steps. But instead of passing or failing based on a comparison, the extraction step gets the value (text based) of an attribute for the element and stores it into a variable. The variable can be used in any of the next steps to data drive a property of the step.
The variable can be as well referenced in a sub-test used as step in the main test. In such case you need to manually type the name of the variable in the data driven property.
The engine for creating the verification sentences allows you to convert any Verification step to Wait or Extracttion step (converting to extraction step is available for text based verifications). Use the Change Role option from the step context menu and choose from the options in the sub-menu.
The Highlighting menu gives quick access to a set of predefined extractions, which can be added with a single click while recording. You can follow the below steps to insert a wait step in your test.
1. Create a test and start a recording session. Navigate to the tested application - in this example we use a web test and the Telerik official page.
2. Enable the highlighting once the recorder is attached to the browser. Hold the mouse over the Demos option in the navigation menu and add a step to extract its text content.
3. Some of the step properties are specific for the extraction step and allow you to change the variable name.
Once an extraction step is added in a test, it generates a variable which holds the extracted value. This variable is listed as available for data driving the properties of the test steps.
Let's continue the described test scenario and use the extracted variable to type some text into the search engine on the Telerik page and check if the displayed results list that word. So, the steps added in the test are to click on the Search icon, type some text in the Search field, click the Search button. Then verify the results count contains the typed text.
1. Open the properties of the 'Enter text' step and expand the Bindings option. The only property to data drive is the text to type and the extracted variable DemosLink is listed in the dropdown as an option for data binding.
2. In the same manner use the extracted variable to data drive the two verification steps.
If you need to use the extracted variable into another test used as a step, the variable name is not directly listed in the sub-test's step properties. However, you still can use it by typing the variable name in the text box (without the $ notation), click on the brackets icon and then Set button:
Extracted variables can be also used in coded steps - you can either get or set their values. This can help in the scenarios when you need to modify the initially extracted string before using it in the next steps.
The automated test scenarios often need to be enriched with additional actons to complete the tested feature. In such cases you might need to add a new extraction step in the already recorded test. For such cases Test Studio provides the options for partial test execution, which allow you to get to a certain point of the test and record the additional steps.
For the cases when the project and scenarios are quite complex, you can add extarction steps for an already recorded element and without starting a recording session. The below list guide you through the steps for this:
1. Open a test in which you need to add a step. Choose an element from the Elements Explorer.
Note: Usually, the extraction to insert is related to an action step and its element. Thus, if you click on that action step, its target element gets highlighted in the Elements Explorer with a red arrow. Select the element and proceed to the Step Builder.
2. Click the Step Builder pane to activate it. Under the Actions and Verification sections, you can see the options corresponding to the type of selected element.
3. Choose the verification type you need for the extraction and click the Add Step button to insert the step in the test.
4. The generated step is either wait or verification step and you need to convert it to an extraction from the step properties option Change Role....
Check this short video demonstrating how to add a step for an existing element in Test Studio.
The implementation of verification steps allows you to convert any text based check to an extraction. Thus you can use the value of each element attribute into an extracted variable.
1. Create an advanced verification for an attribute of an element.
2. Switch the verification step role to an extraction step through the step properties option Change Role....