Test case deduplication method, device, equipment and computer readable storage medium

By calculating similarity on the dimensions of complete use cases and sub-use cases and generating a set of similar use case pairs, the problem of not being able to effectively remove similar use cases with inclusion relationships in the existing technology is solved, thus achieving efficient deduplication of test cases and shortening integration testing time.

CN114896141BActive Publication Date: 2026-03-27GUANGZHOU HUYA TECH CO LTD
View PDF 3 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-24
Publication Date
2026-03-27

AI Technical Summary

Technical Problem

Existing test case deduplication methods cannot effectively handle similar test cases containing related classes, leading to increased integration test duration and reduced efficiency.

Method used

By calculating the similarity of use cases from both the complete use case dimension and the sub-use case dimension, a set of similar use case pairs is generated, and deduplication is performed based on these sets, including data preprocessing, use case multi-way tree structure analysis, and a combination of multiple similarity algorithms.

Benefits of technology

It effectively eliminated duplicate test cases, reduced integration test time, and improved test efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114896141B_ABST
    Figure CN114896141B_ABST
Patent Text Reader

Abstract

The application discloses a test case deduplication method, device and equipment and a computer readable storage medium. The test case deduplication method comprises the following steps: obtaining a test case data set to be processed, wherein the test case data set to be processed comprises a plurality of test cases; performing case similarity calculation on the test case data set to be processed from a complete case dimension and a sub-case dimension respectively, and generating a plurality of similar case pair sets; and performing deduplication processing on similar test cases based on the plurality of similar case pair sets. The above scheme can effectively deduplicate similar test cases.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of software testing, in particular to a test case deduplication method and device, equipment and a computer readable storage medium. BACKGROUND

[0002] When a use case system platform accumulates a large number of test cases, there are a large number of repeated and invalid use cases, and testers need to manually test the core use cases each time during integration testing. However, a large number of repeated and invalid use cases increase the integration testing time and reduce the efficiency of each integration testing. The existing test case similarity deduplication scheme only considers the similarity between complete test cases, and cannot effectively solve the similarity of use cases containing relationships. Therefore, how to improve the accuracy of obtaining similar use cases to find the repeated parts in the core use cases for elimination becomes a research topic of great value. SUMMARY

[0003] The technical problem solved by the present application is to provide a test case deduplication method, device, equipment and computer readable storage medium, which can effectively deduplicate similar test cases.

[0004] To solve the above problems, the first aspect of the present application provides a test case deduplication method, which comprises: obtaining a test case data set to be processed, wherein the test case data set to be processed comprises a plurality of test cases; performing use case similarity calculation on the test case data set to be processed from complete use case dimensions and sub-use case dimensions respectively, to generate a plurality of similar use case pair sets; and performing deduplication processing on similar test cases based on the plurality of similar use case pair sets.

[0005] To solve the above problems, the second aspect of the present application provides a test case deduplication device, which comprises: an acquisition module configured to obtain a test case data set to be processed, wherein the test case data set to be processed comprises a plurality of test cases; a generation module configured to perform use case similarity calculation on the test case data set to be processed from complete use case dimensions and sub-use case dimensions respectively, to generate a plurality of similar use case pair sets; and a processing module configured to perform deduplication processing on similar test cases based on the plurality of similar use case pair sets.

[0006] To solve the above problems, the third aspect of the present application provides an electronic device, which comprises a memory and a processor coupled to each other, wherein the processor is configured to execute program instructions stored in the memory to implement the test case deduplication method of the first aspect.

[0007] To solve the above problems, the fourth aspect of the present application provides a computer readable storage medium, which has program instructions stored thereon, and the program instructions are executed by a processor to implement the test case deduplication method of the first aspect.

[0008] The beneficial effects of the present application are: different from the prior art, in the test case deduplication method of the present application, the test case data set to be processed is obtained, the test case data set to be processed includes multiple test cases, then the test case similarity calculation is performed on the test case data set to be processed from the complete case dimension and the sub-case dimension, multiple similar case pair sets can be generated, and then based on the multiple similar case pair sets, the similar test cases can be deduplicated, which realizes the generation of similar case pairs from the complete case dimension and the sub-case dimension, considers the similarity between two complete test cases, and effectively solves the similar cases containing the relationship class, thereby effectively deduplicating the similar test cases, reducing the integration test time and improving the test efficiency. BRIEF DESCRIPTION OF DRAWINGS

