https://github.com/bjoernq/intellijjunitpatcher
Android Studio Plugin to enable you running standard Java-JUnit tests in the JVM (using robolectric-gradle-plugin)
https://github.com/bjoernq/intellijjunitpatcher
Last synced: over 1 year ago
JSON representation
Android Studio Plugin to enable you running standard Java-JUnit tests in the JVM (using robolectric-gradle-plugin)
- Host: GitHub
- URL: https://github.com/bjoernq/intellijjunitpatcher
- Owner: bjoernQ
- Created: 2014-09-07T17:19:59.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2015-02-13T10:08:58.000Z (over 11 years ago)
- Last Synced: 2025-04-22T14:14:47.525Z (over 1 year ago)
- Language: Java
- Size: 164 KB
- Stars: 2
- Watchers: 4
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# DEPRECATED AS OF Android Studio 1.1-beta3 / Android Gradle Plugin 1.1.0-rc1 - WON'T WORK ANYMORE AND YOU SHOULD USE THE NOW BUILT IN FUNCTIONALITY
# JUnitPatcher for Android Studio
This is a very simple plugin which should enable the execution of JUnit tests in the JVM from inside Android Studio.
It plays together with the Robolectric Gradle Plugin.
After installation into Android Studio (tested with 0.8.7) it will patch the classpath of generated JUnit run configurations.
There is just one thing you should change in your build.gradle file.Add
```
// always compile tests when assembling the app
afterEvaluate { project ->
String variantTestCompileTaskName = 'compileTestDebugJava';
boolean found = false;
project.tasks.each() { task ->
String taskName = task.name;
if(taskName.startsWith("compileTest") && taskName.endsWith("Java")){
if(!found){
variantTestCompileTaskName = taskName;
}
found = true;
}
};
project.tasks.each() { task ->
String taskName = task.name;
if(taskName.startsWith("assemble")){
String variantName = taskName.substring(8);
task.dependsOn(variantTestCompileTaskName);
}
};
}
```
to your build file. This way Studio will compile the tests whenever the debug configuration is compiled.
Otherwise it's possible you will run old versions of your tests in Studio and changes to the tests are not taken into account when running the tests.