BrowserStack IntegrationBrowserStack Integration to Execute Mobile App Automation Scripts for Android Devices

BrowserStack Integration to Execute Mobile App Automation Scripts for Android Devices

This article provides instructions on how to integrate algoQA with BrowserStack for performing mobile test automation for Android devices. It includes prerequisites, configuring the necessary files, running the tests, and monitoring the results.

Prerequisites

  • Make sure you have installed appropriate versions of Java, Maven and Appium. Maven environment variables are set and Maven bin is added to the system path.
  • Make sure you sign up to perform mobile test automation in BrowserStack.
  • In the Dashboard page, click Products > App Testing and then select the App Automate option, as shown:
    BrowserStack Products menu with App Testing and App Automate options highlighted
  • In the Getting Started page, click the Access Key dropdown arrow to view the registered username and password, as shown. Click the copy icon to copy the username and password.
    BrowserStack dashboard with Access Key tab and masked User Name, Access Key fields numbered for steps

Integrating algoQA with BrowserStack

Launching your app in the selected device

Perform the following:

  1. In the Dashboard page, click the Upload icon to upload the APK file for Android.
    BrowserStack uploaded app panel with apk file and bs link, copy icon annotated You can copy here
  2. Click the copy icon to copy the AppKey from the uploaded app.

3.2 Configuring the ApplicationSettings.xml file in the algoQA-generated script folder

Perform the following:

  1. Navigate to the algoQA Platform by entering https://algoshack.com/ and sign in with the appropriate credentials.

  2. In the Main Canvas, click the Generate Script button. Follow the onscreen instructions to generate the scripts.

  3. After generating the algoQA scripts, navigate to the script downloaded folder to open the ApplicationSettings.xml file. For example, you can find the ApplicationSettings.xml file in an algoQA-generated script folder for mobile automation available at the following path:

    C:\Users\Admin\Downloads\ScriptGeneration_202412240520726000\AlgoAFScript_202412240520726000\src\test\java for Java Appium
    
  4. In the ApplicationSettings.xml file, update the following details manually as shown in the example table:

    You can find the Username, Access Key, App ID or Key from the prerequisites steps. The device name, Platform Name, and version depend on whether you are using Android or iOS.

    FieldDetails
    deviceNameSamsung Galaxy S22 Ultra
    PlatformNameAndroid
    PlatformVersion12
    Username<username>
    Access key<access key>
    BrowserStackAppKey<browserstack app key>
    Testing EnvironmentBrowserstack
    AutomationTypeAndroidApp
    AutomationNameuiautomator2
    ApplicationSettings XML file showing URL, AutomationType, device and Browserstack credential fields
  5. Navigate back to the pom.xml directory and open Command Prompt in the same directory.

  6. Run the following command to execute the script. The script folder may vary depending on where you have generated the scripts.

    If you choose to execute scripts for Java Appium, then run the 'mvn test' command.
    

Triggering the build in BrowserStack

Perform the following:

  1. Make sure the APK file is uploaded. When the build is triggered after running the command for the algoQA-generated scripts in the command prompt, scripts are executed in BrowserStack.
  2. The system captures the recording of the steps. You can download the video or view the video.
    BrowserStack build details page for Samsung Galaxy S22 Ultra with video playback and App Capabilities tab

If you don't have an existing APK file, then you can use the sample file from BrowserStack. Make sure to create the test scenario from the same app uploaded.