Mobile (real devices and emulators) testing using Appium 2.0+, VS Code, CSharp and MSTest framework.
Explore the docs »
·
Report Bug
·
Request Feature
Table of Contents
The tests are created in Visual Studio Code using MSTest (test framework for .NET applications).
AUT #1 is a native Huawei calculator (com.android.calculator2). Tested on real android device ( "locale":"de_DE", "manufacturer":"HUAWEI", "model":"ANE-LX1", "platformVersion":"9", ).
AUT #2 is a com.android.settings. Tested on emulator-5554 ( "locale":"en_EN", "platformName": "Android", "platformVersion":"13", ).
AUT #3 is a com.android.chrome. Tested on emulator-5554 ( "locale":"en_EN", "platformName": "Android", ).
- Visual Studio Code: https://code.visualstudio.com
- dotnet (8.0): https://dotnet.microsoft.com
- appium (dotnet-client, 2.0+): https://github.com/appium/dotnet-client
- Android Studio: https://developer.android.com/studio
Necessary tools and packages:
- Visual Studio Code with C# Dev Kit extension
- node
- npm
- jdk
- Appium 2.0+ with uiautomator2 and chromedriver
- Appium-Inspector
- appium-doctor (optional)
- Android Studio (AVD)
- allure-commandline 2.34.1+
- net 8.0
Used packages:
- Appium.WebDriver (e.g., 8.0.0)
- Newtonsoft.Json (e.g., 13.0.3)
- Open the project and build it.
- Create the AVD - an emulator with Android 13 (using Android Studio).
- Go to section "Testing" and run "EmulatorUnitTests" module.
- Build the project.
- Generate .trx report using Microsoft.Testing.Extensions.TrxReport: (!) Make sure the path and framework version (net8.0) match your build output. Run this command from the root of your workspace.
// to run only the Settings test from MSTestProject.dll with the trx-logger:
dotnet test MSTestProject/bin/Debug/net8.0/MSTestProject.dll --filter "Name=Settings" --logger:trx
trx-file is created at "your\path\to\appium2-CSharp\TestResults"
(!) There is no NuGet package to add for MSTest Allure integration. The only way is to use the allure-commandline to generate report from trx-file.
- To generate an Allure report from the .trx file (the test result format from MSTest), follow these steps: A1) Install allure-commandline:
npm install -g allure-commandline
A2) Then generate the report:
// allure generate <allure-results_folder>
allure generate "D:\git\appium2-CSharp\TestResults\"
A3) Open the report:
// allure open <output_folder>
allure open "D:\git\appium2-CSharp\TestResults\allure-report\"
Distributed under the Apache 2.0 License. See
LICENSE.txt for more information.
Project Link: link

