Appium and WebDriverIO - Running tests on TestingBot
Exit course

Running tests on TestingBot

WebDriverIO contains a specific TestingBot service. This makes it easy to run tests with WebDriverIO on TestingBot. WebDriverIO will start a TestingBot Tunnel if required and send back the test meta-data (passed state, name, build-id, ...).

To get started, you can install the service:

Copy code
npm install @wdio/testingbot-service --save-dev

Once added, you will need to modify wdio.conf.js to add the service and the necessary credentials to access the TestingBot Appium grid.

Copy code
...
services: [
        ['testingbot']
    ],
	user: '...',
	key: '...',
...

Uploading a mobile app

TestingBot provides a storage feature to upload a native mobile app. Once uploaded, you can specify this app in the capabilities of your test. At the start of your test, the app will be downloaded on the device.

You can then create a test in WebDriverIO to interact with the app on a specific physical mobile device on TestingBot. The example below is a script that shows how to interact with a calculator app.

Copy code
const assert = require('assert')
describe('calculator', function() {
        it('should calculate a sum', async () => {
            const inputA = await $('~inputA')
            await inputA.waitForDisplayed(5000)
            await inputA.click()
            try {
                    await inputA.addValue('10')
            } catch (e) {}

            const inputB = await $('~inputB')
            await inputB.waitForDisplayed(5000)
            await inputB.click()
            try {
                    await inputB.addValue('5')
            } catch (e) {}

            const sumElement = await $('~sum')
            const sum = await sumElement.getText()
            assert.equal(sum, '15') // 10 + 5
        })
})

Test results

When the test has finished running, you will see a recorded video and test logs. The advantage of using a cloud-based service such as TestingBot is that you can run tests on a variety of devices, simultaneously.

Course completed. Congratulations!

Go back to overview