Hidden JUnit features: @Rules
@Rules seem a better solution than @RunWith to do some special work before/after a test. The release notes mention a couple of ideas: Notification on tests Setting up or tearing down resources,...
View ArticleFeeling like Hercules?
In the ancient mythology, Hercules slew the Hydra, a monster which could grow a new head for each one cut off. Does that remind you of your programming job? The punchline is: Hercules didn’t conquer...
View ArticleTesting Requirements
When developing software, you’re constantly faced with two issues: Get all the requirements Make sure the requirements are correct When writing code, we use tests to make sure we meet all the goals...
View ArticleEclipse Suddenly Takes Long to Start Unit Tests
When starting a JUnit test in Eclipse suddenly takes ages (the process starts quickly as you can see in the Console view but it takes ages until the tree of tests appears in the JUnit view), you might...
View ArticleThe Difference Between Unit and Integration Tests
A unit test checks a certain feature of the software. When it fails, you usually know exactly where to look for a place to fix the problem. They are short, compact and fast. They come at a cost,...
View ArticleSoCraTes Day: Testing the Impossible
I’m back from SoCraTes Day Switzerland where I help a Code&Hack session called “Testing the Impossible”. The session is based on this Mercurial repository de.pdark.testing. Transcript Space Shuttle...
View ArticleReplacing Integration With Unit Tests
Google asks to “Just Say No to More End-to-End Tests” – just go and read it. The suggestion in the document is to have a testing pyramid. A few (slow, expensive, dangerous) End-to-End (E2E) tests, more...
View ArticleTNBT – Creating Tests from the Debugger
From my series “The Next Best Thing“: Often, you will find yourself in a debugger, trying to follow some insanely complicated code to find the root cause of a bug. I would like to see a button in my...
View ArticleGood and Bad Tests
How do you distinguish good from bad tests in your code? Check these criteria. Good tests Nail down expectations Monitor assumptions Help to locate the cause of a failure Document usage patterns Allow...
View Article