Is there an example available that includes running junit test cases? I checked the moe-samples-java repo, but none of the samples have any test cases. I’m trying to run test cases via the moeTest task (through the IDEA IDE’s generated _test run config), however it seems that the moe-ios-junit.jar isn’t included in the final result. The project was generated with the latest version of the IntelliJ MOE plugin.
The app crashes at runtime as the classloader can’t find org.moe.mdt.junit.MoeRemoteTestRunner. A quick glance at the generated application.jar file shows that nothing from org.junit is included, as well as the remote test runner itself being missing. I had initially tried to put a proguard rule to keep the test runner class thinking that may help, but to no avail.
Import moe gradle project, please deselect "Create separate module per source set" gradle option. Add junit tests classes to "src/test/java". Open generated run configuration and then select JUnit tab and check "Run JUnit tests".
That is what I had been doing. If I do this with a brand new project, it does work as expected. For some reason a project I previously created using the same version of the plugin has this issue, but not new ones.
Do you have any idea what I can look at to determine why this might be the case? I’ve tried removing the .idea directory and re-opening the project (with “Create separate module per source set” unchecked), but that doesn’t regenerate the IntelliJ run configurations (although “Create separate module per source set” does recreate them).
Trying to add a run configuration manually with the “Run JUnit Tests”, or running the moeTest gradle task via a terminal doesn’t yield any different results. I’ve tried comparing the working project with the non-working one but haven’t managed to find any differences that matter. Could something in the xcode project be misconfigured to cause this to occur?
I’m using the community version of IDEA 2016.1, if that makes that a difference.
The issue with reimport not generating run configuration is a MOE plugin bug in 1.2.1. Workaround: Close project and reopen. This issue will be fixed in 1.3. Before running moeTest Gradle task from the command line please connect your device first. The test results are here: build/moe/reports. When you use the simulator for testing, use the following command line: ./gradlew moeTest -Pmoe.launcher.simulators='simulator identifier'