You can pass environment variables to the testomat.io reporter using the following syntax:
bash TESTOMATIO={API_KEY} <actual run command>
When running on CI, use secrets.
To read environment variables from .env
file, use dotenv package. And read the env file via:
require('dotenv').config({ path: '.env' }); // or any other path
ℹ️ Specifying any value for truthy variables activates the setting, e.g.
TESTOMAT_ENABLE_SMTH=true
,TESTOMAT_ENABLE_SMTH=1
, and evenTESTOMAT_ENABLE_SMTH=false
,TESTOMAT_ENABLE_SMTH=0
etc do the same - enable the setting.
Variables list:
Name | Description | Example |
---|---|---|
TESTOMATIO or TESTOMATIO_TOKEN or TESTOMATIO_API_KEY | Your api key. | |
TESTOMATIO_CSV_FILENAME | ||
TESTOMATIO_CREATE | Create test ids. | |
TESTOMATIO_DISABLE_BATCH_UPLOAD | Disables batch uploading (multiple test results in one request) and uploads each test result one by one. Please set this variable only for debug and make sure you understand what it does. We do not recommend to use it on a regular basis. | TESTOMATIO_DISABLE_BATCH_UPLOAD=true <actual run command> |
TESTOMATIO_ENV | Adding Environments to Run | TESTOMATIO={API_KEY} TESTOMATIO_ENV="Windows, Chrome" <actual run command> |
TESTOMATIO_EXCLUDE_FILES_FROM_REPORT_GLOB_PATTERN | Exclude tests from report by glob pattern | TESTOMATIO_EXCLUDE_FILES_FROM_REPORT_GLOB_PATTERN="**/*.setup.ts" <actual run command> . You may use multiple patterns, separate them with semicolon (; ): TESTOMATIO_EXCLUDE_FILES_FROM_REPORT_GLOB_PATTERN="**/*.setup.ts;tests/*.auth.js" <actual run command> |
TESTOMATIO_INTERCEPT_CONSOLE_LOGS | Intercept console logs and add them to your report. | TESTOMATIO_INTERCEPT_CONSOLE_LOGS=true <actual run command> |
TESTOMATIO_MAX_REQUEST_FAILURES_COUNT | Maximum number of failed requests within 60s. Default is 10. | TESTOMATIO_MAX_REQUEST_RETRIES_COUNT=5 <actual run command> |
TESTOMATIO_PROCEED | Do Not Finalize Run | TESTOMATIO_PREPEND_DIR="MyTESTS" TESTOMATIO=1111111 npx check-tests CodeceptJS "**/*{.,_}{test,spec}.js" |
TESTOMATIO_PREPEND_DIR | Put all imported tests into a specific suite (folder) | |
TESTOMATIO_RUN | Add Report to Run by ID | |
TESTOMATIO_RUNGROUP_TITLE | Adding Report to RunGroup | TESTOMATIO={API_KEY} TESTOMATIO_RUNGROUP_TITLE="Build ${BUILD_ID}" <actual run command> |
TESTOMATIO_SHARED_RUN | Reporting Parallel Execution to To Same Run | TESTOMATIO={API_KEY} TESTOMATIO_TITLE="report for commit ${GIT_COMMIT}" TESTOMATIO_SHARED_RUN=1 <actual run command> |
TESTOMATIO_STACK_FILTER | ||
TESTOMATIO_STACK_PASSED | Enable stack traces and logs for passed tests (disabled by default to optimize storage) | TESTOMATIO={API_KEY} TESTOMATIO_STACK_PASSED=1 <actual run command> |
TESTOMATIO_TITLE | Setting Report Title | TESTOMATIO={API_KEY} TESTOMATIO_TITLE="title for the report" <actual run command> |
TESTOMATIO_TITLE_IDS | ||
Artifacts | ||
S3_ACCESS_KEY_ID | ||
S3_BUCKET | ||
S3_ENDPOINT | ||
S3_REGION | ||
S3_SECRET_ACCESS_KEY | ||
Pipes | ||
GH_PAT | ||
GITLAB_PAT |
You can use .env
file to store your environment variables. To read environment variables from .env
file, use dotenv package:
require('dotenv').config({ path: '.env' }); // or any other path
or
import dotenv from 'dotenv';
dotenv.config({ path: '.env' }); // or any other path
It is recommended to read .env
file as early as possible in your application, preferably on test runner initialization. E.g. in CodeceptJS you can do it in codecept.conf.js
file. In Playwright: playwright.config.js
. Jest: jest.config.js
. Cypress: cypress.config.js
. And so on.
It is recommended to add .env
file to .gitignore
to avoid committing sensitive data to the repository.