I'm working on android project in Android Studio IDE. Is there any way to create tests for some code in android project that does not require android VM running? I can't mark 'tests' folder as tests and create java files in it. Also i can't see any test-related settings in my module.
Update:
I'm trying the next build.gradle:
android {
compileSdkVersion 19
buildToolsVersion "19.0.3"
sourceSets {
main {
manifest.srcFile 'AndroidManifest.xml'
java.srcDirs = ['src']
resources.srcDirs = ['src']
aidl.srcDirs = ['src']
renderscript.srcDirs = ['src']
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
}
// ...
}
apply plugin: "java"
sourceSets {
simpleTest {
java {
srcDir 'test/java'
}
resources {
srcDir 'test/resources'
}
compileClasspath += sourceSets.main.runtimeClasspath
}
}
task simpleTest(type: Test) {
description = "Runs simple tests"
testClassesDir = sourceSets.simpleTest.output.classesDir
classpath += sourceSets.simpleTest.runtimeClasspath
}
But i'm getting an error:
12:19:10 Gradle 'app' project refresh failed: The 'java' plugin has been applied, but it is not compatible with the Android plugins.