Android unit test only compiles if placed in androidTest folder -


i using android studio 1.1.0. trying separate unit tests , integration tests. integration tests in folder src/androidtest/java. trying create unit tests in src/test/java/. should possible per documentation.

android plug-in gradle version 1.1.0 , higher allows create source directory (src/test/java) in project store junit tests want run on local machine.

my build.gradle dependencies this:

buildscript {     repositories {         jcenter()         mavencentral()     }     dependencies {         classpath 'com.android.tools.build:gradle:1.2.3'         classpath 'com.jakewharton.sdkmanager:gradle-plugin:0.12.+'     } } ... dependencies {     ...     androidtestcompile 'junit:junit:4.12'     androidtestcompile 'org.mockito:mockito-all:1.9.5'     androidtestcompile 'org.mockito:mockito-core:1.10.19'     androidtestcompile files('libs/dexmaker-mockito-1.0.jar')     androidtestcompile files('libs/dexmaker-1.0.jar')      androidtestcompile 'org.hamcrest:hamcrest-core:1.1'     androidtestcompile 'org.hamcrest:hamcrest-integration:1.1'     androidtestcompile 'org.hamcrest:hamcrest-library:1.1'     androidtestcompile 'com.android.support.test:runner:0.3'     androidtestcompile ('com.android.support.test:testing-support-lib:0.1') {         exclude module: 'hamcrest-core'     }     androidtestcompile ('com.android.support.test.espresso:espresso-core:2.2') {         exclude module: 'hamcrest-core'     } } 

this should work accounts sample test wrote not compile @ if place in src/test/java. compiles , runs fine if place in src/androidtest/java. missing? cannot upgrade android studio 1.2 @ moment. have set test artifact unit test.

if using unit test add dependencies testcompile ...

and need change build variant.

check http://tools.android.com/tech-docs/unit-testing-support


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -