Getting Started with Appium and NUnit framework
On This Page Prerequisites for running Appium Tests with NUnitJanuary 13, 2026 · 6 min read · Tool Comparison
Appium with NUnitis a powerful combination for examine mobile applications on Android and iOS. While Appium provides the mechanization library, NUnit acts as the test runner, making it easy for .NET and C # developers to structure and execute mobile test cases efficiently. This usher explain how to set up, write, and run your 1st Appium NUnit exam. What Do You Need Before Running Appium with NUnit? How to Set Up Appium and NUnit on Your System? How to Write Your First Appium NUnit Test? Why Should You Test on Real Devices? This clause coverswhat Appium with NUnit is, how to set it up, how to write your first exam, and why running test on real devices give the nigh reliable results. Before you get writing your first test in Appium with NUnit, you need below frame-up to be finish in our System (This article focuses on setting up puppet in macOS and like apparatus is also potential in Windows) Once the initiation of Optical studio for mac is completed, open the Visual studio for next setup Once the installation is completed, on opening the Appium server, the screen will look like below. You need to enter the host IP, so let ’ s enter127.0.0.1and before starting the host you necessitate to ensure theANDROID_HOMEvariable is defined with the proper path. Enter the android sdk path and click on Save and Restart You can now commence our Appium server with host IP set as127.0.0.1 For autonomous testing across multiple user personas, check out SUSATest — it explores your app like 10 different real users. Once you create the NUnit Test Project, you need to install below packages Once these bundle are added, you can start publish our tests and helpers. Using the NUnit framework for create the test which will test the sample Android Application. The Test class will have Our Project and Classes will look like below in the Solution As you can see there are:Test Class, Config, and the Helper Class, which will receive the reclaimable static methods which will contains Below is the code employ in Helper Class using System; Let ’ s see how our Setup/BeforeAll method look like As find, all the Desired Capabilities are set and so passed to AndroidDriver for creating a new driver object. AndroidDrivercourse constructor accepts three objects As explained earlier, we will be finding an element in the demo app and recruit a text for hunting, and then will validate if the result contains searched textbook. For this thetryout gradewill look like below. To run this tryout, simply double detent on the trial name in Tests window or right click on test name and select Run If we accomplish our test, it will look like below in the Android Emulator Accomplished example repository of the code explained can be foundhere This article discussed, how to set up the tools required for lam Appium tests using NUnit. Appium, an open source test mechanization framework is very powerful and can be used to screen almost all workflows/use cases of Mobile Application across Platforms. Since are like to and interact with them, it will turn conversant for a Selenium ground tester to switch to Appium with less hear curve. However, to get more exact test answer, it is suggested to test on real devices. BrowserStack ’ s provides all the roving devices both latest and older models in the platform. Check out the Official Documentation to learn how to. Using BrowserStack ’ s real devices you can also cut your testing time drastically by leveraging and scat parallel test. # Ask-and-Contributeabout this topic with our Discord community. Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts needed. Upload your APK or URL. SUSA explores like 10 real users — finds bugs, accessibility violations, and security issues. No scripts.Getting Started with Appium and NUnit framework
Overview
Tests can be action directly in Visual Studio by selectingRun Testfrom the NUnit window.Prerequisites for go Appium Tests with NUnit
Visual Studio for Mac apparatus
Appium Setup
Project setup for extend Appium Tests with NUnit
Writing first Appium NUnit test
namespace AppiumDotNetSamples.Helper {public static class Env {public unchanging String rootDirectory = System.IO.Path.GetFullPath ($ '' {System.AppDomain.CurrentDomain.BaseDirectory.ToString ()} / .. / .. / .. / .. ''); static public bool IsBrowserStack () {return Environment.GetEnvironmentVariable (`` BROWSERSTACK '')! = cipher;} static public Uri ServerUri () {String bsUserName = Environment.GetEnvironmentVariable (`` BROWSERSTACK_USERNAME ''); String bsAccessKey = Environment.GetEnvironmentVariable (`` BROWSERSTACK_ACCESS_KEY ''); return (bsUserName == null) || (bsAccessKey == null)? new Uri (`` http: //localhost:4723/wd/hub ''): new Uri ($ '' https: //cloudURL:80/wd/hub '');} public stable TimeSpan INIT_TIMEOUT_SEC = TimeSpan.FromSeconds (180); public unchanging TimeSpan IMPLICIT_TIMEOUT_SEC = TimeSpan.FromSeconds (10);} public static class App {static public String IOSApp () {return Env.IsBrowserStack ()? `` http: //appium.github.io/appium/assets/TestApp7.1.app.zip '': $ '' {Env.rootDirectory} /apps/TestApp.app.zip '';} static public String IOSDeviceName () {homecoming Environment.GetEnvironmentVariable (`` IOS_DEVICE_NAME '')?? `` iPhone 6s '';} inactive public String IOSPlatformVersion () {homecoming Environment.GetEnvironmentVariable (`` IOS_PLATFORM_VERSION '')?? `` 11.4 '';} static public String AndroidApp () {Console.WriteLine (Env.rootDirectory); return Env.IsBrowserStack ()? `` http: //appium.github.io/appium/assets/ApiDemos-debug.apk '': $ '' {Env.rootDirectory} /apps/ApiDemos-debug.apk '';} static public String AndroidDeviceName () {return Environment.GetEnvironmentVariable (`` ANDROID_DEVICE_VERSION '')?? `` Android '';} static public String AndroidPlatformVersion () {return Environment.GetEnvironmentVariable (`` ANDROID_PLATFORM_VERSION '')?? `` 12.0 '';}}}[SetUp ()] public void BeforeAll () {DesiredCapabilities capacity = new DesiredCapabilities (); capabilities.SetCapability (MobileCapabilityType.BrowserName, `` ''); capabilities.SetCapability (MobileCapabilityType.PlatformName, App.AndroidDeviceName ()); capabilities.SetCapability (MobileCapabilityType.PlatformVersion, App.AndroidPlatformVersion ()); capabilities.SetCapability (MobileCapabilityType.AutomationName, `` UIAutomator2 ''); capabilities.SetCapability (MobileCapabilityType.DeviceName, `` Nexus ''); capabilities.SetCapability (`` appActivity '', `` .app.SearchInvoke ''); capabilities.SetCapability (MobileCapabilityType.App, App.AndroidApp ()); driver = new AndroidDriver & lt; AndroidElement & gt; (Env.ServerUri (), capabilities, Env.INIT_TIMEOUT_SEC); driver.Manage () .Timeouts () .ImplicitWait = Env.IMPLICIT_TIMEOUT_SEC;}expend NUnit.Framework; using OpenQA.Selenium; using OpenQA.Selenium.Appium; using OpenQA.Selenium.Appium.Enums; use OpenQA.Selenium.Appium.Android; using OpenQA.Selenium.Remote; using System; habituate AppiumDotNetSamples.Helper; namespace AppiumDotNetSamples {[TestFixture ()] public class AndroidBasicInteractionsTest {private AndroidDriver & lt; AndroidElement & gt; driver; [SetUp ()] public void BeforeAll () {DesiredCapabilities capabilities = new DesiredCapabilities (); capabilities.SetCapability (MobileCapabilityType.BrowserName, `` ''); capabilities.SetCapability (MobileCapabilityType.PlatformName, App.AndroidDeviceName ()); capabilities.SetCapability (MobileCapabilityType.PlatformVersion, App.AndroidPlatformVersion ()); capabilities.SetCapability (MobileCapabilityType.AutomationName, `` UIAutomator2 ''); capabilities.SetCapability (MobileCapabilityType.DeviceName, `` Nexus ''); capabilities.SetCapability (`` appActivity '', `` .app.SearchInvoke ''); capabilities.SetCapability (MobileCapabilityType.App, App.AndroidApp ()); driver = new AndroidDriver & lt; AndroidElement & gt; (Env.ServerUri (), capabilities, Env.INIT_TIMEOUT_SEC); driver.Manage () .Timeouts () .ImplicitWait = Env.IMPLICIT_TIMEOUT_SEC;} [TearDown ()] public void AfterAll () {driver.Quit ();} [Test ()] public void TestShouldSendKetsToSearchBoxThenCheckTheValue () {AndroidElement searchBoxElement = driver.FindElementById (`` txt_query_prefill ''); searchBoxElement.SendKeys (`` Hello World! ``); AndroidElement onSearchRequestButton = driver.FindElementById (`` btn_start_search ''); onSearchRequestButton.Click (); AndroidElement seachText = driver.FindElementById (`` android: id/search_src_text ''); Assert.AreEqual (`` Hello World! ``, seachText.Text);}}}Test on Existent Devices
Related Guides
Automate This With SUSA
Test Your App Autonomously