[0009] Figure 1 is a flowchart of an embodiment of the test case deduplication method of the present application;

[0010] Figure 2 is Figure 1 is a flowchart of an embodiment of step S12 in the method;

[0011] Figure 3 is Figure 2 is a flowchart of an embodiment of step S122 in the method;

[0012] Figure 4 is a structural diagram in an application scenario of the case multi-ary tree in the present application;

[0013] Figure 5 is Figure 2 is a flowchart of an embodiment of step S123 in the method;

[0014] Figure 6 is a flowchart of another embodiment of the test case deduplication method of the present application;

[0015] Figure 7 is a framework diagram of an embodiment of the test case deduplication device of the present application;

[0016] Figure 8 is a framework diagram of an embodiment of the electronic device of the present application;

[0017] Figure 9 is a framework diagram of an embodiment of the computer readable storage medium of the present application. DETAILED DESCRIPTION

[0018] The scheme of the embodiments of the present application will be described in detail below with reference to the accompanying drawings.

[0019] In the following description, for the purpose of explanation and not limitation, specific details are set forth, such as particular system configurations, interfaces, techniques, in order to provide a thorough understanding of the present application.

[0020] The terms "system" and "network" are often used interchangeably herein. The term "and / or", merely describes an associated relationship which can exist between associated objects, and means that there can be three relationships, for example, A and / or B, which means that A exists alone, A and B exist together, and B exists alone. In addition, the character " / " in this paper generally represents an "or" relationship between the front and rear associated objects. In addition, "multiple" in this paper means two or more than two.

[0021] Please refer to Figure 1 , Figure 1 is a flowchart of an embodiment of the test case deduplication method of the present application. Specifically, the test case deduplication method in this embodiment can include the following steps:

[0022] Step S11: Obtain a test case data set to be processed, which includes a plurality of test cases.

[0023] Software testing usually selects a batch of test data according to the specifications and internal structure of the software development stages to form test cases, and uses these test cases to drive the tested program, observes the execution results of the program, verifies whether the obtained results are consistent with the expected results, and then makes corresponding adjustments. In an embodiment, the test case can be a structured test case, which is a semi-formal test case document written in Chinese natural language according to UML (Unified Modeling Language or Standard Modeling Language) and BNF (Backus-Naur Form) constraints. In order to ensure the coverage rate of software testing, test cases generally contain large-scale corpus data that have been scientifically sampled and processed. These corpus data can be collected in the program testing process that has been carried out. Since there are many ways to describe the same thing in Chinese natural language, especially the difference between texts written by different people is greater, therefore, many of these corpus data are repetitive descriptions. Therefore, after obtaining a test case data set including a plurality of test cases, the test case data set needs to be deduplicated, that is, the obtained test case data set is a test case data set to be processed.

[0024] In an embodiment, the above step S11 can include: obtaining a plurality of original test cases; and performing data preprocessing on the plurality of original test cases to form the test case data set to be processed.

[0025] Specifically, when it is needed to deduplicate the test cases in a certain test case platform, firstly, the original test cases in the test case platform can be acquired, and then the acquired original test cases can be subjected to data preprocessing to form a test case data set to be processed. The data preprocessing of the original test cases can include: subjecting the test cases to word segmentation processing, removing non-text parts in the test cases such as labels, symbols, etc.; and perfecting word segmentation and stop word self-defined word library to improve the accuracy of word segmentation; and the N-Gram algorithm can be used to process the word segmentation results. Chinese word segmentation is a basic step of Chinese text processing and a basic module of Chinese human-computer natural language interaction. Unlike English, there is no word boundary in a Chinese sentence. Therefore, when performing Chinese natural language processing, word segmentation is usually needed first, and the word segmentation effect will directly affect the effects of the part-of-speech and syntax tree modules. Taking the Chinese sentence "I come to Beijing Tsinghua University" as an example, the possible word segmentation results are: I / come to / Beijing / Tsinghua University. The N-Gram algorithm is an algorithm based on a statistical language model. Its basic idea is to perform a sliding window operation on the content in the text according to bytes, forming a sequence of byte segments with a length of N.

