This @qualitywatcher/wdio-service
works in conjunction with the @qualitywatcher/wdio-reporter
$ npm install @qualitywatcher/wdio-service --save-dev
import QualityWatcherService from "@qualitywatcher/wdio-service";
services: [[QualityWatcherService, {
email: 'user@domain.com',
apiKey: process.env.QUALITYWATCHER_API_KEY,
testRunName: "Sample Automation results",
description: 'This is a sample test run from our sample test automation.',
projectId: 100,
includeAllCases: true,
// use more optional options
report: true,
includeCaseWithoutId: true,
complete: false,
ignoreSkipped: true,
generateShareableLink: true,
parentSuiteTitle: "Smoke suite",
screenshotFolder: "./screenshots",
uploadScreenshot: true,
}]],
Full reporter options
Option | Required | Description |
---|---|---|
projectId | Yes | The ID of the project. |
testRunName | Yes | The name of the test run. |
description | Yes | A description of the test run. |
includeAllCases | Yes | Whether to include all test cases from any suite that at least one automated result belongs to in the created run. |
complete | No | If true, marks the test run as complete. |
includeCaseWithoutId | No | Include test cases even if they don't have Suite and Case IDs mapping, this will create new test case/s in QualityWatcher from results. |
report | No | If true, send results to QualityWatcher. |
ignoreSkipped | No | If true, skipped tests will be ignored. |
generateShareableLink | No | If true, generates a shareable link for the report. |
parentSuiteTitle | No | The suite where test cases without IDs will be added. |
screenshotFolder | No | The folder where screenshots are stored. |
uploadScreenshot | No | If true, uploads screenshots with the report. |
- Go to your QualityWatcher account
- Hover over your profile avatar and click "Profile Settings"
- Select the "API Key" menu item
- Click the "Generate API Key" button
- Copy your API Key, we will use this for posting the results
touch .env
echo "QUALITYWATCHER_API_KEY=[API Key]" >> .env
# For windows:
# type NUL > .env
# echo QUALITYWATCHER_API_KEY=[API Key] > .env
5. Install dotenv and require it in your config file
wdio.conf.{ts|js}
require("dotenv").config();
If you don't have any tests in QualityWatcher you can still push your results and create new tests by enabling
includeCaseWithoutId
in the service options.
OR
If you have existing test cases ensure that your WebdriverIO tests includes the ID of your QualityWatcher test case and suite that it belongs to. Make sure the suite and test case IDs are distinct from your test titles:
// Good:
it("[S12C1234] Can authenticate a valid user", ...
it("Can authenticate a valid user [S12C1234]", ...
// Bad:
it("S12C123Can authenticate a valid user", ...
it("Can authenticate a valid userS5C123", ...
When saving screenshots, ensure that whitespace/s in the name are replaced with "_", without this QualityWatcher will not be able to find screenshots for uploading. See example below:
afterEach(async function () {
// Take a screenshot after each test/assertion
const testName = this.currentTest?.fullTitle().replace(/\s/g, '_');
const screenshotPath = `./screenshots/${testName}.png`;
await browser.saveScreenshot(screenshotPath);
});
Type: String
(optional)
Email address associated with the account
Type: String
(required)
Get API Key from QualityWatcher
- Go to your QualityWatcher account
- Hover over your profile avatar and click "Profile Settings"
- Select the "API Key" menu item
- Click the "Generate API Key" button
- Copy your API Key, we will use this for posting the results
Type: String
(required)
Title for the test run
Type: String
(required)
Description for the test run
Type: Number
(required)
The id for the project that include the tests
Type: Boolean
(required)
whether or not to include all test cases from each test suite used