Description
Reporter plugin that sends test results to TestRailIt does not provide test output to console, please use with combination with the default reporter
Usage
- Installation
`npm install testcafe-reporter-testrail --save-dev`
- Add reporter to testrail configuration. Make sure to also include default reporter if reporters option was not provided
Command Line:
```
testcafe chrome tests/* -r spec,testrail:out.xml
```
API:
```
testCafe
.createRunner()
.src('path/to/test/file.js')
.browsers('chrome')
.reporter(['spec', { name: 'testrail', output: '' }]) // <-
.run();
```
- Provide required options from the configuration section
Prerequisites
- All test cases should have a valid mapping between TestCafe and TestRail. TestRail
Case ID
should be put into TestCafe test metadata. (Example:test.meta({CID: 'C123'})('test name', async t => { .... });
)
Configuration
Configuration can be provided via:- ENV variables
- configuration file (.testrailrc)
| ENV Variable | Config | Description | Default | Required | | ------------------------------ | ------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :-------------------------: | :------: | | TESTRAILENABLED | enabled | Enables TestRail integration. |
false
| |
| TESTRAILHOST | host | URL of the TestRail instance. | | true
|
| TESTRAILUSER | user | Account name which will be used to push results. | | true
|
| TESTRAILAPIKEY | apiKey | API key which can be generated on the profile page in TestRail. | | true
|
| TESTRAILPROJECTID | projectId | Project id in which test cases are stored. Ex. P123
| | true
|
| TESTRAILSUITEID | suiteId | Suite id in which test cases are stored. Ex. S123
| | true
|
| TESTRAILRUNID | runId | Run id which test cases are stored. Ex R123
| | |
| TESTRAILCASEMETA | caseMeta | Meta attribute to be used to get TestRail case id mapping. | 'CID'
| |
| TESTRAILRUNNAME | runName | Test Run name. Configurable with variables %BRANCH%
- see config optionbranchEnv
%BUILD%
- see config optionbuildNoEnv
%DATE%
- see config optiondateFormat
%BRANCH%#%BUILD% - %DATE%
| |
| TESTRAILRUNDESCRIPTION | runDescription | You can provide you own Test Run description. If this option is not configured, it will contain test results and test coverage. | | |
| TESTRAILREFERENCE | reference | String that will be added to the refs
field in TestRail. This can enable integration with other tools like https://github.com/DamianOsipiuk/jest-reporter-testrail/. Configurable with variables %BRANCH%
- see config optionbranchEnv
%BUILD%
- see config optionbuildNoEnv
BRANCH
| |
| TESTRAILBUILDNOENV | buildNoEnv | Which ENV variable is used to store build number of tests run. | BUILD_NUMBER
| |
| TESTRAILDATEFORMAT | dateFormat | What date format should be used for %DATE%
placeholder. https://momentjs.com/ formats supported. | YYYY-MM-DD HH:mm:ss
| |
| TESTRAILRUNCLOSEAFTERDAYS | runCloseAfterDays | After how many days should reporter close old Runs in testrail. | | |
| TESTRAILUPLOADSCREENSHOTS | uploadScreenshots | Should upload screenshots to testrail. Requires test result edit enabled in testrail. | false
| |
| TESTRAILUPLOADVIDEOS | uploadVideos | Should upload videos to testrail. Requires test result edit enabled in testrail. | false
| |
| TESTRAILUPDATERUNTESTCASES | updateRunTestCases | Tells to the reporting tool to no create or update the given test run, you need to create the mapping for the testcases manually | true
| |