[0026] It can be understood that in the natural language processing process, there are many descriptions of the same thing, which is largely due to the presence of many modifying words in the corpus. These modifying words have little meaning in most cases, and the words that play a major role in the description of things are the key words of the original corpus. Through data preprocessing of the original test cases, the key words reflecting the things described by the original corpus can be extracted. Specifically, the original corpus corresponding to the original test cases is subjected to word segmentation processing, which can divide the original corpus into individual words, some of which may include words that do not have specific meanings for indicating tone, modification, etc. The words that do not have specific meanings are filtered out using preset processing rules, and the remaining words can reflect the things described by the original corpus. Further, the preset processing rules include at least one of a stop word removal rule, a punctuation removal rule, and a number removal rule. The stop word removal rule means to establish a stop word library for filtering to remove the stop words in the stop word library. The punctuation removal rule means to filter out punctuation symbols and suffix symbols. The number removal rule means to filter out numbers.

[0027] Step S12: performing case similarity calculation on the test case data set to be processed from the complete case dimension and the sub-case dimension respectively, to generate a plurality of similar case pair sets.

[0028] Specifically, each test case in the test case data set to be processed is a complete test case, and the similarity between any two complete test cases can be calculated from the complete case dimension, thereby generating a plurality of similar test case pairs. However, when the complete test case A has more test case steps, and the complete test case B has fewer test case steps, and all test case steps of the complete test case B are test case steps of the complete test case A, the complete test case B may actually be a sub-test case of the complete test case A, but from the complete case dimension, the similarity between the complete test case B and the complete test case A may be small, and it cannot be determined that the two are similar, but from the sub-test case dimension, the complete test case B and the complete test case A are similar. Therefore, the embodiments of the present application also calculate the similarity between any two complete test cases from the sub-test case dimension, thereby also generating a plurality of similar test case pairs. Therefore, the plurality of similar test case pairs generated from the complete case dimension and the plurality of similar test case pairs generated from the sub-test case dimension are merged, and a plurality of similar test case pair sets can be generated.

[0029] Please combine Figure 2 , Figure 2 is Figure 1 a flowchart of an embodiment of step S12 in FIG. 1. In an embodiment, the above-mentioned step S12 can specifically include:

[0030] Step S121: For all test cases in the test case data set to be processed, the similarity between any test cases is calculated according to at least one preset similarity algorithm, and a plurality of similar test case pairs based on the complete case dimension are obtained.

[0031] Specifically, in the complete case dimension, for all test cases in the test case data set to be processed, the similarity between any two test cases can be calculated according to at least one preset similarity algorithm, thereby a plurality of similar test case pairs based on the complete case dimension can be obtained. Further, the preset similarity algorithm can include any one of the similarity algorithm based on the intersection-union ratio, the similarity algorithm based on TF-IDF, and the similarity algorithm based on the Skip-Gram model. For example, in the complete case dimension, the similarity algorithm based on the intersection-union ratio, the similarity algorithm based on TF-IDF, and the similarity algorithm based on the Skip-Gram model can be used to calculate the similarity between any two test cases, at this time, the similarity between any two test cases is calculated by taking the tokenization results of the two complete test cases as a whole, and different similarity algorithms can obtain different results of similar test case pairs. Therefore, a plurality of similar test case pairs based on the intersection-union ratio, a plurality of similar test case pairs based on TF-IDF, and a plurality of similar test case pairs based on the Skip-Gram model can be obtained in the complete case dimension, respectively.

[0032] Step S122: Obtain all sub-use cases corresponding to each test case, calculate the use case similarity between all sub-use cases of any two test cases according to the at least one preset similarity algorithm, and obtain a plurality of similar use case pairs based on the sub-use case dimension.

[0033] Specifically, in the sub-use case dimension, for each test case in the test case data set to be processed, all sub-use cases corresponding to each test case can be obtained, and then the use case similarity between all sub-use cases of any two test cases can be calculated according to the at least one preset similarity algorithm, so that a plurality of similar use case pairs based on the sub-use case dimension can be obtained. Further, the preset similarity algorithm can include any one of a similarity algorithm based on intersection over union, a similarity algorithm based on TF-IDF, and a similarity algorithm based on a Skip-Gram model. For example, in the sub-use case dimension, the similarity algorithm based on intersection over union, the similarity algorithm based on TF-IDF, and the similarity algorithm based on the Skip-Gram model can be used to calculate the use case similarity between all sub-use cases of any two test cases respectively, so as to determine whether any two test cases are similar use cases. Since different similarity algorithms may obtain different results of similar use case pairs, a plurality of similar use case pairs based on intersection over union, a plurality of similar use case pairs based on TF-IDF, and a plurality of similar use case pairs based on the Skip-Gram model in the sub-use case dimension can be obtained respectively.

[0034] Please refer to Figure 3 , Figure 3 is Figure 2 the flowchart of an embodiment of step S122 in

[0035] Step S1221: Convert all test cases into a use case multi-ary tree, and the use case multi-ary tree is composed of step nodes.

[0036] Specifically, please refer to Figure 4 , Figure 4 is a structural diagram in an application scenario of the use case multi-ary tree in the present application. In the sub-use case dimension, the similarity calculation can be performed, and each complete test case can be converted into a use case multi-ary tree. In the present application, the complete test case refers to the complete content of a test case, the sub-use case refers to the splitting of the complete test case into a plurality of sub-use cases, and the use case step refers to each operation step, such as Figure 4As shown, test case A is a complete test case, and test case A includes the following use case steps: 1. cold start APP; 2. a click into the youth mode; 2. b click I know; 2. n other sub-operations n; 3. other operations 1; 4. other operations 2; n. other operations n, and the like. For test case A, the sub-use cases can refer to: test case B, test case C. It can be intuitively seen that the use case multi-ary tree structure of test case B and test case C is also the subtree structure of the use case multi-ary tree of test case A. For the use case steps, that is, each numbered use case step, such as "1. cold start APP" is a use case step, and "2. a click into the youth mode" is a use case step. In the above use case multi-ary tree structure, a step node is a use case step.

[0037] Step S1222: calculating the node similarity of each step node between any two use case multi-ary trees by using the at least one preset similarity algorithm.

[0038] Step S1223: taking the test cases corresponding to the two use case multi-ary trees whose step nodes satisfy the preset condition as a use case similarity pair based on the sub-use case dimension.

[0039] After obtaining the use case multi-ary tree structures corresponding to any two test cases, the node similarity of each step node between the two use case multi-ary trees can be calculated by using the similarity algorithm based on the intersection-over-union, the similarity algorithm based on TF-IDF, and the similarity algorithm based on the Skip-Gram model. Then, the test cases corresponding to the two use case multi-ary trees whose step nodes satisfy the preset condition can be taken as a use case similarity pair based on the sub-use case dimension.

[0040] Specifically, the preset condition is that the node similarity between all step nodes of the use case multi-ary tree of the test case and the corresponding step nodes of the use case multi-ary tree of the reference case is greater than a preset threshold. For example, the preset threshold can be set as 0.6, and then the node similarity between each step node of the use case multi-ary tree of the test case B and the corresponding step node of the use case multi-ary tree of the test case A can be calculated; when the node similarity between each step node of the use case multi-ary tree of the test case B and the corresponding step node of the use case multi-ary tree of the test case A is greater than 0.6, the test case B and the test case A can be taken as a use case similarity pair based on the sub-use case dimension; when the node similarity between a step node of the use case multi-ary tree of the test case B and a corresponding step node of the use case multi-ary tree of the test case A is 0.4, and the node similarity between other step nodes of the use case multi-ary tree of the test case B and the corresponding other step nodes of the use case multi-ary tree of the test case A is greater than 0.6, the test case B and the test case A cannot be taken as a use case similarity pair based on the sub-use case dimension.

[0041] Step S123: obtaining the set of the plurality of similar use case pairs according to the plurality of similar use case pairs based on the complete use case dimension and the plurality of similar use case pairs based on the sub-use case dimension.

