Regression test case knowledge base maintenance, regression test case recommendation method and system

By constructing a regression test case knowledge base, changes in the test case knowledge base are automatically identified and updated. By combining methods and branch statements to locate test cases, the problems of inaccurate regression test case recommendations and large workload in existing technologies are solved, achieving accurate recommendations and efficient testing.

CN116107906BActive Publication Date: 2025-12-19BEIJING MOMO INFORMATION TECHNOLOGY CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202310189177.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-02
Publication Date
2025-12-19
Estimated Expiration
2043-03-02

AI Technical Summary

Technical Problem

Existing regression test case recommendation tools recommend a massive number of historical functional test cases when faced with changes to a single project, which increases the workload of test staff and reduces accuracy due to untimely database maintenance, increasing the probability of test errors.

Method used

By building a regression test case knowledge base, changes in the test case knowledge base are automatically identified and updated. By combining methods and branch statements to locate test cases, the number of recommendations is reduced and the accuracy is improved.

Benefits of technology

It enables accurate recommendation of regression test cases during software version iteration, reducing manpower waste, improving test accuracy, preventing missed tests, and reducing test costs.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116107906B_ABST
    Figure CN116107906B_ABST
Patent Text Reader

Abstract

The present application relates to regression test case knowledge base maintenance, regression test case recommendation method and system. In maintenance, according to the first change and / or second change, build to be changed data element, store in to be changed collection;Get the to-be-changed data element in the to-be-changed collection, and the update position of the regression test case knowledge base is located according to the to-be-changed data element obtained;Update the regression test case knowledge base. In recommendation, the method and branch statement affected by code change are obtained, and the change collection is constructed;Match the first candidate object set from the regression test case knowledge base based on the change collection;The regression test case corresponding to each candidate object in the first candidate object set is extracted as the recommended case. The present application guarantees the correctness of the stored data element, and accurately locates the smaller order of magnitude regression test case range based on branch and statement in branch, reduces the manpower waste in the test process.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of software testing, in particular to a regression test case knowledge base maintenance and regression test case recommendation method and system. BACKGROUND

[0002] Regression testing needs to use a large number of test cases to test the unreleased software version, to confirm whether the modification introduces other errors or makes other codes new errors, and the number of test cases directly affects the workload of regression testing. Automatically recommending test cases can avoid testers manually selecting a large number of test cases for the functions to be tested, thereby reducing the workload of testers. Due to the increasing frequency of software version updates, in order to reduce the workload and test time of regression testing, how to further reduce the number of test cases of regression testing has become a hot spot of attention.

[0003] In the prior art, there are many tools that obtain the code lines corresponding to the function test cases through coverage, and then infer the regression range of the test cases through the modified code, in order to obtain accurate test cases. The above-mentioned test case recommendation tools already exist in the prior art, which obtain the correspondence between the test cases and the code lines through historical records, store them in a database, and query the database to obtain the test cases to be tested when automatically recommending regression test cases. However, if the code of a single project change modifies a method with high reusability, the above-mentioned tool will recommend a large number of historical function test cases, thereby increasing the workload of testers. In addition, if the test case database is not updated in time after the function of the test case is changed, the database will become inaccurate. After a long time of code changes, the credibility of the test case database will decrease, and the database needs to be constantly re-associated with the test cases and the code, which consumes a lot of manpower for maintenance. If the database is not updated, the automatic recommendation of regression test cases will easily recommend inappropriate test cases, which increases the error probability in the test process and increases the workload of testers. SUMMARY

[0004] To solve the technical problems of the prior art that the number of recommended regression test cases is large and the test case database lacks automatic maintenance, the present application provides a regression test case knowledge base maintenance and regression test case recommendation method and system, which can accurately recommend regression test cases for modified code, automatically maintain the regression test case knowledge base, and reduce the number of regression test cases while considering the regression test effect.

[0005] The present application provides a regression test case knowledge base maintenance method, which specifically comprises:

[0006] According to the first change and / or the second change, a to-be-changed data element is constructed and stored in a to-be-changed set, wherein the first change is a test case content change, and the second change is a code change.

[0007] determining whether the to-be-changed set is empty, if not empty, obtaining a to-be-changed data element in the to-be-changed set, and locating an update position of the regression test case knowledge base according to the obtained to-be-changed data element;

[0008] updating the regression test case knowledge base according to the obtained to-be-changed data element and the update position.

[0009] Preferably, the regression test case knowledge base maintenance method further comprises, before the above steps:

