March 2016
Intermediate to advanced
304 pages
8h 9m
English
With the def mystery solved, the second striking feature of Spock tests is the lack of assert statements for evaluating results. All JUnit tests end with one or more assert statements[6] that define the expected result of the computation. If the expected result doesn’t match the actual one, the test will fail. JUnit comes with an extensive API for assert statements, and it’s considered a good practice to create your own extensions, dealing with the business domain of your application.
Not having an assert (or verify) statement is a huge antipattern, because the test never fails.
I mentioned in the previous chapter that unlike JUnit, Spock doesn’t have assert methods. In this section, ...
Read now
Unlock full access