In all the automation suites general requirements is passing data from one method/test to another method/test.
In TTS you can achieve this behavior in three ways
1. In Telerik Test Studio, for each Telerik test we have an option called 'InheritParentDataSource' property. Once we set this property child test calling can access this variable.
2. Using Extracted Variables - These are stored in a global data dictionary and exist for the entire life of the test. Both child tests and parent tests have access to these variables.
You can achieve this in two ways
3. Writing your own custom code. ex: Create a global variable in code which can be accessed anywhere in the code.
In TTS you can achieve this behavior in three ways
1. In Telerik Test Studio, for each Telerik test we have an option called 'InheritParentDataSource' property. Once we set this property child test calling can access this variable.
2. Using Extracted Variables - These are stored in a global data dictionary and exist for the entire life of the test. Both child tests and parent tests have access to these variables.
You can achieve this in two ways
- Using Recording steps.
1.
Start recorder and enable 'Highlight
Element'
2.
Select the desired element, choose
Quick Steps > Extract - text contains entry. This adds the Extracted step to
the test. In the test drill down the extracted step and set desired
DataBindVariableName. (Step 1)
3.
Record the step where you want to
use this extracted variable.
4.
In the test, select the step where
you want to set the text. (Step 2)
5.
In the properties pane click the
'Bindings' drop down. and select the extracted variable from the value drop
down list (Step 3)
6. Click Set.
- Using Coded Step
In
the telerik test add Script Step and use below variables for setting and
getting values via code.
Example :
string name = "Test Automation";
SetExtractedValue("extractedID", name);
Object nameVal = GetExtractedValue("extractedID");
string name = "Test Automation";
SetExtractedValue("extractedID", name);
Object nameVal = GetExtractedValue("extractedID");
3. Writing your own custom code. ex: Create a global variable in code which can be accessed anywhere in the code.
No comments:
Post a Comment