In this post, you will see steps to download and setup visual studio, appium components to run appium tests using c# language.
Download
- Visual Studio
- Genymotion
- APK info – mobile app to get appPackage and appActivity
Appium components
nuGet packages
- Selenium WebDriver
- Appium
- Nunit
- Nunit3 test adapter
Code implementation
using NUnit.Framework; using OpenQA.Selenium.Appium.Android; using OpenQA.Selenium.Remote; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace AppiumCTest { public class TC1 { AndroidDriver<AndroidElement> driver; DesiredCapabilities cap; [SetUp] public void InitDriver() { cap = new DesiredCapabilities(); cap.SetCapability("platformName", "Android"); cap.SetCapability("deviceName", "Google Pixel XL - 8.0 - API 26"); cap.SetCapability("appPackage", "com.android.dialer"); cap.SetCapability("appActivity", "DialtactsActivity"); driver = new AndroidDriver<AndroidElement>(new Uri("http://127.0.01:4723/wd/hub"), cap); } [Test] public void Test1() { Assert.IsNotNull(driver); System.Threading.Thread.Sleep(2000); } [TearDown] public void closeDriver() { driver.Quit(); } } }
For detailed steps on how to download nuget packages in visual studio and run the appium test [nunit tests], watch here