CN110941555B - Test case recommendation method and device, computer equipment and storage medium - Google Patents
Test case recommendation method and device, computer equipment and storage medium Download PDFInfo
- Publication number
- CN110941555B CN110941555B CN201911173675.5A CN201911173675A CN110941555B CN 110941555 B CN110941555 B CN 110941555B CN 201911173675 A CN201911173675 A CN 201911173675A CN 110941555 B CN110941555 B CN 110941555B
- Authority
- CN
- China
- Prior art keywords
- test case
- code
- current
- recommendation model
- information
- 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.)
- Active
Links
- 238000012360 testing method Methods 0.000 title claims abstract description 624
- 238000000034 method Methods 0.000 title claims abstract description 51
- 230000008859 change Effects 0.000 claims abstract description 251
- 238000004590 computer program Methods 0.000 claims description 20
- 238000012545 processing Methods 0.000 claims description 6
- 238000010586 diagram Methods 0.000 description 6
- 230000008569 process Effects 0.000 description 5
- 238000013522 software testing Methods 0.000 description 4
- 230000004048 modification Effects 0.000 description 3
- 238000012986 modification Methods 0.000 description 3
- 238000013528 artificial neural network Methods 0.000 description 2
- 238000005516 engineering process Methods 0.000 description 2
- 230000001360 synchronised effect Effects 0.000 description 2
- 238000013527 convolutional neural network Methods 0.000 description 1
- 238000011161 development Methods 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 239000004973 liquid crystal related substance Substances 0.000 description 1
- 238000013507 mapping Methods 0.000 description 1
- 230000007246 mechanism Effects 0.000 description 1
- 230000000306 recurrent effect Effects 0.000 description 1
- 230000003068 static effect Effects 0.000 description 1
- 238000012549 training Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Prevention of errors by analysis, debugging or testing of software
- G06F11/3668—Testing of software
- G06F11/3672—Test management
- G06F11/3684—Test management for test design, e.g. generating new test cases
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Prevention of errors by analysis, debugging or testing of software
- G06F11/3668—Testing of software
- G06F11/3672—Test management
- G06F11/3688—Test management for test execution, e.g. scheduling of test suites
-
- Y—GENERAL 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
- Y02—TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
- Y02D—CLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
- Y02D10/00—Energy efficient computing, e.g. low power processors, power management or thermal management
Landscapes
- Engineering & Computer Science (AREA)
- Theoretical Computer Science (AREA)
- Computer Hardware Design (AREA)
- Quality & Reliability (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Debugging And Monitoring (AREA)
- Test And Diagnosis Of Digital Computers (AREA)
Abstract
The application relates to a test case recommending method, a test case recommending device, computer equipment and a storage medium. The method comprises the following steps: acquiring code change information, wherein the code change information comprises a code change file number and a code change line number; inputting the code change information into a test case recommendation model, and outputting the corresponding target test case through the test case recommendation model, wherein the test case recommendation model comprises the association relation between the test case and the change code, and the association relation is determined according to the code coverage rate information corresponding to the test case. By adopting the method, the test efficiency can be improved.
Description
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a test case recommendation method, a test case recommendation device, a computer device, and a storage medium.
Background
With the development of computer technology, more and more objects are involved in software testing, and corresponding test cases and test tools are also more and more abundant. At present, along with the iteration of the version of the tested system, thousands of test case sets of the tested system exist, however, when the tested system is changed, the changed code is usually checked manually, then the range of the code change is evaluated, and finally the corresponding test case is output, however, the software test efficiency is easy to be low by the mode of checking the changed code manually.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a test case recommendation method, apparatus, computer device, and storage medium that can improve software testing efficiency.
A test case recommendation method, the method comprising:
acquiring code change information, wherein the code change information comprises a code change file number and a code change line number;
inputting the code change information into a test case recommendation model, and outputting the corresponding target test case through the test case recommendation model, wherein the test case recommendation model comprises the association relation between the test case and the change code, and the association relation is determined according to the code coverage rate information corresponding to the test case.
In one embodiment, the test case recommendation method further includes: acquiring a current test case set, wherein the current test case set comprises at least one current test case; executing the current test case in the current test case set through an automatic test case system to obtain current code coverage rate information corresponding to the current test case set; acquiring forward code coverage information corresponding to a current test case set; determining a code change file number and a code change line number according to the forward code coverage information and the current code coverage information to obtain current code change information; establishing an association relation between a current test case and current code change information in a current test case set; and generating a test case recommendation model according to the association relation between each current test case in the current test case set and the current code change information.
In one embodiment, the test case recommendation method further includes: acquiring a preset time interval; and acquiring a next test case set according to a preset time interval, taking the next test case set as a current test case set, returning to the step of executing the current test case in the current test case set through the automatic test case system, updating the test case recommendation model, and obtaining an updated test case recommendation model.
In one embodiment, the test case recommendation method further includes: when the test case recommendation model fails to output the target test case corresponding to the code change information, acquiring a change test case set corresponding to the code change information; executing the change test case set through an automatic test case system to obtain corresponding change coverage rate information; and updating the test case recommendation model according to the change coverage rate information to obtain an updated test case recommendation model.
In one embodiment, the test case recommendation method further includes: executing the target test case to obtain corresponding target test case operation information; when the operation information of the target test case meets the preset operation condition, the target test case is determined to be the recommended test case, otherwise, the target test case is determined to be the non-recommended test case.
A test case recommending apparatus, the apparatus comprising:
the code change information acquisition module is used for acquiring code change information, wherein the code change information comprises a code change file number and a code change line number;
the test case recommendation model processing module is used for inputting code change information into the test case recommendation model, and outputting the code change information to obtain a corresponding target test case through the test case recommendation model, wherein the test case recommendation model comprises an incidence relation between the test case and the changed code, and the incidence relation is obtained through determination according to code coverage rate information corresponding to the test case.
A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the steps of:
acquiring code change information, wherein the code change information comprises a code change file number and a code change line number;
inputting the code change information into a test case recommendation model, and outputting the corresponding target test case through the test case recommendation model, wherein the test case recommendation model comprises the association relation between the test case and the change code, and the association relation is determined according to the code coverage rate information corresponding to the test case.
A computer readable storage medium having stored thereon a computer program which when executed by a processor performs the steps of:
acquiring code change information, wherein the code change information comprises a code change file number and a code change line number;
inputting the code change information into a test case recommendation model, and outputting the corresponding target test case through the test case recommendation model, wherein the test case recommendation model comprises the association relation between the test case and the change code, and the association relation is determined according to the code coverage rate information corresponding to the test case.
The test case recommending method, the device, the computer equipment and the storage medium acquire code change information, wherein the code change information comprises a code change file number and a code change line number; inputting the code change information into a test case recommendation model, and outputting the corresponding target test case through the test case recommendation model, wherein the test case recommendation model comprises the association relation between the test case and the change code, and the association relation is determined according to the code coverage rate information corresponding to the test case.
Therefore, the test case recommendation model comprises the association relation between the test case and the changed code, the association relation is determined according to the code coverage rate information corresponding to the test case, when the test case recommendation model acquires the code change information, the corresponding target test case can be quickly and accurately acquired according to the association relation, the code change information can be acquired through a code snapshot, manual participation is not needed in the whole process, and the test efficiency is improved.
Drawings
FIG. 1 is an application environment diagram of a test case recommendation method in one embodiment;
FIG. 2 is a flow chart of a test case recommendation method in one embodiment;
FIG. 3 is a flowchart of a test case recommendation method according to another embodiment;
FIG. 4 is a flowchart of a test case recommendation method according to another embodiment;
FIG. 5 is a flow chart of a test case recommendation method in yet another embodiment;
FIG. 6 is a flow chart of a test case recommendation method in one embodiment;
FIG. 7 is a block diagram of a test case recommending apparatus in one embodiment;
FIG. 8 is a block diagram of a test case recommending apparatus in another embodiment;
FIG. 9 is a block diagram of a test case recommending apparatus in yet another embodiment;
fig. 10 is an internal structural view of a computer device in one embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application will be further described in detail with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the present application.
The test case recommendation method provided by 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 terminal 102 may be, but not limited to, various personal computers, notebook computers, smartphones, tablet computers, and portable wearable devices, and the server 104 may be implemented by a stand-alone server or a server cluster composed of a plurality of servers.
Specifically, the terminal 102 obtains code change information, where the code change information includes a code change file number and a code change line number, sends the code change information to the server 104, and the server 104 inputs the code change information into a test case recommendation model, and outputs the test case recommendation model to obtain a corresponding target test case, where the test case recommendation model includes an association relationship between the test case and the change code, and the association relationship is determined according to code coverage information corresponding to the test case. Further, the server 104 sends the target test case to the terminal 102, so that the tester of the terminal 102 can execute the target test case.
In one embodiment, as shown in fig. 2, a test case recommendation method is provided, and the method is applied to the terminal or the server in fig. 1 for illustration, and includes the following steps:
step 202, code change information is obtained, wherein the code change information comprises a code change file number and a code change line number.
The code change information is information related to the change of the code, and includes a code change part and a code change file number corresponding to the code change part, wherein the code change part includes a code change line number. The code change file number is used for identifying the code file where the code change part is located, and the code change line number is used for identifying the code line information where the code change department is located.
Specifically, when the tested system generates version iteration or code change, the terminal or the server can acquire the code change file number and the code change line number of the code change. The code change information can be obtained by acquiring the code change file number and the code change line number through the code snapshot, wherein the code snapshot is used for recording the code file and the code, and the code file number and the code line number which are changed can be quickly found through the code snapshot.
And 204, inputting code change information into a test case recommendation model, and outputting through the test case recommendation model to obtain a corresponding target test case, wherein the test case recommendation model comprises an association relation between the test case and the change code, and the association relation is obtained according to code coverage rate information corresponding to the test case.
The test case recommendation model is used for predicting the test case corresponding to the code change information, and may be a neural network, a recurrent neural network, a convolutional neural network, and the like. The test case recommendation model can be obtained by training a large number of test case sets in advance, and the trained test case recommendation model is used. The test case recommendation model comprises an association relation between a test case and a change Code, the change Code is the changed Code, the association relation between the test case and the change Code is determined and obtained according to Code coverage information corresponding to the test case, the Code coverage information is also called Code coverage (Code coverage), and the Code coverage information is a measure in software testing and describes the proportion and degree of tested source codes in the program. The code coverage rate is high, no risk is represented, but if the code coverage rate is low, the sufficiency of the test is insufficient, a larger risk exists objectively, and the code coverage rate needs to be improved.
The test case recommendation model specifically may be that a current test case set is obtained, current code change information is obtained through determination of current code coverage information and forward code coverage information corresponding to the current test case set, an association relationship between the current code change information and the current test case set is built, and finally the test case recommendation model is obtained according to the association relationship. That is, the test case recommendation model includes a mapping relation between the test case and the change code, and the corresponding test case can be obtained by the input change code.
Specifically, after code change information is acquired, the terminal or the server takes the code change information as input of a test case recommendation model, after the test case recommendation model acquires the code change information, the test case recommendation model is matched according to a code change file number and a code change line number in the code change information, after the corresponding test case is matched, a target test case corresponding to the code change information is output, otherwise, after the corresponding test case is not matched, the fact that the corresponding test case does not exist in the test case recommendation model is indicated, the test case recommendation model needs to be updated again, specifically, a change test case set corresponding to the code change information is acquired, the test case recommendation model is updated according to change coverage rate information by acquiring change coverage rate information corresponding to acquire the updated test case recommendation model. That is, the updated test case recommendation model has a wider prediction range than the test case recommendation model before updating, and has more test cases, higher accuracy and higher test efficiency.
In the test case recommending method, code changing information is obtained, wherein the code changing information comprises a code changing file number and a code changing line number; inputting the code change information into a test case recommendation model, and outputting the corresponding target test case through the test case recommendation model, wherein the test case recommendation model comprises the association relation between the test case and the change code, and the association relation is determined according to the code coverage rate information corresponding to the test case.
Therefore, the test case recommendation model comprises the association relation between the test case and the changed code, the association relation is determined according to the code coverage rate information corresponding to the test case, when the test case recommendation model acquires the code change information, the corresponding target test case can be quickly and accurately acquired according to the association relation, the code change information can be acquired through a code snapshot, manual participation is not needed in the whole process, and the test efficiency is improved.
In one embodiment, as shown in fig. 3, the test case recommendation method further includes:
step 302, a current test case set is obtained, where the current test case set includes at least one current test case.
And step 304, executing the current test case in the current test case set through an automatic test case system to obtain the current code coverage information corresponding to the current test case set.
The current test case set refers to a test case set currently being used for processing, and the test case set comprises at least one current test case. Likewise, the current test case is the test case currently being used for processing. The current test case set is a test case set used for building a test case recommendation model. Specifically, the terminal or the server may collect all test cases, and use all collected test cases as current test cases to form a current test case set. When the terminal or the server collects test cases, the terminal or the server can collect the test cases corresponding to different scenes, and the test cases corresponding to the same scene are classified into one set to form one test case set. At this time, the current test case set may acquire a corresponding test case set according to an actual service scenario, and the acquired test case set is used as the current test case set. That is, the current test cases in the current test case set all belong to the same scene at this time.
The automatic test case system is used for automatically executing test cases and acquiring Code coverage information generated in the execution process of the test cases, and the Code coverage information is also called Code coverage (Code coverage), is a measure in software testing and describes the proportion and degree of tested source codes in a program. The code coverage rate is high, no risk is represented, but if the code coverage rate is low, the sufficiency of the test is insufficient, a larger risk exists objectively, and the code coverage rate needs to be improved. That is, the automated test case system generates code coverage information corresponding to each test case during execution of the test case.
Specifically, the terminal or the server acquires a current test case set, wherein the current test case set comprises at least one current test case, the current test cases in the current test case set are automatically executed through an automatic test case system, current code coverage rate information corresponding to each current test case is generated when the automatic test case system executes the current test cases, the current code coverage rate information corresponding to each current test case is acquired, and the current code coverage rate information corresponding to each current test case in the current test case set is obtained.
Step 306, obtaining the forward code coverage information corresponding to the current test case set.
Step 308, determining the code change file number and the code change line number according to the forward code coverage information and the current code coverage information, and obtaining the current code change information.
The forward code coverage information is code coverage information generated when the current test case is executed last time in the current test case set, the corresponding code coverage information is generated when the test case is executed each time, and the terminal or the server stores the code coverage information generated when the test case is executed each time.
Further, after the forward code coverage information corresponding to the current test case set is obtained, the code change file number and the code change line number can be determined according to the forward code coverage information and the current code coverage information, and the corresponding current code change information is formed by the code change file number and the code change line number. The method specifically may be that the forward code coverage rate information and the current code coverage rate information are subtracted to obtain a corresponding change file number and a code change line number, that is, the current code change information. Or, the forward code coverage rate information and the current code coverage rate information are compared, and the code file number and the code which are different from each other are used as a change file number and a code change line number.
Step 310, an association relationship between the current test case and the current code change information in the current test case set is established.
Step 312, generating a test case recommendation model according to the association relation between each current test case in the current test case set and the current code change information.
Specifically, after the current code change information is obtained, an association relationship between the current test case and the corresponding current code change information in the current test case set is established, the association relationship between the current test case and the corresponding current code change information is unique, the corresponding current test case can be obtained through the current code change information, and similarly, the corresponding current code change information can be obtained through the current test case. Further, after the association relationship between the current test case and the current code change information is obtained, a test case recommendation model can be established according to the association relationship. That is, the test case recommendation model includes a relation between the test case and the code change information, and when the code is submitted to the test case recommendation model, the test case recommendation model can quickly obtain the test case corresponding to the submitted code through accurate matching of the association relation between the test case and the code change information.
In one embodiment, as shown in fig. 4, the test case recommendation method further includes:
step 402, a preset time interval is acquired.
Step 404, obtaining a next test case set according to a preset time interval, taking the next test case set as a current test case set, returning to the step of executing the current test case in the current test case set through the automatic test case system, updating the test case recommendation model, and obtaining an updated test case recommendation model.
The preset time interval is preset to update the test case set, and can be specifically set according to product requirements or service scenes, which is equivalent to setting a timing mechanism or a timer. Specifically, a preset time interval for updating the test case set is preset, once the preset time interval is reached, a next test case set is automatically acquired, the next test case set is used as a current test case set, the current test case step in the current test case set is executed through an automatic test case system, a test case recommendation model is updated, and the updated test case recommendation model is obtained. At this time, the test case recommendation model is continuously updated, so that the range of the test case in the test case recommendation model is larger, and the recommendation accuracy of the test case is improved.
Specifically, a preset time interval is acquired, when the preset time interval is met, the terminal or the server can acquire all new test cases to form a next test case set, the test case recommendation model is continuously updated through the next test case set, and the recommendation accuracy of the test case recommendation model is improved. Specifically, the next test case set is taken as a current test case set, the current test case step in the current test case set is executed through an automatic test case system, the current code coverage rate and the forward code coverage rate corresponding to the current test case set are obtained again, corresponding current code change information is obtained through the obtained current code coverage rate and the forward code coverage rate again, the association relation between the current code change information and the current test case set is established again, the test case recommendation model is updated, and the updated test case recommendation model is obtained. By the method for continuously updating the test case recommendation model, the recommendation accuracy of the test case recommendation model and the recommendation range of the test case can be improved.
In one embodiment, as shown in fig. 5, the test case recommendation method further includes:
Step 502, when the test case recommendation model fails to output the target test case corresponding to the code change information, acquiring a change test case set corresponding to the code change information.
And step 504, executing the change test case set through the automatic test case system to obtain corresponding change coverage rate information.
And step 506, updating the test case recommendation model according to the change coverage rate information to obtain an updated test case recommendation model.
When the test case recommendation model fails to output the target test case corresponding to the code change information, the code change information indicates that the change code corresponding to the code change information is a newly added function, and the test case corresponding to the change code does not exist in the test case recommendation model, so that the test case recommendation model needs to be updated.
Specifically, the changing test case set corresponding to the code changing information is obtained, the test cases can be manually added according to the code changing information, or the corresponding test cases are matched from all collected test cases according to the code changing information, and the test cases corresponding to the code changing information are used as changing test cases to form the changing test case set.
Further, all the change test cases in the change test case set are automatically executed by the automatic test case system, and corresponding change coverage rate information is collected and obtained when the self-customized test case system executes the change test cases. And finally, updating the test case recommendation model through changing the coverage rate information to obtain an updated test case recommendation model. Specifically, a preset coverage rate condition is obtained, and when the change coverage rate information meets the preset coverage rate condition, an association relationship between the test case corresponding to the change coverage rate information and the code change information can be established, namely, a test case recommendation model is updated. Otherwise, when the change coverage rate information does not meet the preset coverage rate condition, the change test case is not met, and the change test case corresponding to the change coverage rate information is discarded.
In one embodiment, as shown in fig. 6, the test case recommending method further includes:
step 602, executing the target test case to obtain corresponding running information of the target test case.
Step 604, when the operation information of the target test case meets the preset operation condition, determining the target test case as a recommended test case, otherwise, determining the target test case as a non-recommended test case.
Specifically, after the target test case output by the test case recommendation model is obtained, the target test case is executed, and corresponding target test case operation information is generated in the execution process of the target test case. The target test case operation information is information related to the generation of the target test case in the execution process. Furthermore, whether the target test case can be used as a recommended test case can be judged according to the target test case operation information corresponding to the target test case, wherein the recommended test case refers to a test case which can be recommended to a tester or other personnel needing the test case, and for the tester or other personnel, the recommended test case is more accurate than the target test case, and the recommended test case can improve the test efficiency and reduce the workload of the tester.
The method comprises the steps of judging whether the target test case can be used as a recommended test case or not, specifically, acquiring preset operation conditions, wherein the preset operation conditions are preset conditions for judging whether the target test case can be used as the recommended test case or not, and the conditions can be customized, and the customization can be obtained by setting according to actual service requirements or actual application scenes. And then judging whether the running information of the target test case meets the preset running conditions or not, and if the running information of the target test case meets the preset running conditions, indicating that the target test case meets the test conditions and being used as a recommended test case. Otherwise, if the running information of the target test case does not meet the preset running condition, the target test case is not in accordance with the test condition, and the target test case cannot be used as a recommended test case and is used as a non-recommended test case, wherein the non-recommended test case refers to a test case which is not recommended to a tester or other people needing the test case. Further, to prevent occupying the storage space of the terminal or server, non-recommended test cases may be discarded.
In a specific embodiment, a test case recommendation method is provided, which specifically includes the following steps:
1. the method comprises the steps of obtaining a current test case set, wherein the current test case set comprises at least one current test case.
2. And executing the current test case in the current test case set through an automatic test case system to obtain the current code coverage rate information corresponding to the current test case set.
3. And acquiring forward code coverage rate information corresponding to the current test case set.
4. And determining a code change file number and a code change line number according to the forward code coverage information and the current code coverage information to obtain the current code change information.
5. And establishing an association relation between the current test case and the current code change information in the current test case set.
6. And generating a test case recommendation model according to the association relation between each current test case in the current test case set and the current code change information.
7. And acquiring a preset time interval.
8. And acquiring a next test case set according to a preset time interval, taking the next test case set as a current test case set, returning to the step of executing the current test case in the current test case set through the automatic test case system, updating the test case recommendation model, and obtaining an updated test case recommendation model.
9. Code change information is acquired, the code change information comprising a code change file number and a code change line number.
10. Inputting the code change information into a test case recommendation model, and outputting the corresponding target test case through the test case recommendation model, wherein the test case recommendation model comprises the association relation between the test case and the change code, and the association relation is determined according to the code coverage rate information corresponding to the test case.
11. And when the test case recommendation model fails to output the target test case corresponding to the code change information, acquiring a change test case set corresponding to the code change information.
12. And executing the change test case set through the automatic test case system to obtain corresponding change coverage rate information.
13. And updating the test case recommendation model according to the change coverage rate information to obtain an updated test case recommendation model.
14. And executing the target test case to obtain corresponding target test case operation information.
15. When the operation information of the target test case meets the preset operation condition, the target test case is determined to be the recommended test case, otherwise, the target test case is determined to be the non-recommended test case.
It should be understood that, although the steps in the above-described flowcharts are shown in order as indicated by the arrows, these steps are not necessarily performed in order as 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 above may include a plurality of sub-steps or stages that are not necessarily performed at the same time, but may be performed at different times, and the order of execution of the sub-steps or stages is not necessarily sequential, but may be performed alternately or alternately with at least a part of the sub-steps or stages of other steps or other steps.
In one embodiment, as shown in fig. 7, there is provided a test case recommending apparatus 700, including: a code change information acquisition module 702 and a test case recommendation model processing module 704, wherein:
the code change information obtaining module 702 is configured to obtain code change information, where the code change information includes a code change file number and a code change line number.
The test case recommendation model processing module 704 is configured to input code change information into a test case recommendation model, and obtain a corresponding target test case through output of the test case recommendation model, where the test case recommendation model includes an association relationship between the test case and the changed code, and the association relationship is determined according to code coverage information corresponding to the test case.
In one embodiment, as shown in fig. 8, the test case recommendation apparatus 700 further includes:
the test case set obtaining module 802 is configured to obtain a current test case set, where the current test case set includes at least one current test case.
The test case execution module 804 is configured to execute the current test case in the current test case set through the automated test case system, so as to obtain current code coverage information corresponding to the current test case set.
The code coverage information obtaining module 806 is configured to obtain forward code coverage information corresponding to the current test case set.
The code change information obtaining module 808 is configured to determine a code change file number and a code change line number according to the forward code coverage information and the current code coverage information, so as to obtain current code change information.
The association relation establishing module 810 is configured to establish an association relation between a current test case and current code change information in the current test case set.
The test case recommendation model generating module 812 is configured to generate a test case recommendation model according to the association relationship between each current test case in the current test case set and the current code change information.
In one embodiment, as shown in fig. 9, the test case recommending apparatus 700 further includes:
a time interval acquisition module 902, configured to acquire a preset time interval.
The test case recommendation model updating module 904 is configured to obtain a next test case set according to a preset time interval, use the next test case set as a current test case set, return to executing a current test case step in the current test case set by the automated test case system, update the test case recommendation model, and obtain an updated test case recommendation model.
In one embodiment, the test case recommendation device 700 is further configured to obtain a modified test case set corresponding to the code modification information when the test case recommendation model fails to output the target test case corresponding to the code modification information; executing the change test case set through an automatic test case system to obtain corresponding change coverage rate information; and updating the test case recommendation model according to the change coverage rate information to obtain an updated test case recommendation model.
In one embodiment, the test case recommendation device 700 is further configured to execute a target test case to obtain corresponding target test case operation information; when the operation information of the target test case meets the preset operation condition, the target test case is determined to be the recommended test case, otherwise, the target test case is determined to be the non-recommended test case. The specific limitation of the test case recommendation device can be referred to the limitation of the test case recommendation method, and is not described herein. The above-described respective modules in the test case recommending apparatus may be implemented in whole or in part by software, hardware, and 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.
FIG. 10 illustrates an internal block diagram of a computer device in one embodiment. The computer device may be specifically the terminal 102 or the server 104 in fig. 1. As shown in fig. 10, the computer device includes a processor, a memory, a network interface, an input device, and a display screen connected by a system bus. The memory includes a nonvolatile storage medium and an internal memory. The non-volatile storage medium of the computer device stores an operating system, and may also store a computer program that, when executed by the processor, causes the processor to implement a test case recommendation method. The internal memory may also store a computer program that, when executed by the processor, causes the processor to perform the test case recommendation method. The display screen of the computer equipment can be a liquid crystal display screen or an electronic ink display screen, the input device of the computer equipment can be a touch layer covered on the display screen, can also be keys, a track ball or a touch pad arranged on the shell of the computer equipment, and can also be an external keyboard, a touch pad or a mouse and the like.
It will be appreciated by those skilled in the art that the structure shown in fig. 10 is merely a block diagram of some of the structures associated with the present application and is not limiting of the computer device to which the present application may be applied, and that a particular computer device may include more or fewer components than shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, a computer device is provided comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, the processor implementing the steps of when executing the computer program: acquiring code change information, wherein the code change information comprises a code change file number and a code change line number; inputting the code change information into a test case recommendation model, and outputting the corresponding target test case through the test case recommendation model, wherein the test case recommendation model comprises the association relation between the test case and the change code, and the association relation is determined according to the code coverage rate information corresponding to the test case.
In one embodiment, the processor when executing the computer program further performs the steps of: acquiring a current test case set, wherein the current test case set comprises at least one current test case; executing the current test case in the current test case set through an automatic test case system to obtain current code coverage rate information corresponding to the current test case set; acquiring forward code coverage information corresponding to a current test case set; determining a code change file number and a code change line number according to the forward code coverage information and the current code coverage information to obtain current code change information; establishing an association relation between a current test case and current code change information in a current test case set; and generating a test case recommendation model according to the association relation between each current test case in the current test case set and the current code change information.
In one embodiment, the processor when executing the computer program further performs the steps of: acquiring a preset time interval; and acquiring a next test case set according to a preset time interval, taking the next test case set as a current test case set, returning to the step of executing the current test case in the current test case set through the automatic test case system, updating the test case recommendation model, and obtaining an updated test case recommendation model.
In one embodiment, the processor when executing the computer program further performs the steps of: when the test case recommendation model fails to output the target test case corresponding to the code change information, acquiring a change test case set corresponding to the code change information; executing the change test case set through an automatic test case system to obtain corresponding change coverage rate information; and updating the test case recommendation model according to the change coverage rate information to obtain an updated test case recommendation model.
In one embodiment, the processor when executing the computer program further performs the steps of: executing the target test case to obtain corresponding target test case operation information; when the operation information of the target test case meets the preset operation condition, the target test case is determined to be the recommended test case, otherwise, the target test case is determined to be the non-recommended test case.
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 code change information, wherein the code change information comprises a code change file number and a code change line number; inputting the code change information into a test case recommendation model, and outputting the corresponding target test case through the test case recommendation model, wherein the test case recommendation model comprises the association relation between the test case and the change code, and the association relation is determined according to the code coverage rate information corresponding to the test case.
In one embodiment, the processor when executing the computer program further performs the steps of: acquiring a current test case set, wherein the current test case set comprises at least one current test case; executing the current test case in the current test case set through an automatic test case system to obtain current code coverage rate information corresponding to the current test case set; acquiring forward code coverage information corresponding to a current test case set; determining a code change file number and a code change line number according to the forward code coverage information and the current code coverage information to obtain current code change information; establishing an association relation between a current test case and current code change information in a current test case set; and generating a test case recommendation model according to the association relation between each current test case in the current test case set and the current code change information.
In one embodiment, the processor when executing the computer program further performs the steps of: acquiring a preset time interval; and acquiring a next test case set according to a preset time interval, taking the next test case set as a current test case set, returning to the step of executing the current test case in the current test case set through the automatic test case system, updating the test case recommendation model, and obtaining an updated test case recommendation model.
In one embodiment, the processor when executing the computer program further performs the steps of: when the test case recommendation model fails to output the target test case corresponding to the code change information, acquiring a change test case set corresponding to the code change information; executing the change test case set through an automatic test case system to obtain corresponding change coverage rate information; and updating the test case recommendation model according to the change coverage rate information to obtain an updated test case recommendation model.
In one embodiment, the processor when executing the computer program further performs the steps of: executing the target test case to obtain corresponding target test case operation information; when the operation information of the target test case meets the preset operation condition, the target test case is determined to be the recommended test case, otherwise, the target test case is determined to be the non-recommended test case.
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, storage, database, or other medium used in the various embodiments provided herein may include non-volatile and/or volatile memory. The nonvolatile memory can include Read Only Memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double Data Rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous Link DRAM (SLDRAM), memory bus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), among others.
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 above examples merely represent a few embodiments of the present application, which are described in more detail and are not to be construed as limiting the scope of the invention. It should be noted that it would be apparent to those skilled in the art that various modifications and improvements could be made without departing from the spirit of the present application, which would be within the scope of the present application. Accordingly, the scope of protection of the present application is to be determined by the claims appended hereto.
Claims (7)
1. A test case recommendation method, the method comprising:
acquiring code change information through a code snapshot, wherein the code change information comprises a code change file number and a code change line number, and the code snapshot is used for recording a code file and a code;
inputting the code change information into a test case recommendation model, and outputting the code change information through the test case recommendation model to obtain a corresponding target test case, wherein the test case recommendation model comprises an association relation between the test case and a change code, and the association relation is determined according to code coverage rate information corresponding to the test case;
Executing the target test case to obtain corresponding target test case operation information;
when the target test case operation information meets preset operation conditions, determining the target test case as a recommended test case, otherwise, determining the target test case as a non-recommended test case; the test case recommendation model generation step comprises the following steps:
acquiring a current test case set, wherein the current test case set comprises at least one current test case;
executing the current test cases in the current test case set through an automatic test case system to obtain current code coverage information corresponding to the current test case set;
acquiring forward code coverage information corresponding to the current test case set;
determining a code change file number and a code change line number according to the forward code coverage information and the current code coverage information to obtain current code change information;
establishing an association relation between the current test case and the current code change information in the current test case set;
and generating the test case recommendation model according to the association relation between each current test case in the current test case set and the current code change information.
2. The method according to claim 1, wherein the method further comprises:
acquiring a preset time interval;
and acquiring a next test case set according to the preset time interval, taking the next test case set as the current test case set, returning to the step of executing the current test case in the current test case set by the automatic test case system, updating the test case recommendation model, and obtaining an updated test case recommendation model.
3. The method according to claim 1, wherein the method further comprises:
when the test case recommendation model fails to output the target test case corresponding to the code change information, acquiring a change test case set corresponding to the code change information;
executing the change test case set through an automatic test case system to obtain corresponding change coverage rate information;
and updating the test case recommendation model according to the change coverage rate information to obtain an updated test case recommendation model.
4. A test case recommendation apparatus, the apparatus comprising:
the code change information acquisition module is used for acquiring code change information through a code snapshot, wherein the code change information comprises a code change file number and a code change line number, and the code snapshot is used for recording a code file and a code;
The test case recommendation model processing module is used for inputting the code change information into a test case recommendation model, outputting the code change information into the test case recommendation model to obtain a corresponding target test case through the test case recommendation model, wherein the test case recommendation model comprises an incidence relation between the test case and a change code, the incidence relation is determined according to code coverage rate information corresponding to the test case, the target test case is executed to obtain corresponding target test case operation information, when the target test case operation information meets preset operation conditions, the target test case is determined to be used as a recommended test case, and otherwise, the target test case is determined to be used as a non-recommended test case; the apparatus further comprises:
the test case set acquisition module is used for acquiring a current test case set, wherein the current test case set comprises at least one current test case;
the test case execution module is used for executing the current test case in the current test case set through an automatic test case system to obtain the current code coverage rate information corresponding to the current test case set;
The code coverage rate information acquisition module is used for acquiring forward code coverage rate information corresponding to the current test case set;
the code change information acquisition module is used for determining a code change file number and a code change line number according to the forward code coverage rate information and the current code coverage rate information to obtain current code change information;
the incidence relation establishing module is used for establishing an incidence relation between the current test case in the current test case set and the current code change information;
and the test case recommendation model generation module is used for generating the test case recommendation model according to the association relation between each current test case in the current test case set and the current code change information.
5. The apparatus of claim 4, wherein the apparatus further comprises:
the time interval acquisition module is used for acquiring a preset time interval;
the test case recommendation model updating module is used for acquiring a next test case set according to the preset time interval, taking the next test case set as the current test case set, returning to the step of executing the current test case in the current test case set through the automatic test case system, updating the test case recommendation model and obtaining an updated test case recommendation model.
6. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the steps of the method according to any one of claims 1 to 3 when the computer program is executed by the processor.
7. 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 3.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911173675.5A CN110941555B (en) | 2019-11-26 | 2019-11-26 | Test case recommendation method and device, computer equipment and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201911173675.5A CN110941555B (en) | 2019-11-26 | 2019-11-26 | Test case recommendation method and device, computer equipment and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110941555A CN110941555A (en) | 2020-03-31 |
CN110941555B true CN110941555B (en) | 2023-07-28 |
Family
ID=69908141
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201911173675.5A Active CN110941555B (en) | 2019-11-26 | 2019-11-26 | Test case recommendation method and device, computer equipment and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110941555B (en) |
Families Citing this family (9)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN111782516A (en) * | 2020-06-24 | 2020-10-16 | Oppo广东移动通信有限公司 | Code testing method and device and storage medium |
CN112052160B (en) * | 2020-08-06 | 2024-09-06 | 中信银行股份有限公司 | Code use case acquisition method and device, electronic equipment and medium |
CN112256556A (en) * | 2020-09-11 | 2021-01-22 | 上海汇付数据服务有限公司 | Test method and test device using test case |
CN112395203B (en) * | 2020-11-30 | 2024-06-14 | 京东科技控股股份有限公司 | Program testing method, device and storage medium |
CN113127338A (en) * | 2021-03-22 | 2021-07-16 | 四川锐明智通科技有限公司 | Firmware testing method, server and computer readable storage medium |
CN113704094B (en) * | 2021-08-06 | 2024-10-22 | 北京城市网邻信息技术有限公司 | Test case knowledge base construction method and device, electronic equipment and storage medium |
CN113704103B (en) * | 2021-08-24 | 2023-08-04 | 网易(杭州)网络有限公司 | Test case recommendation method and device, medium and electronic equipment |
CN113760769B (en) * | 2021-09-13 | 2023-11-07 | 北京百度网讯科技有限公司 | Test case processing method and device, electronic equipment and storage medium |
CN118445214B (en) * | 2024-07-08 | 2024-08-30 | 英诺达(成都)电子科技有限公司 | Code file modification-based method, device, equipment, medium and product for obtaining measurement |
Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107423214A (en) * | 2017-04-18 | 2017-12-01 | 恒生电子股份有限公司 | Software regression testing use-case acquisition methods, device and storage medium and electronic equipment |
CN110489321A (en) * | 2019-07-08 | 2019-11-22 | 平安科技(深圳)有限公司 | Test case screening technique, device, computer equipment and storage medium |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN106557413A (en) * | 2015-09-25 | 2017-04-05 | 伊姆西公司 | Based on the method and apparatus that code coverage obtains test case |
-
2019
- 2019-11-26 CN CN201911173675.5A patent/CN110941555B/en active Active
Patent Citations (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107423214A (en) * | 2017-04-18 | 2017-12-01 | 恒生电子股份有限公司 | Software regression testing use-case acquisition methods, device and storage medium and electronic equipment |
CN110489321A (en) * | 2019-07-08 | 2019-11-22 | 平安科技(深圳)有限公司 | Test case screening technique, device, computer equipment and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN110941555A (en) | 2020-03-31 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110941555B (en) | Test case recommendation method and device, computer equipment and storage medium | |
CN112884092B (en) | AI model generation method, electronic device, and storage medium | |
CN108492005B (en) | Project data processing method and device, computer equipment and storage medium | |
CN108874661B (en) | Test mapping relation library generation method and device, computer equipment and storage medium | |
CN111240905B (en) | Screen projection diagnosis method, device, system, storage medium and equipment | |
CN109766261B (en) | Coverage test method, coverage test device, computer equipment and storage medium | |
CN109377388B (en) | Medical insurance application method, medical insurance application device, computer equipment and storage medium | |
CN111026647B (en) | Method and device for acquiring code coverage rate, computer equipment and storage medium | |
CN111104644A (en) | Reliability evaluation method and device, computer equipment and storage medium | |
CN113946986A (en) | Method and device for evaluating average time before product failure based on accelerated degradation test | |
CN116227240B (en) | Product life evaluation method, device and equipment based on comprehensive stress acceleration test | |
CN112637008B (en) | Link simulation test method, device, system, computer equipment and storage medium | |
CN109542962B (en) | Data processing method, data processing device, computer equipment and storage medium | |
CN113419950A (en) | Method and device for generating UI automation script, computer equipment and storage medium | |
CN114549849A (en) | Image recognition method and device, computer equipment and storage medium | |
CN115795920A (en) | Product reliability evaluation method and device based on multi-stress coupling acceleration model | |
CN114138634B (en) | Test case selection method and device, computer equipment and storage medium | |
CN111209111A (en) | Resource allocation method, device, equipment and storage medium based on block chain system | |
CN110232018A (en) | Interface test method, device, computer equipment | |
CN110874612B (en) | Time interval prediction method and device, computer equipment and storage medium | |
CN111210105B (en) | Continuous operation performance verification, apparatus, computer device, and storage medium | |
CN111141981B (en) | Line loss point inspection method and device, computer equipment and storage medium | |
CN115169155A (en) | Engine fault prediction method and device, computer equipment and storage medium | |
CN114490361A (en) | Test script quality obtaining method and device, computer equipment and storage medium | |
CN110704218B (en) | Data processing method, data processing device, computer equipment and storage medium |
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 | ||
GR01 | Patent grant | ||
GR01 | Patent grant |