在 Android Studio 2 Beta 5 的构建变体中测试工件选择器 missing/gone

Test Artifact selector missing/gone from Build Variants in Android Studio 2 Beta 5

为了从 Android Studio 中进行 运行 仪器测试,我通常 select "Android Instrumentation Tests" 作为要构建的测试工件,通过构建变体 window。我最近升级到 Android Studio 2 Beta 5,"Test Artifact" selector 不再可见。它去哪儿了?是否有其他配置取代了它?

我在 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 -> 实验。然后取消选中:"Enable all test artifacts (Unit Test and Instrumentation Test) in Android projects".

除了浏览“设置”之外,您还可以使用“设置”对话框顶部的搜索框,只需搜索 "instrumentation"。

就像@markproxy说的没有"Test artifact"和"Android Instrumentation Tests"到select。 window 在 Android Studio 1.5x 版本

中看起来像这样

据我所知,在 Android Studio 2.3.3 中,此选项已消失 4 个。

@markproxy:这是因为该功能不再是实验性的,而是作为一项功能嵌入到 Android Studio 中,我想没有必要禁用它。

在这里,为了任何人的需要,link Android 单元测试指南:Getting Started with Testing(包括仪器化单元测试)