[0010] recording an executed test case, obtaining a mobile terminal code coverage file corresponding to the recorded test case, constructing a first file according to the mobile terminal code coverage file, the first file containing a code set of a method and a branch in the method, constructing a data element according to the first file and the executed test case, and storing the constructed data element into the regression test case knowledge base.

[0011] Preferably, the step of constructing a data element according to the first file and the executed test case comprises:

[0012] extracting test case information of the executed test case, associating code information corresponding to one or more data blocks in the first file with the extracted test case information to construct a data element, the test case information at least including a test case name, a test case ID, a test case step and a test case result, and the code information at least including a class name, a method name, a method input parameter, a method and / or a branch statement.

[0013] Preferably, the step of obtaining a mobile terminal code coverage file corresponding to the recorded test case comprises:

[0014] obtaining executed test case information, clearing a historical coverage file related to the executed test case in the mobile terminal code coverage file, thereby obtaining a latest mobile terminal code coverage file to construct a first file.

[0015] Preferably, the step of updating the regression test case knowledge base according to the obtained to-be-changed data element and the update position comprises:

[0016] determining a type of the to-be-changed data element, matching a target update method from an update method set based on the type of the to-be-changed data element, and updating the regression test case knowledge base according to the obtained to-be-changed data element and the update position by using the matched target update method;

[0017] The types of the to-be-changed data elements include the to-be-changed data element corresponding to the first change and the to-be-changed data element corresponding to the second change, and the update method set at least includes a test case recording and a code fragment update.

[0018] Preferably, the regression test case knowledge base maintenance method further comprises the following steps of:

[0019] Obtaining real-time code change information, locating the method and the corresponding branch statement corresponding to the real-time code change, and constructing a real-time change set.

[0020] Based on the real-time change set, the same method and the corresponding branch statement in the regression test case knowledge base are searched, and the corresponding regression test case is extracted and added to the test case set.

[0021] The application also provides a regression test case knowledge base maintenance system, comprising:

[0022] A monitoring module is configured to construct to-be-changed data elements according to the first change and / or the second change and store the to-be-changed data elements in a to-be-changed set, wherein the first change is a test case content change, and the second change is a code change.

[0023] A case management module is configured to manage data elements in the regression test case knowledge base, and the case management module at least includes a locating module configured to determine whether the to-be-changed set is empty, and if not, obtain to-be-changed data elements in the to-be-changed set and locate an update position of the regression test case knowledge base according to the obtained to-be-changed data elements; and an update module configured to update the regression test case knowledge base according to the to-be-changed data elements and the update position.

[0024] The application also provides a regression test case recommendation method, comprising:

[0025] Obtaining a method affected by the code change and a branch statement affected by the code change, and constructing a change set.

[0026] Based on the change set, a first candidate object set is matched from a regression test case knowledge base pre-constructed based on a historical coverage file, wherein the regression test case knowledge base stores data elements, and the data elements at least include test case information and method and branch statement code information.

[0027] The regression test cases corresponding to each candidate object in the first candidate object set are extracted as recommended test cases.

[0028] Preferably, before the regression test cases corresponding to each candidate object in the first candidate object set are extracted as recommended test cases, the following steps are included:

[0029] According to the number of test cases corresponding to a single method or branch statement in the first candidate object set, each candidate object is evaluated, if the number of test cases corresponding to the single method or branch statement is less than a preset threshold, the candidate object corresponding to the single method or branch statement is added to the second candidate object set, otherwise, it is added to the third candidate object set;

[0030] Based on the regression test cases, each sub candidate object in the third candidate object set is clustered, a representative sub candidate object is selected from each cluster after clustering and added to the second candidate object set, and the regression test cases corresponding to each candidate object in the second candidate object set are used as recommended test cases.

[0031] The application also provides a regression test case recommendation system, comprising:

[0032] The change acquisition module is configured to acquire methods affected by code changes and branch statements affected by code changes, and construct a change set.

[0033] The construction module is configured to match a first candidate object set from a regression test case knowledge base pre-constructed based on historical coverage files based on the change set, and the regression test case knowledge base stores data elements, and the data elements at least include test case information and method and branch statement code information.

[0034] The recommendation module is configured to extract regression test cases corresponding to each candidate object in the first candidate object set as recommended test cases.

