testrail-vitest-reporter v0.1.9
testrail-vitest-reporter
TestRail Reporter is a package that allows you to easily generate reports for your tests using Vitest and integrate them with TestRail, a popular test management system. With this package, you can streamline your testing process by automatically synchronizing your test results with TestRail, providing valuable insights and analytics for your test executions.
Features
- Seamlessly integrate Vitest with TestRail to create comprehensive test reports.
- Simple and intuitive API for easy integration into your test automation workflow.
Installation
To install Testrail-vitest-reporter, use the following command:
npm install -D @dexcare/testrail-vitest-reporter
Usage
To generate a report with Vitest and upload it to TestRail, follow these steps:
- Configure Vitest by adding the TestRail reporter as a reporter in your Vitest config file. Open your Vitest config file (e.g.,
vitest.config.js
) and add the following line to thereporters
array:
reporters: ['@dexcare/testrail-vitest-reporter'],
- Create a
testrail.config.js
file in your project's root directory. Enter the following credentials in the file:
module.exports = {
'baseUrl': 'https://dexcare.testrail.io',
'user': '<your-testrail-username>',
'pass': '<your-testrail-password>',
'project_id': 22,
'suite_mode': 3,
'API_KEY': '<your-testrail-api-key>',
'regex': /[@C][?\d]{3,6}/gm
}
Replace your-testrail-username
, your-testrail-password
, and your-testrail-api-key
with your actual TestRail credentials and API key.
- Write your tests using Vitest, ensuring that each test has appropriate assertions and result statuses. You can include the TestRail test IDs in the test names or descriptions. For example:
it('@C123 Should perform a specific task', () => {
// Test logic here
});
In the example above, @C123
represents the TestRail test ID. Replace C123
with the actual test ID from TestRail.
Run your tests with Vitest as you normally would. The TestRail reporter will collect the test results.
After running your tests, the TestRail reporter will automatically upload the test results to your TestRail project based on the provided configuration.