JSON Parameters File Parameters
Pass parameters to a test using JSON Parameters File
Using a JSON Parameters File, you can pass parameters to test runs. This method allows you to define dynamic values inside your test which vary by your test environment. For example, you can set different login credentials (username and password) when you test locally and when testing in your CI. The JSON Parameters File, which defines parameters, is created and then when running the test you can add an argument to the command that calls the JSON Parameters Files. The CLI command will pass the parameters to the tests that are included in the run.
Parameter scope
The scope of the defined parameter covers all the tests in a single run (execution).
Defining parameters in a JSON Parameters File
Create a JSON File in which you define the desired parameters like the following example:
{
"username": "david",
"password": "123"
}
Using the parameters in the CLI
After defining the JSON Parameters File, you can pass it to Testim CLI as an argument: --params-file followed by the file name.
The string path that is set in the
params-file
path must be a relative path, and not a full path.
testim --label "<YOUR LABEL>" --token "<YOUR ACCESS TOKEN>" --project "<YOUR PROJECT ID>" --grid "<Your grid name>"
--params-file <PARAM FILE NAME e.g. params-file.json>
At this stage the parameters can be used/called from within the relevant tests using the Step Properties Panel Parameters.
Updated 11 months ago