Android Studio "No tests were found"


Has anyone been able to get tests to run in Android Studio (from the GUI and not terminal), I have been unable to run tests from the GUI.

Everytime I try to run tests through the GUI I just get the following message:

enter image description here

I am able to run the tests from terminal using the following command:

./gradlew connectedAndroidTest

I am running Android Studio 0.5.2 with Gradle 1.11 with Plugin 0.9.0 on Mac OSX

My project structure is as follows;

                … (tests source code) …
                … (source code) …
                … (resources code) …

My build.gradle file looks similar to the following:

android {
    compileSdkVersion 19
    buildToolsVersion "19.0.1"

    defaultConfig {
        versionCode 12
        versionName "2.0"
        minSdkVersion 9
        targetSdkVersion 19       
    testPackageName ""
        testInstrumentationRunner "android.test.InstrumentationTestRunner"

If anyone has any suggestions, I will be more than happy to here them.


Ok, I found the cause of my problem.

In the misc.xml file which is located in the .idea folder of my project had an invalid attribute value for the ProjectRootManager component, which looked like the following:

<component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" assert-keyword="true" jdk-15="true" project-jdk-name="1.6 (3)" project-jdk-type="JavaSDK">
    <output url="file://$PROJECT_DIR$/build/classes" />

So changing the project-jdk-name attribute value to just "1.6", fixed the problem for me. Below is what it looked like after I had updated the value.

<component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" assert-keyword="true" jdk-15="true" project-jdk-name="1.6" project-jdk-type="JavaSDK">
    <output url="file://$PROJECT_DIR$/build/classes" />

Hope this helps anyone out.

Answered By – Shane Doyle

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published