如何在Android Studio使用Espresso框架自动化测试
来源:互联网 发布:亩和平方米精准算法 编辑:程序博客网 时间:2024/06/04 20:12
1,Open your app's build.gradle file. This is usually not the top-level build.gradle file but app/build.gradle. Add the following lines inside dependencies:
androidTestCompile 'com.android.support.test.espresso:espresso-core:2.2.2'
androidTestCompile 'com.android.support.test:runner:0.5'
2,Set the instrumentation runner, add to the same build.gradle file the following line in android.defaultConfig:
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
3,Add the first test in src/androidTest/java/
@RunWith(AndroidJUnit4.class)
@LargeTest
public class HelloWorldEspressoTest {
@Rule
public ActivityTestRule<MainActivity>mainActivity = new ActivityTestRule(MainActivity.class);
@Test
public void TestElement(){
onView()...
}
}
4,Create a test configuration, Run menu - Edit Configurations - Add a new Android Tests configuration - Choose a module - Add a specific instrumentation runner (android.support.test.runner.AndroidJUnitRunner)
参考文件:
https://google.github.io/android-testing-support-library/docs/espresso/setup/index.html
关于Android Studio 的安装和使用:
http://www.open-open.com/lib/view/open1468118887690.html
- 如何在Android Studio使用Espresso框架自动化测试
- android studio使用espresso做自动化测试
- Android自动化测试--Espresso框架使用
- Android自动化测试框架---Espresso(1)
- Android自动化测试框架---Espresso(2)
- Espresso——Android自动化测试框架
- 如何在Eclipse上使用Espresso测试框架测试Android App
- Android自动化测试框架Espresso(三)——View Action的使用
- Android自动化测试中Espresso框架学习笔记(1)
- Android自动化测试框架Espresso(一)——简介
- Android UI自动化测试--Espresso
- Android自动化测试|Espresso-简介
- Android自动化测试|Espresso-list
- Espresso 自动化测试的使用
- Android 自动化测试 Espresso篇:简介&基础使用
- Android Studio Espresso测试配置
- Android Espresso 测试框架探究
- Android Espresso 测试框架介绍
- matrics Global Cache Blocks Lost
- 单元格的表示方式
- div.2/Bellovin<最长上升子序列>
- java中equals与==的区别
- 电脑的运行、控制面板、命令提示符被禁用的解决方案
- 如何在Android Studio使用Espresso框架自动化测试
- 完美 定义popwindow
- 调整数组顺序使奇数位于偶数前面
- 双向链表
- 夜间模式
- 四、封装OkHttp
- poj3628
- 安卓 toast
- Servlet(1)