CHAPTER 15 UNIT TESTING (JUNIT)

This chapter explores the use of the JUnit testing framework within the Groovy environment. We use classes from the case study of Chapter 13 to illustrate how unit testing can be accomplished with the GroovyTestCase class. Next, we show how several GroovyTestCases can be combined into a GroovyTestSuite. Finally, we reflect on the role of unit testing in an iterative, incremental approach to application development. Throughout our discussion, we emphasize just how easy it is to benefit from unit testing with Groovy.

15.1 UNIT TESTING

The fundamental unit of an object-oriented system is the class. Therefore, an obvious candidate for a unit in unit testing is the class. The approach taken is to create an object ...

Get Groovy Programming 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.