Automated Testing

Last modified on June 21, 2022

You can use BitBar to run automated web tests in desktop and mobile browsers on multiple environments. This is an easy way to check your web application on different combinations of operating systems, browsers, and screen resolutions. See below for the step-by-step tutorial.

Supported test frameworks

Currently, BitBar supports running Selenium web tests.

Before you start

Using BitBar, you can test both publicly available web applications and applications running on local networks. In the latter case, you need to set up a secure tunnel before you create or run automated tests. For complete information on this, see Local Testing - BitBar SecureTunnel.

1. Create a Selenium and Appium script

You can use BitBar to run these tests, but as for test creation, you need to do this on your machine. So, you start by creating a Selenium or Appium test on your computer. For information on how to do this, see Selenium documentation (specifically, the WebDriver section).

To make it easier for you to test the new functionality, BitBar offers sample scripts. You can generate them when configuring your automated test runs. See below.

Important: If you decide to use your test, not the sample one, then before running your test in BitBar, check that it functions correctly on your local machine.

2. Create an automated test in BitBar

  1. Once you login to your BitBar account, select Automation > Create Automated Test from the left-hand side menu, or use the Create Automated Test button on the Automated Testing tile:

    Start creating an automated desktop test

    Click the image to enlarge it.

  2. Then, select Desktop and choose the test framework. Currently, the only available framework is Selenium (Desktop Browser Client Side). Select it:

    Select a test framework

    Click the image to enlarge it.

  3. Now you need to configure your test run:

    • Specify the names for your test project and test run:

    • Choose your Hub Location that is closest to you to improve performance.

    • Update your test script with the Hub URL.

      Capabilities

      Click the image to enlarge it.

      Note: These names are arbitrary strings that will help you identify your test results on the Projects screen:

      Project Screen

      Click the image to enlarge it.

    • Set the combination of the operating system, browser and screen resolution for the test run (these and other settings are called capabilities). BitBar will generate script code in popular languages and show it for preview.

    • To have capabilities in the W3C-recommended format, select the Show W3C Capabilities check box.

      Note: By default, the test editor generates capability code in the format adopted by the JSON wire protocol.

    • (Optional) If you are going to use sample script code generated by BitBar, select the Show full sample script check box.

      Get full sample code

      Click the image to enlarge it.

  4. Click to Copy to clipboard to copy the generated code and paste it to the Selenium script on your computer:

    Specify capabilities

    Click the image to enlarge it.

3. Capabilities Creator

Capabilities creator for Selenium

To configure your test, you select Capabilities Creator from the left-hand side menu.

Note: In the Creator, make sure the slider is set on Selenium.

Cap Creator Selenium

Click the image to enlarge it.

Now you need to configure your capabilities.

  • Specify the name for your test project and test run.

  • Choose your Hub Location that is closest to you to improve performance.

  • Update your test script with the Hub URL.

    Cap Creator Setting

    Click the image to enlarge it.

    Note: The names are arbitrary strings that will help you identify your test results on the Projects screen.

  • Set the combination of the operating system, browser, and screen resolution for the test run (these and other settings are called capabilities). BitBar will generate script code in popular languages and show it for preview.

  • To have capabilities in the W3C-recommended format, select the Show W3C Capabilities check box.

    Note: By default, the test editor generates capability code in the format adopted by the JSON wire protocol.

  • (Optional) If you are going to use sample script code generated by BitBar, select the Show full sample script check box

  • Click Copy to clipboardto copy the generated code and paste it to the Selenium script on your computer:

    Other Selelium Setting

    Click the image to enlarge it.

Capabilities creator for Appium

To configure your test, you select Capabilities Creator from the left-hand side menu.

Note: In the Creator, make sure the slider is set on Appium.

Cap Creator Appium

Click the image to enlarge it.

Now you need to configure your capabilities.

  • Specify the name for your test project and test run.

  • Choose your Hub Location that is closest to you to improve performance.

  • Update your test script with the Hub URL.

    Cap Creator Setting2

    Click the image to enlarge it.

    Note: The names are arbitrary strings that will help you identify your test results on the Projects screen.

  • Set the combination of the operating system, device, and application. BitBar will generate script code in popular languages and show it for preview

  • Click Copy to clipboardto copy the generated code and paste it to the Appium script on your computer:

    Other Appium Setting

    Click the image to enlarge it.

Note: Remember to change your Appium URL (command executor) the proper one.

4. Configure the Selenium script

It is important that you insert your API key to the copied script code and that you modified the Selenium Grid address in your test.

Insert the API key

  1. Get the API key from your BitBar account settings:

    • Log in to BitBar, click the user icon in the top-right corner, and select My Account.
    • Go to the My Integrations section, click API Access, and copy the API key value:

      API Key

      Click the image to enlarge it.

  2. Insert this API key into the bitbar_apiKey capability:

    Python

    capabilities = {
    ...
    'bitbar_apiKey': 'suZ##########################Um8',
    ...
    }

    Java

    DesiredCapabilities capabilities = new DesiredCapabilities();
    ...
    capabilities.setCapability("bitbar_apiKey", "suZ##########################Um8");
    ...

    C#

    DesiredCapabilities capabilities = new DesiredCapabilities();
    ...
    capabilities.setCapability('bitbar_apiKey', 'suZ##########################Um8');
    ...

    Ruby

    capabilities = Selenium::WebDriver::Remote::Capabilities.new
    ...
    capabilities['bitbar_apiKey'] = 'suZ##########################Um8'
    ...

    Node.js

    var capabilities = {
      ...
      'bitbar_apiKey': 'suZ##########################Um8',   ...
    }

Set the Selenium Grid address

You need to modify the Selenium Grid address in your test’s capabilities. The value to use depends on the target location, where the tested browser will run:

  • EU: DESKTOP – https://eu-desktop-hub.bitbar.com/wd/hub

  • US: DESKTOP – https://us-west-desktop-hub.bitbar.com/wd/hub

Now you are ready to run your test.

Set the Appium Grid address

You need to modify the Appium Grid address in your test’s capabilities. The value to use depends on the target location, where the tested browser will run:

  • US: APPIUM – https://us-west-mobile-hub.bitbar.com/wd/hub

  • EU: APPIUM – https://eu-mobile-hub.bitbar.com/wd/hub

Now you are ready to run your test.

4. Run your test and view results

Run your test as you would normally do this.

The results will go to BitBar. You can view them on the Projects screen under the project and test run node, whose name you specified in capabilities:

Test results

Click the image to enlarge it.

See Also

Web App Testing
BitBar Browser Testing

Highlight search results