[0042] It can be understood that after the plurality of similar use case pairs generated under the complete use case dimension and the sub-use case dimension are obtained, since the plurality of similar use case pairs under the complete use case dimension and the plurality of similar use case pairs under the sub-use case dimension can have repeated similar use case pairs, the plurality of similar use case pairs under the complete use case dimension and the plurality of similar use case pairs under the sub-use case dimension can be merged, and the set of the plurality of similar use case pairs can be obtained.

[0043] Please refer to Figure 5 , Figure 5 is Figure 2 a flowchart of an embodiment of step S123 in

[0044] Step S1231: taking the union of the plurality of similar use case pairs based on the complete use case dimension and the plurality of similar use case pairs based on the sub-use case dimension, and obtaining the plurality of similar use case pairs generated by mixing.

[0045] Step S1232: arranging each similar use case pair in the plurality of similar use case pairs generated by mixing in descending order according to the similarity between the two test cases in each similar use case pair, and selecting a preset number of similar use case pairs as the set of the plurality of similar use case pairs.

[0046] It can be understood that, in order to maximize the mining potential similar use case pairs, the present application first obtains multiple similar use case pairs under complete use case dimensions and sub-use case dimensions respectively through multi-type unsupervised similarity calculation, for example, multiple similar use case pairs under complete use case dimensions based on intersection-over-union, multiple similar use case pairs based on TF-IDF and multiple similar use case pairs based on Skip-Gram model, and multiple similar use case pairs under sub-use case dimensions based on intersection-over-union, multiple similar use case pairs based on TF-IDF and multiple similar use case pairs based on Skip-Gram model. After obtaining all the multiple similar use case pairs, the union of similar use case pairs can be obtained, and multiple similar use case pairs generated by mixing are obtained, and then each similar use case pair in the multiple similar use case pairs generated by mixing is arranged in descending order according to the similarity between the two test cases in each similar use case pair, and a preset number of similar use case pairs are selected as the multiple similar use case pair set, that is, after being arranged in descending order according to the similarity, the top-N similar use case pairs are selected as the multiple similar use case pair set.

[0047] Step S13: Based on the multiple similar use case pair set, the similar test cases are processed for deduplication.

[0048] It can be understood that, after obtaining the multiple similar use case pair set, the similar test cases can be processed for deduplication.

[0049] The above scheme, by obtaining a test case data set to be processed, wherein the test case data set to be processed includes multiple test cases, then respectively performing use case similarity calculation on the test case data set to be processed from complete use case dimensions and sub-use case dimensions, multiple similar use case pair sets can be generated, and then based on the multiple similar use case pair sets, the similar test cases can be processed for deduplication, realizing the generation of similar use case pairs from two aspects of complete use case dimensions and sub-use case dimensions, considering the similarity between two complete test cases, and effectively solving the similar use cases containing relationship, so as to effectively deduplicate the similar test cases, so that the integration test time can be effectively reduced and the test efficiency can be improved.

[0050] Please refer to Figure 6 , Figure 6 is a flowchart of another embodiment of the test case deduplication method of the present application. The test case deduplication method in the embodiment can include the following steps:

[0051] Step S61: Obtain a test case data set to be processed, wherein the test case data set to be processed includes multiple test cases.

[0052] Step S62: performing case similarity calculation on the to-be-processed test case data set from the complete use case dimension and the sub-use case dimension respectively, to generate a plurality of similar case pair sets.

[0053] Step S63: performing deduplication processing on similar test cases based on the plurality of similar case pair sets.

[0054] Steps S61 to S63 in this embodiment are basically the same as S11 to S13 in the above embodiment, and will not be described here again.

[0055] Further, the test case deduplication method in this embodiment can further include:

[0056] Step S64: performing optimization processing on the plurality of similar case pair sets.

[0057] Specifically, the optimization processing on the plurality of similar case pair sets can be implemented by defining rules based on expert experience to filter invalid similar case pairs.

[0058] Step S65: marking similar pair tags for all similar case pairs in the plurality of similar case pair sets after the optimization processing, and storing in a database.

