问题描述
为了在 Android Studio 中运行 Instrumentation Tests,我通常通过 Build Variants 窗口选择Android Instrumentation Tests"作为要构建的测试工件.我最近升级到 Android Studio 2 Beta 5,Test Artifact"选择器不再可见.它去哪儿了?是否有其他配置取代了它?
In order to run Instrumentation Tests from within Android Studio, I typically select "Android Instrumentation Tests" as the test artifact to be built, via the Build Variants window. I recently upgraded to Android Studio 2 Beta 5, and the "Test Artifact" selector is no longer visible. Where did it go? Has some other configuration taken its place?
推荐答案
我在 Android Studio 2.0 Preview 5 发行说明中发现了这一点:实验测试工件功能(在 IDE 中同时启用单元测试和仪器测试)已得到进一步改进现在默认启用."
I discovered this in the release notes for Android Studio 2.0 Preview 5: "The experimental test artifacts feature (where both unit test and instrumentation tests are enabled simultaneously in the IDE) has been improved further and is now enabled by default."
要禁用单元和仪器测试的同时构建,请转到此处:文件菜单 -> 设置 -> 构建、执行、部署 -> 构建工具 -> Gradle -> 实验.然后取消选中:在 Android 项目中启用所有测试工件(单元测试和仪器测试)".
To disable the simultaneous building of unit and instrumentation tests, go here: File Menu -> Settings -> Build, Execution, Deployment -> Build Tools -> Gradle -> Experimental. Then uncheck this: "Enable all test artifacts (Unit Test and Instrumentation Test) in Android projects".
您也可以使用设置"对话框顶部的搜索框,而不是浏览设置",只需搜索仪器"即可.
Rather than navigate through Settings, you can also use the search box at the top of the Settings dialog, and just search for "instrumentation".
这篇关于Android Studio 2 Beta 5 中的 Build Variants 测试工件选择器丢失/消失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!