Skip to main content
🚀 Self Healing AI Agent now live in App Automate! Auto-fix flaky tests instantly with zero code changes. Enable now!
No Result Found
Connect and get help from 7,000+ developers on our Discord community. Ask the CommunityAsk the Community

Run Appium tests using Katalon Studio

Run your automated app tests on Appium using Katalon Studio. Execute automated tests on thousands of real iOS and Android devices offered by BrowserStack.

Katalon Studio allows you to set up, create, and manage automated mobile tests. With BrowserStack and Katalon, you can execute your automated tests on a range of real devices offered by BrowserStack.

Select the platform you want to test on:

Download Katalon Studio by signing up for a free account at Katalon’s website. After installation, log in to Katalon Studio using your account credentials and create a new Sample Android Mobile Tests Project. This process uses the sample app and test cases provided by Katalon. You can replace them with your own app and test cases.

Creating new sample Android Mobile Tests Project

Set the project name in the Name field and click OK.

Set the project name in name field and press OK

In the Tests Explorer window, go to the folder androidapp → APIDemos.apk. This is the application that will be tested on BrowserStack.

Tests Explorer

Upload app on the BrowserStack server

To learn how to upload your apps to BrowserStack devices and manage them, refer to the upload and manage apps section. For example, to upload APIDemos.apk to BrowserStack with the REST API using your account credentials:

Bash
Copy icon Copy

The following is a sample response:

JSON
Copy icon Copy

After the app uploads successfully, BrowserStack returns an app_url. This is the unique hashed ID of your uploaded app.

Configure the tests

In the Tests Explorer section in Katalon Studio, go to Test Cases and open the test case named Verify Last Items In List in the script view. Replace the highlighted portion of the code as shown below:

Verify Last Items In List Make the following changes to the code:

Replace this code:

Java
Copy icon Copy

With this code:

Java
Copy icon Copy

You must also import a few additional packages:

Java
Copy icon Copy

This is the resultant script:

Resultant script

You can also replace the existing code in Verify Last Items In List with the sample test script and execute it. Update the following details in the script:

  1. Add your USERNAME and ACCESS_KEY.
  2. Add the app_url (bs://<hashed-id>) returned for the uploaded Android app.

Execute the test by clicking the play icon and visit the App Automate Dashboard to see your session running on BrowserStack.

Download Katalon Studio by signing up for a free account at Katalon’s website. After installation, log in to Katalon Studio using your account credentials and create a new Sample iOS Mobile Tests Project. This process uses the sample app and test cases provided by Katalon. You can replace them with your own app and test cases.

Creating new sample iOS Mobile Tests Project

Set the project name in the Name field and click OK.

Setting project name in Katalon Studio

In the Tests Explorer window, go to the folder App → Coffee Timer-iPad Pro (9.7-inch).ipa. This is the application that will be tested on BrowserStack.

Katalon IOS Test Select Coffee Timer-iPad Pro (9.7-inch).ipa file

Upload app on the BrowserStack server

To learn how to upload your apps to BrowserStack devices and manage them, refer to the upload and manage apps section. For example, to upload Coffee Timer-iPad Pro (9.7-inch).ipa to BrowserStack with the REST API using your account credentials:

Bash
Copy icon Copy

The following is a sample response:

JSON
Copy icon Copy

After the app uploads successfully, BrowserStack returns an app_url. This is the unique hashed ID of your uploaded app.

Configure the tests

In the Tests Explorer section in Katalon Studio, go to Test Cases and open the file named Verify the main list in the script view. Replace the highlighted portion of the code as shown below:

Replace the highlighted portion of the code in the script

Make the following changes to the code.

Replace this code:

Java
Copy icon Copy

With this code:

Java
Copy icon Copy

You must also import a few additional packages:

Java
Copy icon Copy

This is the resultant script:

How to use MobileDriverType while creating driver

You can also replace the existing code in the Verify the main list with the sample test script and execute it. Update the following details in the script:

  1. Add your USERNAME and ACCESS_KEY.
  2. Add the app_url (bs://<hashed-id>) returned for the uploaded iOS app.

Execute the test by clicking the play icon and visit the App Automate Dashboard to see your session running on BrowserStack.

Set session and build names

By default, BrowserStack labels each session and build automatically. You can set your own names to organize your tests on the App Automate dashboard. Choose one of the following approaches based on when the names are known.

Set names when you create the driver

If the session and build names are known before the test runs, set them as capabilities in the same block where you create the driver:

Java
Copy icon Copy

Set names dynamically from a Test Suite Listener

To name a session after the test case that produced it, you need the test case name and status at runtime. A Test Suite Listener exposes these through the TestCaseContext object, but the naming must happen after the session exists.

In Katalon Studio, the Appium driver is created only when a driver-starting step runs inside the test case body, such as AppiumDriverManager.createMobileDriver() or Mobile.startApplication(). Calling MobileDriverFactory.getDriver() inside the @BeforeTestCase method of a Test Suite Listener runs before the driver exists and fails with StepFailedException: No application is started yet. Read the driver from @AfterTestCase instead, after the test case has started the session.

Implement the listener in one of the following two ways. Both read the driver in @AfterTestCase, so register only one of them.

The first approach updates the session from the @AfterTestCase method using the BrowserStack REST API. At this point the test case has already started the session, so you can read its ID from the driver and send the runtime name and status:

BrowserstackListener.groovy
Copy icon Copy

The second approach updates the session with the browserstack_executor JavaScript executor instead of the REST API. Because the session is still active when @AfterTestCase runs, this keeps your username and access key out of the listener:

BrowserstackListener.groovy
Copy icon Copy

Ensure the test case does not close the app as its final step:

  • If the last step is Mobile.closeApplication(), which Katalon sample tests often use, the driver is already quit by the time @AfterTestCase runs.
  • MobileDriverFactory.getDriver() then throws the same StepFailedException, and the update silently falls into the catch block.
  • Remove the closing step from the test case body, as Katalon tears down the driver after listeners run anyway.

Register the listener in your project so that it runs for every test case. Katalon runs @AfterTestCase once per test case, so each session is named after the test case that created it.

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked





Thank you for your valuable feedback

Is this page helping you?

Yes
No

We're sorry to hear that. Please share your feedback so we can do better

Contact our Support team for immediate help while we work on improving our docs.

We're continuously improving our docs. We'd love to know what you liked





Thank you for your valuable feedback!

Talk to an Expert
Download Copy Check Circle