Method and test device for confirming code coverage rate

A code coverage and code technology, applied in the direction of software testing/debugging, can solve problems such as unfavorable stability and security of the program under test, and achieve the effect of ensuring stability

Active Publication Date: 2009-06-24
ZHUHAI KINGSOFT SOFTWARE CO LTD
View PDF0 Cites 36 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0007] However, the application of this technical solution requires testers to modify the source code of the test...

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Method and test device for confirming code coverage rate
  • Method and test device for confirming code coverage rate

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0031] Before performing the method of the present embodiment, the file path of dbghelp.dll, the file path of the program to be tested, and the program database (Program DataBase, PDB for short) file path can be delivered to the code coverage testing tool so as to initialize the test environment information, thereby You can use the code coverage test tool to test in this test environment. The code coverage test tool can start the tested module in a suspended debugging mode to prepare for subsequent tests:

[0032] figure 1 A schematic flowchart of a method for determining code coverage provided in this embodiment, as shown in the figure, the method may include:

[0033] Step 101: Determine the total code size of the program under test, the base address of the program under test, and the relative virtual address of each code line.

[0034] Analyze the PE header information of the program under test to find the base address of the program.

[0035] According to the PDB file of...

Embodiment 2

[0060] figure 2 Shown is a schematic structural diagram of the test device provided in this embodiment. As shown in the figure, the device may include:

[0061] The parameter determination unit 201 is configured to determine the total code amount of the program under test, the base address of the program under test, and the relative virtual address of each code line.

[0062] The interrupt setting unit 202 is configured to set an interrupt in each code line according to the base address determined by the parameter determination unit 201 and the relative virtual address of each code line.

[0063] The interrupt monitoring unit 203 is configured to monitor whether an interrupt occurs during the program under test.

[0064] The marking interrupt operation unit 204 is used to mark the code line where the interrupt is located when the interrupt monitoring unit 203 detects that an interrupt is currently occurring. According to the relative virtual address of the interrupt, inform...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

PUM

No PUM Login to view more

Abstract

The invention relates to the computer field. The embodiment of the invention discloses a method for confirming code coverage and a test method thereof. The test method comprises the following steps: confirming the total code amount and the basic address of a tested program, as well as relative virtual addresses of all code lines; setting interruption in the code lines according to the basic address and the virtual addresses of the code lines; detecting whether interruption takes place in the process of the tested program, if yes, marking the code line the interruption belongs; detecting whether the test is completed, if no, returning to the step of detecting whether interruption takes place, and if yes, accumulating marked total code in the code lines to acquire executed total code amount; and obtaining the code coverage of a tested program according to the executed total code amount and the total code amount thereof. By adopting the technical scheme of the embodiment of the invention, the code coverage of the tested program can be accurately obtained and the stability of the tested program can be guaranteed.

Description

technical field [0001] The invention relates to the field of computers, in particular to a method and a testing device for determining code coverage in computer program testing. Background technique [0002] In the testing process of computer programs, code coverage is an index to evaluate the product code covered by testing activities. The purpose of code coverage testing is to confirm that the production code works as expected. Code coverage can be seen as a documentation of how the production code works, an indirect indicator of the quality of the production code, and it is used to determine the effectiveness of the tests. Code coverage is used to evaluate whether the test code has covered all paths of the product code. Different test cases have different requirements for code coverage, therefore, it is generally necessary to check the code coverage of the program during the testing process. [0003] In order to determine code coverage, the prior art mainly uses the fo...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

Application Information

Patent Timeline
no application Login to view more
IPC IPC(8): G06F11/36
Inventor 张康宗王钊戴赞洵
Owner ZHUHAI KINGSOFT SOFTWARE CO LTD
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products