安卓ios app自动化测试用例模板
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了安卓ios app自动化测试用例模板相关的知识,希望对你有一定的参考价值。
import io.appium.java_client.android.AndroidDriver; import io.appium.java_client.android.AndroidElement; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.junit.Test; import org.openqa.selenium.Point; import org.openqa.selenium.remote.DesiredCapabilities; import java.net.URL; import java.util.concurrent.TimeUnit; public class AppTest { private static AndroidDriver<AndroidElement> driver; static Logger log = LogManager.getLogger( InterfaceTest.class.getName()); Login login = new Login(driver); PageObject pageobject = new PageObject(driver); @org.junit.BeforeClass public static void beforeTest() throws Exception { DesiredCapabilities capabilities=new DesiredCapabilities(); 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=new AndroidDriver<AndroidElement>(new URL("http://localhost:4723/wd/hub"),capabilities); driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS); } /** * 关闭 */ @org.junit.AfterClass public static void afterTest() { if (driver != null) { driver.quit(); } log.debug("---------------------------测试完毕"); } @Test public void testOpenAPI() throws InterruptedException { log.debug("------------------------开始测试"); loginTest(); } public void loginTest() { 具体的测试内容............. }
以上是关于安卓ios app自动化测试用例模板的主要内容,如果未能解决你的问题,请参考以下文章
APP自动化框架LazyAndroid使用手册--测试模板工程详解