The QA-Challenge: Reproducers with JUnit
Common development – if you are not test driven – goes like this:
- Implement Feature
- Write Test
- Run Test
If you are lucky, your test will never break and your test covers all necessary boundaries like
If you have to fix a bug in your product it typically goes like this:
- Reproduce bug manually.
- Fix the bug.
- Write Test – of course you should do that as obviously your current tests were not able to detect the bug.
- Run Test
To do it this way was a bad decision: You missed the Challenge.
The challenge is to write a reproducer test for this bug. And to do this before you actually fix the bug.
- Only if you write the test before fixing the bug you will know if the test is able to actually detect the bug.
- It gives you the opportunity to learn how to write robust tests: Robust tests…
- can deal with the failure
- don’t block the complete test-run
- clean up their data not to make other tests fail
The more you learn about robust testing the more you learn about
finally statements, how to use
tearDown() in your tests and you will learn about tests which are able to automatically end after a given timeout.
So – do you take the challenge?