【Android studio uiautomator执行单元测试】

步骤一:在build.gradle(:app)中增加     testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

 

步骤二:在build.gradle(:app)中增加   testImplementation 'junit:junit:4.12', androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.3'

 

步骤三:点击三角下拉栏,选择"Edit Configurations"菜单进入到设置界面,如下图二所示

       (图一)

 

 

                                                (图二)

步骤四:选择添加按钮,添加 Android Instrumented Tests,并配置需要执行的测试用例,保存

步骤五:编写测试用例,选择测试用例,并点击绿色按钮,执行测试用例。

 

posted @ 2020-09-22 09:45  xmmc  阅读(293)  评论(0编辑  收藏  举报