android-studio-unit-test-plugin
android-studio-unit-test-plugin copied to clipboard
Running tests from IDE does not recompile test classes
Android Studio: 1.0.1 android-unit-test: 2.1.1 android-studio-unit-test-plugin: 1.4.0
It appears that recent changes to this plugin have attempted to add a make task before running the unit tests that should run with a goal of testDebugClasses, but it only seems to be running with a goal of assembleDebug anyway.
Therefore, after a project cleaning, I get the ClassNotFound error until I build from the command line.
Also, if I make changes to the tests, they don't get recompiled when I run the tests from the IDE.
Noticing this as well. If I have some time I'll dig into the plugin to see if I can come up with a fix.
Is there a workaround until this is fixed?
You can try some of the workarounds from before the latest update. One of:
- Add
tasks.findByName("assembleDebug").dependsOn("testDebugClasses")to yourbuild.gradleto force the test classes to be compiled whenever your project is compiled. - Go to
Edit Configurationsand add a new gradle configuration that runs the tasktestClasses. Then in your junit configuration, belowBefore launch, click+ -> Run Another Configurationand add the gradle configuration you just created.
Alternative 1 ends in an error due to circular dependencies of tasks.
The second one works, but needs to be done for each test you run.... Any timeline on getting this fixed? Any way I can help?
I'm not quite experiencing this issue (it fails the first time after a clean but then works correctly after that). So I'd need more info about your project setup. Honestly though, I'm not really invested on working on this anymore since google is releasing a proper solution.
Official solution: that's good news!