JUnit test NoClassDefFoundError

Hi,

I’m trying to add unit test for iOS, and the built application only contains codes from src/test but not src/main, so I got NoClassDefFoundError when I try to access classes written in src/main/java.

I face the same problem even generate an new simple moe application. The project was generated with the latest version of the IntelliJ MOE plugin in IntelliJ.

Any idea?

Thanks.

Dear Noisyfox,

Thank you for bringing this to our attention.

Best Regards,
Kristóf

Hi @liliomk ,

Is there any solution to this problem? Thanks.

Dear Noisyfox,

This might work as a workaround to this issue:

tasks.moeTestProGuard {
    dependsOn project.tasks.compileJava
    inJars = inJars + project.tasks.compileJava.destinationDir
}

Best Regards,
Kristóf

Thanks for your code. That’s almost work except it doesn’t include the dependencies from main module.

Edit:

I tried
inJars = inJars + project.tasks.compileJava.destinationDir + configurations.runtime
to include all dependencies and it works!

Thanks man.

@liliomk And I’m wondering if it’s a good idea to add an option to shutdown the simulator after the test automatically because we are trying to run the unit test on jenkins.

Dear Noisyfox,

we are not planning on such feature, but you can do it via the simctl command-line utility:

xcrun simctl --help

Best Regards,
Kristóf