This repository demonstrates how to run Appium tests in JUnit4 and Junit5 on BrowserStack App Automate.
Based on
These code samples are currently based on:
- Appium-Java-Client:
8.1.1 - Protocol:
W3C
Setup
Requirements
-
Java 8+
-
Maven (Only required if using Maven as the build tool)
-
Gradle (Only required if using Gradle as the build tool)
Install the dependencies
To install the dependencies for JUnit4 tests, run :
-
For Android
cd junit-4/android mvn clean -
For iOS
Or,
To install the dependencies for JUnit5 tests, run :
-
For Android
cd junit-5/android mvn clean -
For iOS
Getting Started
Getting Started with Appium tests in Junit4 and Junit5 on BrowserStack couldn't be easier!
Run first test :
-
Junit4
- Update
browserstack.ymlfile at root level of Android Junit4 examples or iOS Junit4 examples with your BrowserStack Username and Access Key - For Maven: Run the following command to execute tests in the Maven environment:
- For Gradle: Run the following command to execute tests in the Gradle environment:
- Update
-
Junit5
- Update
browserstack.ymlfile at root level of Android Junit5 examples or iOS Junit5 examples with your BrowserStack Username and Access Key - For Maven: Run the following command to execute tests in the Maven environment:
- For Gradle: Run the following command to execute tests in the Gradle environment:
- Update
Use Local testing for apps that access resources hosted in development or testing environments :
-
Junit4
- Update
browserstack.ymlfile at root level of Android Junit4 examples or iOS Junit4 examples with your BrowserStack Username and Access Key - Simply configure the browserstackLocal parameter in the browserstack.yml file accordingly in Android Junit4 examples or iOS Junit4 examples.
- For Maven: Run the following command to execute tests in the Maven environment:
mvn test -P sample-local-test - For Gradle: Run the following command to execute tests in the Gradle environment:
gradle clean sampleLocalTest
- Update
-
Junit5
- Update
browserstack.ymlfile at root level of Android Junit5 examples or iOS Junit5 examples with your BrowserStack Username and Access Key - Simply configure the browserstackLocal parameter in the browserstack.yml file accordingly in Android Junit5 examples or iOS Junit5 examples.
- For Maven: Run the following command to execute tests in the Maven environment:
mvn test -P sample-local-test - For Gradle: Run the following command to execute tests in the Gradle environment:
gradle clean sampleLocalTest
- Update
Note: If you are facing any issues, refer Getting Help section
Integration with other Java frameworks
For other Java frameworks samples, refer to following repositories :
Note: For other test frameworks supported by App-Automate refer our Developer documentation
Getting Help
If you are running into any issues or have any queries, please check Browserstack Support page or get in touch with us.
