Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Do you TDD for debugging fix?

I know there's a lot of stuff on TDD and i'm trying to pick up the practice too. But i wonder is it a good idea to to TDD your bug fix too?

I was thinking along the lines of find the bug and narrow it down. Write unit test to ensure that it will now pass whatever problem that it previously caused. Write more unit test for other breakable conditions. And finally write unit test to test for Integration test, as we don't have any unit test prior to this, so whenever i'm fixing a bug i'm always worried that i might accidentally break something.

  1. So is TDD suitable for debugging too?
  2. Or is there other method or resource/book that would be more useful for this purpose?
  3. I am more concerned for the Integration Test part as i've mentioned above. I'm looking for anything in LAMP/Axkit/Perl related method.

Thanks.

like image 388
melaos Avatar asked Jan 21 '09 09:01

melaos


People also ask

How is debugging is done in testing?

Debugging is done by the developer or the programmer. 4. The test engineers perform manual and automated test cases on the application, and if they detect any bug or error, they can report back to the development team for fixing. The developers will find, evaluates, and removes the software errors.

Do testers do debugging?

Testing is done by the tester. Debugging is done by either programmer or developer. There is no need of design knowledge in the testing process. Debugging can't be done without proper design knowledge.

How is it that using test driven development is better than using the debugger?

Developers have less debugging to doFewer bugs and errors are the primary benefit of the TDD approach. When the code has fewer bugs, you'll spend less time fixing them than other programming methodologies. TDD produces a higher overall test coverage and, therefore to a better quality of the final product.


2 Answers

  1. Write a test that fails because of the bug.
  2. Fix the bug in your code.
  3. Re-run test.
  4. Re-run all tests.

So - yes - very much so.

like image 165
DanSingerman Avatar answered Oct 06 '22 09:10

DanSingerman


When a tester finds a bug I usually write a unit test for it. When the test succeeds, I know the bug is fixed and it will always be covered again in the future.

like image 20
Gerrie Schenck Avatar answered Oct 06 '22 08:10

Gerrie Schenck