GithubHelp home page GithubHelp logo

java-appium-app-browserstack's Introduction

java-appium-app-browserstack

This repository demonstrates how to run Appium Java tests on BrowserStack App Automate.

Setup

Requirements

  1. Java 8+
  • If Java is not installed, follow these instructions:
    • For Windows, download latest java version from here and run the installer executable
    • For Mac and Linux, run java -version to see what java version is pre-installed. If you want a different version download from here
  1. Maven

    • If Maven is not downloaded, download it from here
    • For installation, follow the instructions here

Install the dependencies

To install the dependencies, run the following command in the project's base folder

mvn clean install

Getting Started

Getting Started with Appium tests in Java on BrowserStack couldn't be easier!

Run your first test :

1. Upload your Android or iOS App

Upload your Android app (.apk or .aab file) or iOS app (.ipa file) to BrowserStack servers using our REST API. Here is an example cURL request :

curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \
-X POST "https://api-cloud.browserstack.com/app-automate/upload" \
-F "file=@/path/to/apk/file"

Ensure that @ symbol is prepended to the file path in the above request. Please note the app_url value returned in the API response. We will use this to set the application under test while configuring the test later on.

Note: If you do not have an .apk or .ipa file and are looking to simply try App Automate, you can download and test using our sample Android app or sample iOS app.

2. Configure and run your first test

Open BrowserStackSample.java file in the android directory or ios directory :

  • Replace YOUR_USERNAME & YOUR_ACCESS_KEY with your BrowserStack access credentials. Get your BrowserStack access credentials from here

  • Replace bs://<app-id> with the URL obtained from app upload step

  • Set the device and OS version

  • If you have uploaded your own app update the test case

  • To run the test, use the following command in the base directory :

    • For Android test, run
    mvn test -P android-first-test
    • For iOS test, run
    mvn test -P ios-first-test
  • You can access the test execution results, and debugging information such as video recording, network logs on App Automate dashboard


Use Local testing for apps that access resources hosted in development or testing environments :

1. Upoad your Android or iOS App

Upload your Android app (.apk or .aab file) or iOS app (.ipa file) that access resources hosted on your internal or test environments to BrowserStack servers using our REST API. Here is an example cURL request :

curl -u "YOUR_USERNAME:YOUR_ACCESS_KEY" \
-X POST "https://api-cloud.browserstack.com/app-automate/upload" \
-F "file=@/path/to/apk/file"

Ensure that @ symbol is prepended to the file path in the above request. Please note the app_url value returned in the API response. We will use this to set the application under test while configuring the test later on.

Note: If you do not have an .apk or .ipa file and are looking to simply try App Automate, you can download and test using our sample Android Local app or sample iOS Local app.

2. Configure and run your local test

Open BrowserStackSampleLocal.java file in the android or ios directory :

  • Replace YOUR_USERNAME & YOUR_ACCESS_KEY with your BrowserStack access credentials. Get your BrowserStack access credentials from here

  • Replace bs://<app-id> with the URL obtained from app upload step

  • Set the device and OS version

  • Ensure that browserstack.local capability is set to true. Within the test script, there is code snippet that automatically establishes Local Testing connection to BrowserStack servers using Java binding for BrowserStack Local.

  • If you have uploaded your own app update the test case

  • To run the test, use the following command in the base directory :

    • For Android test, run
    mvn test -P android-local-test
    • For iOS test, run
    mvn test -P ios-local-test
  • You can access the test execution results, and debugging information such as video recording, network logs on App Automate dashboard

Integration with other Java frameworks

Getting Help

If you are running into any issues or have any queries, please check Browserstack Support page or get in touch with us.

java-appium-app-browserstack's People

Contributors

kn-neeraj avatar tejasshah93 avatar nidhimj22 avatar gaurav-bstack avatar vedharish avatar agundawar avatar kdoshi2014 avatar tr4n2uil avatar nakula avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.