The basic method of troubleshooting in testing

In software testing, troubleshooting (that is, debugging) goes hand in hand with successful testing. A sign of a successful test is that a bug was found. Determining the cause and exact location of the error based on the error signs, and correcting it mainly depends on the troubleshooting technique.

1. Troubleshooting process

The troubleshooting process begins with the execution of a test case. If the test result is different from the expected result, it means that there is an error symptom. The troubleshooting process first needs to find out the cause of the error, and then correct the error. Therefore, there are two possibilities in the troubleshooting process. One is to find the cause of the error and correct the error. The other is that the cause of the error is unknown. If the guess fails, a second guess is made until the error is found and corrected.

Troubleshooting is a rather arduous process, not only due to the psychological obstacles of developers, but also because the errors hidden in the program have the following special properties:

  (1) The external symptom of the error is far away from the internal cause of the error, which is more serious for the highly coupled program structure;

  (2) Correction of one error causes the (temporary) disappearance of another error phenomenon;

  (3) Some error symptoms are just illusions;

  (4) It is not easy to track some error symptoms caused by the momentary negligence of the operator;

  (5) The error was due to wind time rather than the program;

  (6) The input conditions are difficult to reconstruct accurately (for example, the input order of some real-time applications is uncertain);

  (7) Error symptoms sometimes disappear, this phenomenon is especially common for embedded systems;

  (8) The error is caused by distributing the tasks to run on several different processors.

In the process of software troubleshooting, you may encounter problems of all kinds, large and small. As the number of problems increases, the pressure on the troubleshooting personnel will also increase. Excessive tension causes developers to introduce more problems while troubleshooting one problem. Lots of new questions.

Although troubleshooting is not an easy technique (sometimes people prefer to call it an art), there are still several effective methods and strategies. Here are a few troubleshooting methods.

2. Troubleshooting method

No matter which troubleshooting method is used, there is only one goal, that is, to find and eliminate the cause of the error, which requires the troubleshooting personnel to be able to combine intuitive imagination and system evaluation well.

Commonly used troubleshooting strategies fall into three categories:

  ① Primitive class (brute force)

  ② backtracking class (backtracking)

  ③ Exclusions (cause eliminations)

The original class troubleshooting method is the most commonly used and the least efficient method. It is only used in desperate situations. The main idea is to "find errors through the computer". For example, outputting the contents of the memory and registers, arranging several output statements in the program, etc., relying on a large amount of on-site information to find the clues of the error, although it can be successful in the end, it will inevitably take a lot of time and energy.

Backtracking can be successfully used to debug programs. The method is to start from the error symptom and trace back along the control flow manually until the source of the error is found. Unfortunately, when the program becomes larger, the possible traceback routes increase significantly, so that manual traceback is out of reach.

The method of elimination is based on the principles of induction and deduction, and adopts the concept of "divide and conquer". First of all, there is all the data related to the error, and an imaginary cause of the error is used to prove or refute it; or list all possible reasons at once, and pass the test Exclude them one by one. As long as a certain test result shows that a certain hypothesis has emerged, the data will be refined immediately, and the victory will be pursued.

Each of the above methods can be supplemented with troubleshooting tools. At present, a series of tools such as debugging compilers, dynamic debuggers ("tracers"), automatic test case generators, memory maps, and cross-access graphs have been widely used. However, no tool can replace the role played by a developer after careful review and scrutiny of complete design documents and clear source code. In addition, one of the most valuable resources in the troubleshooting process should not be neglected, that is, the evaluation and advice of other members of the development team, as the saying goes, "the parties involved are confused, and the bystanders are clear."

As mentioned many times before, modifying an old problem may introduce several new problems, and sometimes the program becomes more chaotic as the program is changed, but if you can ask yourself three questions before each error correction, the situation will be greatly improved:

  ① Could the cause of this error exist in other parts of the program?

  ② What impact might this modification have on the relevant logic and data in the program? What problem does it cause?

  ③ How to solve the similar problem encountered last time?

Finally:  The complete software testing video learning tutorial below has been sorted out and uploaded, and friends can get it for free if they need it【保证100%免费】

insert image description here

 These materials should be the most comprehensive and complete preparation warehouse for [software testing] friends. This warehouse has also accompanied tens of thousands of test engineers through the most difficult journey. I hope it can help you too!

软件测试技术交流群社:786229024(里面还有工作内推机会,毕竟我们是关系社会。)

Software Testing Interview Documentation

We must study to find a high-paying job. The following interview questions are the latest interview materials from first-tier Internet companies such as Ali, Tencent, and Byte, and some Byte bosses have given authoritative answers. Finish this set The interview materials believe that everyone can find a satisfactory job.

How to obtain interview documents:

Guess you like

Origin blog.csdn.net/wx17343624830/article/details/130105250