Run Appium tests using C# SDK | BrowserStack Docs
Appium with C#
Test your native and hybrid apps on a real device cloud. This guide helps you run your first test build on a real Android or iOS device on BrowserStack.
In this document, you’ll learn how to set up your C# Appium testing environment, configure your test settings, and execute your first automated test on BrowserStack’s real device cloud. We’ll walk you through each step, from initial setup to viewing your test results on the dashboard.
Onboard faster with Test Companion
Launch in your IDE. Chat with the AI assistant to configure and run your first build instantly.
Prerequisites
BrowserStack Username and Access key. You can find this in your account profile section. If you do not have an account yet, sign up for a Free Trial.
Run a sample build
Run a sample C# test build using your preferred method on BrowserStack:
Get sample project
Get our sample project by following these steps:
Download project
After downloading the sample project, unzip it in a desired location.
Import the downloaded project
Click File > Open. Navigate to your project and open it.
Configure your browserstack.yml config file
The browserstack.yml file holds all the required capabilities to run your tests on BrowserStack. It is found in your project’s (android/ios) root folder and is part of downloaded sample.
Set access credentials
Set userName and accessKey parameters in the browserstack.yml file, available in the root directory, to authenticate your tests on BrowserStack.
Select Android or iOS devices from a list of 150+ available combinations:
Use one of our sample apps to run your first Appium test on BrowserStack App Automate. Choose from the options below:
Platforms
Select an OS to choose the devices from below
Android
- Samsung Galaxy S22 Ultra 12.0
- Google Pixel 8 Pro 14.0
- OnePlus 11R 13.0
Update the browserstack.yml config file
Replace the platforms object in the browserstack.yml file.
userName: YOUR_USERNAME
accessKey: YOUR_ACCESS_KEY
app: YOUR_APP_ID
platforms:
- YOUR_FIRST_OS_TYPE: YOUR_FIRST_OS
YOUR_FIRST_BROWSER_TYPE: YOUR_FIRST_BROWSER
YOUR_FIRST_BROWSER_VERSION_TYPE: 'YOUR_FIRST_BROWSER_VERSION'
- YOUR_SECOND_OS_TYPE: YOUR_SECOND_OS
YOUR_SECOND_BROWSER_TYPE: YOUR_SECOND_BROWSER
YOUR_SECOND_BROWSER_VERSION_TYPE: 'YOUR_SECOND_BROWSER_VERSION'
- YOUR_THIRD_OS_TYPE: YOUR_THIRD_OS
YOUR_THIRD_BROWSER_TYPE: YOUR_THIRD_BROWSER
YOUR_THIRD_BROWSER_VERSION_TYPE: 'YOUR_THIRD_BROWSER_VERSION'
browserstackLocal: true
buildName: browserstack-build-1
projectName: BrowserStack Sample
Run sample tests on BrowserStack!
Follow these steps to run your test on BrowserStack.
On the Visual Studio toolbar, select Test > Test Explorer.
Right-click on your test and click Run.
Get sample project
Get our sample project using one of the following options.
Option 1: Download the project
Option 2: Clone the Git repository
Clone our sample Git repository using these commands.
git clone https://github.com/browserstack/nunit-appium-app-browserstack.git
cd nunit-appium-app-browserstack
Configure your browserstack.yml config file
Set access credentials
Set userName and accessKey parameters in the browserstack.yml file, available in the root directory, to authenticate your tests on BrowserStack.
Run sample tests on BrowserStack!
Based on the devices and app selected, cd to the right project, install dependencies, and run a sample test build on BrowserStack
cd android
dotnet build
dotnet test --filter "Category=sample-test"
cd ios
dotnet build
dotnet test --filter "Category=sample-test"
cd #(project folder Android or iOS)
dotnet build
dotnet test
- After you run your test, visit the App Automate dashboard to view your test results.
- If you want to toggle between BrowserStack and your Local device grid when using BrowserStack SDK, refer to the commands here.
If a test run stops due to a crash, you can stop the build from running by clicking the Stop build option from the App Automate dashboard.
Next steps
After you have successfully run your first test on BrowserStack, try integrating your test suite with BrowserStack.