Boost Your Mobile App Testing: Automation with Appium and BrowserStack

Image source:NashTechGlobal

BrowserStack Mobile App Automation allows you to test mobile apps on real devices in the cloud using tools like appium. It helps run tests quickly across different devices and platforms without needing physical devices, ensuring your app works well everywhere.

BrowserStack Features

BrowserStack offers access to over 3,000+ real devices and browsers. It integrates with popular test automation frameworks like Selenium and Appium, making it easy for developers and testers to run automated tests on real devices and browsers. It has a user-friendly interface that is easy to navigate and use, even for non-technical users.

1. Device availability and behaviour

We are able to use various kinds of devices using browserStack. If we are running tests locally, there would be some limitations. Because they are emulators or simulators, so there may be a lack of real behaviour of a mobile phone.  So in this case, browserStack would be better. We will get a variety of devices and based on the released year, OS version, or screen sizes.

2. Speed

When I compare browserStack testing with local run, I feel that launching a device and application, and running tests in browserStack is faster, especially in the case of iOS. When we run code, it completes faster and we get proper results within time.

3. Documents / Reports

BrowserStack provides some reports while running tests

  1. Screen recordings
  2. Text logs
  3. Network logs
  4. Test reports
  5. We can share the details with the link

4. CI / CD integration

BrowserStack provides CI /CD integration for automation code. There are so many options to integrate automation code to CI/CD.

We would be able to use the CI /CD tools which are displayed in the below mentioned screenshot.

We can integrate automation code with CI/CD only when development is completed. So after completion of development, we commonly start automation and add it in git and then we can connect the code with CI/CD tool with DevOps team.  After that we can run the automation code in the browserStack device.

When we need to use browserStack App automate

We cannot start automating an app from the very first build. Because it can contain some bugs. So initially we need to test manually and need to set the build stable.

We commonly start automating an application only when the app is stable. Because if frequent changes are occurring, we need to update the automation code frequently. So all the test cases may not need to be automated. First of all we need to select the cases which need to be automated.

Most commonly we start automating an application after a phase’s development completes. If the next phase is critically affecting the first phase’s functionalities, that can be considered as a proper time to automate it. Because if the app is not stable, we need to change the code frequently. That can be a time consuming process.

There would be enough advantage only when repetitive tasks need to be tested or a lot of test cases written. Automation is valuable when manual testing becomes too time-consuming, especially for large test suites or multiple devices.

When the application needs to be tested across various devices and operating systems, automation can ensure consistent results quickly.

If the client has the requirement that all the test cases need to be tested in a periodical time, we can use this browserStack automation feature.

After completing a set of code, then we can update it to git. After that we can integrate code with CI/CD. Then we need to update the code in git after every module also.

How to automate mobile app with browserStack?

1. Upload your app to browserStack (.apk for Android and .ipa for iOS)

2. Copy the url and paste it in your code

3. Copy userName and accessKey and paste it in your code

4. Declare device and platform details in your code

[Sample code to launch the device and application]

public void setup() throws MalformedURLException {

    // Initialize XCUITestOptions for iOS testing
    XCUITestOptions options = new XCUITestOptions();
    HashMap<String, Object> bstackOptions = new HashMap<>();

    bstackOptions.put("userName", "Enter your user name");
    bstackOptions.put("accessKey", "Enter your access Key");
    bstackOptions.put("appiumVersion", "2.0.1");

    options.setDeviceName("iPhone 15")
           .setPlatformVersion("17.0")
           .setApp("Enter your App URL")
           .setCapability("bstack:options", bstackOptions);

    options.setCapability("browserstack.networkLogs", true);
    options.setAutoAcceptAlerts(true);  // Auto accept alerts automatically for iOS

    // Initialize the class-level driver
    driver = new IOSDriver(new URL("https://hub-cloud.browserstack.com/wd/hub"), options);
    wait = new WebDriverWait(driver, Duration.ofSeconds(10));
    System.out.println("App launched successfully on BrowserStack device (iPhone 15, iOS 17)");
}

5. Run your code

6. Check results

Image Source: BrowserStack

Advantages if we automate apps with BrowserStack

  • We can reduce time in regression testing if we automate when the app is stable.
  • Some cases may be time dependent (eg : Some cases may need to test at midnight). So, those cases can be executed if we schedule the run with browserStack.
  • Some cases may be time consuming or there may be a lot of test cases, it may take a lot of time to complete. At this time, we need to invest our time if we check those manually. If we automate it, we can save that time and check if any other issues are occurring in it apart from test cases.
  • In future, we can reuse the automation code for a new project for common functionalities like login, logout or registration modules if we change the locators(eg : xpath, accessibility ID).
  • We can test with different kinds of devices (depends on OS versions, Screen size). So we can understand whether it is functioning or not.
  • We will get the results of a test within time. So that would be an advantage. When running a test on a device, we can get real time reports like text logs and screen recordings.
  • If we have a long term project with proper requirements, mobile app automation can be good. Because when a new build updates with additional functionalities (Only if additional functionalities are not affecting current one), we can do regression testing with automation and that can be completed within less time.

Concerns

  • Taking a subscription from browserStack can be a little expensive. And we can use it properly  when multiple projects need to be automated.
  • If a company, developing MVP projects and the project can be completed fast. In that case, there may be a lack of time to automate the application.
  • Projects can be automated only when the application is stable. But sometimes project’s UI or requirements can be changed at any time. So at that time, we may need to update the code frequently.
  • Some test cases remain non automatable, primarily due to factors like complex UI interactions, third-party integrations, or system-dependent behaviours.
  • Sometimes, we need to test different scenarios like Uploading images’ quality and size. At that time, we cannot depend on automation and that cases need to be handled manually.

Future Outlook

The future of mobile app automation with BrowserStack and Appium is bright, with emerging trends like AI and Machine Learning (ML) transforming testing by automating complex tasks and improving accuracy. These technologies enable analysis of vast data sets to identify patterns, predict issues, and optimize test cases, enhancing the overall testing process. Shift-left testing—integrating testing early in the development cycle—helps detect and resolve issues sooner, reducing costs and post-production defects. Cloud-based testing is also gaining traction for its scalability, cost-effectiveness, and accessibility. Additionally, as mobile apps handle more sensitive data, the need for robust security testing is growing, driven by new security threats and stricter regulatory standards. Together, these advancements position teams to deliver higher-quality apps faster, with greater confidence in their security and performance.

Conclusion

In conclusion, using BrowserStack with Appium for mobile app automation significantly streamlines testing by enabling cross-platform compatibility and remote device access. This setup enhances test efficiency, allowing for comprehensive coverage across diverse devices and OS versions without needing physical hardware. By leveraging BrowserStack's robust infrastructure and Appium's versatile automation capabilities, teams can ensure higher quality and consistency in mobile app performance, ultimately reducing release cycles and improving user experience.

References

[1]
[2]
[3]
[4]
[5]
[6]
[7]
[8]

Contents

Share

Written By

Sanand Raj

Software Tester

Dedicated software tester with a passion for ensuring flawless user experiences. Committed to meticulously testing every aspect of software functionality to guarantee quality and reliability.

Contact Us

We specialize in product development, launching new ventures, and providing Digital Transformation (DX) support. Feel free to contact us to start a conversation.