Appium + junit 的简单实例
2016-05-05 13:29
267 查看
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; @Before public void setUp() throws Exception { DesiredCapabilities capabilities = new DesiredCapabilities(); 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"); driver = new AndroidDriver(new URL("http://127.0.0.1:4723/wd/hub"),capabilities); } @After public void tearDown() throws Exception { driver.quit(); } @SuppressWarnings("deprecation") @Test public void test1() { driver.findElement(By.name("9")).click(); driver.findElement(By.name("5")).click(); driver.findElement(By.name("+")).click(); driver.findElement(By.name("6")).click(); driver.findElement(By.name("=")).click(); assertTrue("ok", driver.findElement(By.name("101")).isDisplayed()); } @SuppressWarnings("deprecation") @Test public void test2() { driver.findElement(By.name("9")).click(); driver.findElement(By.name("5")).click(); driver.findElement(By.name("+")).click(); driver.findElement(By.name("7")).click(); driver.findElement(By.name("=")).click(); assertTrue("ok", driver.findElement(By.name("102")).isDisplayed()); } }
Appium服务关键字
参考:http://www.cnblogs.com/puresoul/p/4709189.htmlAppium使用总结
参考:http://www.cnblogs.com/tobecrazy/category/699177.htmlhttp://www.2cto.com/kf/201501/368019.html
Appium定位方法总结
参考:http://www.2cto.com/kf/201410/340345.htmlhttp://blog.csdn.net/today520/article/details/37815087
Appium实例收集
参考:http://blog.csdn.net/wirelessqa/article/details/29188455相关文章推荐
- Android studio 导入fresco报错can not resolve 'com.facebook.fresco:fresco'的解决思想
- android:layout_width=“0dp”有什么用?为什么这么设置?
- 深度讲解VIEWPORT和PX是什么?移动端单位px,em,rem
- OPENGL es版本和OGL 及android关系
- android studio中生成aidl
- 对iOS锁的一些研究
- JavaScript学习总结(十一)——Object类详解
- Object-c------@property的内存管理
- Android中使用ShareSDK功能学习
- Android xml资源文件中@、@android:type、@*、?、@+含义和区别
- 【fastweixin框架教程1】一分钟快速搭建微信公众平台JAVA服务器
- Swift重载和自定义运算符
- 【fastweixin框架教程1】一分钟快速搭建微信公众平台JAVA服务器
- android获取app的版本信息
- Adapter-ListView实例
- unity中使用protobuf(兼容ios平台)
- 带你实现开发者头条APP(五)--RecyclerView下拉刷新上拉加载
- 如何使用csapp文件
- android 布局
- iOS开发Xcode使用github托管代码