Rational Test Suite-Purify
What is the most headache in the test process, I think that the server is unknown when the server is running, and the system's memory is continuously reduced by SYSTEMMONITOR, and it is particularly useful in C . Because of Java , C # has a better GC, all memory is the developer to control, and it is easy to have a memory leak, so how to efficiently discover memory issues, becoming a concern of senior testers and developers.
Workers must have a good fault, and must first use the artificial investigation of memory in large applications, there is a big sea. How to position problems in millions of code, manual! Obviously it is impossible, that must be used with tools, now there are many more than memory check tools, such as the Purify, Purify, which is introduced by IBM, from the IBM.
The common error type of Purify check is as follows:
1. Stack of related errors.
2. Stack related errors.
3. Garbage memory collects -Java code related memory management issues.
4. COM related errors.
5. Pointer error.
6. Memory use error.
7. Windows API related errors.
8. Handle error.
Of course, there is still a lot of error types, you can refer to online help, but I think most of the mistakes have happened above.
The following mainly gives you an example to illustrate the use of Purify:
figure 1
The use of PURIFY is still relatively simple, generally written to .exe, then run it directly, then if the program is relatively large, you need to reorganize it, and take a few segments to test, the best way is to use CPPUnit. Write the test framework, directly call a single function to test is the best, my example is written by CPPUnit, separate call related test functions, because it is not introducing CPPUINT, so just let you mention the unit test Can be written like this. The startup of PURIFY is still relatively simple, that is, running one .exe.
After running, the results are as follows:
figure 2
Everyone can see the following mistakes, there is no initialization of the memory, the array of crosses, memory leaks, etc., the previous code is more than, it is not possible, now there is this tool, you can Soon finding problems.
At the same time, PURIFY can be displayed. It can be positioned to be positioned. Of course, you have to have code, but it is displayed all of them, you have to find it from inside it is caused by your code, this It is a more dizzy, but I will do more times. Of course, if the program is better, it is easier to find the problem, expand the problem of the above problems, and I generally Will not find a system-related function, but first find a function related to our own engineering, such as the memory demonstration Int cmabstring :: leakmemory ():
image 3
It is the code in the project. General problems are caused by their own code, but Purify introduces all the modules related to this, so you have to filter out what is the real problem, and you can also see if the program has If the code, PURIFY can mark the errors in the code, thereby reducing you to find the difficulty of code, thus fast positioning issues.
Of course, there is still much better features, such as filtration, error display settings, etc. You can find problems faster. Purify is a very good memory check job. Combine tools under the Rose Test Suite of PureCoverage, Quantify, of course, if the test framework is combined, the automated test can be greatly saved. Test costs, improve work efficiency, of course, implement unit testing or see the ability of the test team, can not strongly push J. If you have to know other two tools, you can see other introductions in my column, thank you.