Looking for breakthrough ideas for innovation challenges? Try Patsnap Eureka!

Test method and device based on code coverage rate

A technology of code coverage and testing methods, applied in software testing/debugging, error detection/correction, instruments, etc., can solve the problems of low reliability of test results, achieve the effect of solving low reliability and improving effectiveness

Active Publication Date: 2019-09-03
WUHAN DOUYU NETWORK TECH CO LTD
View PDF5 Cites 4 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0005] The embodiment of the present invention provides a test method and device based on code coverage, which is used to solve or at least partly solve the technical problem that the reliability of the test effect of the existing test method is not high

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
  • Test method and device based on code coverage rate
  • Test method and device based on code coverage rate
  • Test method and device based on code coverage rate

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0056] This embodiment provides a test method based on code coverage, such asfigure 1 As shown, the method includes:

[0057] Firstly, step S101 is executed: instrumenting and monitoring the first source code to be tested to obtain a second source code to be tested, wherein the second source code to be tested includes method codes.

[0058] Specifically, the first source code to be tested can be the code of the entire program or a piece of code, and stub monitoring is to insert some probes (also known as "probes") into the program on the basis of ensuring the original logical integrity of the program under test. "Instrument" is essentially a code segment for information collection, which can be an assignment statement or a function call to collect coverage information), through the execution of the probe and throwing out the characteristic data of the program running, through the analysis of these data, the program can be obtained Control flow and data flow information, and th...

Embodiment 2

[0079] This embodiment provides a test device based on code coverage, such as figure 2 As shown, the device includes:

[0080] The instrumentation module 201 is configured to perform instrumentation monitoring on the first source code to be tested to obtain a second source code to be tested, wherein the second source code to be tested includes method codes;

[0081] A testing module 202, configured to test the second source code to be tested, and record test information, wherein the test information includes code coverage information;

[0082] The first obtaining module 203 is configured to obtain the mapping relationship between the method code and the corresponding function;

[0083] The second obtaining module 204 is configured to obtain codes of tested function points and codes of untested function points according to the test information and the mapping relationship.

[0084] As an optional implementation manner of this embodiment, in the device provided in this embodi...

Embodiment 3

[0097] See image 3 , the present application also provides a computer-readable storage medium 300, on which a computer program 311 is stored, and when the program is executed by a processor, the method in Embodiment 1 is implemented.

[0098] Specifically, the above program is configured to perform the following steps:

[0099] Perform stub monitoring on the first source code to be tested to obtain a second source code to be tested, wherein the second source code to be tested includes method codes;

[0100] Testing the second source code to be tested, and recording test information, wherein the test information includes code coverage information;

[0101] Obtain a mapping relationship between the method code and the corresponding function;

[0102] According to the test information and the mapping relationship, codes of tested function points and codes of untested function points are obtained.

[0103] Since the computer-readable storage medium introduced in the third embo...

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 embodiment of the invention provides a test method and device based on code coverage rate, and the method comprises the steps: carrying out the instrumentation monitoring of a first to-be-tested source code, obtaining a second to-be-tested source code, and the second to-be-tested source code comprising a method code; testing the second to-be-tested source code, and recording test information;obtaining a mapping relation between the method code and a corresponding function; and obtaining codes of the tested function points and codes of the untested function points according to the test information and the mapping relationship. The technical problem that an existing testing method is not high in reliability of the testing effect is solved.

Description

technical field [0001] The invention relates to the technical field of testing, in particular to a testing method and device based on code coverage. Background technique [0002] During the process of program development, developers usually need to test the developed program code, including the test based on code coverage. Among them, code coverage (Code coverage) is a measure in software testing, which describes the proportion and degree of the source code in the program being tested, and the resulting proportion is called code coverage. [0003] In the existing method, after the program code is tested, such as unit test, interface test, automated test, functional test, etc., the coverage statistics of the tested code can be carried out to obtain the code coverage rate, which can be used as a measure of the quality of the test. index. However, in the existing methods, the code coverage rate is for the entire program code, which cannot evaluate and guide the test effect we...

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
Patent Type & Authority Applications(China)
IPC IPC(8): G06F11/36
CPCG06F11/3676G06F11/3668
Inventor 潘协飞陈少杰张文明
Owner WUHAN DOUYU NETWORK TECH CO LTD
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Patsnap Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Patsnap Eureka Blog
Learn More
PatSnap group products