本文介绍了在Android Studio中运行所有单元测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在Android Studio中有这个项目:
I have this project in Android Studio :
我希望一键式运行所有项目中的所有单元测试.
I wish to run all unit tests in all project with one click.
我该怎么做?
推荐答案首先,您可以列出项目中可用的所有测试任务,
First, you can list all the test tasks available in your project with
./gradlew tasks然后,您可以选择要执行的任务.如果要对所有口味和所有buildTypes执行所有测试,则只需运行
Then you can choose the tasks you want to execute. If you want to execute all tests for all flavors ans all buildTypes, you just have to run
./gradlew test connectedAndroidTest如果您不想每次运行测试时都记住所有gradle测试命令,则可以创建文件"custom_tasks.gradle"并添加
If you don't want to remember all the gradle test command each time you want to run the tests, you can create a file "custom_tasks.gradle" and add
task testAll(dependsOn: ['test', 'connectedAndroidTest']) { group = 'custom_tasks' description = "Run all tests" }然后,您只需要运行
./gradlew testAll更多推荐
在Android Studio中运行所有单元测试
发布评论