newman-reporter-testrail-extra

A newman reporter for TestRail

Usage no npm install needed!

<script type="module">
  import newmanReporterTestrailExtra from 'https://cdn.skypack.dev/newman-reporter-testrail-extra';
</script>

README

newman-reporter-testrail-extra

A newman reporter for testrail

Installation

npm install newman-reporter-testrail-extra

Usage

Add test case ids to assertions

Prefix test assertions with testRail case Id CXXXXXX, including the letter C. Multiple test case ids can be added.

pm.test("C12345 C67890 Status code is 200", function() {
  pm.response.to.have.status(200);
});

Set the reporter options.

Reporter option can be set as environment variables or from reporter options arguments

export TESTRAIL_HOST='https://testrail.domain.com'  # TestRail host.
export TESTRAIL_USERNAME='username@domain.com'      # TestRail username.
export TESTRAIL_PASSWORD='testrail_password'        # TestRail password.
export TESTRAIL_API_KEY='testrail_api_key'          # TestRail API key.
export TESTRAIL_PROJECT_ID='testrail_project_id'    # TestRail project id.
export TESTRAIL_SUITE_ID='testrail_suite_id'        # (optional) TestRail suite id. Required for multi-suite projects.
export TESTRAIL_RUN_NAME='Automation run'           # (optional) Name of test run to create.
export TESTRAIL_INCLUDE_ALL=true                    # (optional) Boolean to determine wheter or not to include all case ids while adding run.

Note: Either username and password or username and api key can be used.

Run newman test with the reporter option -r testrail-extra

newman run my-collection.postman_collection.json -r cli,testrail-extra \
--reporter-testrail-extra-host 'https://testrail.domain.com' \
--reporter-testrail-extra-username 'username@domain.com' \
--reporter-testrail-extra-password 'password' \
--reporter-testrail-extra-project-id 'testrail_project_id' \
--reporter-testrail-extra-suite-id 'testrail_suite_id' \
--reporter-testrail-extra-run-name 'Automation run'  \
--reporter-testrail-extra-include-all