Document toolboxDocument toolbox

Header

(8.6.X) Execution on BrowserStack

Introduction

BrowserStack is a cloud environment that allows running tests in the cloud using different combinations of operating systems, browsers, and browser versions. In this environment, all tests are executed on BrowserStack VM. You can view the ongoing tests execution on BrowserStack.

For more information about BrowserStack, click here.

Prerequisites

Before you start offline execution on BrowserStack, ensure you have:

  • An active account with valid Username/Access Key. If you don’t have an account, then you need to create an account first using this link https://www.browserstack.com/users/sign_up
  • Sufficient balance of execution hours

BrowserStack does not support all Selenium versions. Qualitia users can use the browserstack.selenium_version capability to specify the version they want to use when executing test cases.
For more information about supported versions of Selenium, please refer to the BrowserStack documentation.

Execution Guidelines 

To execute tests on BrowserStack, follow these steps:

  1. Sign into your BrowserStack account.


  2. Select the language of your choice (e.g. Java).


  3. Select Operating System and Browser in the Configure the browser or device combinations section.

    Here is a sample program:
    {
    "server": "hub.browserstack.com",
    "user": "shrushti_A6iJC8",
    "key": "nnzynAMTyAbwPypxLfj7",
    "capabilities": {
    "build": "browserstack-build-1",
    "name": "parallel_test",
    "browserstack.debug": true
    },
    "environments": {
    "env1": {
    "browserName": "Chrome",
    "browserVersion": "103.0",
    "os": "Windows",
    "osVersion": "11"
    },
    "env2": {
    "browserName": "Firefox",
    "browserVersion": "102.0",
    "os": "Windows",
    "osVersion": "10"
    },
    "env3": {
    "browserName": "Safari",
    "browserVersion": "14.1",
    "os": "OS X",
    "osVersion": "Big Sur"
    }
    }
    }

    The URL format is as follows:
    URL = "https://" + USERNAME + ":" + AUTOMATE_KEY + @hub-cloud.browserstack.com/wd/hub

  4. Now, open Qualitia Automation Studio and login.
  5. Go to the Execute tab.
  6. Click Execution Profile.
  7. Click the plus icon to add new Execution Profile.
  8. Provide a name for the Execution Profile.
  9. Under Execution Configuration > Web Environment select BrowserStack.


  10. Under Web Execution select BrowserStack.
  11. In the Desired Capabilities window, enter all the following mandatory fields by selecting the checkbox:
    1. url
    2. username
    3. accesskey
    4. platform
    5. os
    6. os version



      Note: Username and Access Key is provided here:


  12. Select Chrome under Browser and enter the version in the Desired Capabilities section.
  13. Navigate to Suite Execution tab.
  14. Create a test suite and test case.
  15. Select the Execution Profile you created.


  16. Click on the run now icon.
  17. Verify the report in RTR.


  18. Go to BrowserStack and click the Automate button.
  19. Verify the execution.


  20. You can also see the video recording as shown in the following screenshot:

Viewing Current Execution on BrowserStack

Once you have triggered the offline execution, you can view the status of your ongoing executions on BrowserStack. BrowserStack considers each Test case as a new project. The status is updated after each project is completed with its status against it. Also, you can filter the projects by their status (Completed, Timeout, or Errors) or you can search it by build name or session name.

You can record your test case execution configuring the browserstack.properties file accordingly. If you set the recordVideo value as true and all the test case executions will be recorded. You can download these videos once the test execution is completed.


Execution Behind Firewall 

Sometimes applications are configured to be accessed within private networks. Such applications deny access when they are being accessed from other than local networks and so from BrowserStack. Executing test cases on BrowserStack for such applications needs special configurations.

When executing test case for applications running behind firewall on Windows, you need to execute the BrowserStackLocal.exe file on the machine in the private network to allow BrowserStack to execute tests flawlessly.

To execute test cases for applications running behind firewall on BrowserStack (Windows):

  1. Make sure you have set the browserstack.local value as true in the Edit Additional capabilities.
  2. Download the BrowserStackLocal.exe on any machine in the network using the following url:
    https://www.browserstack.com/automate/python#setting-local-tunnel
  3. Unzip the folder.
  4. Open Command Prompt and navigate to the BrowserStackLocal.exe file followed by BrowserStack Access key.
    For example:
    <Path where the file is saved> BrowserStackLocal.exe --key <BrowserStack access key>
  5. Press Enter.

Once the BrowserStackLocal.exe file is executed successfully, you can execute your Offline tests on BrowserStack environment using the same method mentioned above. When executing test case for applications running behind firewall on Mac, you need to execute the BrowserStackLocal Unix Executable file on the machine in the private network to allow BrowserStack executing tests flawlessly.

To execute test cases for applications running behind firewall on BrowserStack (Mac):

  1. Make sure you have set the browserstack.local value as true in the Edit Additional Capabilities.
  2. Download the BrowserStackLocal Unix Executable file on any machine in the network using the following url:
    https://www.browserstack.com/automate/python#setting-local-tunnel
  3. Unzip the folder.
  4. Open Terminal and navigate to the BrowserStackLocal Unix Executable file followed by BrowserStack Access key.
    For example:
    ./BrowserStackLocal --key <BrowserStack access key>
  5. Press Enter.

Once the BrowserStackLocal Unix Executable file is executed successfully, you can execute your Offline tests on BrowserStack environment using the same method mentioned above.

Execution Behind Proxy

Qualitia users can execute the test cases behind a proxy.

In order to execute the test cases behind a proxy, you must configure Proxy Properties in the Edit Additional Capabilities.

Qualitia users can define these properties using the command line as well.

Execution using Browser Capabilities

Selenium allows you setting desired browser specific properties to be used when executing test cases. These properties can be set for offline execution as well. You can provide these browser specific details through browser-capability files. For each supported browser (Firefox, IE, Google Chrome, and Safari) you need to configure the settings in the Edit Additional Capabilities.

Each property file above is a set of all the browser specific properties that Selenium allows you change. If you do not change any property, Selenium uses its default values.

Qualitia gives you provision to set these values for Selenium. Selenium has its own control on what value to use and how to reflect them in Execution Browser. For more information about Selenium Capabilities, refer following links:

Footer