[0059] In an embodiment, after obtaining the plurality of similar case pair sets after the optimization processing, all test cases in the plurality of similar case pair sets after the optimization processing can be reported to a case platform, and then whether all similar case pairs are similar can be marked by business personnel, so that the test cases in the similar case pairs have corresponding similar pair tags and are stored in the database.

[0060] In an embodiment, the test case deduplication method described above can further include:

[0061] Step S66: constructing an initial supervised model, training the initial supervised model by using similar case pairs with similar pair tags in the database to obtain a trained supervised model. Correspondingly, the step S64 described above can specifically include: performing similar pair judgment on the plurality of similar case pair sets by using the trained supervised model to perform optimization processing on the plurality of similar case pair sets.

[0062] Specifically, considering that the accuracy of the above unsupervised similarity calculation is lower than that of the supervised model, the embodiments of the application can construct a closed-loop feedback strategy from similar use case pair generation to similar use case pair feedback to optimized similar use case pair regeneration. For example, when the business personnel perform the test, the use case platform displays other use cases similar to the current use case. While the business personnel manually test, they can mark whether the corresponding use cases are similar, and at the same time store the corresponding similar pair labels in the database, such as test case A is similar to test case B, test case C is not similar to test case D, etc. Thus, the initial supervised model such as FastText / Bert can be provided as a data source for training. After obtaining the trained supervised model, the trained supervised model can be used to judge the similarity of the above unsupervised similarity calculation to obtain a plurality of similar use case pair sets for optimizing the plurality of similar use case pair sets. Thus, the unsupervised similarity calculation and the supervised model are effectively combined, and the generated similar use case pair set is continuously optimized.

[0063] In an application scenario, through the test case deduplication method of the application, more than 6000 similar use case pairs can be generated in the use of the test case platform. Taking the core integration test set of a certain module as an example, there are more than 1200 test cases, and the test case deduplication method of the application can generate 248 similar use case pairs. Finally, 79 repeated test cases are actually eliminated. The test case deduplication method of the application can effectively reduce the integration test time and improve the test efficiency.

[0064] Please refer to Figure 7 , Figure 7 is a framework schematic diagram of an embodiment of the test case deduplication device of the application. The test case deduplication device 70 includes: an acquisition module 700, the acquisition module 700 is configured to acquire a test case data set to be processed, and the test case data set to be processed includes a plurality of test cases; a generation module 702, the generation module 702 is configured to respectively perform use case similarity calculation on the test case data set to be processed from the complete use case dimension and the sub-use case dimension to generate a plurality of similar use case pair sets; and a processing module 704, the processing module 704 is configured to perform deduplication processing on similar test cases based on the plurality of similar use case pair sets.

[0065] In some embodiments, the acquisition module 700 performs the step of acquiring a test case data set to be processed, and the test case data set to be processed includes a plurality of test cases, including: acquiring a plurality of original test cases; and performing data preprocessing on the plurality of original test cases to form the test case data set to be processed.

[0066] In some embodiments, the generating module 702 performs the step of performing case similarity calculation on the to-be-processed test case data set from the complete use case dimension and the sub-use case dimension respectively, to generate a plurality of similar use case pair sets, including: for all test cases in the to-be-processed test case data set, calculating the case similarity between any test cases according to at least one preset similarity algorithm to obtain a plurality of similar use case pairs based on the complete use case dimension; obtaining all sub-use cases corresponding to each test case, calculating the case similarity between all sub-use cases of any two test cases according to the at least one preset similarity algorithm to obtain a plurality of similar use case pairs based on the sub-use case dimension; and obtaining the plurality of similar use case pair sets according to the plurality of similar use case pairs based on the complete use case dimension and the plurality of similar use case pairs based on the sub-use case dimension.

[0067] In some embodiments, the preset similarity algorithm includes any one of an intersection-over-union-based similarity algorithm, a TF-IDF-based similarity algorithm, and a Skip-Gram model-based similarity algorithm.

