I'am a little bit confused what is better to use debug or write unit test? and is this general or there are cases where debug better than unit test?or should I use both of them?
Thanks
In software development, the debugging process begins when a developer locates a code error in a computer program and is able to reproduce it. Debugging is part of the software testing process and is an integral part of the entire software development lifecycle.
Testing is a stage of software development life cycle (SDLC). Debugging is not an aspect of software development life cycle, it occurs as a consequence of testing.
Debugging is a process of line by line execution of the code/ script with the intent of finding errors/ fixing the defects. Unit testing is often automated but it can also be done manually. Debugging is a process of line by line execution of the code/ script with the intent of finding errors/ fixing the defects.
Run all your unit tests as often as possible, ideally every time the code is changed. Make sure all your unit tests always run at 100%. Frequent testing gives you confidence that your changes didn't break anything and generally lowers the stress of programming in the dark.
Unit test is used to ensure that code works as expected. Debug is used when you need to find why the code doesn't work as expected.
Debugging will help you diagnose non-working code.
Unit tests provide the following:
Your unit tests should be run repeatedly (most often as part of your build process). If you do break them (most often due to a programming error), then it's time to break out the debugger to identify the issues and fix up the code (or perhaps amend the test) accordingly.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With