CLI and library that adds Synthetics Continuous Automated Testing directly into your CICD pipeline!
To install the package for use as a library, use your favorite npm-based package manager:
npm install @newrelic/continuous-automated-testing
For use as a CLI package, install it globally:
npm install @newrelic/continuous-automated-testing -g
To run a batch of tests when using the package as a CLI, use the run-tests command:
newrelic-cat run-tests -a <new-relic-api-key> -c <json-config-file-path -v
The run-tests
command will start a batch of tests based on the config file input. The results will be displayed once the tests have finished running.
The command has the following options:
-
-a, --api-key <value>
: Your New Relic API key. We suggest using a secrets manager during CI to avoid hardcoding and exposing your API key. -
-c, --config-file-path <value>
: Relative path to a JSON CAT configuration file. See an example here. -
-v, --verbose
: See more detail on test results in STDOUT. When not enabled, only blocking tests will have all details displayed. Can also be added in the config file.
After installing the package, import the runTestBatch
function:
import { runTestBatch } from "@newrelic/newrelic-continuous-automated-testing"
The function takes the following parameters:
-
apiKey
: A New Relic API key. -
config
: A JSON CAT configuration file. See an example here.
{
"accountId": 12345, // Required
"region": "US", // Required, options: US, EU
"verbose": true, // Optional, default: false
"tests": [ // Array of tests to run
{
"monitorGuid": "monitor-GUID-1", // Required
"config": { // All config fields optional
"isBlocking": true,
"overrides":{
"startingUrl": "example.com"
}
}
},
{
"monitorGuid": "monitor-GUID-2" // Required
}
],
"config": { // All config fields optional
"batchName": "Test Batch"
}
}
New Relic hosts and moderates an online forum where customers can interact with New Relic employees as well as other customers to get help and share best practices.
New Relic Continuous Automated Testing CLI is licensed under the Apache 2.0 License.
The New Relic Continuous Automated Testing CLI also uses source code from third-party libraries. You can find full details on which libraries are used and the terms under which they are licensed in the third-party notices document.