Welcome to BrowserStack NUnit Examples, a sample UI testing framework empowered with Appium and NUnit. Along with the framework the repository also contains a collection of sample test scripts written for BrowserStack Demo Application.
This repository includes a number of sample configuration files to run these on tests on BrowserStack platforms including **browsers running on a remote selenium grid such as BrowserStack AppAutomate
Following are the test cases included in this repository:
Module | Test Case | Description |
---|---|---|
Login | PerformLoginValidCreds | Test case Perform Login with valid credentials |
Login | PerformLoginNoCreds | Test case Perform Login with Blank credentials |
Browse | CheckItemCount | Test case validates Item counts on initial state of App |
Browse | AddNewItem | Test case adds new item validates newly added item |
About | GoToAboutTab | Test case navigates to About tab |
Ensure you have the following dependencies installed on the machine
- Dotnet (3 or above)
- Allure Command Line Tool
- BrowserStack AppAutomate Account.
- Upload Your App on BrowserStack
Click here for more details on how to upload an app.
For this example repository, the sample apps are available here:
- Xamarin: bin/xamarin/SimpleApp_Android.apk, bin/xamarin/SimpleApp_iOS.ipa
📌 Clone this repository
📌 Navigate to the repository directory
cd browserstack-examples-appium-nunit
📌 Restore the required nuget pakages
dotnet restore
📌 Build the project
dotnet build
The repository is designed to execute test on list of Device's hosted on BrowserStack
List of devices could be found here
On BrowserStack AppAutomate, you can spin multiple Devices instances in parallel to reduce your over all build time. With NUnit you configure the number concurrent test executions to an optimal count by configuring through AssemblyInfo.cs
📌 Create a new BrowserStack account or use an existing one.
📌 Identify your BrowserStack username and access key from the BrowserStack App-Automate Dashboard and export them as environment variables using the below commands.
- For Unix-like or Mac machines:
export BROWSERSTACK_USERNAME=<browserstack-username> &&
export BROWSERSTACK_ACCESS_KEY=<browserstack-access-key>
export CAPABILITIES_FILENAME=<capabilities_file>
export BROWSERSTACK_ANDROID_APP_ID=<APP_BSTACK_URL__OR__CUSTOM_ID>
export BROWSERSTACK_IOS_APP_ID=<APP_BSTACK_URL__OR__CUSTOM_ID>
- For Windows:
set BROWSERSTACK_USERNAME=<browserstack-username>
set BROWSERSTACK_ACCESS_KEY=<browserstack-access-key>
set CAPABILITIES_FILENAME=<capabilities_file>
set BROWSERSTACK_ANDROID_APP_ID=<APP_BSTACK_URL__OR__CUSTOM_ID>
set BROWSERSTACK_IOS_APP_ID=<APP_BSTACK_URL__OR__CUSTOM_ID>
📄 Note: We have configured a list of test capabilities in these configuration files
Default Configuration file:
CAPABILITIES_FILENAME = capabilities.yml.
This default capabilities file and other test configuration files reside in the below folder:
browserstack-examples-appium-nunit/Browserstack/Webdriver/Resources/
Feel free to update the configurations based on your device and test requirements. The exact test capability values can be easily identified using the Browserstack Capability Generator
Following are the preconfigured test execution profiles.
- View your test results on the BrowserStack AppAutomate dashboard
- Documentation for writing Automate test scripts in C#
- Customizing your tests capabilities on BrowserStack using our test capability generator
- List of mobile devices for automation testing on BrowserStack
- Using AppAutomate REST API to access information about your tests via the command-line interface
- Understand how many parallel sessions you need by using our Parallel Test Calculator
- For testing public web applications behind IP restriction, Inbound IP Whitelisting can be enabled with the BrowserStack Enterprise offering