Just a quick note to myself for how to do bug fixing:
- Write an integration test that reproduces the bug
This should create a test failure which will guard against regressions later on - Write integration tests for the other cases
You should write at least one test. This should prove that it works the other way so you'll feel safe you don't break behavior later on - Track down the problem to unit level
Debug to the lowest level where you can find the real cause of the problem - Write a unit test that reproduces the bug
This should create a test failure which will guard against regressions later on - Write unit tests for the other cases
You should write at least one test. There may be a chance that other corner cases have slipped as well, so examine closely. Keep in mind that unit tests are cheap! - Now, fix the bug
Change it so all unit tests are green - Clean up
Tidy up, don't leave a mess.
Remember: Someone certainly will have to come back here. If that one is you, you will spend much more time, cursing the one who left that mess than if you do it right now! - Run the unit tests again
Verify your clean up didn't break anything - Run the integration tests
These should be green by now - Integrate changes
- Create release
Nice algorithm :). However, I would be very careful with the second step ("Write integration tests for the other cases"). This can lead to unmaintainable tests with false assumptions. I would do it only if I thoroughly knew the workflow of the application.
ReplyDelete