Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 14. Unit testing with Groovy > Organizing your tests

14.4. Organizing your tests

So far, we have been running our Groovy tests individually. For large systems, tests typically aren’t run individually but are grouped into test suites that are run together. JUnit has built-in facilities for working with suites. These facilities allow you to add individual test cases (and other nested suites) to test suites. JUnit’s test runners know about suites and run all the tests they contain. Unfortunately, these facilities require you to manually add all of your tests to a suite and assume you are using Java classes for your tests. We’ll look at ways of making life easier with Groovy.

Because grouping tests into suites is so important, numerous solutions have popped up in the Java world for automatically creating suites, but these too typically assume you are using Java classes. The good news is that because Groovy classes compile to Java classes, you don’t have to abandon any of your current practices for grouping tests—as long as you are willing to compile your Groovy files using groovyc first. The even better news is that there are solutions that allow you to work more naturally directly with your Groovy files.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial