Testing
The question already has a good definition about tests. It has a broader definition in Tests, TDD, Unit Test, QA and similar. What is the difference between concepts on tests?.
So we can conclude that it is a measure to "guarantee" quality. You check whether the software is compliant.
It is a process of development as a whole. Testing lasts throughout the project lifecycle.
New tests are always desirable. If a problem is detected by other means (such as debugging), a test to ensure that the problem does not recur is interesting.
Tests are made with specific tools that automate the process and codes that have the function of telling whether something very specific generating the expected result or not.
The concern is with the result, not how it arrived at it.
Testing is to identify when a code is correct, not when it has a problem. A common mistake is for people to believe that if they pass the test there is absence of code problems, but it only says that certain situations happened correctly, can not reverse the logic that if passed the test there is no bugs.
Debugging
Debugging is a repair process for something that is known to be broken.
In general it is punctual for a defect.
Often the process is initiated because a test has detected that there is such a defect.
It is something that simulates the execution step by step manually to find the reason for the problem and determine what would need to be changed to solve it.
In general it is done with the aid of additional tools or extra code to determine what is happening and at the end when the problem is solved it is thrown away.
The focus is the detail of the execution, there is a concern with the algorithm and the state changes.
Everyone knows that debugging is twice as difficult as writing a program in the first place. So if you’re as smart as you can, when you write it, why will you debug it?
-- Brian Kernighan
What I would really like is for people who choose to program to learn at least the basics of debugging, which already helps to understand a little better what she’s doing. At a time when "programming" has turned to copying ready-made code and filling gaps without understanding what it is doing, knowing how to debug seems to be unnecessary. Luckily we still have professionals interested in doing the best possible and understanding the complete process.