Method and device for obtaining code coverage rate

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

Active Publication Date: 2014-03-12
TENCENT TECH (SHENZHEN) CO LTD
View PDF3 Cites 20 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
  • Method and device for obtaining code coverage rate
  • Method and device for obtaining code coverage rate
  • Method and device for obtaining code coverage rate

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 the code coverage rate, and relates to the technical field of communication. The code coverage rate of manual test can be obtained, and consumption of a large number of manpower and material resources is avoided. The method comprises the steps that second codes are obtained after codes with the code coverage rate being obtained are added to first codes of a tested application, and information, recorded in a compiling process of the second codes, of the first codes is used for generating first files; test cases operate after test instructions are received, and code executing information, recorded in an operation process of the test cases, of the first codes is used for generating second files; according to the first files, the second files and code files for obtaining the code coverage rate, the code coverage rate of the first codes is obtained. The method and device for obtaining the code coverage rate are suitable for being adopted when the code coverage rate is obtained by conducting manual test.

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 Applications(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