w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
JUnit tester class runs without a main method. How is this done/possible?

No Java application can run without a main(String[]) method. It is the single entry point. For JUnit tests, this method is usually hidden behind a plugin. For Eclipse, that seems to be org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.

In the link you've posted, they propose java org.junit.runner.JUnitCore which sets up your @Test annotated methods and Suites and runs them. In similar fashion, Ant has JUnitTask which somewhere (if you go through its source code) creates a runner to run your tests. That seems to be JUnitTestRunner, which actually runs in its own JVM thanks to the Ant task.





© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.