欢迎来到天天文库
浏览记录
ID:21859275
大小:79.00 KB
页数:9页
时间:2018-10-25
《android自动化测试》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、达内广州软件培训http://tarena3g.com.cn/Android自动化测试如果大家配置好了athrun的测试环境,那么开始吧(这里只介绍有源码的情况,没有源码也是可以做的)1.导入被测试应用--新建测试工程--依赖被测试应用测试工程的Manifest.xml 2、st" android:versionCode="1" android:versionName="1.0"> 3、cation android:icon="@drawable/testicon" android:label="@string/app_name"> 2.测试代码(只贴出MainActivity,用例很简单就不多作注释了)packageorg.athrun.android.test; importorg.athrun.android.a4、pp.R; importorg.athrun.android.framework.AthrunTestCase; importorg.athrun.android.framework.Test; importorg.athrun.android.framework.ViewOperation; importorg.athrun.android.framework.viewelement.AbsListViewElement; importorg.athrun.android.framework.viewelement.SlideableEl5、ement; importorg.athrun.android.framework.viewelement.TextViewElement; importorg.athrun.android.framework.viewelement.ViewElement; importorg.athrun.android.framework.viewelement.ViewGroupElement; importandroid.util.Log; importandroid.widget.AbsListView; //继承AthrunTestCa6、se publicclassMainActivityTestextendsAthrunTestCase{ privatestaticfinalStringLOG_TAG="MainActivityTest"; publicMainActivityTest()throwsException{ //super(被测试程序包名,启动的activity) super("org.athrun.android.app","org.athrun.android.app.MainActivity"); 7、 //设置查找VIEW最多用多少时间 广州天河北校区广州达内岗顶中心广州达内江南中心天河区天寿路105号天寿大厦4层天河龙口东路5号龙晖大厦403-405室海珠区礼岗路10号2楼电话:020-38097500联系电话:020-85262372联系电话:020-34430387达内广州软件培训http://tarena3g.com.cn/AthrunTestCase.setMaxTimeToFindView(10000); } @Test //等待activity publicvoidtestWait8、ForActivity()throwsException{ //log("Thisisatestforlog()method"); assertEqu
2、st" android:versionCode="1" android:versionName="1.0"> 3、cation android:icon="@drawable/testicon" android:label="@string/app_name"> 2.测试代码(只贴出MainActivity,用例很简单就不多作注释了)packageorg.athrun.android.test; importorg.athrun.android.a4、pp.R; importorg.athrun.android.framework.AthrunTestCase; importorg.athrun.android.framework.Test; importorg.athrun.android.framework.ViewOperation; importorg.athrun.android.framework.viewelement.AbsListViewElement; importorg.athrun.android.framework.viewelement.SlideableEl5、ement; importorg.athrun.android.framework.viewelement.TextViewElement; importorg.athrun.android.framework.viewelement.ViewElement; importorg.athrun.android.framework.viewelement.ViewGroupElement; importandroid.util.Log; importandroid.widget.AbsListView; //继承AthrunTestCa6、se publicclassMainActivityTestextendsAthrunTestCase{ privatestaticfinalStringLOG_TAG="MainActivityTest"; publicMainActivityTest()throwsException{ //super(被测试程序包名,启动的activity) super("org.athrun.android.app","org.athrun.android.app.MainActivity"); 7、 //设置查找VIEW最多用多少时间 广州天河北校区广州达内岗顶中心广州达内江南中心天河区天寿路105号天寿大厦4层天河龙口东路5号龙晖大厦403-405室海珠区礼岗路10号2楼电话:020-38097500联系电话:020-85262372联系电话:020-34430387达内广州软件培训http://tarena3g.com.cn/AthrunTestCase.setMaxTimeToFindView(10000); } @Test //等待activity publicvoidtestWait8、ForActivity()throwsException{ //log("Thisisatestforlog()method"); assertEqu
3、cation android:icon="@drawable/testicon" android:label="@string/app_name"> 2.测试代码(只贴出MainActivity,用例很简单就不多作注释了)packageorg.athrun.android.test; importorg.athrun.android.a
4、pp.R; importorg.athrun.android.framework.AthrunTestCase; importorg.athrun.android.framework.Test; importorg.athrun.android.framework.ViewOperation; importorg.athrun.android.framework.viewelement.AbsListViewElement; importorg.athrun.android.framework.viewelement.SlideableEl
5、ement; importorg.athrun.android.framework.viewelement.TextViewElement; importorg.athrun.android.framework.viewelement.ViewElement; importorg.athrun.android.framework.viewelement.ViewGroupElement; importandroid.util.Log; importandroid.widget.AbsListView; //继承AthrunTestCa
6、se publicclassMainActivityTestextendsAthrunTestCase{ privatestaticfinalStringLOG_TAG="MainActivityTest"; publicMainActivityTest()throwsException{ //super(被测试程序包名,启动的activity) super("org.athrun.android.app","org.athrun.android.app.MainActivity");
7、 //设置查找VIEW最多用多少时间 广州天河北校区广州达内岗顶中心广州达内江南中心天河区天寿路105号天寿大厦4层天河龙口东路5号龙晖大厦403-405室海珠区礼岗路10号2楼电话:020-38097500联系电话:020-85262372联系电话:020-34430387达内广州软件培训http://tarena3g.com.cn/AthrunTestCase.setMaxTimeToFindView(10000); } @Test //等待activity publicvoidtestWait
8、ForActivity()throwsException{ //log("Thisisatestforlog()method"); assertEqu
此文档下载收益归作者所有