Qase TMS Jest Reporter
npm install jest-qase-reporterQase Jest reporter sends test results and metadata to Qase.io.
It can work in different test automation scenarios:
* Create new test cases in Qase from existing autotests.
* Report Jest test results to existing test cases in Qase.
Testing frameworks that use Jest as a test runner, such as Puppeteer, Appium, and Detox,
can also be used with Jest reporter.
To install the latest version, run:
``shell`
npm install --save-dev jest-qase-reporter
- Getting started
- Using Reporter
- Configuration
- Requirements
To report your tests results to Qase, install jest-qase-reporter,jest.config.ts
and add a reporter config in the file.
A minimal configuration needs just two things:
* Qase project code, for example, in https://app.qase.io/project/DEMO the code is DEMO.
* Qase API token, created on the Apps page.
`js`
module.exports = {
reporters: [
'default',
[
'jest-qase-reporter',
{
mode: 'testops',
testops: {
api: {
token: 'api_token'
},
project: 'project_code',
},
},
],
],
};
Now, run the Jest tests as usual.
Test results will be reported to a new test run in Qase.
`console
$ npx jest
Determining test suites to run...
...
qase: Project DEMO exists
qase: Using run 42 to publish test results
...
Ran all test suites.
`
The Jest reporter has the ability to auto-generate test cases
and suites from your test data.
But if necessary, you can independently register the ID of already
existing test cases from TMS before the executing tests. For example:
- qase.title - set the title of the test caseqase.fields
- - set the fields of the test caseqase.suite
- - set the suite of the test caseqase.comment
- - set the comment of the test caseqase.parameters
- - set the parameters of the test caseqase.groupParameters
- - set the group parameters of the test caseqase.ignore
- - ignore the test case in Qase. The test will be executed, but the results will not be sent to Qase.qase.step
- - create a step in the test caseqase.attach
- - attach a file to the test case
`typescript
const { qase } = require('jest-qase-reporter/jest');
describe('My First Test', () => {
test(qase([1, 2], 'Several ids'), () => {
expect(true).toBe(true);
});
test(qase(3, 'Correct test'), () => {
qase.title('Title');
expect(true).toBe(true);
});
test.skip(qase('4', 'Skipped test'), () => {
expect(true).toBe(true);
});
test(qase(['5', '6'], 'Failed test'), () => {
expect(true).toBe(false);
});
});
`
To run tests and create a test run, execute the command (for example from folder examples):
`bash`
QASE_MODE=testops npx jest --runInBand
or
`bash`
npm test

A test run will be performed and available at:
``
https://app.qase.io/run/QASE_PROJECT_CODE
Qase Jest Reporter supports sending test results to multiple Qase projects simultaneously. You can specify different test case IDs for each project using qase.projects(mapping, name).
For detailed information, configuration, and examples, see the Multi-Project Support Guide.
Reporter options (* - required):
- mode - testops/off Enables reporter, default - offdebug
- - Enables debug logging, default - falseenvironment
- - To execute with the sending of the envinroment informationtestops.api.token
- * - Token for API access, you can generate it here.testops.project
- * - Your project's codetestops.run.id
- - Qase test run ID, used when the test run was created earlier using CLI or API call.testops.run.title
- - Set custom Run name, when new run is createdtestops.run.description
- - Set custom Run description, when new run is createdtestops.run.complete
- - Whether the run should be completed
Example jest.config.js config:
`js`
module.exports = {
reporters: [
'default',
[
'jest-qase-reporter',
{
mode: 'testops',
testops: {
api: {
token: 'api_key'
},
project: 'project_code',
run: {
complete: true,
},
},
debug: true,
},
],
],
...
};
You can check example configuration with multiple reporters in example project.
Supported ENV variables:
- QASE_MODE - Same as modeQASE_DEBUG
- - Same as debugQASE_ENVIRONMENT
- - Same as environmentQASE_TESTOPS_API_TOKEN
- - Same as testops.api.tokenQASE_TESTOPS_PROJECT
- - Same as testops.projectQASE_TESTOPS_RUN_ID
- - Pass Run ID from ENV and override reporter option testops.run.idQASE_TESTOPS_RUN_TITLE
- - Same as testops.run.titleQASE_TESTOPS_RUN_DESCRIPTION
- - Same as testops.run.description
We maintain the reporter on LTS versions of Node. You can find the current versions by following
the link
jest >= 28.0.0`
[auth]: https://developers.qase.io/#authentication