Import static Junit.framework.assert.asserttrue;import static Org.junit.assert.*;import Org.junit.after;import Org.junit.before;import org.junit.test;import java.net.url;import io.appium.java_client. Appiumdriver;import Io.appium.java_client.android.androiddriver;import Org.openqa.selenium.by;import Org.openqa.selenium.remote.capabilitytype;import Org.openqa.selenium.remote.desiredcapabilities;public Class appiumtestcase {appiumdriver driver; @Beforepublic void SetUp () throws Exception {desiredcapabilities capabilities = new D Esiredcapabilities (); Capabilities.setcapability (Capabilitytype.browser_name, ""); Capabilities.setcapability (" Platforname "," Android "); Capabilities.setcapability (" DeviceName "," 05157df53de0042b "); capabilities.setcapability ("Platformversion", "6.0.1"), Capabilities.setcapability ("Apppackage", "Com.sec.android.app.popupcalculator"); Capabilities.setcapability ("Appactivity", ". Calculator ");d river = new Androiddriver (New URL (" Http://127.0.0.1:4723/wd/hub "), capabilities);} @afterpublic void TearDown () throws Exception {Driver.quit ();} @SuppressWarnings ("deprecation") @Testpublic void Test1 () {driver.findelement (By.name ("9")). Click (); Driver.findelement (By.name ("5")). Click ();d river.findelement (by.name ("+")). Click ();d river.findelement (By.name (" 6 "). Click ();d river.findelement (by.name (" = ")). Click (); Asserttrue (" OK ", Driver.findelement (By.name (" 101 ")). Isdisplayed ());} @SuppressWarnings ("deprecation") @Testpublic void Test2 () {driver.findelement (By.name ("9")). Click (); Driver.findelement (By.name ("5")). Click ();d river.findelement (by.name ("+")). Click ();d river.findelement (By.name (" 7 "). Click ();d river.findelement (by.name (" = ")). Click (); Asserttrue (" OK ", Driver.findelement (By.name (" 102 ")). Isdisplayed ());}}
Simple example of Appium + JUnit