Skip to Content
Effective Unit Testing
book

Effective Unit Testing

by Lasse Koskela
February 2013
Intermediate to advanced content levelIntermediate to advanced
258 pages
7h 26m
English
Manning Publications
Content preview from Effective Unit Testing

Appendix B. Extending JUnit

Before JUnit reached its venerable 4.0 version, the API was based on your test class inheriting from junit.framework.TestCase, and extending JUnit was done by overriding parts of the inherited behavior. With the annotation-based approach adopted by the latest version of JUnit, extensions have a new shape and are hooked up through—you guessed it—annotations.

The main concepts relevant for extending the built-in JUnit behavior are runners and rules. Though we’re not going to delve too deeply into writing custom extensions, you should be aware of what kind of extensions come built-in with JUnit and where to start when you do want to write a custom extension.

We’ll begin with a brief look at how the runners work. Implementing ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

The Art of Unit Testing, Second Edition

The Art of Unit Testing, Second Edition

Roy Osherove
Testing with JUnit

Testing with JUnit

Leonard Przybylski, Frank Appel

Publisher Resources

ISBN: 9781935182573Publisher SupportOtherPublisher WebsiteErrata PageSupplemental ContentPurchase Link