Robotium APK Tests Running succesfuly with Android Studio. But While running with gradle, Issue occurs

177 views
Skip to first unread message

Naidu A

unread,
Aug 23, 2015, 11:10:12 PM8/23/15
to Robotium Developers
Hi,
I encountered an issue while trying run few android tests with gradle.
The same project when i run through android studio & select as android tests, runs succesfully.
screenshot attached for the configurations i chosed.

But i want to use gradle to run my tests. My output looks like this:

:GameStoreApplicationTest:connectedAndroidTestDebug

Tests on Nexus_5_API_22_x86(AVD) - 5.1 failed: Instrumentation run failed due to 'java.lang.ClassNotFoundException'


com.android.builder.testing.ConnectedDevice > No tests found.[Nexus_5_API_22_x86(AVD) - 5.1] FAILED 

No tests found. This usually means that your test classes are not in the form that your test runner expects (e.g. don't inherit from TestCase or lack @Test annotations).

:GameStoreApplicationTest:connectedAndroidTestDebug FAILED


FAILURE: Build failed with an exception.


Not sure where i am doing wrong?


my build.gradle file looks like this:

buildscript {
repositories {
mavenCentral()
flatDir {
dirs 'libs'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:1.0.0'
}
}

apply plugin: 'com.android.application'

repositories {
mavenCentral()
flatDir {
dirs 'libs'
}
}

dependencies {
androidTestCompile fileTree(dir: 'libs', include: 'robotium-solo-5.4.1.jar')
}

android {
compileSdkVersion 'android-19'
buildToolsVersion '19.1'

android {
defaultConfig {
minSdkVersion 15
}

lintOptions {
abortOnError false
}
sourceSets
{
androidTest
{
res.srcDirs = ['res']
assets.srcDirs = ['assets']
}
}
}
buildTypes {
release {
proguardFile getDefaultProguardFile('proguard-android.txt')
}
}
}

My manifest.xml looks like this:

<?xml version="1.0" encoding="utf-8" standalone="no"?><manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="com.xxx.yyy.zzz">
<application android:icon="@drawable/ic_launcher" android:label="@string/app_name">
<activity android:label="@string/app_name" android:name="GameStoreActivity">
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
</application>
<instrumentation android:name="android.test.InstrumentationTestRunner" android:targetPackage="com.xxx.yyy.zzz"/></manifest>



Screen Shot 2015-08-24 at 2.02.58 am.png
Reply all
Reply to author
Forward
0 new messages