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
- Summary
- Abstract
- Description
- Claims
- Application Information
AI Technical Summary
Problems solved by technology
Method used
Image
Examples
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...
PUM
Abstract
Description
Claims
Application Information
- R&D Engineer
- R&D Manager
- IP Professional
- Industry Leading Data Capabilities
- Powerful AI technology
- Patent DNA Extraction
Browse by: Latest US Patents, China's latest patents, Technical Efficacy Thesaurus, Application Domain, Technology Topic, Popular Technical Reports.
© 2024 PatSnap. All rights reserved.Legal|Privacy policy|Modern Slavery Act Transparency Statement|Sitemap|About US| Contact US: help@patsnap.com