Unit Test of standard lib

Jonathan Gibbons jonathan.gibbons at oracle.com
Wed Oct 26 20:56:00 UTC 2016

On 10/26/2016 01:43 PM, Abdessamed MANSOURI wrote:
> Hello all,
> I was looking about how Java do unit tests of its standard library and i've
> found in the code source of OpenJDK unit tests under test folder, my
> question is why Java uses direct unit tests (using main) and it doesn't use
> a powerfull framework as JUnit? i think it is possible to use it because
> unit tests of standard lib are already written in Java.

There are various aspects to this.

The most obvious one is that many of the tests date back to a time 
before there
was any framework like JUnit or TestNG.

In addition, many of the tests rely on features not directly supported 
by those
frameworks, such as the easy ability to execute in a separate JVM, or to 
the security manager or policy for each test.

Finally, the OpenJDK test framework (jtreg) does now support tests 
written for
TestNG, and to a lesser extent, JUnit as well, and this has been used 
for some
of the more recent additions to the test suite.

-- Jon

More information about the discuss mailing list