- Use IntelliJ to refactor a class so it’s easier to test.
- Add a suitable mock object jar to the library.
- Add unit tests for the class which we’re about to change. Make sure all functionality is covered.
- Write new test method which falls over.
- Make unit test pass.
- Write new test method which falls over.
- Make unit test pass.
- Check in new tests, new functionality, and all the tools required to do this again tomorrow.
- Sit back, look at the lovely, tidy(ish) code and smile.
There’s just something about that green bar. I remember why I love this job.
I need to invent a green bar for housework.
I think the hard part is often making sure that all functionality is covered and finding the sweet spot between too few and too many tests.
A nice cup of tea and a biccie and radio 4… that’s the green bar for housework.
Hmm. It should really read “all behaviour is covered,” shouldn’t it?
For all of us married people out there, I’m not so sure we would like to see the results of this. Before long, it would span into acceptance tests. 😉
Ah… but the entire team has responsibility for the codebase, and you’re not allowed to assign blame…
good point, you have me there. Ok, I’ll support the effort 🙂
-Joe
objo dot com