How to Integrate WebdriverIO with TestBeats ​
This guide shows you how to send your WebdriverIO test results to Slack, Microsoft Teams, or Google Chat using TestBeats.
What You'll Achieve ​
After following this guide, your WebdriverIO tests will automatically send results to your team communication channels, complete with AI-powered failure analysis and detailed reporting.
Prerequisites ​
Before starting, ensure you have:
- A WebdriverIO project with tests
- Node.js and npm/yarn installed
- TestBeats installed (
npx testbeats@latest --version
) - A webhook URL for your communication platform (Slack, Teams, or Chat)
- (Optional) TestBeats API key from app.testbeats.com
Step 1: Configure WebdriverIO to Generate Reports ​
WebdriverIO supports multiple report formats. Choose the one that best fits your testing setup.
Option A: JUnit Reporter (Recommended) ​
Install the JUnit reporter:
npm install --save-dev @wdio/junit-reporter
Update your wdio.conf.js
:
// wdio.conf.js
export const config = {
// ... other configuration
reporters: [
'spec',
['junit', {
outputDir: './results',
outputFileFormat: function(options) {
return `results-${options.cid}.xml`
}
}]
],
// ... rest of configuration
}
Option B: Cucumber JSON Reporter (For BDD Tests) ​
If you're using Cucumber with WebdriverIO:
npm install --save-dev @wdio/cucumberjs-json-reporter
Update your wdio.conf.js
:
// wdio.conf.js
export const config = {
framework: 'cucumber',
reporters: [
'spec',
['cucumberjs-json', {
outputDir: './results'
}]
]
}
Step 2: Run Your Tests ​
Execute your WebdriverIO tests:
# Run all tests
npx wdio run wdio.conf.js
# Run specific suite
npx wdio run wdio.conf.js --suite login
Step 3: Choose Your Integration Method ​
You have two options to send results to TestBeats:
Option A: Command Line (Quick Setup) ​
For JUnit reports:
npx testbeats@latest publish \
--api-key '<your-api-key>' \
--slack '<your-webhook-url>' \
--junit 'results/results-*.xml'
For Cucumber reports:
npx testbeats@latest publish \
--api-key '<your-api-key>' \
--slack '<your-webhook-url>' \
--cucumber 'results/wdio-*.json'
Option B: Configuration File (Recommended) ​
Create testbeats.config.json
:
For JUnit reports:
{
"api_key": "<your-api-key>",
"targets": [
{
"name": "slack",
"inputs": {
"url": "<your-webhook-url>"
}
}
],
"results": [
{
"type": "junit",
"files": ["results/results-*.xml"]
}
]
}
For Cucumber reports:
{
"api_key": "<your-api-key>",
"targets": [
{
"name": "slack",
"inputs": {
"url": "<your-webhook-url>"
}
}
],
"results": [
{
"type": "cucumber",
"files": ["results/wdio-*.json"]
}
]
}
Then run:
npx testbeats@latest publish -c testbeats.config.json
Step 4: Integrate with Your Workflow ​
Add scripts to your package.json
:
{
"scripts": {
"test:report": "wdio run wdio.conf.js && testbeats publish -c testbeats.config.json"
}
}
Example Integration ​
For a complete example, refer to the WebdriverIO TestBeats example repository.
Next Steps ​
- Configure additional targets for multiple communication channels
- Set up CI/CD integration for automated reporting
- Explore advanced extensions for enhanced reporting
- Learn about TestBeats Portal features
Need help with a different framework? Check Framework Integrations →