I tried to add this class to my code:
import org.junit.runner.JUnitCore;
import org.junit.runner.Request;
import org.junit.runner.Result;
public class SingleJUnitTestRunner {
public static void main(String... args) throws ClassNotFoundException {
String[] classAndMethod = args[0].split("#");
Request request = Request.method(Class.forName(classAndMethod[0]),
classAndMethod[1]);
Result result = new JUnitCore().run(request);
System.exit(result.wasSuccessful() ? 0 : 1);
}
}
Then I got this error:
Even though my Gradle includes JUnit 4.12
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.12'
How can I fix this?
What does "adding to class path" mean? I used to see it in Eclipse. Not in IntelliJ.
Please try using:
dependencies {
compile group: 'junit', name: 'junit', version: '4.12'
instead of:
dependencies {
testCompile group: 'junit', name: 'junit', version: '4.12'