Command Line
Canarytrace is distributed as a docker image and is run from command line. Behavior and functions are set using options. Some options are mandatory and some are optional. Canarytrace is based on WDIO v7 and therefore some options are described on WDIO CLI Options page.
#
What you’ll learn
- How to run Canarytrace from the command line
- Options for Canarytrace settings
- All options are environment variables and they are used when running in both the docker and the kubernetes
#
How to run CanarytraceExamples below shows how to run Canarytrace in minimal configuration. Minimal configuration means, that Canarytrace will be run with default configuration.
#
Docker composeThe easiest way to run Canarytrace is to use a docker compose
In this example are only options BASE_URL
which contain target URL and LICENSE
.
You can run a command using docker-compose up
#
KubernetesUse Kubernetes CronJob for production use and for non-stop monitoring.
This example isn't complete, but contains more options as environment variable ELASTIC_CLUSTER
, PT_AUDIT
, PT_AUDIT_THROTTLING
or LABELS
. Some of them are mandatory and some are optional.
smoke
#
Mode #
How to read this documentation
- You can run Canarytrace in modes
smoke
oruser-journey
. Smoke mode is a default mode and is maintenance free and therefore you can use less mandatory options.- If you have Canarytrace Pro edition, you can run audits such as performance audit. Features for Canarytrace Pro have this badge Professional
#
Mandatory optionsMode
smoke
is a default.
BASE_URL
add more URLs, e.g.BASE_URL=https://canarytrace.com/;https://webperf.canarytrace.com/
LICENSE
add your license key.
#
ElasticsearchIf you want use live logging to Elasticsearch and visualize data in a Kibana, you must use this options.
ELASTIC_CLUSTER
URI of elasticsearch cluster. E.g.ELASTIC_CLUSTER="http://localhost:9200"
This option activate live reporting all data to elasticsearch. If left blank, documents will be printed to stdout.ELASTIC_HTTP_AUTH
Basic authentication in format username:password . E.g.ELASTIC_HTTP_AUTH=elastic:1fKP17UklmiI14rekO6iCx9r
MIN_PTIME
Print requests to elasticsearch if is exceeded transactions time. Default min processing time is 300ms.ELASTIC_OBSERVABILITY
Useallow
for print settings of elasticsearch and all requests and responses to stdout.INDEX_PREFIX
- Default isc.
USE_ELASTIC_DOC_TYPE_BY_INDEX_NAME
Default is false and will be used type _doc. If you true will be used name of index just type.ELASTIC_REQUEST_COMPRESSION
Useallow
for use compression.ELASTIC_TIMEOUT
Default is 5000ms.
#
Performance auditProfessionalConfiguration is on separate page. Performance audit configuration
#
OptionalPAUSE_BETWEEN_SMOKE
Default is 0ms. Pause between every tested URL.
user-journey
#
Mode
- If you use this mode you need test script / monitor script writen in Webdriver.IO. Try how to write test script / monitor script
- In this mode you must use more mandatory options, because Canarytrace need to download test cases from your git repositry.
- If you have Canarytrace Pro edition, you can run audits such as performance audit. Features for Canarytrace Pro have this badge Professional
BASE_URL
- is a start address 'https://the-internet.herokuapp.com/' for your test script. You test script can start with/
#
Mandatory optionsMODE
- switch mode of Canarytrace on user journeyMODE="user-journey"
SPEC
- is file with your test case / monitor script, e.g.SPEC="test/specs/example.e2e.js"
GIT_REPOSITORY
- e.g.git@github.com:canarytrace/wdio75-demo.git
GIT_REPOSITORY_PORT
- e.g.22
GIT_REPOSITORY_HOST
- e.g.github.com
GIT_REVISION
-fd29508
revision of your test case. Canarytrace perform git checkout before run test.
#
OptionalUSER
username for TC, which use login to app. E.g.USER=CYBERTRUCK
PASS
password for TC, which use login to app. E.g.PASS=Cybertruck@250Mil
How to use in your test case
#
OtherThese options are not mandatory and are available for both mode.
LABELS
is optional metainformation, which is stored in the elastic to each record in each index, e.g.'relesease=7, environment=dev'
SPEC
is path and name of testcase / monitor script. E.g.SPEC=tesla/smoke.js
ENGINE
- default iswdio
for Webdriver.IO v7.5 and no need change itENV_PRINT
- Print all environment variables. Print all environment variables before execution of monitor script. All environment variables will be saved to Elasticsearch indexc.env-*
It's useful for debugging but use with caution. This command print value all environment variables including sensitive if exist.
AVAILABILITY_CHECK
- useallow
if you want run check availability of web app before run Canarytrace.
It's useful for check availability environment and tested application.
WAIT_FOR_TIMEOUT
- Timeout limit for all webdriver.io waitFor* commands. Default is 30.000msLOG_LEVEL
- default iswarn
. Level of logging verbosityATTACHMENTS
Useallow
for store screenshot to disk, when testStep is failed.Format HHmmss-YYYY-MM-DD-uuidAction.png
You must bind volume
-v $(pwd)/attachments/:/opt/canary/attachments
for "move screenshot from docker container to local directory"/attachments
.You can use
AWS_S3_BUCKET
option for upload screenshot to AWS S3 This option is described below.
CAPTURE_EVERY_SCREEN=allow
create a screenshot on every test step.TESTS_PATH
default is/opt/canary/tests
there is no reason to change this option.
#
ServicesProfessionalREQUEST_LOG
defaultno
store collection all requests and responses directly from browser into elasticsearch indexc.request-log-*
- For activate this features use
REQUEST_LOG=allow
- For activate this features use
CONSOLE_INTERCEPT
defaultno
store console of browser into elasticsearch indexc.console-*
- For activate this features use
CONSOLE_INTERCEPT=allow
- For activate this features use
COVERAGE_AUDIT
defaultno
store percentage used and unused code of web application into elasticsearch indexc.coverage-audit-*
- For activate this features use
COVERAGE_AUDIT=allow
- For activate this features use
MEMORY_INTERCEPT
defaultno
store used javascript memory during loading and using the web application into elasticsearch indexc.memory-*
- For activate this features use
MEMORY_INTERCEPT=allow
- For activate this features use
HERO_ELEMENTS
defaultno
store Hero Elements into elasticsearch indexc.performance-entries-*
- For activate this features use
HERO_ELEMENTS=allow
- For activate this features use
#
Volumes-v $(pwd)/assets/:/opt/canary/assets
binding local directory with directory in docker container for statical files, e.g. Lighthouse HTML report or JSON records of activity in Chrome's processes.-v $(pwd)/tests/:/opt/canary/tests
binding local directory with tests to directory in docker container.-v $(pwd)/config:/opt/canary/config/wdio
for extended default configuration.
- Do you find mistake or have any questions? Please create issue, thanks 👍
- Have more questions? Contact us.