Chapter 8. Troubleshooting JUnit
This chapter covers
- Problems finding your tests
- Problems executing your custom test suite and test setup
- Problems executing your test after the first assertion fails
- Problems reloading classes between tests
- Problems reloading XML-related classes
- Problems narrowing EJB references in your tests
Wouldn’t it be nice if everything worked exactly the way you expected it to work? Come to think of it, if that were so then you wouldn’t be reading this book—or maybe because you’re reading this book, the software you build will work exactly the way you expect. At least, that’s the idea.
This chapter is about how to handle those situations in which JUnit doesn’t do what you expect. Although JUnit is simple, it is a framework, and when you use a framework you always have a learning curve. More than that, the JUnit community pushes the boundaries of what JUnit can do every day. Someone, somewhere is using JUnit to do something it has never done before. Putting software through stress can unearth all sorts of problems, and given the number of people using JUnit these days, it is under considerable stress.