Software Debugging and Testing
1. Introduction
When we make software, it is not always perfect on the first try.
There may be mistakes (errors/bugs) in it.
To make software correct and reliable, we do two important activities:
Debugging (finding and fixing errors)
Testing (checking if the software works properly)
Both are like two friends that help developers make high-quality software.
2. Debugging
The term “debugging” came from an event in 1947 when a real bug/moth was stuck in computer and
was removed.
Meaning:
Debugging means finding and removing errors (bugs) from a program.
• A "bug" = mistake in software.
• Debugging = the process of locating the bug and correcting it.
Tools used in Debugging:
1. Debugger (Software Tool):
o A program that helps programmers run code step by step.
o Example: Python Debugger (pdb), Visual Studio Debugger.
2. Print Statement:
o Adding simple print lines in code to check where the program is going wrong.
o Example: print("Value of x =", x)
3. Code Reviews:
o Asking teammates to read and review the code.
o Sometimes a fresh pair of eyes easily catches mistakes.
3. Testing
Meaning:
Testing means checking the software to see if it works as expected.
It helps in finding errors before customers use it.
Debugging = fixing errors
Testing = finding errors
Types of Testing
1. Unit Testing
o Testing smallest part of the software (like a single function or module).
o Example: Checking if the “Add to Cart” button in an online store adds 1 product correctly.
2. Integration Testing
o Testing how different modules work together.
o Example: Checking if “Add to Cart” works properly with the “Payment System”.
3. System Testing
o Testing the whole software system as one piece.
o Example: Running the entire online shopping app to see if all features work smoothly.
4. Acceptance Testing
o Testing done by end-users or clients to see if software meets their needs.
o Example: Customer checks the app to confirm it works as they required.
Conclusion
• Debugging = fixing mistakes in software.
• Testing = checking software for mistakes.
• Both are important for good quality software.