Skip to content

Latest commit

 

History

History
66 lines (61 loc) · 1.69 KB

parameters.md

File metadata and controls

66 lines (61 loc) · 1.69 KB

Paramaters

Parameters are used in the test scripts.

Passing Params to Test

Define in conf.js file:

exports.config = {
  params: {
    someKey: someValue,
    anotherKey: {
     secondLevelKey: secondLevelValue
    }
  }
};

Override from command line or define new params:

$ uiveri5 --params.someKey=redefineSomeValue --params.anotherKey.anotherSecondLevelKey=anotherSecondLevelValue

Using Paramaters in Test

if('should check something',function(){
  if(browser.testrunner.config.params.someKey) {
    doSomethingWithThisValue(browser.testrunner.config.params.someKey);
  }
});

Importing Parameters from a File

The configuration can point to a JSON file that contains test parameters. All data in the file will be made available in browser.testrunner.config.params. Any command-line parameters with matching names will take priority over the ones imported from the file.

$ uiveri5 --paramsFile="./param.json"

param.json before test start:

{
  "some_param": "some value"
}
if('should check something', function () {
  expect(browser.testrunner.config.params.some_param).toBe("some value);
});

Exporting Parameters to a File

The configuration can point to a JSON file where test parameters will be exported after all tests complete.

$ uiveri5 --exportParamsFile="./exportParam.json"
if('should do something', function () {
  browser.testrunner.config.exportParams.some_param = "some value derived during the test";
  expect(Object.keys(browser.testrunner.config.exportParams).length).toBe(1);
});

exportParam.json after test completed:

{
  "some_param": "some value derived during the test"
}