[0068] In some embodiments, the generating module 702 performs the step of obtaining all sub-use cases corresponding to each test case, calculating the case similarity between all sub-use cases of any two test cases according to the at least one preset similarity algorithm to obtain a plurality of similar use case pairs based on the sub-use case dimension, specifically including: converting all test cases into use case multi-ary trees, the use case multi-ary trees being composed of step nodes; calculating the node similarity of each step node between any two use case multi-ary trees using the at least one preset similarity algorithm; and taking the test cases corresponding to two use case multi-ary trees whose step nodes satisfy a preset condition as a similar use case pair based on the sub-use case dimension.

[0069] In some embodiments, the preset condition is that all step nodes of one use case multi-ary tree have a node similarity greater than a preset threshold with the step nodes corresponding to another use case multi-ary tree.

[0070] In some embodiments, the generating module 702 performs the step of obtaining the plurality of similar use case pair sets according to the plurality of similar use case pairs based on the complete use case dimension and the plurality of similar use case pairs based on the sub-use case dimension, specifically including: taking a union of the plurality of similar use case pairs based on the complete use case dimension and the plurality of similar use case pairs based on the sub-use case dimension to obtain a plurality of hybrid generated similar use case pairs; arranging each similar use case pair in the plurality of hybrid generated similar use case pairs in descending order according to the similarity between the two test cases in each similar use case pair, and selecting a preset number of similar use case pairs as the plurality of similar use case pair sets.

[0071] In some embodiments, the test case deduplication apparatus 70 further comprises an optimization module 706, configured to optimize the plurality of similar case pair sets and mark all similar case pairs in the optimized plurality of similar case pair sets with a similar pair label and store in a database.

[0072] In some embodiments, the optimization module 706 is further configured to construct an initial supervised model, train the initial supervised model by using similar case pairs with the similar pair label in the database to obtain a trained supervised model; at this time, the optimization module 706 performs the step of optimizing the plurality of similar case pair sets, comprising: performing similar pair judgment on the plurality of similar case pair sets by using the trained supervised model to optimize the plurality of similar case pair sets.

[0073] Please refer to Figure 8 , Figure 8 is a schematic diagram of a framework of an embodiment of the electronic device. The electronic device 80 comprises a memory 81 and a processor 82 coupled with each other. The processor 82 is configured to execute program instructions stored in the memory 81 to implement the steps of any of the embodiments of the test case deduplication method described above. In a specific implementation scenario, the electronic device 80 can include but is not limited to: a microcomputer, a server.

[0074] Specifically, the processor 82 is configured to control itself and the memory 81 to implement the steps of any of the embodiments of the test case deduplication method described above. The processor 82 can also be referred to as a CPU (Central Processing Unit). The processor 82 can be an integrated circuit chip with processing capability. The processor 82 can also be a general purpose processor, a DSP (Digital Signal Processor), an ASIC (Application Specific Integrated Circuit), an FPGA (Field-Programmable Gate Array) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components. The general purpose processor can be a microprocessor or the processor can also be any conventional processor. In addition, the processor 82 can be implemented by an integrated circuit chip.

[0075] Please refer to Figure 9 , Figure 9is a schematic diagram of a framework of an embodiment of the computer readable storage medium of the present application. The computer readable storage medium 90 stores program instructions 800 capable of being executed by a processor, and the program instructions 900 are used to implement the steps of any one of the test case deduplication method embodiments described above.

[0076] In several embodiments provided in the present application, it should be understood that the disclosed methods and devices can be implemented in other ways. For example, the device implementation described above is only schematic, and the division of modules or units is only a logical function division, and actual implementation can have another division manner, for example, the units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the units shown or discussed can be indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.

[0077] The units described as separate components can or can not be physically separate, and the components shown as units can or can not be physical units, i.e., they can be located in one place or distributed on network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the present embodiment.

[0078] In addition, the functional units in each embodiment of the present application can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of a software functional unit.

[0079] If the integrated unit is realized in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer readable storage medium. Based on this understanding, the technical solutions of the present application or the whole or part of the technical solutions that essentially contribute to the prior art can be embodied in the form of a software product, which is stored in a storage medium and includes a number of instructions for making a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor execute all or part of the steps of the various embodiment methods of the present application. The aforementioned storage medium includes: a U disk, a mobile hard disk, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), a magnetic disk or an optical disk, and various program code storage media.

Claims

