1.6. Spock’s position in the Java ecosystem

The de facto testing framework in a Java project is JUnit, but TestNG is another testing framework for Java that’s similar. At one point, TestNG had several extra features that JUnit lacks, resulting in a lot of developers switching over to TestNG (especially for big enterprise projects). But JUnit quickly closed the gap, and TestNG failed to gain a majority in the mindset of Java developers. The throne of JUnit is still undisputed. I’ve seen junior Java developers who think that JUnit and unit testing are the exact same thing. In reality, JUnit is one of the many ways that unit tests can be implemented.

Unit tests in both JUnit and TestNG are written in Java as well. Traditionally, this has been seen ...

Get Java Testing with Spock now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.