简体   繁体   English

在使用Android Studio保存时运行单元测试

[英]Run unit tests on Save with Android Studio

Has anyone managed to make a reasonably comfortable setup for their project where unit tests run on every save? 有没有人设法为他们的项目做一个相当舒适的设置,在每次保存时运行单元测试?

I currently have a split project -- An Android Application project, and a Java project that the android application depends upon. 我目前有一个拆分项目 - 一个Android应用程序项目,以及一个Android应用程序所依赖的Java项目。 I write unit tests for the Java project and run them manually every now and then. 我为Java项目编写单元测试并且不时地手动运行它们。

In my understanding, to make this happen as expected, I also want to have incremental builds for the Java project. 根据我的理解,为了实现预期,我还希望为Java项目提供增量构建。 I am not sure that this is feasibly possible while using Gradle with its current state of affairs. 在使用Gradle及其当前状态时,我不确定这是否可行。

If you are using Eclipse or IntelliJ with JUnit, you can use InfiniTest to run tests on save. 如果您使用Eclipse或IntelliJ和JUnit,则可以使用InfiniTest在保存时运行测试。 InfiniTest only runs tests for code that has changed rather than running everything, so it's great for TDD. InfiniTest只对已更改而不是运行所有内容的代码运行测试,因此对于TDD来说非常棒。 InfiniTest is completely decoupled from Gradle, so you don't have to worry about incremental builds. InfiniTest与Gradle完全分离,因此您不必担心增量构建。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 仪表测试将作为本地单元测试在Android Studio 3(空测试套件)上运行 - Instrumentation Tests will run as Local Unit tests on Android Studio 3 (Empty test suite) Android Studio Gradle单元测试不起作用 - Android Studio Gradle Unit Tests Not Working Android Studio - 单元测试模拟应用重启 - Android Studio - Unit Tests Simulate App Restart 如何为Android运行单元测试不在设备或模拟器上? - How to run unit tests for Android is not on the device or emulator? 让简单的JUnit测试在Android Studio中运行 - Getting simple JUnit tests to run in Android Studio 更新到 Android Studio Chipmunk 后单元测试未运行 - Unit tests not running after updated to Android Studio Chipmunk 如何使 Cucumber 功能在 Android 项目中作为本地单元测试运行? - How to make Cucumber features run in an Android project as local unit tests? 如何运行位于 android 模块内的单元测试? - How to run unit tests located inside a android module? Android Gradle:如何分别运行集成和单元测试? - Android gradle: how to run separately integration and unit tests? 是否可以在 @BeforeClass 注释方法中运行 Android Espresso 单元测试? - Is it possible to run Android Espresso unit tests in @BeforeClass annotated methods?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM