CN116881117A - Test case coverage rate evaluation method, device, computer equipment and storage medium - Google Patents

Test case coverage rate evaluation method, device, computer equipment and storage medium Download PDF

Info

Publication number
CN116881117A
CN116881117A CN202310647079.6A CN202310647079A CN116881117A CN 116881117 A CN116881117 A CN 116881117A CN 202310647079 A CN202310647079 A CN 202310647079A CN 116881117 A CN116881117 A CN 116881117A
Authority
CN
China
Prior art keywords
coverage rate
test case
code
development
acquiring
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202310647079.6A
Other languages
Chinese (zh)
Inventor
刘洋
党娜
李�昊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Bank of China Ltd
Original Assignee
Bank of China Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Bank of China Ltd filed Critical Bank of China Ltd
Priority to CN202310647079.6A priority Critical patent/CN116881117A/en
Publication of CN116881117A publication Critical patent/CN116881117A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3676Test management for coverage analysis
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02PCLIMATE CHANGE MITIGATION TECHNOLOGIES IN THE PRODUCTION OR PROCESSING OF GOODS
    • Y02P90/00Enabling technologies with a potential contribution to greenhouse gas [GHG] emissions mitigation
    • Y02P90/30Computing systems specially adapted for manufacturing

Abstract

The application relates to the technical field of computers, in particular to a test case coverage rate evaluation method, a test case coverage rate evaluation device, a test case coverage rate evaluation computer device and a test case coverage rate evaluation storage medium, which can be applied to product development in the financial field. The method comprises the following steps: acquiring a demand point of a target product; acquiring a development code of a target product according to the demand points; generating a test case based on the test case template, acquiring the test coverage rate of the test case relative to the demand points, and acquiring the code coverage rate of the test case relative to the development codes; and acquiring a coverage rate evaluation result of the test case according to the test coverage rate and the code coverage rate. The adoption of the method can accurately evaluate the coverage rate of the test case based on a clear coverage rate measurement standard without depending on manual analysis of testers and developers.

Description

Test case coverage rate evaluation method, device, computer equipment and storage medium
Technical Field
The present application relates to the field of computer technology, and in particular, to a test case coverage rate evaluation method, apparatus, computer device, storage medium, and computer program product, which can be applied to product development in the financial field.
Background
Test Case (Test Case) refers to the description of a specific software product for testing tasks, and reflects testing schemes, methods, technologies and strategies. The content of the method comprises a test target, a test environment, input data, a test step, an expected result, a test script and the like, and finally a document is formed. Briefly, a test case is a set of test inputs, execution conditions, and expected results tailored for a particular goal to verify that a particular software requirement is met.
The coverage rate plays a very important role in software testing, and whether the testing is sufficient or not and the aspects of the weaknesses of the testing can be known through the coverage rate, so that code developers are guided to design test cases with the coverage rate increased, and the testing quality is effectively improved. On one hand, the coverage rate technology can guide the design of test cases; on the other hand, the strength of the white box test can be measured by coverage. The higher the coverage of the test cases to the code, the more accurately the corresponding test cases can test the software.
Coverage is a means to measure test integrity and more test tools are now able to support coverage testing, but they do not contain test technology themselves, but are only a measure of the effectiveness of the test technology. The common white box test method is as follows: and testing by using an Xunit series tool in the JAVA platform, wherein the Xunit test tool is a class-level test tool, and testing each class and the class method. And calculating the class coverage rate and the row coverage rate of the test case by counting the class level association relation and counting the number of tested code rows, so as to judge the coverage rate of the test case. Or, by means of code walking, a tester reads and inspects the developed codes to find out the grammar and logic problems, and further, the coverage rate of the test cases is judged manually. However, in the prior art, in the process of acquiring the coverage rate of the test case, the test case is processed only by overlapping the test point ranges related to the test case, and whether the test case can successfully complete the verification process of the corresponding test point is not considered, namely, when the verification bug is not cleaned completely, the coverage rate directly collected cannot well represent the verification condition, and finally, the test point which can cause verification failure is also contained in the coverage rate of the test case, and the verification progress effect cannot be accurately reflected.
The coverage rate of the current test cases depends on the analysis of testers and developers, and no clear measurement standard exists, so that the coverage rate of the test cases cannot be accurately tested.
Disclosure of Invention
Based on this, it is necessary to provide a test case coverage evaluation method, apparatus, computer device, computer readable storage medium and computer program product capable of accurately testing the coverage of the test case in view of the above-described technical problems.
In a first aspect, the present application provides a test case coverage evaluation method. The method comprises the following steps:
acquiring a demand point of a target product;
acquiring a development code of a target product according to the demand points;
generating a test case based on the test case template, acquiring the test coverage rate of the test case relative to the demand points, and acquiring the code coverage rate of the test case relative to the development codes;
and acquiring a coverage rate evaluation result of the test case according to the test coverage rate and the code coverage rate.
In one embodiment, obtaining a demand point for a target product includes:
acquiring demand information of a target product based on a test case template;
determining a functional module included in the target product according to the demand information; the functional module comprises functional points of a target product;
and determining the demand point of the target product according to the function point.
In one embodiment, according to a demand point, acquiring a development code of a target product includes:
acquiring a code branch corresponding to a demand point;
and acquiring development codes of the target product according to the code branches.
In one embodiment, before generating the test case based on the test case template, the method further includes:
acquiring development coverage rate of the development code relative to the demand points, and comparing the development coverage rate with a coverage rate threshold;
under the condition that the development coverage rate is smaller than a first coverage rate threshold value, adjusting the development code, executing the step of acquiring the development coverage rate of the development code relative to the demand points again, and comparing the development coverage rate with the coverage rate threshold value;
and executing the step of generating the test case based on the test case template under the condition that the development coverage rate is not smaller than the first coverage rate threshold value.
In one embodiment, obtaining a coverage evaluation result of the test case according to the test coverage and the code coverage includes:
determining a first score according to the test coverage; the first score is used for representing the coverage degree of the test case to the demand points;
determining a second score from the code coverage; the second score is used for representing the coverage degree of the test case on the development codes;
and obtaining a coverage rate evaluation result according to the weighted sum of the first score and the second score.
In one embodiment, determining the second score from the code coverage includes:
acquiring the main flow code coverage rate and the abnormal flow code coverage rate of the development codes according to the code coverage rate;
determining a third score according to the primary flow code coverage rate; the third score is used for representing the coverage degree of the test case on the main stream codes in the development codes;
determining a fourth score according to the abnormal flow code coverage rate; the fourth score is used for representing the coverage degree of the test case on the abnormal flow codes in the development codes;
and obtaining a second score according to the weighted sum of the third score and the fourth score.
In a second aspect, the application further provides a test case coverage rate evaluation device. The device comprises:
the acquisition module is used for acquiring the demand points of the target product;
the development module is used for acquiring development codes of target products according to the demand points;
the test module is used for generating a test case based on the test case template, acquiring the test coverage rate of the test case relative to the demand point and acquiring the code coverage rate of the test case relative to the development code;
and the evaluation module is used for acquiring the coverage rate evaluation result of the test case according to the test coverage rate and the code coverage rate.
In a third aspect, the present application also provides a computer device. The computer device comprises a memory storing a computer program and a processor which when executing the computer program performs the steps of:
acquiring a demand point of a target product;
acquiring a development code of a target product according to the demand points;
generating a test case based on the test case template, acquiring the test coverage rate of the test case relative to the demand points, and acquiring the code coverage rate of the test case relative to the development codes;
and acquiring a coverage rate evaluation result of the test case according to the test coverage rate and the code coverage rate.
In a fourth aspect, the present application also provides a computer-readable storage medium. The computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of:
acquiring a demand point of a target product;
acquiring a development code of a target product according to the demand points;
generating a test case based on the test case template, acquiring the test coverage rate of the test case relative to the demand points, and acquiring the code coverage rate of the test case relative to the development codes;
and acquiring a coverage rate evaluation result of the test case according to the test coverage rate and the code coverage rate.
In a fifth aspect, the present application also provides a computer program product. The computer program product comprises a computer program which, when executed by a processor, implements the steps of:
acquiring a demand point of a target product;
acquiring a development code of a target product according to the demand points;
generating a test case based on the test case template, acquiring the test coverage rate of the test case relative to the demand points, and acquiring the code coverage rate of the test case relative to the development codes;
and acquiring a coverage rate evaluation result of the test case according to the test coverage rate and the code coverage rate.
The test case coverage rate evaluation method, the test case coverage rate evaluation device, the computer equipment, the storage medium and the computer program product acquire the demand points of the target product; acquiring a development code of a target product according to the demand points; generating a test case based on the test case template, acquiring the test coverage rate of the test case relative to the demand points, and acquiring the code coverage rate of the test case relative to the development codes; and acquiring a coverage rate evaluation result of the test case according to the test coverage rate and the code coverage rate. The coverage rate of the test cases can be accurately estimated based on a clear coverage rate measurement standard without relying on manual analysis of testers and developers.
Drawings
FIG. 1 is an application environment diagram of a test case coverage evaluation method in one embodiment;
FIG. 2 is a flow chart of a test case coverage evaluation method in one embodiment;
FIG. 3 is a block diagram of a test case coverage evaluation device in one embodiment;
fig. 4 is an internal structural diagram of a computer device in one embodiment.
Detailed Description
The present application will be described in further detail with reference to the drawings and examples, in order to make the objects, technical solutions and advantages of the present application more apparent. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the scope of the application.
The test case coverage rate evaluation method provided by the embodiment of the application can be applied to an application environment shown in fig. 1. Wherein the terminal 102 communicates with the server 104 via a network. The data storage system may store data that the server 104 needs to process. The data storage system may be integrated on the server 104 or may be located on a cloud or other network server. The terminal 102 may be, but not limited to, various personal computers, notebook computers, smart phones, tablet computers, internet of things devices, and portable wearable devices, where the internet of things devices may be smart speakers, smart televisions, smart air conditioners, smart vehicle devices, and the like. The portable wearable device may be a smart watch, smart bracelet, headset, or the like. The server 104 may be implemented as a stand-alone server or as a server cluster of multiple servers.
In one embodiment, as shown in fig. 2, a test case coverage evaluation method is provided, and the method is applied to the terminal 102 in fig. 1 for illustration, and includes the following steps:
step 202, obtaining a demand point of a target product.
Optionally, selecting a target product as a test sample, performing demand analysis on the target product, determining a function to be realized by the target product, determining a plurality of function points of the target product according to the function, determining a demand point based on the function points, wherein one demand point may include one or more function points.
And 204, acquiring a development code of the target product according to the demand point.
Optionally, according to each demand point, developing the target product to obtain a development code, after the development is completed, checking the coverage condition of the development code relative to the demand point, and one by one corresponding each code branch in the development code to the demand point, so as to ensure that the development code completely covers each demand point.
Step 206, generating a test case based on the test case template, obtaining the test coverage rate of the test case relative to the demand points, and obtaining the code coverage rate of the test case relative to the development codes.
The code coverage rate refers to the ratio of the number of codes covered by the test case to the total number of codes after the test case is executed, and is usually expressed by a percentage, which is an important index for measuring the degree of the test case to the code coverage. The test coverage rate refers to the proportion of the total functional area occupied by the functional area (such as code line, function, statement, branch, judgment, etc.) of the application program covered by the test case when the test case is executed, and is an important index for measuring the degree of the test case corresponding to the functional test of the application program. The code coverage rate and the test coverage rate are both important indicators of the test case. They reflect the effectiveness of test case execution and the breadth of test coverage. By detecting the code coverage rate and the test coverage rate, the method can help testers find out missing test points and repair code defects in time, and improves software quality.
In automated testing, detection of code coverage and test coverage is typically accomplished by code analysis tools. Common code analysis tools are JTest, clover, emma, openCover, etc. For code coverage detection, the code analysis tool may represent the executed code paths as a tree structure and then calculate the proportion of the executed paths on the tree. This method is called "basic block coverage", and colloquially takes into account whether statistical points are encountered on all code lines that the program is capable of executing when running. The test coverage rate detection can adopt a code coverage rate method, an application program functional area (such as code lines, functions, sentences, branches, decisions and the like) covered in the test execution process is represented as a tree structure, and then the proportion of executed paths on the tree is calculated. This method is called "functional coverage", and colloquially covers all of the syntax elements of the code under test.
Optionally, a preset test case template is adopted to generate at least one test case, and under the condition that the preset test case template is not available, a test case template can be generated according to test requirements, at least one test case is generated, and the number of the test cases depends on the requirement point. And testing the developed codes by adopting at least one test case to respectively obtain the test coverage rate and the code coverage rate.
And step 208, acquiring a coverage rate evaluation result of the test case according to the test coverage rate and the code coverage rate.
Optionally, the coverage rate evaluation result of the test cases is obtained by combining the test coverage rate and the code coverage rate, and the quantity and the content of the test cases can be adjusted by referring to the coverage rate evaluation result. The test coverage and code coverage are mainly applied to the following two aspects:
A. the quality of the test cases is improved, and the test personnel can be helped to evaluate whether the test cases cover key code paths and functional areas or not and whether the holes and defects exist or not by detecting the code coverage rate and the test coverage rate.
B. Optimizing the number and execution efficiency of test cases, namely, detecting the code coverage rate and the test coverage rate, finding out missing test points, repairing code defects in time, reducing the number of test cases,
the execution efficiency of the test cases is improved.
The test case coverage rate evaluation method can be applied to product development in the financial field. Acquiring a demand point of a target product; acquiring a development code of a target product according to the demand points; generating a test case based on the test case template, acquiring the test coverage rate of the test case relative to the demand points, and acquiring the code coverage rate of the test case relative to the development codes; and acquiring a coverage rate evaluation result of the test case according to the test coverage rate and the code coverage rate. The coverage rate of the test cases can be accurately estimated based on a clear coverage rate measurement standard without relying on manual analysis of testers and developers.
In one embodiment, obtaining a demand point for a target product includes: acquiring demand information of a target product based on a test case template; determining a functional module included in the target product according to the demand information; the functional module comprises functional points of a target product; and determining the demand point of the target product according to the function point.
Further, according to the demand point, acquiring a development code of the target product, including: acquiring a code branch corresponding to a demand point; and acquiring development codes of the target product according to the code branches.
Optionally, the requirement description is performed on the target product according to a preset test case template, so as to obtain requirement information corresponding to the test case template, one or more functional modules of the target product are determined according to the requirement information, one functional module represents one function of the target product, one functional module comprises one or more functional points, and corresponding requirement points can be obtained based on the functional points, that is, the target product has a plurality of requirement points. For example, a mobile banking APP (Application program, foreign language Application) is taken as a target product, a plurality of functions to be implemented by the mobile banking APP include a transfer function module, each function point to be implemented by the transfer function module is determined, for example, an input account number, a mobile phone number transfer function, a security tool support function and the like are supported, a plurality of requirement points of the target product are determined according to the function points, and one requirement point generally includes one function point.
Further, according to each demand point, writing code branches, and combining the code branches corresponding to each demand point, the development code of the target product can be obtained.
In one embodiment, before generating the test case based on the test case template, the method further comprises: acquiring development coverage rate of the development code relative to the demand points, and comparing the development coverage rate with a coverage rate threshold; under the condition that the development coverage rate is smaller than a first coverage rate threshold value, adjusting the development code, executing the step of acquiring the development coverage rate of the development code relative to the demand points again, and comparing the development coverage rate with the coverage rate threshold value; and executing the step of generating the test case based on the test case template under the condition that the development coverage rate is not smaller than the first coverage rate threshold value.
In this embodiment, the first coverage rate threshold is generally configured to be 100%, so that, under the condition that the development code fails to completely cover all the requirement points, the development coverage rate is less than 100%, the development code needs to be adjusted, and the development coverage rate is tested again, until the development coverage rate is equal to 100%, the coverage rate test of the test case is started until the development code completely covers all the requirement points, so that the development code is ensured to completely cover each requirement point, and the coverage rate evaluation of the test case is prevented from being influenced by the development code, thereby improving the coverage rate evaluation accuracy of the test case.
In one embodiment, obtaining a coverage evaluation result of the test case according to the test coverage and the code coverage includes: determining a first score according to the test coverage; the first score is used for representing the coverage degree of the test case to the demand point. Acquiring the main flow code coverage rate and the abnormal flow code coverage rate of the development codes according to the code coverage rate; determining a third score according to the primary flow code coverage rate; the third score is used for representing the coverage degree of the test case on the main stream codes in the development codes; determining a fourth score according to the abnormal flow code coverage rate; the fourth score is used for representing the coverage degree of the test case on the abnormal flow codes in the development codes; obtaining a second score according to the weighted sum of the third score and the fourth score; the second score is used to characterize the extent to which the test case covers the developed code. And obtaining a coverage rate evaluation result according to the weighted sum of the first score and the second score.
Optionally, if the test coverage rate reflects that the demand points are not covered, considering that the test case has a risk of testing the demand points, wherein the first Score 1=1; if the test coverage rate reflects that all the demand points are covered, the test case is considered to have no risk of testing the demand points, and the first Score is 1=0.
If the main flow code coverage rate is lower than a preset first coverage rate threshold value, a third Score 3=2; if the main flow code coverage is not lower than the preset coverage threshold, the third Score 3=0. If the abnormal flow code coverage rate is lower than a preset second coverage rate threshold value, the fourth Score 4=1; if the abnormal flow code coverage is not lower than the preset second coverage threshold, the fourth Score 4=0. Calculating a second Score 2=a3×score3+a4×score4 from the weighted sum of the third Score and the fourth Score. The larger the value of the second score, the higher the code testing risk of the test case.
Finally, calculating a coverage rate evaluation result according to the weighted sum of the first score and the second score: total_score=a1×score1+a2×score2. The larger the value of the coverage rate evaluation result is, the higher the overall test risk of the test case is.
Wherein a1, a2, a3 and a4 are respectively preset weighting coefficients of each item of score, and are positive numbers, and each preset weighting coefficient can be subjected to custom assignment according to different test scenes.
In this embodiment, the coverage rate measurement standard can be clarified, and the coverage rate of the test case can be directly estimated based on the clarified coverage rate measurement standard without relying on manual analysis of testers and developers.
In one embodiment, a test case coverage evaluation method includes:
acquiring demand information of a target product based on a test case template; determining a functional module included in the target product according to the demand information; the functional module comprises functional points of a target product; and determining the demand point of the target product according to the function point.
And acquiring the development coverage rate of the development code relative to the demand point, and comparing the development coverage rate with a coverage rate threshold value.
And under the condition that the development coverage rate is smaller than a first coverage rate threshold value, adjusting the development code, executing the step of acquiring the development coverage rate of the development code relative to the demand point again, and comparing the development coverage rate with the coverage rate threshold value.
Acquiring a code branch corresponding to a demand point under the condition that the development coverage rate is not smaller than a first coverage rate threshold value; and acquiring development codes of the target product according to the code branches.
Generating a test case based on the test case template, acquiring the test coverage rate of the test case relative to the demand points, and acquiring the code coverage rate of the test case relative to the development codes;
determining a first score according to the test coverage; the first score is used for representing the coverage degree of the test case to the demand point.
Acquiring the main flow code coverage rate and the abnormal flow code coverage rate of the development codes according to the code coverage rate; determining a third score according to the primary flow code coverage rate; the third score is used for representing the coverage degree of the test case on the main stream codes in the development codes; determining a fourth score according to the abnormal flow code coverage rate; the fourth score is used for representing the coverage degree of the test case on the abnormal flow codes in the development codes; obtaining a second score according to the weighted sum of the third score and the fourth score; the second score is used to characterize the extent to which the test case covers the developed code.
And obtaining a coverage rate evaluation result according to the weighted sum of the first score and the second score.
In one embodiment, determining the second score from the code coverage includes:
it should be understood that, although the steps in the flowcharts related to the embodiments described above are sequentially shown as indicated by arrows, these steps are not necessarily sequentially performed in the order indicated by the arrows. The steps are not strictly limited to the order of execution unless explicitly recited herein, and the steps may be executed in other orders. Moreover, at least some of the steps in the flowcharts described in the above embodiments may include a plurality of steps or a plurality of stages, which are not necessarily performed at the same time, but may be performed at different times, and the order of the steps or stages is not necessarily performed sequentially, but may be performed alternately or alternately with at least some of the other steps or stages.
Based on the same inventive concept, the embodiment of the application also provides a test case coverage rate evaluation device for realizing the test case coverage rate evaluation method. The implementation scheme of the solution to the problem provided by the device is similar to the implementation scheme recorded in the method, so the specific limitation in the embodiment of the test case coverage rate evaluation device or test case coverage rate evaluation devices provided below can be referred to the limitation of the test case coverage rate evaluation method hereinabove, and will not be repeated here.
In one embodiment, as shown in FIG. 3, there is provided a test case coverage evaluation apparatus 300, comprising: an acquisition module 301, a development module 302, a test module 303, and an evaluation module 304, wherein:
the obtaining module 301 is configured to obtain a demand point of a target product.
And the development module 302 is configured to obtain a development code of the target product according to the requirement point.
The test module 303 is configured to generate a test case based on the test case template, obtain a test coverage of the test case relative to a demand point, and obtain a code coverage of the test case relative to a development code.
And the evaluation module 304 is used for acquiring the coverage evaluation result of the test case according to the test coverage and the code coverage.
In one embodiment, the obtaining module 301 is further configured to obtain requirement information of the target product based on the test case template; determining a functional module included in the target product according to the demand information; the functional module comprises functional points of a target product; and determining the demand point of the target product according to the function point.
In one embodiment, the development module 302 is further configured to obtain a code branch corresponding to the demand point; and acquiring development codes of the target product according to the code branches.
In one embodiment, the test module 303 is further configured to obtain a development coverage rate of the development code relative to the demand point, and compare the development coverage rate with a coverage rate threshold; under the condition that the development coverage rate is smaller than a first coverage rate threshold value, adjusting the development code, executing the step of acquiring the development coverage rate of the development code relative to the demand points again, and comparing the development coverage rate with the coverage rate threshold value; and executing the step of generating the test case based on the test case template under the condition that the development coverage rate is not smaller than the first coverage rate threshold value.
In one embodiment, the assessment module 304 is further configured to determine a first score based on the test coverage; the first score is used for representing the coverage degree of the test case to the demand points; determining a second score from the code coverage; the second score is used for representing the coverage degree of the test case on the development codes; and obtaining a coverage rate evaluation result according to the weighted sum of the first score and the second score.
In one embodiment, the evaluation module 304 is further configured to obtain a main flow code coverage rate and an abnormal flow code coverage rate of the development code according to the code coverage rate; determining a third score according to the primary flow code coverage rate; the third score is used for representing the coverage degree of the test case on the main stream codes in the development codes; determining a fourth score according to the abnormal flow code coverage rate; the fourth score is used for representing the coverage degree of the test case on the abnormal flow codes in the development codes; and obtaining a second score according to the weighted sum of the third score and the fourth score.
The modules in the test case coverage rate evaluation device may be implemented in whole or in part by software, hardware, or a combination thereof. The above modules may be embedded in hardware or may be independent of a processor in the computer device, or may be stored in software in a memory in the computer device, so that the processor may call and execute operations corresponding to the above modules.
In one embodiment, a computer device is provided, which may be a server, the internal structure of which may be as shown in fig. 4. The computer device includes a processor, a memory, an Input/Output interface (I/O) and a communication interface. The processor, the memory and the input/output interface are connected through a system bus, and the communication interface is connected to the system bus through the input/output interface. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, computer programs, and a database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database of the computer device is used to store test case data. The input/output interface of the computer device is used to exchange information between the processor and the external device. The communication interface of the computer device is used for communicating with an external terminal through a network connection. The computer program, when executed by a processor, implements a test case coverage assessment method.
It will be appreciated by persons skilled in the art that the architecture shown in fig. 4 is merely a block diagram of some of the architecture relevant to the present inventive arrangements and is not limiting as to the computer device to which the present inventive arrangements are applicable, and that a particular computer device may include more or fewer components than shown, or may combine some of the components, or have a different arrangement of components.
In one embodiment, a computer device is provided comprising a memory and a processor, the memory having stored therein a computer program, the processor when executing the computer program performing the steps of: acquiring a demand point of a target product; acquiring a development code of a target product according to the demand points; generating a test case based on the test case template, acquiring the test coverage rate of the test case relative to the demand points, and acquiring the code coverage rate of the test case relative to the development codes; and acquiring a coverage rate evaluation result of the test case according to the test coverage rate and the code coverage rate.
In one embodiment, the processor when executing the computer program further performs the steps of: acquiring demand information of a target product based on a test case template; determining a functional module included in the target product according to the demand information; the functional module comprises functional points of a target product; and determining the demand point of the target product according to the function point.
In one embodiment, the processor when executing the computer program further performs the steps of: acquiring a code branch corresponding to a demand point; and acquiring development codes of the target product according to the code branches.
In one embodiment, the processor when executing the computer program further performs the steps of: acquiring development coverage rate of the development code relative to the demand points, and comparing the development coverage rate with a coverage rate threshold; under the condition that the development coverage rate is smaller than a first coverage rate threshold value, adjusting the development code, executing the step of acquiring the development coverage rate of the development code relative to the demand points again, and comparing the development coverage rate with the coverage rate threshold value; and executing the step of generating the test case based on the test case template under the condition that the development coverage rate is not smaller than the first coverage rate threshold value.
In one embodiment, the processor when executing the computer program further performs the steps of: determining a first score according to the test coverage; the first score is used for representing the coverage degree of the test case to the demand points; determining a second score from the code coverage; the second score is used for representing the coverage degree of the test case on the development codes; and obtaining a coverage rate evaluation result according to the weighted sum of the first score and the second score.
In one embodiment, the processor when executing the computer program further performs the steps of: acquiring the main flow code coverage rate and the abnormal flow code coverage rate of the development codes according to the code coverage rate; determining a third score according to the primary flow code coverage rate; the third score is used for representing the coverage degree of the test case on the main stream codes in the development codes; determining a fourth score according to the abnormal flow code coverage rate; the fourth score is used for representing the coverage degree of the test case on the abnormal flow codes in the development codes; and obtaining a second score according to the weighted sum of the third score and the fourth score.
In one embodiment, a computer readable storage medium is provided having a computer program stored thereon, which when executed by a processor, performs the steps of: acquiring a demand point of a target product; acquiring a development code of a target product according to the demand points; generating a test case based on the test case template, acquiring the test coverage rate of the test case relative to the demand points, and acquiring the code coverage rate of the test case relative to the development codes; and acquiring a coverage rate evaluation result of the test case according to the test coverage rate and the code coverage rate.
In one embodiment, the computer program when executed by the processor further performs the steps of: acquiring demand information of a target product based on a test case template; determining a functional module included in the target product according to the demand information; the functional module comprises functional points of a target product; and determining the demand point of the target product according to the function point.
In one embodiment, the computer program when executed by the processor further performs the steps of: acquiring a code branch corresponding to a demand point; and acquiring development codes of the target product according to the code branches.
In one embodiment, the computer program when executed by the processor further performs the steps of: acquiring development coverage rate of the development code relative to the demand points, and comparing the development coverage rate with a coverage rate threshold; under the condition that the development coverage rate is smaller than a first coverage rate threshold value, adjusting the development code, executing the step of acquiring the development coverage rate of the development code relative to the demand points again, and comparing the development coverage rate with the coverage rate threshold value; and executing the step of generating the test case based on the test case template under the condition that the development coverage rate is not smaller than the first coverage rate threshold value.
In one embodiment, the computer program when executed by the processor further performs the steps of: determining a first score according to the test coverage; the first score is used for representing the coverage degree of the test case to the demand points; determining a second score from the code coverage; the second score is used for representing the coverage degree of the test case on the development codes; and obtaining a coverage rate evaluation result according to the weighted sum of the first score and the second score.
In one embodiment, the computer program when executed by the processor further performs the steps of: acquiring the main flow code coverage rate and the abnormal flow code coverage rate of the development codes according to the code coverage rate; determining a third score according to the primary flow code coverage rate; the third score is used for representing the coverage degree of the test case on the main stream codes in the development codes; determining a fourth score according to the abnormal flow code coverage rate; the fourth score is used for representing the coverage degree of the test case on the abnormal flow codes in the development codes; and obtaining a second score according to the weighted sum of the third score and the fourth score.
In one embodiment, a computer program product is provided comprising a computer program which, when executed by a processor, performs the steps of: acquiring a demand point of a target product; acquiring a development code of a target product according to the demand points; generating a test case based on the test case template, acquiring the test coverage rate of the test case relative to the demand points, and acquiring the code coverage rate of the test case relative to the development codes; and acquiring a coverage rate evaluation result of the test case according to the test coverage rate and the code coverage rate.
In one embodiment, the computer program when executed by the processor further performs the steps of: acquiring demand information of a target product based on a test case template; determining a functional module included in the target product according to the demand information; the functional module comprises functional points of a target product; and determining the demand point of the target product according to the function point.
In one embodiment, the computer program when executed by the processor further performs the steps of: acquiring a code branch corresponding to a demand point; and acquiring development codes of the target product according to the code branches.
In one embodiment, the computer program when executed by the processor further performs the steps of: acquiring development coverage rate of the development code relative to the demand points, and comparing the development coverage rate with a coverage rate threshold; under the condition that the development coverage rate is smaller than a first coverage rate threshold value, adjusting the development code, executing the step of acquiring the development coverage rate of the development code relative to the demand points again, and comparing the development coverage rate with the coverage rate threshold value; and executing the step of generating the test case based on the test case template under the condition that the development coverage rate is not smaller than the first coverage rate threshold value.
In one embodiment, the computer program when executed by the processor further performs the steps of: determining a first score according to the test coverage; the first score is used for representing the coverage degree of the test case to the demand points; determining a second score from the code coverage; the second score is used for representing the coverage degree of the test case on the development codes; and obtaining a coverage rate evaluation result according to the weighted sum of the first score and the second score.
In one embodiment, the computer program when executed by the processor further performs the steps of: acquiring the main flow code coverage rate and the abnormal flow code coverage rate of the development codes according to the code coverage rate; determining a third score according to the primary flow code coverage rate; the third score is used for representing the coverage degree of the test case on the main stream codes in the development codes; determining a fourth score according to the abnormal flow code coverage rate; the fourth score is used for representing the coverage degree of the test case on the abnormal flow codes in the development codes; and obtaining a second score according to the weighted sum of the third score and the fourth score.
It should be noted that, the user information (including but not limited to user equipment information, user personal information, etc.) and the data (including but not limited to data for analysis, stored data, presented data, etc.) related to the present application are information and data authorized by the user or sufficiently authorized by each party, and the collection, use and processing of the related data need to comply with the related laws and regulations and standards of the related country and region.
Those skilled in the art will appreciate that implementing all or part of the above described methods may be accomplished by way of a computer program stored on a non-transitory computer readable storage medium, which when executed, may comprise the steps of the embodiments of the methods described above. Any reference to memory, database, or other medium used in embodiments provided herein may include at least one of non-volatile and volatile memory. The nonvolatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical Memory, high density embedded nonvolatile Memory, resistive random access Memory (ReRAM), magnetic random access Memory (Magnetoresistive Random Access Memory, MRAM), ferroelectric Memory (Ferroelectric Random Access Memory, FRAM), phase change Memory (Phase Change Memory, PCM), graphene Memory, and the like. Volatile memory can include random access memory (Random Access Memory, RAM) or external cache memory, and the like. By way of illustration, and not limitation, RAM can be in the form of a variety of forms, such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM), and the like. The databases referred to in the embodiments provided herein may include at least one of a relational database and a non-relational database. The non-relational database may include, but is not limited to, a blockchain-based distributed database, and the like. The processor referred to in the embodiments provided in the present application may be a general-purpose processor, a central processing unit, a graphics processor, a digital signal processor, a programmable logic unit, a data processing logic unit based on quantum computing, or the like, but is not limited thereto.
The technical features of the above embodiments may be arbitrarily combined, and all possible combinations of the technical features in the above embodiments are not described for brevity of description, however, as long as there is no contradiction between the combinations of the technical features, they should be considered as the scope of the description.
The foregoing examples illustrate only a few embodiments of the application and are described in detail herein without thereby limiting the scope of the application. It should be noted that it will be apparent to those skilled in the art that several variations and modifications can be made without departing from the spirit of the application, which are all within the scope of the application. Accordingly, the scope of the application should be assessed as that of the appended claims.

Claims (10)

1. A test case coverage assessment method, the method comprising:
acquiring a demand point of a target product;
acquiring a development code of the target product according to the demand point;
generating a test case based on a test case template, acquiring the test coverage rate of the test case relative to the demand points, and acquiring the code coverage rate of the test case relative to the development codes;
and acquiring a coverage rate evaluation result of the test case according to the test coverage rate and the code coverage rate.
2. The method of claim 1, wherein the obtaining the point of need for the target product comprises:
acquiring the demand information of the target product based on the test case template;
determining a functional module included in the target product according to the demand information; the functional module comprises functional points of the target product;
and determining the demand point of the target product according to the function point.
3. The method according to claim 1, wherein the obtaining the development code of the target product according to the demand point includes:
acquiring a code branch corresponding to the demand point;
and acquiring the development codes of the target product according to the code branches.
4. The method of claim 1, wherein prior to generating the test case based on the test case template, further comprising:
acquiring development coverage rate of the development code relative to the demand points, and comparing the development coverage rate with a coverage rate threshold;
under the condition that the development coverage rate is smaller than a first coverage rate threshold value, adjusting the development code, and executing the step of acquiring the development coverage rate of the development code relative to the demand point again, and comparing the development coverage rate with the coverage rate threshold value;
and executing the step of generating the test case based on the test case template under the condition that the development coverage rate is not smaller than the first coverage rate threshold value.
5. The method according to claim 1, wherein the obtaining the coverage evaluation result of the test case according to the test coverage and the code coverage includes:
determining a first score according to the test coverage; the first score is used for representing the coverage degree of the test case to the demand point;
determining a second score from the code coverage; the second score is used for representing the coverage degree of the test case on the development code;
and acquiring the coverage rate evaluation result according to the weighted sum of the first score and the second score.
6. The method of claim 5, wherein said determining a second score from said code coverage comprises:
acquiring the main flow code coverage rate and the abnormal flow code coverage rate of the development code according to the code coverage rate;
determining a third score according to the main flow code coverage rate; the third score is used for representing the coverage degree of the test case on the main stream codes in the development codes;
determining a fourth score according to the abnormal flow code coverage rate; the fourth score is used for representing the coverage degree of the test case on the abnormal flow codes in the development codes;
and obtaining the second score according to the weighted sum of the third score and the fourth score.
7. A test case coverage evaluation device, the device comprising:
the acquisition module is used for acquiring the demand points of the target product;
the development module is used for acquiring development codes of the target products according to the demand points;
the test module is used for generating a test case based on a test case template, acquiring the test coverage rate of the test case relative to the demand points and acquiring the code coverage rate of the test case relative to the development codes;
and the evaluation module is used for acquiring the coverage rate evaluation result of the test case according to the test coverage rate and the code coverage rate.
8. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor implements the steps of the method of any of claims 1 to 6 when the computer program is executed.
9. A computer readable storage medium, on which a computer program is stored, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 6.
10. A computer program product comprising a computer program, characterized in that the computer program, when being executed by a processor, implements the steps of the method of any of claims 1 to 6.
CN202310647079.6A 2023-06-02 2023-06-02 Test case coverage rate evaluation method, device, computer equipment and storage medium Pending CN116881117A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310647079.6A CN116881117A (en) 2023-06-02 2023-06-02 Test case coverage rate evaluation method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310647079.6A CN116881117A (en) 2023-06-02 2023-06-02 Test case coverage rate evaluation method, device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN116881117A true CN116881117A (en) 2023-10-13

Family

ID=88253728

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310647079.6A Pending CN116881117A (en) 2023-06-02 2023-06-02 Test case coverage rate evaluation method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN116881117A (en)

Similar Documents

Publication Publication Date Title
US20140033174A1 (en) Software bug predicting
US8397104B2 (en) Creation of test plans
US20050204241A1 (en) Method and device for analyzing software error
CN112017056B (en) Intelligent double-recording method and system
CN110083514B (en) Software test defect evaluation method and device, computer equipment and storage medium
CN112199293A (en) Software quality evaluation method and device, terminal equipment and storage medium
CN115841046B (en) Accelerated degradation test data processing method and device based on wiener process
CN113837596A (en) Fault determination method and device, electronic equipment and storage medium
CN111427928A (en) Data quality detection method and device
CN114490404A (en) Test case determination method and device, electronic equipment and storage medium
CN115952081A (en) Software testing method, device, storage medium and equipment
CN113946983A (en) Method and device for evaluating weak links of product reliability and computer equipment
CN113902457B (en) Method and device for evaluating reliability of house source information, electronic equipment and storage medium
CN116881117A (en) Test case coverage rate evaluation method, device, computer equipment and storage medium
CN111858377B (en) Quality evaluation method and device for test script, electronic equipment and storage medium
CN115203025A (en) Test defect analysis method and device
CN111444093B (en) Method and device for determining quality of project development process and computer equipment
CN107402883A (en) A kind of data test treating method and apparatus
CN112612882B (en) Review report generation method, device, equipment and storage medium
CN113434408B (en) Unit test case sequencing method based on test prediction
CN112486808B (en) System testing method and device, electronic equipment and storage medium
CN114490361A (en) Test script quality obtaining method and device, computer equipment and storage medium
CN115994081A (en) Test case processing method and device, electronic equipment and storage medium
CN114816990A (en) Method for evaluating application level of automated test and related equipment
CN117873867A (en) Method, device, equipment and storage medium for generating test quality report

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination