WebDriverIO
WebdriverIO is an open-source testing framework for automating web applications using JavaScript or TypeScript. Built on the WebDriver protocol, it offers a simple API and supports various test frameworks like Mocha and Cucumber.
With the wdio-qase-reporter
you can `publish the results of your automated test runs to your Qase project using the public API.
Installation
To integrate Qase Reporter in your WebdriverIO setup, follow these steps:
Activate the WebdriverIO App
To activate the app, go to the Apps section in your workspace, and click on ‘Activate’
Switch to the ‘Access tokens’ tab, and create a new API token from here. Save the API token as we’ll need it for the next steps.
Install WDIO
Run npm init wdio@latest
. to create a project in the current directory, and we’ll choose the following configuration for the purpose of this guide.
Add wdio-qase-reporter to your project
To install and add the reporter as a development dependency, run the following in node project:
npm install -D wdio-qase-reporter@beta
npm install -D wdio-qase-reporter@beta
Add the reporter to your configuration file wdio.conf.ts
:
import WDIOQaseReporter from 'wdio-qase-reporter';
import type { Options } from '@wdio/types';
import { afterRunHook, beforeRunHook } from 'wdio-qase-reporter';
export const config: Options.Testrunner = {
reporters: \[
[
WDIOQaseReporter,
{
disableWebdriverStepsReporting: true,
disableWebdriverScreenshotsReporting: true,
useCucumber: false,
}
]
],
onPrepare: async function() {
await beforeRunHook();
},
onComplete: async function() {
await afterRunHook();
},
};
Additional options to configure in the wdio.conf.ts
file:
disableWebdriverStepsReporting
– Default:false
to not log custom steps to the reporter.disableWebdriverScreenshotsReporting
– Default:false
do not attach screenshots to the reporter.useCucumber
– Default:false
if you use Cucumber, enable this option.
At the very least, the reporter will need two variables defined - your WebdriverIO App’s Token, and the Qase Project code you want to publish your results to.
We will create a new file qase.config.json
at the root of your project to add these values.
qase.config.json
:
{
"debug": false,
"testops": {
"api": {
"token": "<app-token>"
},
"project": "<project-code>",
"run": {
"complete": true
}
}
}
Please refer to this article for guidance on how to find your Project code in Qase.
Verify the integration
We’ll use the autogenerated login tests to check if the results are being published to your Qase project.
Let’s run the test, by executing the following command:
QASE_MODE=testops npx wdio run ./wdio.conf.ts
In the above command, we’re setting the reporter’s mode to ‘testops’ using the Environment variable QASE_MODE
.
Updated 8 days ago