1. A method for deduplication of test cases, the method comprising: The test case deduplication method comprises: obtaining a test case data set to be processed, the test case data set to be processed comprising a plurality of test cases; for all test cases in the test case data set to be processed, calculating the case similarity between any test cases according to at least one preset similarity algorithm to obtain a plurality of similar case pairs based on complete case dimensions; converting each test case into a case multi-ary tree, the case multi-ary tree being composed of step nodes, and calculating the node similarity of each step node between any two case multi-ary trees by using at least one preset similarity algorithm, and taking the test cases corresponding to two case multi-ary trees whose step nodes satisfy a preset condition as a similar case pair based on sub-case dimensions; taking the union of the plurality of similar case pairs based on complete case dimensions and the plurality of similar case pairs based on sub-case dimensions to obtain a plurality of hybrid generated similar case pairs, and arranging each similar case pair in the plurality of hybrid generated similar case pairs in descending order according to the similarity between the two test cases in each similar case pair, and selecting a preset number of similar case pairs as a plurality of similar case pair sets; based on the plurality of similar case pair sets, performing deduplication processing on similar test cases.

2. The test case deduplication method of claim 1, wherein, The obtaining of the test case data set to be processed, the test case data set to be processed comprising a plurality of test cases, comprises: obtaining a plurality of original test cases; performing data preprocessing on the plurality of original test cases to form the test case data set to be processed.

3. The test case deduplication method of claim 1, wherein, The preset similarity algorithm comprises any one of an intersection-union ratio based similarity algorithm, a TF-IDF based similarity algorithm, and a Skip-Gram model based similarity algorithm.

4. The test case deduplication method of claim 1, wherein, The preset condition is that the node similarity between all step nodes of one case multi-ary tree and the step nodes corresponding to another case multi-ary tree is greater than a preset threshold.

5. The test case deduplication method of claim 1, wherein, The test case deduplication method further comprises: optimizing the plurality of similar case pair sets; labeling the similar case pairs in the plurality of similar case pair sets after optimization with similar pair labels and storing them in a database.

6. The test case deduplication method of claim 5, wherein, The test case deduplication method further comprises: constructing an initial supervised model, training the initial supervised model by using the similar case pairs with similar pair labels in the database to obtain a trained supervised model; the optimization of the plurality of similar case pair sets comprises: performing similar pair judgment on the plurality of similar case pair sets by using the trained supervised model to optimize the plurality of similar case pair sets.

7. A deduplication apparatus of test cases, characterized in that, comprises: an obtaining module, configured to obtain a test case data set to be processed, the test case data set to be processed comprising a plurality of test cases; a generating module, configured to, for all test cases in the test case data set to be processed, calculate the case similarity between any test cases according to at least one preset similarity algorithm to obtain a plurality of similar case pairs based on complete case dimensions; Each test case is converted into a use case multi-tree composed of step nodes, and a node similarity of each step node between any two use case multi-trees is calculated by using at least one preset similarity algorithm, two test cases corresponding to two use case multi-trees whose node similarities of the step nodes meet a preset condition are taken as a use case similarity pair based on a sub-use case dimension; a union of the multiple similarity use case pairs based on the complete use case dimension and the multiple similarity use case pairs based on the sub-use case dimension is taken to obtain multiple hybrid generated similarity use case pairs; Each similarity use case pair in the multiple hybrid generated similarity use case pairs is arranged in descending order according to a similarity between two test cases in each similarity use case pair, and a preset number of similarity use case pairs are selected as a multiple similarity use case pair set; The processing module is configured to perform a deduplication processing on the similar test cases based on the multiple similarity use case pair set.

8. An electronic device, comprising: The memory and the processor are coupled to each other, and the processor is configured to execute program instructions stored in the memory to implement the test case deduplication method in any one of claims 1 to 7.

9. A computer-readable storage medium having stored thereon program instructions, wherein, The program instructions, when executed by the processor, implement the test case deduplication method in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Method for simplifying question bank, device and computer readable storage medium

    CN110990389A

  • Method, device and equipment for generating test case based on test scene

    CN111881022A

  • Test case deduplication method and device, computer equipment and storage medium

    CN113535563A