Skip to content

browserstack/pytest-appium-app-browserstack

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PyTest with Browserstack AppAutomate

PyTest Integration with BrowserStack.

BrowserStack Logo

Requirements

  1. Python 3.6+ or Python 2.7+

    • For Windows, download latest python version from here and run the installer executable
    • For Mac and Linux, run python --version to see what python version is pre-installed. If you want a different version download from here

Install the dependencies

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

  • For Python 3

    pip3 install -r requirements.txt
  • For Python 2

    pip install -r requirements.txt

Getting Started

Getting Started with Pytest-Appium tests in Python 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 single test

Open single.json file in android/run-single-test folder for Android and ios/run-single-test folder for iOS:

  • Replace BROWSERSTACK_USERNAME & BROWSERSTACK_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 deviceName and platformVersion. You can refer our Capability Generator

  • Run the below command to execute a single Android test on BrowserStack AppAutomate:

    cd android
    paver run single
    
  • Run the below command to execute a single iOS test on BrowserStack AppAutomate:

    cd ios
    paver run single
    

3. Configure and run your parallel test

  • In order to run tests in parallel across different configurations, Open parallel.json file in android/run-parallel-test folder for Android and ios/run-parallel-test folder for iOS

  • Replace BROWSERSTACK_USERNAME & BROWSERSTACK_ACCESS_KEY with your BrowserStack access credentials. Get your BrowserStack access credentials from here

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

  • Set the deviceName and platformVersion. You can refer our Capability Generator

  • Run the below command to execute parallel Android test on BrowserStack AppAutomate:

cd android
paver run parallel
  • Run the below command to execute a parallel iOS test on BrowserStack AppAutomate:
cd ios
paver run parallel
  • 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. Upload 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 local.json file in android/run-local-test folder for Android and ios/run-local-test folder for iOS:

  • Replace BROWSERSTACK_USERNAME & BROWSERSTACK_ACCESS_KEY with your BrowserStack access credentials. Get your BrowserStack access credentials from here

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

  • Set the deviceName and platformVersion. You can refer our Capability Generator

  • Ensure that local capability is set to true. The conftest.py contains the code snippet that automatically establishes Local Testing connection to BrowserStack servers using Python binding for BrowserStack Local.

  • Run the below command for Android:

    cd android
    paver run local
    
  • Run the below command for iOS:

    cd ios
    paver run local
    
  • You can access the test execution results, and debugging information such as video recording, network logs on App Automate dashboard

About

Pytest integration with BrowserStack

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages