When you work with test automation, parameterizing data or creating variables instead of hard coding test data can often be a more efficient practice, especially when you have test cases in which test data may change. Instead of updating all the test cases individually, which can take a lot of time and effort, you can edit global variables to update all instances within your test cases at once.
For example: Let’s parameterize username and password, which means if the credentials change, there is no need to update the test cases, but rather we can simply change the test data.
- Go to
Test Data(by default Global Variables is selected)
- Select the variable type (for the username, we will use
- Give the variable a name. We must take case sensitivity into account since this will be how we call the variable into our test case.
Set the value of the variable.
The process to create the password variable is the same as the one described previously, with the difference that we select
Hidden as the variable type instead of
This is how the variables will appear in the
Test Data section.
Note: You can always edit or delete a global variable.
To call a variable within the test case, we always have to use the keywords
stored value or
enter stored value "Username" into "Username" enter stored value "Password" into "Password"