Overview
Test Parameters allow externalizing custom test data and provides a mechanism for overriding the data when the test is executed part of a Collection.
For example, imagine a browser test that requires to be executed on your Staging, Pre-prod and Prod environments. The test may have set of variables such as url, username, password specific to each of your environments.
The test may also contain certain test data that remains constant across all your environments. Instead of hard-coding such common variables in your test or replicating the same variables in all your environments, you can leverage Test Parameters. Test Parameters are key-value pairs associated with a monitor that can be programatically accessed while executing your API or Browser Test.
Using Test Parameters
Test Parameters can be defined for API or Browser Tests. The defined parameters can be accessed via scripts as below.
Here is an example of a test with Test Parameters defined.
These variables can be accessed in your test as below.
console.log(devraven.testParams.foo); //prints value1
console.log(devraven.testParams.bar); //prints value2
console.log(devraven.testParams.baz); //prints undefined
Overriding in Collections
Test Parameters defined for a Test, can be overriden when the test is executed part of a Collection. The Collection Steps tab on Collection definition page allows specifying additional Test Parameters or override the values for any Test Parameters.
If Override Test Parameters are specified for a Step in a Collection, the specified parameters will override any Test Parameters specified directly on the test. The test will then be executed with the new overriden Test Parameter values.
Here are the screenshots showing where Override Test Parameters can be specified for a Step in a Collection.