These two terms are used interchangeably by some individuals due to the seeming similarity in their functions. However, they are quite different in meanings and depend on each other. A little explanation of the two terms will aid your understanding of them. I will start with testing.
What is testing?
Testing is the process or a way of determining that a software program is devoid of any error that may affect its efficiency. It is also done to find out whether a program performs according to the objective of building it. An effective testing can be done by changing the input of a program or run it on different platforms to see its response to these inputs and platforms. Sometimes, testing may reveal a huge flaw or bug that may influence the output of a program if not promptly corrected before its distribution to the many users who will subject the program to different conditions on a variety of platforms.
During testing, different techniques way be used. This includes providing both correct and incorrect inputs, intentionally wrong inputs, and other different inputs with the objective of assessing the response of the program to different situations. While testing a program using different data, the program may flag a bug that needs to be corrected. That raises the question “What is a bug?”
A bug is a programming error that affects the execution of a program. The program may not function properly or does not execute at all. Some of the bugs may be caused by the omission of a code or the use of a wrong one. In either way, the program will not execute in line with the objective of developing the program. The result of the execution may be at variance with the expected result. This brings about the concept of debugging.
What is debugging?
When an error or bug is detected in a program, it must be corrected. Otherwise, the objective of developing the program is defeated. Nobody will feel comfortable processing the payroll of his employers with a flawed program, neither will one trusted a program filled with errors for information on construction, lest people’s lives are put at risk.
The process of removing or correcting these errors is called debugging, derived from the word “bug.” Wikipedia defines debugging thus “Debugging is the process of finding and resolving of defects that prevent correct operation of computer software or a system.”
Debugging varies in the degree of complexity. There are some simple debugging such as a small program designed for in-house use and some other related programs. Due to the relatively short length of the program, the debugging done by a programmer will be relatively simple.
Contrary to this, the code for some big conglomerate like Facebook or Google will run to millions of lines of code. In this case, debugging may be complex and difficult because the debugger may need to trace the origin of all the bugs before correcting them. Either way, debugging still remains an important part of a robust and well-functioning program.
How do programmers detect bugs? The answer is simple: through testing. As discussed above, one of the reasons for testing a program is to identify potential bugs that may impede the smooth execution of a program. When these bugs are detected during testing, the developer immediately takes over to correct all the errors, in another word, to debug the program.
Debugging can be strenuous and time-consuming. Each of the errors will be read and understood before debugging takes place. This requires much time and effort on the part of the programmer if he wants to be credit for a good job and meet the needs of the users.