Skip to content

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.

Install the JUnit reporter:

bash
npm install --save-dev @wdio/junit-reporter

Update your wdio.conf.js:

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:

bash
npm install --save-dev @wdio/cucumberjs-json-reporter

Update your wdio.conf.js:

js
// wdio.conf.js
export const config = {
    framework: 'cucumber',
    reporters: [
        'spec',
        ['cucumberjs-json', {
            outputDir: './results'
        }]
    ]
}

Step 2: Run Your Tests ​

Execute your WebdriverIO tests:

bash
# 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:

bash
npx testbeats@latest publish \
  --api-key '<your-api-key>' \
  --slack '<your-webhook-url>' \
  --junit 'results/results-*.xml'

For Cucumber reports:

bash
npx testbeats@latest publish \
  --api-key '<your-api-key>' \
  --slack '<your-webhook-url>' \
  --cucumber 'results/wdio-*.json'

Create testbeats.config.json:

For JUnit reports:

json
{
  "api_key": "<your-api-key>",
  "targets": [
    {
      "name": "slack",
      "inputs": {
        "url": "<your-webhook-url>"
      }
    }
  ],
  "results": [
    {
      "type": "junit",
      "files": ["results/results-*.xml"]
    }
  ]
}

For Cucumber reports:

json
{
  "api_key": "<your-api-key>",
  "targets": [
    {
      "name": "slack",
      "inputs": {
        "url": "<your-webhook-url>"
      }
    }
  ],
  "results": [
    {
      "type": "cucumber",
      "files": ["results/wdio-*.json"]
    }
  ]
}

Then run:

bash
npx testbeats@latest publish -c testbeats.config.json

Step 4: Integrate with Your Workflow ​

Add scripts to your package.json:

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 ​


Need help with a different framework? Check Framework Integrations →

Released under the MIT License.