A custom Github Action that consumes Stratus test reports to create and execute TestRail runs
This action is designed to provide a test case coverage report through the following:
- When target branch is not "staging", create a new self-closing Test Run in TestRail
- When target branch is "staging", create or re-use a Milestone to create a new Test Plan in Testrail
- Upload the results of test suites ran by Jest or Nightwatch to TestRail
- Use the Stratus Jest Reporter or the Stratus Nightwatch Reporter to generate results easily!
This action assumes that a report file or files have already been generated in JSON format with the following structure:
[
{
"case_id": 905000,
"status_id": 1,
"comment": "Test passed successfully."
}
]Where:
case_idis the TestRail Test Case IDstatus_idis the result of the Test Case
Used in trunk-based development flow. This key is used to synchronize milestones and test runs with the feature. Ex: JAV-13
Used in git development flow. This will determine whether to leverage milestones to track regression.
The TestRail account domain name. Ex: https://<YourProjectURL>.testrail.com.
The username associated with the test runner. Usually an email address.
The API key associated with the username.
The project ID of the TestRail project.
The suite ID of the TestRail project. Does not include "S" prefix.
Make sure testrail milestone will get closed after production pipeline is completed.
The id of TestRail run created in the action.
A string to represent the time when the TestRail run completed in the action.
- name: Prepare Test Results File for TestRail
run: npm run test
- name: Report to TestRail
uses: q4mobile/stratus-testrail-reporter@v1
with:
regression_mode: true
api_key: ${{ secrets.TESTRAIL_API_KEY }}
project_id: 26
suite_id: 11417Ensure that file(s) are available to parse. The reporter will inspect the file system using this Regex pattern:
.*-?testrail-report.json
- name: Prepare Test Results File for TestRail
run: npm run test
- name: Report to TestRail
uses: q4mobile/stratus-testrail-reporter@v1
with:
api_key: ${{ secrets.TESTRAIL_API_KEY }}Ensure that file(s) are available to parse. The reporter will inspect the file system using this pattern:
testrail-${projectId}-${suiteId}-report.json
To work locally, typescript code needs to be built and committed. Run the following command and commit all changes as usual:
npm run all