Skip to content

Latest commit

 

History

History
317 lines (221 loc) · 4.75 KB

config.md

File metadata and controls

317 lines (221 loc) · 4.75 KB

Config API

At first, testring have similar API for config file and arguments in command line, so this guide will have examples for both CLI and config file.
Framework have 3 levels of configuration, sorted by priority:

CLI arguments -> environment file -> config file

Config file have lowest priority, it's fields will be overrided by environment config, if it's exists, CLI arguments overrides everything.


config

.testringrc default

Path to config file, relative to project root, works only as CLI argument. Config can be json or javascript file.

Javascript file should return:

  • Config object;
  • Function with config object;
  • Function with Promise, that returns config object (for async initialization).
$ testring run --config ./my-custom-config.json

envConfig

void default

Path to environment config, relative to project root, works only as CLI argument. All resolving logic is similar to --config.
envConfig extends and overrides original config, useful for decomposing config into smaller parts.


tests

./tests/**/*.js default

Glob pattern, relative to project root. All founded file will be added to run queue.

$ testring run --tests ./src/**/test/*.spec.js
{
  "tests": "./src/**/test/*.spec.js"
}

logLevel

info default

Filtering logs rule.

Available levels:

  • verbose
  • debug
  • info
  • warning
  • error
  • silent
$ testring run --log-level silent
{
  "logLevel": "silent"
}

silent

false default

Alias for --logLevel silent.

$ testring run --silent
{
  "silent": true
}

bail

false default

Fail out on the first error instead of tolerating it.

$ testring run --bail
{
  "bail": true
}

workerLimit

1 default

Limit of parallel running tests. Increase this number carefully, because a lot of workers won't be so efficient, also your driver plugin may not be able to handle so much connections. Can be passed as local value to run test in same process with runner.

$ testring run --worker-limit 20
{
  "workerLimit": 20
}

retryCount

3 default

Reruns count, if test failed. Useful, if your test is not stable.

$ testring run --retry-count 5
{
  "retryCount": 5
}

retryDelay

2000 default

Value in milliseconds, adds time gap between reruns of test.

$ testring run --retry-delay 10000
{
  "retryDelay": 10000
}

testTimeout

900000 default

Value in milliseconds, maximum time for test execution.

$ testring run --test-timeout 10000
{
  "testTimeout": 10000
}

screenshots

disable default

String value for screenshots making policy

Available values:

  • disable - turn off screenshots
  • enable - turn on screenshots
  • afterError - turn on screenshots only on retry runs
$ testring run --screenshots enable
{
  "screenshots": "enable"
}

restartWorker

never default

String value for workers restart strategy. If passed always - it will be killed after it ends

Available values:

  • always - always restart worker after test execution finished
  • never - disable restart
$ testring run --restartWorker always
{
  "restartWorker": "never"
}

envParameters

{} default

Special object, that passed right into test. You can get it inside test with api.getEnvironment() call.

{
  "envParameters": {
    "custom": [ "test", "data" ]
  }
}

httpThrottle

0 default

Delay between http requests in milliseconds. Useful if you don't want spam your test environment.

$ testring run --http-throttle 500	
{	
 "httpThrottle": 500	
}	

plugins

void default

Plugins are powerful instrument for extending framework functional. More about plugins you can read here.

$ testring run --plugins my-plugin-1 --plugins my-plugin-2
{
  "plugins": [
    "my-plugin-1",

    ["my-plugin-2", {
      "userConfig": true
    }]
  ]
}