Hi,

As part of my app Unit testing code, I am using JMock for mocking dependent 
objects for my SUT (class under test) in my Test Application. I am using 
Gradle build to build my app. I have defined the 'JMock' dependency using 
'androidTestCompile'. The Test app. code is being compiled fine, but when I 
try to execute the Test app, it gives 'ClassNotFoundException' for JMock 
classes. 

I tried to dynamically package the JMock dependency as part of the Test app 
APK file, using 'runtime' scope for the dependency, but it did not help.

The question I have is, how do I package these Testing jar dependencies, to 
my Test APK using the dependency code. I am listing relevant excerpts from 
build.gradle file:

.....
android {
     .....
     sourceSets {
          ....
          dependencies {
                androidTestCompile 'org.jmock:jmock:2.6.0'
          }
     }

    ..........

     applicationVariants.all { appVariant ->
        if (appVariant.buildType.name.contains('test')) {
            appVariant.sourceSet.dependencies << {
                runtime 'org.jmock:jmock:2.6.0'
            }
        }
    }
    ........ 
}

Any help is greatly appreciated.

Regards,
Sandesh.

-- 
You received this message because you are subscribed to the Google Groups 
"adt-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to