Publish results simple and easy.
npm install jest-qase-reporter
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:
import { qase } from 'jest-qase-reporter/dist/jest';
describe('My First Test', () => {
test(qase([1,2], 'Several ids'), () => {
expect(true).toBe(true);
})
test(qase(3, 'Correct test'), () => {
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):
QASE_REPORT=1 npx jest
or
npm test
A test run will be performed and available at:
https://app.qase.io/run/QASE_PROJECT_CODE
Reporter options (* - required):
- *
apiToken
- Token for API access, you can find more information here - *
projectCode
- Code of your project (can be extracted from main page of your project:https://app.qase.io/project/DEMOTR
-DEMOTR
is project code here) runId
- Run ID from Qase TMS (also can be got from run URL)environmentId
- Environment ID from Qase TMSlogging
[true/false] - Enabled debug logging from reporter or notrunComplete
[true/false] - Complete run after all tests are finished
Example jest.config.js
config:
module.exports = {
reporters: [
'default',
[
'jest-qase-reporter',
{
apiToken: 'api_key',
projectCode: 'project_code',
runId: 45,
environmentId: 1,
logging: true,
runComplete: true,
},
],
],
...
};
You can check example configuration with multiple reporters in example project.
Supported ENV variables:
QASE_REPORT
- You should pass this ENV if you want to use qase reporterQASE_API_TOKEN
- API tokenQASE_PROJECT_CODE
- Your project codeQASE_ROOT_SUITE_TITLE
- Setting the root suite that the reporter will useQASE_RUN_ID
- Pass Run ID from ENV and override reporter optionsQASE_ENVIRONMENT_ID
- Pass Environment ID from ENV and override reporter optionsQASE_RUN_NAME
- Set custom Run name, when new run is createdQASE_RUN_DESCRIPTION
- Set custom Run description, when new run is createdQASE_RUN_COMPLETE
- Complete run after all tests are finished
We maintain the reporter on LTS versions of Node. You can find the current versions by following the link