ImportIo.appium.java_client.android.AndroidDriver;Importio.appium.java_client.android.AndroidElement;ImportOrg.apache.logging.log4j.LogManager;ImportOrg.apache.logging.log4j.Logger;Importorg.junit.Test;ImportOrg.openqa.selenium.Point;Importorg.openqa.selenium.remote.DesiredCapabilities;ImportJava.net.URL;ImportJava.util.concurrent.TimeUnit; Public classApptest {Private StaticAndroiddriver<androidelement>driver; StaticLogger log = Logmanager.getlogger (interfacetest.class. GetName ()); Login Login=NewLogin (driver); PageObject PageObject=NewPageObject (driver); @org. Junit.beforeclass Public Static voidBeforetest ()throwsException {desiredcapabilities capabilities=Newdesiredcapabilities (); Capabilities.setcapability ("DeviceName", "Default"); Capabilities.setcapability ("Device", "Android"); Capabilities.setcapability ("PlatformName", "Android"); Capabilities.setcapability ("Browsername", "" "); Capabilities.setcapability ("Version", "7.0"); Capabilities.setcapability ("Apppackage", "Com.eg.XXXXXX"); Capabilities.setcapability ("Appactivity", ". Xxxxlogin "); Driver=NewAndroiddriver<androidelement> (NewURL ("Http://localhost:4723/wd/hub"), capabilities); Driver.manage (). Timeouts (). Implicitlywait (10, Timeunit.seconds); } /*** Close*/@org. Junit.afterclass Public Static voidaftertest () {if(Driver! =NULL) {driver.quit (); } log.debug ("---------------------------Test Complete"); } @Test Public voidTestopenapi ()throwsinterruptedexception {log.debug ("------------------------Start Testing"); Logintest (); } Public voidLogintest () {Specific test content ...} ...}
Android iOS app automation test case template