A method and device for obtaining code coverage

A technology of code coverage and code, applied in the field of obtaining code coverage, can solve the problems of consuming manpower and material resources, unable to obtain manual test code coverage, etc.

Active Publication Date: 2018-01-30
TENCENT TECH (SHENZHEN) CO LTD
View PDF3 Cites 2 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0004] The inventor finds that there are at least the following problems in the prior art: since the functions of the existing Android android platform are mainly guaranteed by manual testing, manual test code coverage cannot be obtained; in addition, due to the need to write a large number of automated test cases when obtaining code coverage, Consume a lot of manpower and material resources

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
  • A method and device for obtaining code coverage
  • A method and device for obtaining code coverage
  • A method and device for obtaining code coverage

Examples

Experimental program
Comparison scheme
Effect test

Embodiment 1

[0046] An embodiment of the present invention provides a method for obtaining code coverage, the execution subject of the method is a terminal, such as an Android device, such as figure 1 As shown, the method includes the following steps:

[0047] Step 101, obtaining the second code after adding the code for obtaining code coverage in the first code of the tested application program (Application, APP), and compiling the first code recorded in the second code process information to generate the first file;

[0048] In this step, the first code refers to the source code of the application program APP.

[0049]Wherein, the information of the first code includes version information of the code, package, class method and information of the line where the code is located. That is to say, the information of the first code includes the version information of the code, the package used, the class method used, and the line where a certain code is located.

[0050] This step includes:...

Embodiment 2

[0082] An embodiment of the present invention provides a method for obtaining code coverage, the method is executed by a terminal, such as an Android device, such as image 3 As shown, the method includes the following steps:

[0083] Step 301, obtaining the second code after adding the code for obtaining code coverage to the first code of the tested application program APP;

[0084] The first code in this step is the source code of the APP. APP is the abbreviation of Application, and APP mostly refers to third-party application programs of smart phones. In the embodiment of the present invention, APP may refer to an application program on an Android device.

[0085] Further, there are two ways to obtain the second code in this step:

[0086] Method 1: Receive the code for obtaining code coverage added in the function called when logging out or exiting in the first code of the APP under test, and obtain the code consisting of the first code and the code for obtaining code c...

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 discloses a method and device for obtaining code coverage, relates to the field of communication technology, can obtain the code coverage of manual testing, and avoids consuming a lot of manpower and material resources. In the embodiment of the present invention, by obtaining the second code after adding the code for obtaining code coverage in the first code of the tested application program APP, and compiling the information of the first code recorded in the process of compiling the second code Generate a first file; run the test case after receiving the test instruction, and generate a second file from the code execution information of the first code recorded in the process of running the test case; according to the first file and the second file, and the code file for obtaining code coverage, and obtain the code coverage of the first code. The embodiment of the present invention is suitable for use when manual testing is performed to obtain code coverage.

Description

technical field [0001] The invention relates to the field of communication technology, in particular to a method and device for acquiring code coverage. Background technique [0002] Code coverage is an important index reflecting the degree of coverage of test cases on the software under test. It is a reference value used to measure the integrity of the test. Its value is equal to the code divided by the total code that the test runs. With code coverage data, it is possible to assess the adequacy of testing. [0003] At present, a test project is established on the basis of the tested application program (Application, APP), wherein EMMA or a similar code coverage statistical tool is added to the test project, and then a large number of automated test cases are written in the test project. After running a large number of test cases written according to the test plan, the current code coverage can be obtained. [0004] The inventor finds that there are at least the following...

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 Patents(China)
IPC IPC(8): G06F11/36
Inventor 丁如敏皮凯
Owner TENCENT TECH (SHENZHEN) 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