I've been trying to get tests with code coverage to work in IntelliJ for a couple of hours so far, without success.
First off: "Run with coverage>" without junit included in the project produces the following error (obviously)
Exception in thread "main" java.lang.NoClassDefFoundError: junit/textui/ResultPrinter
Adding junit 4.11 and hamcrest-core 1.3 to libraries, then "run with coverage":
!!! JUnit version 3.8 or later expected:
java.lang.RuntimeException: Stub!
Now, I have read that changing the dependency order in the module options fixes this. So after changing the order, I get this error:
junit.framework.AssertionFailedError: Exception in constructor: testMakeTextView (java.lang.NoClassDefFoundError: be/dave/DiversoScoreApp/MyActivity
at be.dave.DiversoScoreApp.MyActivityTest.<init>(MyActivityTest.java:20)
Which points to the code below:
public class MyActivityTest extends ActivityInstrumentationTestCase2<MyActivity> {
MyActivity myActivity;
public MyActivityTest() {
super("be.dave.DiversoScoreApp", MyActivity.class);
}
@Override
public void setUp() throws Exception {
super.setUp();
myActivity = getActivity();
}
public void testMakeTextView() throws Exception {
TextView textView = myActivity.makeTextView("Test-text", 50);
TextView textView1 = myActivity.makeTextView("Diverso", 75);
assertEquals("TextView Text should be correct", textView.getText(), "Test-text");
assertNotSame("TextView Text should fail", textView1.getText(), "Not Diverso");
}
}
I've googled and googled, but alas I've found no solution so far.