[0035] Compared with the prior art, the regression test case knowledge base maintenance, regression test case recommendation method and system provided by the application can automatically identify various situations in which the regression test case knowledge base changes, and automatically trigger the update of the knowledge base when the regression test case knowledge base changes, thereby reducing the workload of maintaining the regression test case knowledge base, ensuring the correctness of the data elements stored in the regression test case knowledge base, and improving the accuracy of the regression test case when the regression test case is automatically recommended. When recommending the regression test case, the application can accurately locate a smaller number of regression test cases based on the pre-branch and the statements in the branch, thereby reducing the waste of manpower in the testing process and increasing the testing accuracy. Finally, in the business function testing process, through the change detection and function test case recommendation of the mobile terminal code, the test personnel can accurately determine the test regression range, prevent the waste of manpower caused by missed testing or a large number of regressions, and reduce the number of test cases in the mobile terminal version iteration process, thereby reducing the version regression manpower cost.

[0036] The above description is only a summary of the technical solutions of the present application, in order to enable the technical means of the present application to be more clearly understood, and to be implemented according to the content of the description, and in order to enable the above and other purposes, characteristics and advantages of the present application to be more apparent and easy to understand, the following specific embodiments of the present application are described. BRIEF DESCRIPTION OF DRAWINGS

[0037] One or more embodiments are illustrated by way of example in the drawings in which like reference numerals indicate like elements, and in which:

[0038] Figure 1 The regression test case knowledge base maintenance process diagram provided for the embodiments of the present application is as follows:

[0039] Figure 2 The regression test case knowledge base construction process diagram provided for the embodiments of the present application is as follows:

[0040] Figure 3 The regression test case recommendation method process diagram provided for the embodiments of the present application is as follows. DETAILED DESCRIPTION

[0041] In order to make the purposes, technical solutions and advantages of the embodiments of the present application more clear, the embodiments of the present application will be described in detail below with reference to the drawings. However, those skilled in the art can understand that in the embodiments of the present application, many technical details are proposed in order to make the reader better understand the present application. However, even without these technical details and various changes and modifications based on the following embodiments, the technical solutions claimed by the present application can be implemented. The following embodiments are classified for the convenience of description, and should not constitute any limitation on the specific implementation of the present application, and the embodiments can be combined and referred to each other without contradiction.

[0042] The first embodiment of the present application provides a regression test case knowledge base maintenance method, please refer to Figure 1 .

[0043] The regression test case knowledge base maintenance method specifically includes:

[0044] According to the first change and / or the second change, the to-be-changed data element is constructed and stored in the to-be-changed set, wherein the first change is a test case content change, and the second change is a code change;

[0045] It is judged whether the to-be-changed set is empty, if not, the to-be-changed data element in the to-be-changed set is obtained, and the update position of the regression test case knowledge base is located according to the obtained to-be-changed data element;

[0046] According to the obtained to be changed data element and the update position, the regression test case knowledge base is updated.

[0047] The regression test case knowledge base maintenance method provided by the application can intelligently identify case change conditions and code change conditions, intelligently maintain and prompt case knowledge base updates, reduce labor consumption, reduce maintenance costs, ensure the correctness of the data elements stored in the regression test case knowledge base, and further improve the accuracy of the regression test case when the regression test case is automatically recommended.

[0048] Further, the regression test case knowledge base stores one or more data elements, and each data element at least includes test case information and code information, wherein the test case information at least includes a test case name, a test case ID, a test case step, and a test case result, and the test case step and the test case result are natural languages; and the code information at least includes a class name, a method name, a method input parameter, a method, and / or a branch statement. Figure 2As shown, the regression test case knowledge base maintenance method further comprises the following steps before the above steps: recording the executed test case, obtaining a mobile terminal code coverage file corresponding to the recorded test case, constructing a first file according to the mobile terminal code coverage file, and the first file contains the code set of the method and the branch in the method; constructing a data element according to the first file and the executed test case, and storing the data element into the regression test case knowledge base. Specifically, the mobile terminal code coverage file includes complete source program code, the code related to the recorded test case in the source program code has an execution identifier, and the method and branch code related to the recorded test case are extracted from the complete source program code according to the execution identifier, so as to construct the first file according to the mobile terminal code coverage file, and the first file contains the code set of one or more methods and branches in the method. Further, if the recorded test case needs to execute multiple methods and branches, the first file contains multiple data blocks, each data block can be a code set corresponding to a method and a branch in the method, the methods or branches in the methods of the data blocks are different, for example, data block 1 is method A branch a, data block 2 is method A branch b, and data block 3 is method B branch c. As an optional embodiment, if there is no branch statement in the method executed by the recorded test case, the data block is a code set corresponding to the method. According to the first file and the executed test case, a data element is constructed, and the first file can contain multiple data blocks, and the executed test case and the multiple code information corresponding to the multiple data blocks in the first file are stored in association, that is, the executed test case and the code information can be stored in a one-to-many relationship or a one-to-one relationship. According to the first file and the executed test case, a data element is constructed, specifically: extracting test case information of the executed test case, associating the code information corresponding to one or more data blocks in the first file with the extracted test case information to construct a data element.

[0049] The method provided by the application stores the test case code information to the branch statement when constructing the test case knowledge base, compared with the prior art which only stores to the method level, the branch statement is also stored when constructing the data element, so that the test case is located by using the method and the branch statement during maintenance and recommendation, and the test case positioning accuracy, the maintenance efficiency, the maintenance accuracy and the test case recommendation accuracy are improved.

[0050] The mobile terminal code coverage rate file corresponding to the recorded test case is obtained, specifically including: obtaining the executed test case information, clearing the historical coverage rate file related to the executed test case in the mobile terminal code coverage rate file, thereby obtaining the latest mobile terminal code coverage rate file to construct a first file. Before constructing the data element according to the first file and the executed test case, it further includes: uploading and storing the first file in a server, and the server constructs the data element. As a preferred embodiment, the server can be a Linux server, and the mobile terminal code coverage rate file is obtained in the code insertion mode. The method provided by the application can automatically clear the historical coverage rate file, so that the latest coverage rate file corresponding to the executed test case is obtained each time, the time of coverage rate file search matching is reduced, and the requirement for storage space is reduced.

[0051] Before constructing the data element to be changed according to the first change and / or the second change, it further includes: obtaining mobile terminal application program version change information, and triggering the regression test case knowledge base update according to the mobile terminal application program version change information. Test case change information is obtained from a first use case monitoring platform, whether the test case content is changed or the test case is deleted is judged, the test case content at least includes a test case name, a test case step and a test case result, if yes, the data element to be changed is constructed according to the test case content change information, the data element to be changed corresponding to the first change contains the ID of the changed test case, the change object identifier and the changed content of the change object, for example, the data element to be changed corresponding to the first change is “123, Step, S1 obtains the data of the touch exceeding the first preset time length”, “123” is the ID of the changed test case, “Step” is the identifier of the change object, here indicating that the test case step is changed, “S1 obtains the data of the touch exceeding the first preset time length” is the changed content of the test case step, if the test case is deleted, the ID of the deleted test case, the change object identifier and the changed content of the change object are all empty, thereby constructing the data element to be changed; code change information is obtained from a code management platform, whether there is code change is judged, the code change at least includes code deletion, class name change, method name change, method input parameter change and method and / or branch statement change, if yes, the data element to be changed is constructed according to the code change, the data element to be changed corresponding to the second change contains the code change object identifier, the content before the code change of the code change object and the content after the code change of the code change object, wherein the content after the code change of the code change object is empty when the code is deleted. Preferably, the code management platform can be gitHub.

[0052] The method provided by the application can first classify and sort the changes to be maintained in the change-to-be-set collection, thereby maintaining the changes to one object in a set manner, and the number of object matching searches is reduced compared with disordered maintenance, thereby improving the maintenance efficiency.

[0053] In order to further improve the efficiency of the maintenance of the regression test case knowledge base, compared with the maintenance according to the time sequence of the changes, the method provided by the application can first classify and sort the changes to be maintained in the change-to-be-set collection, thereby maintaining the changes to one object in a set manner, and the number of object matching searches is reduced compared with disordered maintenance, thereby improving the maintenance efficiency.

[0054] The method provided by the application can first classify and sort the changes to be maintained in the change-to-be-set collection, thereby maintaining the changes to one object in a set manner, and the number of object matching searches is reduced compared with disordered maintenance, thereby improving the maintenance efficiency.

[0055] According to the obtained to be changed data element and the update position, the regression test case knowledge base is updated, specifically including: determining the type of the to be changed data element, matching a target update method from an update method set based on the type of the to be changed data element, and updating the regression test case knowledge base by using the obtained to be changed data element and the update position according to the matched target update method. The type of the to be changed data element includes a to be changed data element corresponding to a first change and a to be changed data element corresponding to a second change, and the update method set at least includes test case recording and code segment updating. As an optional embodiment, the to be changed data element corresponding to the first change corresponds to test case recording, and the to be changed data element corresponding to the second change corresponds to code segment updating. If the to be changed data element is test case content change, a test case corresponding to the to be changed data element is re-recorded to obtain a first updated test case; a first original data element is determined based on the update position to obtain first original code information in the first original data element; the first updated test case and the first original code information are bound to generate a first updated data element to replace the first original data element. As another optional embodiment, each type of to be changed data element corresponds to a plurality of candidate update methods, and an optimal update method is recommended from the plurality of candidate update methods as the target update method based on the change content of the to be changed data element.

[0056] The maintenance method provided by the application adopts different maintenance methods for different changes, and the test case is described in natural language, so that a complex natural language processing and positioning algorithm is required for local content update. The method provided by the application matches different update methods by type, provides the fastest, low-computing, and accurate update method for different methods, improves the efficiency and accuracy of the knowledge base maintenance, and reduces the computing amount in the maintenance process. The application stores the test case in the database, including the function description content and the code information of the test case, and performs operations such as adding, deleting, modifying, and inquiring on the test case according to the parameter information. When the test case changes or the code segment corresponding to the test case changes, the existing content in the database is maintained by using the local modification update method, the deletion and reconstruction or the continuous new construction method is avoided, and the maintenance of the regression test case knowledge base is realized.

[0057] Further, the regression test case knowledge base maintenance method further comprises: acquiring real-time code change information, locating the method and the corresponding branch statement corresponding to the real-time code change, and constructing a real-time change set; searching for the same method and the corresponding branch statement in the regression test case knowledge base based on the real-time change set, and extracting the corresponding regression test case to add to the test case set. As an optional embodiment, the regression test cases in the test case set are displayed through a web interface, and the test personnel can select part of the test cases for manual test case testing; or the automatic test cases in the test case set can be automatically run; the final execution result is displayed in the web interface when the test cases are executed; and whether the test case test passes and the real-time test progress are marked.

[0058] The regression test case knowledge base maintenance method provided by the application determines the test cases corresponding to the method and the branch statement as recommended test cases based on the maintenance of the regression test case knowledge base, improves the accuracy and precision of the regression test case recommendation, avoids the omission of part of the test cases or the recommendation of a large range of useless test cases, and further improves the test accuracy.

[0059] The second embodiment of the application provides a regression test case knowledge base maintenance system, comprising:

[0060] A monitoring module is configured to construct a to-be-changed data element according to the first change and / or the second change and store the to-be-changed data element in a to-be-changed set, wherein the first change is a test case content change, and the second change is a code change.

[0061] A test case management module is configured to manage the data elements in the regression test case knowledge base, and the test case management module at least comprises: a locating module configured to determine whether the to-be-changed set is empty, and if not, acquire the to-be-changed data element in the to-be-changed set and locate the update position of the regression test case knowledge base according to the acquired to-be-changed data element; and an updating module configured to update the regression test case knowledge base according to the to-be-changed data element and the update position.

[0062] Further, the regression test case knowledge base stores one or more data elements, each of which includes at least test case information and code information, wherein the test case information at least includes a test case name, a test case ID, test case steps, and test case results, and the test case steps and test case results are in natural language; and the code information at least includes a class name, a method name, method input parameters, and a method and / or branch statement. The test case management module further includes a creation module configured to record an executed test case, obtain a mobile terminal code coverage file corresponding to the recorded test case, construct a first file according to the mobile terminal code coverage file, wherein the first file includes a code set of a method and branches in the method, and construct a data element according to the first file and the executed test case, and store the data element in the regression test case knowledge base.

[0063] Further, the regression test case knowledge base maintenance system further includes a recommendation module configured to obtain real-time code change information, locate a method and corresponding branch statements corresponding to the real-time code change, construct a real-time change set, search for the same method and corresponding branch statements in the regression test case knowledge base based on the real-time change set, and extract corresponding regression test cases to add to a test case set.

[0064] It can be found that the present embodiment is a device embodiment corresponding to the first embodiment, and the present embodiment can be implemented in cooperation with the first embodiment. The related technical details mentioned in the first embodiment are still valid in the present embodiment. In order to reduce repetition, they will not be described here. Correspondingly, the related technical details mentioned in the present embodiment can also be applied in the first embodiment.

[0065] It is worth mentioning that each module involved in the present embodiment is a logical module. In actual application, a logical unit can be a physical unit, a part of a physical unit, or a combination of multiple physical units. In addition, in order to highlight the innovative part of the present application, units not closely related to solving the technical problems proposed in the present application are not introduced in the present embodiment, but this does not mean that there are no other units in the present embodiment.

[0066] The third embodiment of the present application provides a regression test case recommendation method, as shown in Figure 3 The regression test case recommendation method includes:

[0067] obtaining a method and branch statements affected by a code change, and constructing a change set;

[0068] match a first candidate object set from a regression test case knowledge base pre-constructed based on a historical coverage file based on the change set, the regression test case knowledge base storing data elements including at least test case information and method, branch statement code information;

[0069] extract regression test cases corresponding to each candidate object in the first candidate object set as recommended test cases.

[0070] The regression test case recommendation method provided by the application can exclude invalid recommendations caused by only using methods or branch statements in the prior art, and provides a test case recommendation method based on methods and branch statements, so that the range of recommended test cases is determined comprehensively based on methods and branch statements, the number of recommended test cases is greatly reduced, the case denoising process is performed for the case of pushing out a large number of test cases caused by a single change, the accuracy of regression test case recommendation is improved, the workload of testers is reduced, and the regression test cost is reduced. The test range is determined by the code change, so that it is convenient to find out whether there is a missed test point in the test process, and the test quality is improved.

[0071] As a preferred embodiment, the code change is obtained through gitlab, so as to obtain a method for obtaining the influence of the code change and the corresponding branch statement, and form a change set. The first candidate object set is matched from the regression test case knowledge base pre-constructed based on the historical coverage file based on the change set, and specifically includes the following steps: if there is an intersection between the change set and the associated code set of all test cases in the regression test case knowledge base, the data elements corresponding to the intersection code are extracted to obtain the first candidate object set.

[0072] Before extracting the regression test cases corresponding to each candidate object in the first candidate object set as recommended test cases, the following steps are further included: evaluating each candidate object according to the number of test cases corresponding to a single method or branch statement in the first candidate object set, if the number of test cases corresponding to the single method or branch statement is less than a preset threshold, the candidate object corresponding to the single method or branch statement is added to the second candidate object set, otherwise, the candidate object is added to the third candidate object set; the kmeans method is used for clustering each sub-candidate object in the third candidate object set based on the regression test case, the center coordinates of each class after clustering are calculated, and the sub-candidate object closest to the center coordinates is selected as the representative sub-candidate object of the class.

[0073] The regression test case recommendation method provided by the application, after obtaining the first candidate object set of the case recommendation, firstly obtains the number of cases affected by a single change method or branch statement, sets a threshold x, the method whose number of affected cases is less than the threshold x is evaluated as a change method that must be tested, and all cases associated with the method are added to the recommended cases;The method whose number of affected cases exceeds the threshold x is evaluated as a change method that is not necessary to be tested, and the cases of this part are clustered and analyzed by the kmeans method, similar cases are aggregated into a pile, and the number of cases recommended by each aggregated pile is dynamically determined according to the order of magnitude of the recommended cases, and finally all are added to the recommended cases.

[0074] The regression test case recommendation method provided by the application, by means of case denoising and case aggregation, a part of the suspected noise cases is retained and a large number of cases are removed, the noise is reduced, and the regression test case recommendation method based on coverage can be truly applied to the production environment, and the manpower investment of version regression test is saved.

[0075] The regression test case recommendation method further comprises: displaying the recommended cases, the recommended cases are displayed through a web interface, and test personnel can select part of the cases for manual test of the cases;The automatic test cases in the test case set can also be automatically run;When the regression test cases are executed, the final execution result is displayed in the web interface;And whether the case test passes and the real-time test progress are marked. Through visual processing, the code with high understanding cost is converted into the case with high readability, and the case is simple and easy to use, and the code ability of the case executor is not required, and the operability of the case test is improved.

[0076] As an optional embodiment, the regression test case knowledge base pre-constructed based on the historical coverage file is maintained in the manner of embodiment one, and no more detailed description is given here.

[0077] The fourth embodiment of the application provides a regression test case recommendation system, comprising:

[0078] A change acquisition module is configured to acquire methods affected by code changes and branch statements affected by code changes, and construct a change set.

[0079] A construction module is configured to match a first candidate object set from a regression test case knowledge base pre-constructed based on a historical coverage file based on the change set, and the regression test case knowledge base stores data elements, and the data elements at least include test case information and method and branch statement code information.

[0080] A recommendation module is configured to extract regression test cases corresponding to each candidate object in the first candidate object set as recommended cases.

[0081] Further, the construction module further comprises a filtering module configured to evaluate each candidate object according to the number of test cases corresponding to the single method or branch statement in the first candidate object set, and if the number of test cases corresponding to the single method or branch statement is less than a preset threshold, the candidate object corresponding to the single method or branch statement is added into the second candidate object set, otherwise, the candidate object is added into the third candidate object set; each sub candidate object in the third candidate object set is clustered based on the regression test cases, and a representative sub candidate object is selected from each cluster after clustering and added into the second candidate object set, and the regression test cases corresponding to each candidate object in the second candidate object set are sent to the recommendation module as recommended test cases.

[0082] Preferably, the regression test case recommendation system provided by the present application further comprises a display module configured to display the recommended test cases, the recommended test cases are displayed through a web interface, and a tester can select part of the test cases to perform manual test; or the tester can automatically run the automatic test cases in the test case set; when the regression test cases are executed, the final execution result is displayed in the web interface; and whether the test case test is passed and the real-time test progress are marked.

[0083] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments can be completed by a computer program instructing related hardware, and the program can be stored in a computer readable storage medium, and when the program is executed, the processes of the above-mentioned embodiments can be included.

[0084] Those skilled in the art can understand that the above-mentioned embodiments are specific embodiments for implementing the present application, and in actual application, various changes can be made in form and details without departing from the spirit and scope of the present application.

Claims

1. A method for maintaining a regression test case knowledge base, characterized in that, The method for maintaining the regression test case knowledge base specifically includes: Based on the first change and / or the second change, construct the data elements to be changed and store them in the set to be changed, wherein the first change is a change in the content of the test case and the second change is a change in the code; Determine whether the set to be changed is empty. If it is not empty, obtain the data elements to be changed in the set to be changed. The set to be changed stores multiple data elements to be changed. Locate the update position of the regression test case knowledge base based on the obtained data elements to be changed. The process of obtaining the data elements to be changed from the set to be changed includes: classifying all data elements to be changed in the set to be changed according to their type to obtain a first data element cluster and a second data element cluster. The data element types include the data elements to be changed corresponding to the first change and the data elements to be changed corresponding to the second change. In the first data element cluster, the data elements to be changed are clustered using the test case ID to obtain a first adjustment data element cluster. In the second data element cluster, clustering is performed according to the content of the code change object before the change and the code semantic analysis to obtain a second adjustment data element cluster. The first adjustment data element cluster has a higher priority than the second adjustment data element cluster. If the first adjustment data element cluster is not empty, all data elements of a subclass in the first adjustment data element cluster are obtained in a preset order. If the first adjustment data element cluster is empty, all data elements of a subclass in the second adjustment data element cluster are obtained in a preset order as the data elements to be changed with the highest priority, so as to update the regression test case knowledge base. The regression test case knowledge base is updated according to the obtained data elements to be changed and the update position; wherein, updating the regression test case knowledge base according to the obtained data elements to be changed and the update position includes: Determine the type of the data element to be changed, match the target update method from the update method set based on the type of the data element to be changed, and update the regression test case knowledge base according to the matched target update method using the obtained data element to be changed and the update position; The types of data elements to be changed include data elements to be changed corresponding to the first change and data elements to be changed corresponding to the second change. The set of update methods includes at least test case recording and code snippet updating.

2. The regression test case knowledge base maintenance method according to claim 1, characterized in that, Before the regression test case knowledge base maintenance method, it also includes: Record the executed test cases, obtain the mobile code coverage file corresponding to the recorded test cases, and construct a first file based on the mobile code coverage file. The first file contains a set of code for methods and branches in the methods. Data elements are constructed based on the first file and the executed test cases, and the constructed data elements are stored in the regression test case knowledge base.

3. The regression test case knowledge base maintenance method according to claim 2, characterized in that, The step of constructing data elements based on the first file and the executed test cases includes: Extract the test case information of the executed test cases, and associate the code information corresponding to one or more data blocks in the first file with the extracted test case information to construct data elements; The test case information includes at least: test case name, test case ID, test case steps, and test case results; The code information includes at least: class name, method name, method input parameters, method and / or branch statements.

4. The regression test case knowledge base maintenance method according to claim 2, characterized in that, The process of obtaining the mobile code coverage file corresponding to the recorded test cases includes: Obtain the information of the executed test cases, clear the historical coverage files related to the executed test cases in the mobile code coverage file, and thus obtain the latest mobile code coverage file to construct the first file.

5. The regression test case knowledge base maintenance method according to claim 1, characterized in that, Following the method for maintaining the regression test case knowledge base, it also includes: Obtain real-time code change information, locate the methods and branch statements corresponding to the real-time code changes, and construct a set of real-time changes; Based on the real-time change set, search for the same method and corresponding branch statement in the regression test case knowledge base, extract the corresponding regression test case and add it to the test case set.

6. A regression test case knowledge base maintenance system, characterized in that, The regression test case knowledge base maintenance system includes: The monitoring module is used to construct data elements to be changed based on the first change and / or the second change, and store them in the set to be changed, wherein the first change is a change in test case content, and the second change is a code change; The test case management module is used to manage the data elements in the regression test case knowledge base. The test case management module includes at least: a positioning module, which is used to determine whether the set to be changed is empty. If it is not empty, it obtains the data elements to be changed in the set to be changed. The set to be changed stores multiple data elements to be changed. The update position of the regression test case knowledge base is located based on the obtained data elements to be changed. The process of obtaining the data elements to be changed from the set to be changed includes: classifying all data elements to be changed in the set to be changed according to their type to obtain a first data element cluster and a second data element cluster. The data element types include the data elements to be changed corresponding to the first change and the data elements to be changed corresponding to the second change. In the first data element cluster, the data elements to be changed are clustered using the test case ID to obtain a first adjustment data element cluster. In the second data element cluster, clustering is performed according to the content of the code change object before the change and the code semantic analysis to obtain a second adjustment data element cluster. The first adjustment data element cluster has a higher priority than the second adjustment data element cluster. If the first adjustment data element cluster is not empty, all data elements of a subclass in the first adjustment data element cluster are obtained in a preset order. If the first adjustment data element cluster is empty, all data elements of a subclass in the second adjustment data element cluster are obtained in a preset order as the data elements to be changed with the highest priority, so as to update the regression test case knowledge base. The update module is used to update the regression test case knowledge base according to the data element to be changed and the update position; wherein, updating the regression test case knowledge base according to the obtained data element to be changed and the update position includes: Determine the type of the data element to be changed, match the target update method from the update method set based on the type of the data element to be changed, and update the regression test case knowledge base according to the matched target update method using the obtained data element to be changed and the update position; The types of data elements to be changed include data elements to be changed corresponding to the first change and data elements to be changed corresponding to the second change. The set of update methods includes at least test case recording and code snippet updating.

7. A regression test case recommendation method, characterized in that, The regression test case recommendation method includes: Obtain the methods affected by the code changes and the branch statements affected by the code changes, and construct a set of changes; Based on the change set, a first candidate object set is matched from the regression test case knowledge base pre-built based on the historical coverage file. The regression test case knowledge base stores data elements, which include at least test case information and method and branch statement code information. The regression test case knowledge base is maintained using the method described in any one of claims 1-5. Extract the regression test cases corresponding to each candidate object in the first candidate object set as recommended test cases.

8. The regression test case recommendation method according to claim 7, characterized in that, Before extracting the regression test cases corresponding to each candidate object in the first candidate object set as recommendation test cases, the following steps are taken: Each candidate object is evaluated based on the number of test cases corresponding to a single method or branch statement in the first candidate object set. If the number of test cases corresponding to a single method or branch statement is less than a preset threshold, the candidate object corresponding to that single method or branch statement is added to the second candidate object set; otherwise, it is added to the third candidate object set. Based on regression test cases, each sub-candidate object in the third candidate object set is clustered. Representative sub-candidate objects are selected from each cluster and added to the second candidate object set. The regression test cases corresponding to each candidate object in the second candidate object set are used as recommended test cases.

9. A regression test case recommendation system, characterized in that, The regression test case recommendation system includes: The change acquisition module is used to acquire the methods affected by code changes and the branch statements affected by the code changes, and to build a change set; A construction module is used to match a first candidate object set from a regression test case knowledge base pre-built based on a historical coverage file based on the change set. The regression test case knowledge base stores data elements, which include at least test case information and method and branch statement code information. The regression test case knowledge base is maintained using the method described in any one of claims 1-5. The recommendation module is used to extract the regression test cases corresponding to each candidate object in the first candidate object set, and use them as recommended test cases.

Citation Information

Patent Citations

  • Testing mapping relation database generation method and device, computer equipment and storage medium

    CN108874661A

  • Precise coverage testing method and system based on modularized distributed system

    CN112817865A

  • Test case recommendation method and device

    CN113609020A