Test case processing method and device, storage medium and electronic equipment
By obtaining the code files of test cases for structured analysis and deep learning model processing, the problem of identifying equivalent test scripts in different languages is solved, the accuracy and efficiency of test case deduplication are improved, and it is suitable for large-scale testing scenarios in multiple languages.
Patent Information
- Application Number
- CN202510894195.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-06-30
- Publication Date
- 2025-10-17
AI Technical Summary
When faced with a large-scale test case library, existing technologies have difficulty identifying equivalent test scripts that implement the same functions in different programming languages, and the processing speed is slow, which cannot meet the multi-language testing needs in modern software engineering.
By obtaining the code files corresponding to the test cases, structured parsing is performed to extract key operation nodes, natural language sentences and input parameters, the mixed similarity is calculated, and a deep learning model is used to deduplicate redundant test cases.
It significantly improves the ability to understand the semantics of program behavior, identifies functionally equivalent test scripts in different languages, improves the accuracy and processing efficiency of test case deduplication, and meets the needs of multi-language and large-scale testing scenarios.
Smart Images

Figure CN120803929A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of software testing, and in particular to a test case processing method and device, a storage medium and an electronic device. BACKGROUND
[0002] A test case is a collection of specific inputs, operation steps and expected results used to verify whether a specific function or feature is correctly implemented in the software testing process, which can help testers systematically find defects, verify function correctness and ensure software quality. With the increasing complexity of system functions and the growing testing needs, the number of test cases is also increasing exponentially. Removing invalid or repetitive test content in the test case library in a timely manner can reduce maintenance costs and speed up the testing cycle.
[0003] Currently, the similarity determination and deduplication of test cases mainly rely on traditional text matching methods or manual review mechanisms. Text matching is performed on the title, Jaccard coefficient, term frequency-inverse document frequency (TF-IDF) algorithm and other contents in the test case to calculate the similarity score between them, and then it is determined whether they belong to repetitive or redundant content.
[0004] However, the traditional method can only perform shallow comparison based on string matching or syntax structure when facing code-level test cases, lacks the ability to understand program behavior semantics, and thus it is difficult to identify equivalent implementations of the same function in different programming languages (such as Java / Python equivalent test scripts). When facing large-scale test case libraries, the processing speed of test cases is slow, which cannot meet the large-scale and multi-language testing needs in modern software engineering. SUMMARY
[0005] Therefore, the present application provides a test case processing method, device, storage medium and electronic device, which mainly aims to improve the technical problem that the existing method in the prior art lacks understanding of program behavior semantics, is difficult to identify equivalent test scripts for implementing the same function in different programming languages, and is slow in processing large-scale test case libraries, which cannot meet the large-scale and multi-language testing needs in modern software engineering.
[0006] In a first aspect, the present application provides a test case processing method, comprising:
[0007] obtaining code files corresponding to a plurality of test cases;
[0008] performing structured parsing on the code files to extract key operation nodes, natural language sentences and input parameters corresponding to the plurality of test cases, respectively;
[0009] calculate a hybrid similarity of the plurality of test cases based on the key operation nodes, the natural language sentences and the input parameters;
[0010] determine a test case with a hybrid similarity higher than a similarity threshold as a redundant test case;
[0011] perform deduplication processing on the redundant test case through a deep learning model.
[0012] In a second aspect, the present application provides a processing device of test cases, comprising:
[0013] an obtaining module configured to obtain code files corresponding to a plurality of test cases;
[0014] a parsing module configured to perform structural parsing on the code files, and extract key operation nodes, natural language sentences and input parameters corresponding to the plurality of test cases respectively;
[0015] a calculating module configured to calculate a hybrid similarity of the plurality of test cases based on the key operation nodes, the natural language sentences and the input parameters;
[0016] a determining module configured to determine a test case with a hybrid similarity higher than a similarity threshold as a redundant test case;
[0017] a processing module configured to perform deduplication processing on the redundant test case through a deep learning model.
[0018] In a third aspect, the present application provides a computer readable storage medium having a computer program stored thereon, wherein the computer program is executed by a processor to implement the processing method of test cases of the first aspect.
[0019] In a fourth aspect, the present application provides an electronic device comprising a storage medium, a processor and a computer program stored on the storage medium and executable on the processor, wherein the processor executes the computer program to implement the processing method of test cases of the first aspect.
[0020] By the technical scheme, the test case processing method, device, storage medium and electronic equipment provided by the application are provided, compared with the prior art, the application first acquires code files corresponding to a plurality of test cases; the code files are structurally parsed to extract key operation nodes, natural language sentences and input parameters corresponding to the plurality of test cases respectively; based on the key operation nodes, the natural language sentences and the input parameters, a hybrid similarity of the plurality of test cases is calculated; test cases with a hybrid similarity higher than a similarity threshold are determined as redundant test cases; and the redundant test cases are processed by a deep learning model. By acquiring the code files corresponding to the test cases and performing structural parsing, the key operation nodes, the natural language sentences and the input parameters are accurately extracted, the hybrid similarity between the test cases is calculated in combination with the deep learning model, the redundant test cases are identified and processed, the program behavior semantic understanding ability is significantly improved, and then the functionally equivalent test scripts in different languages can be identified, the accuracy and processing efficiency of the test case deduplication are improved, and the actual needs of the multi-language and large-scale test scenarios in software testing can be better met. BRIEF DESCRIPTION OF DRAWINGS
[0021] The accompanying drawings, which are incorporated into and form a part of the specification, illustrate an embodiment consistent with the present application and, together with the description, serve to explain the principles of the application.
[0022] In order to more clearly illustrate the technical solutions in the embodiments of the application or the prior art, the accompanying drawings needed to be used in the embodiments or prior art description will be briefly introduced. Obviously, for those skilled in the art, other drawings can also be obtained based on these drawings without creative labor.
[0023] Figure 1 A flowchart of a test case processing method provided by an embodiment of the application is shown;
[0024] Figure 2 A flowchart of a test case processing method provided by an embodiment of the application is shown;
[0025] Figure 3 A flowchart of an example provided by an embodiment of the application is shown;
[0026] Figure 4 A flowchart of an example provided by an embodiment of the application is shown;
[0027] Figure 5 A flowchart of an example provided by an embodiment of the application is shown;
[0028] Figure 6 A structural diagram of a test case processing device provided by an embodiment of the application is shown;
[0029] Figure 7 A structural schematic diagram of an electronic device provided by an embodiment of the present application is shown. DETAILED DESCRIPTION
[0030] Embodiments of the present application will be described in more detail below with reference to the accompanying drawings. It should be noted that the embodiments in the present application and the features in the embodiments can be combined with each other without conflict.
[0031] In order to improve the technical problems in the prior art that the method lacks understanding of the program behavior semantics, it is difficult to identify equivalent test scripts for realizing the same function in different programming languages, and the speed is slow when processing large-scale test case libraries, and it cannot meet the large-scale and multi-language test requirements in modern software engineering. The present embodiment provides a processing method for test cases, as shown in Figure 1 The method comprises the following steps:
[0032] Step 101, obtaining code files corresponding to a plurality of test cases.
[0033] In some examples, the test case can include identification information (such as name and number), preconditions that need to be met before executing the test case, test steps and input data, etc.
[0034] For example, according to the description or name of the test case, the associated function module or business logic can be determined, and the specific code area is located. Or use the historical records and annotation information in the version control system (such as Git) to track the mapping relationship between each test case and the code file. For the automated test framework, the relevant code implementation can also be found directly by analyzing the classes, methods or functions referenced in the test script.
[0035] Step 102, structurally analyzing the code files to extract key operation nodes, natural language sentences and input parameters corresponding to the plurality of test cases respectively.
[0036] For example, the key operation node is the main function call or code block involved in the test case execution process, which represents the core checkpoint or action in the test flow, such as database query, port call, etc.
[0037] For example, the natural language sentence is derived from code comments, document strings or human-readable descriptions in method names, which provides a textual description of the test purpose, steps and expected results, and can help understand the specific intention of each test case.
[0038] For example, the input parameters are data required when executing the test case, including variable values defined directly in the test code, data imported from external data sources, or results calculated by other functions.
[0039] Step 103, based on the key operation nodes, natural language sentences, and input parameters, calculate the hybrid similarity of multiple test cases.
[0040] For example, the hybrid similarity integrates multiple dimensions of features, including semantic vector cosine similarity (reflecting the consistency of functional intent), execution path overlap rate (based on control flow graph comparison), input-output parameter Jaccard similarity, and domain label matching degree, etc.
[0041] In some examples, the system can comprehensively evaluate the similarity between different test cases through weighted summation, accurately identify redundant test cases with the same logical behavior under different input parameters or expression forms, and provide the basis for intelligent deduplication and test optimization.
[0042] Step 104, determine the test case with a hybrid similarity higher than the similarity threshold as a redundant test case.
[0043] In some examples, the redundant test case is a test case that is logically equivalent or highly similar to other test cases, and thus contributes little to increasing test coverage or discovering new defects. For example, redundant test cases include but are not limited to: test cases that execute the same functional path but use different parameter values, test cases with the same expected results, outdated test cases that are no longer applicable due to code refactoring or requirement changes but have not been removed from the test suite, test cases that cover different code segments but are repetitive at the logical and business process level, etc.
[0044] Step 105, perform deduplication processing on the redundant test cases through a deep learning model.
[0045] For example, by identifying and removing these redundant test cases, test efficiency can be significantly improved, unnecessary maintenance workload can be reduced, and overall test effectiveness and relevance can be improved.
[0046] Compared with the prior art, the embodiment first acquires code files corresponding to a plurality of test cases; performs structural analysis on the code files to extract key operation nodes, natural language sentences and input parameters corresponding to the plurality of test cases respectively; calculates hybrid similarity of the plurality of test cases based on the key operation nodes, the natural language sentences and the input parameters; determines test cases with hybrid similarity higher than a similarity threshold as redundant test cases; and performs deduplication processing on the redundant test cases through a deep learning model. By acquiring code files corresponding to test cases and performing structural analysis, key operation nodes, natural language sentences and input parameters are accurately extracted, and the hybrid similarity between test cases is calculated in combination with a deep learning model, so as to identify and deduplicate redundant test cases, significantly improve the program behavior semantic understanding ability, and further identify functionally equivalent test scripts in different languages, while improving the accuracy and processing efficiency of test case deduplication, and better meeting the actual needs of multi-language and large-scale test scenarios in software testing.
[0047] As a refinement and extension of the above embodiment, the present embodiment provides a specific method as shown in Figure 2 The method comprises the following steps:
[0048] Step 201: Acquire code files corresponding to a plurality of test cases.
[0049] For example, the overall architecture of the system in the embodiment is as shown in Figure 3 A multi-source data access mechanism can be designed at the system input layer to ensure the comprehensiveness and diversity of test case information. This multi-source data access mode can support direct import of code files in multiple formats (such as.java,.py,.go), facilitating the acquisition of test scripts from different programming language environments. In addition, an Application Programming Interface (API) connector can be used to seamlessly connect with mainstream test management platforms (such as TestRail, Jira and Zephyr) to synchronize key information such as test plans and execution status in real time, and Excel / XML structured documents can also be used as supplementary data sources.
[0050] Optionally, the method of the embodiment can further comprise: uniformly mapping element identifiers corresponding to test cases of different platforms to general identifiers, and converting key operations corresponding to test cases of different platforms to uniform semantic instructions.
[0051] In some examples, in order to improve the compatibility and reusability of test cases between different platforms, element identifiers (such as control IDs, page paths, interface names, etc.) involved in test cases from different test platforms can be uniformly mapped to a set of general identifiers, thereby shielding the naming differences between platforms. At the same time, the key operation instructions (such as clicking, inputting, sliding, etc.) representing the same or similar operations in each platform are converted into a unified semantic instruction set, so that the operations of different platforms have a unified expression form at the logical level. This conversion mechanism not only helps to build a platform-independent test logic abstraction layer, but also supports the automatic migration, reuse and maintenance of cross-platform test cases, improving the flexibility and expansibility of the test framework.
[0052] Step 202, structurally parsing the code file to extract a plurality of test cases respectively corresponding to key operation nodes, natural language sentences, and input parameters.
[0053] For example, the core task of the processing layer of the system is to deeply analyze and semantically enhance the original test cases. The structured parser in the preprocessing module is responsible for uniformly converting multi-source heterogeneous data into a standardized format. For code files, the parser uses Abstract Syntax Tree (AST) technology to extract key operation nodes to form a clear sequence of operation steps.
[0054] In some examples, for text description type cases, a Natural Language Processing (NLP) method can be used for sentence processing, and input parameters can be matched through regular expressions to finally generate a standardized test case representation.
[0055] Step 203, based on the key operation nodes, semantically analyzing the natural language sentences in combination with context labels to identify test cases that have logical equivalence under different input parameter combinations.
[0056] In some examples, context labels such as priority, module ownership, and other metadata information are further injected in the semantic enhancement unit, and historical execution logs are associated to supplement performance indicators such as average execution time and failure rate, providing more rich semantic features for subsequent similarity calculation and decision making.
[0057] For example, by identifying the behavior patterns of different test cases under input parameter combinations, test cases with logical equivalence can be automatically identified, even if there are differences in their expressions, such as test cases with logical equivalence but different step orders (such as entering a password first and then entering a username). The similarity in functionality can be accurately judged, thereby improving the efficiency and accuracy of test case deduplication, merging, and optimization.
[0058] Optionally, the embodiment method can further include: utilizing the semantic reasoning capability in the domain knowledge graph corresponding to different test cases to identify the implicit logical equivalence between the expressions of different test cases.
[0059] In some examples, the domain knowledge base includes two parts: a function module graph and historical execution data. The function module graph records the hierarchical relationship and dependency structure of the software system in detail, providing context for subsequent analysis; while the historical execution data covers the pass rate, failure rate, and execution time of each test case, which helps to evaluate the effectiveness and stability of the test case.
[0060] For example, in the semantic analysis process of the test case, the system introduces a knowledge-enhanced context-aware mechanism, and with the help of the semantic relationship defined in the domain knowledge graph, the system can identify the equivalence between "payment failure" and "insufficient balance" in business logic, even if there are differences in text expression. This semantic reasoning capability based on domain knowledge effectively improves the accuracy of the model in judging the similarity of test cases, helping the system to more accurately identify potential redundancies and enhance the intelligence level of test case deduplication and recommendation.
[0061] Step 204, calculating the hybrid similarity of test cases with logical equivalence.
[0062] Optionally, step 204 can specifically include: combining the semantic vector cosine similarity, the execution path overlap rate, the input-output parameter similarity, and the domain label matching degree to evaluate the hybrid similarity of the test cases.
[0063] In some examples, in order to comprehensively evaluate the hybrid similarity of the test cases, a weighted combination model can be used, which combines the semantic vector cosine similarity (S_semantic), the execution path overlap rate (S_execution), the input-output parameter similarity (S_IO), and the domain label matching degree (S_context).
[0064] For example, the total similarity S_total can be calculated by the following formula:
[0065] S_total = a * S_semantic + β * S_execution + γ * S_IO + δ * S_context (Formula One)
[0066] wherein a, b, g and d can be configured as weight coefficients of 0.5, 0.3, 0.1 and 0.1 respectively, and can be adjusted according to actual needs. S semantic measures the cosine similarity between the semantic vectors of two test cases, which is used to reflect their similarity in functional intent; S execution is based on control flow graph comparison, which is used to evaluate the degree of overlap of the execution paths of two test cases; S IO uses Jaccard similarity to quantify the similarity of input and output parameters; and S context considers the matching of domain-specific tags to enhance the consideration of application scenario consistency.
[0067] For example, through this multi-dimensional similarity evaluation method, the truly repeated or highly similar test cases can be more accurately identified, thereby improving the efficiency and quality of test management.
[0068] Step 205: Determine the test cases with a mixed similarity higher than the similarity threshold value as redundant test cases.
[0069] Optionally, the embodiment method can further include dynamically adjusting the similarity threshold value according to the change of the test coverage of the plurality of test cases.
[0070] In some examples, the process of dynamically adjusting the similarity threshold value is as shown in Figure 4 As shown, first read the project stage (development, testing or maintenance), select the base threshold value according to the stage, then calculate the test coverage change rate (ACoverage), and adjust the threshold value by combining the application time decay factor (N=months away from the last update). Finally, output the adjusted threshold value, and apply it to the current detection batch, to ensure that the evaluation standard of the test cases can be flexibly adjusted with the changes of the project progress and the test coverage.
[0071] In some examples, the redundancy of the test cases can be dynamically determined by an adaptive threshold algorithm. First, set the base threshold value according to the project stage (for example, set to 0.85 in the development stage and 0.75 in the maintenance stage), and introduce a time decay factor for adjustment, as shown in Equation 2:
[0072] Similarity threshold value = base threshold value x (1-0.05 x N_months) (Equation 2)
[0073] Wherein N_months represents the number of months of project duration.
[0074] Exemplarily, during the test process, the system can dynamically adjust the threshold according to the change of the test coverage: if the test coverage decreases by more than 5%, the threshold is appropriately reduced (multiplied by 0.98) to increase the sensitivity; if a new function module is added, the threshold is appropriately increased (multiplied by 1.02) to adapt to the new test requirements. Then the test cases with a mixed similarity higher than the current threshold are identified as redundant cases, thereby realizing intelligent optimization and dynamic management of the test case library.
[0075] In step 206, the redundant test cases are processed by the deep learning model.
[0076] In some examples, the output layer of the system is used to generate a detailed redundancy report and an optimized case library to support the test personnel to efficiently manage and maintain the test assets. The redundancy report displays the repeated case groups in table form, each group is labeled with a specific similarity score and a suggested action, helping users to quickly identify and handle redundant content. The optimized case library contains a refined case set after automatic deduplication, and is accompanied by a version tracking log, which records the change details in each optimization process, ensuring the traceability and transparency of the case library. In addition, the system also provides an integrated interface with the CI / CD pipeline (such as Jenkins, GitHub Actions), realizing seamless connection between test case management and continuous integration process, and helping the deep integration of automated testing and agile development practices.
[0077] In some examples, after deduplication, the optimized test case library is output, which contains a refined and efficient case set, and is supplemented by a version tracking log that details the change details involved in each optimization, ensuring the traceability and maintainability of the test case library, thereby comprehensively improving test efficiency and case management quality.
[0078] Optionally, step 206 can specifically include: utilizing a dual-tower neural network structure to process the redundant test cases, wherein the left tower of the dual-tower neural network structure is used to process new test cases, and the right tower of the dual-tower neural network structure is used to process historical test cases.
[0079] Exemplarily, the test cases can be analyzed for semantic similarity by constructing a deep learning model, and the system can efficiently identify and process redundant test cases. After completing the similarity calculation and redundancy determination, the system generates a detailed redundancy report, which highlights the repeated case groups and labels each group with a specific similarity score, while providing merging suggestions, clearly indicating the cases to be retained and their logical basis for retention, such as higher coverage, better readability, or lower maintenance cost, etc.
[0080] In some examples, efficient semantic matching and similarity retrieval between test cases can be achieved through a dual-tower large model architecture. For example, Figure 5As shown, the double-tower large model is a symmetric neural network architecture for processing current use cases and historical use case library. The model consists of two symmetric neural network towers on the left and right, each containing an input layer, a word embedding layer, an AST parsing branch, an attention layer, a fully connected layer, and an output vector. The left tower is responsible for processing current use cases, while the right tower processes the historical use case library. The similarity calculation layer connects the output vectors of the left and right towers through a cosine similarity calculation module to evaluate the similarity between use cases. The fine-tuning data flow part includes triplet data (Anchor / Positive / Negative), loss function calculation (TripletLoss), and model update through backpropagation, ensuring that the model can be optimized and adjusted according to the training data, thereby achieving efficient and accurate test case similarity identification and management.
[0081] For example, the left tower is responsible for processing the current input test case, with inputs of normalized test steps and parameter text. The network structure includes an embedding layer, an AST Attention module (for capturing code structure information), a bidirectional LSTM (BiLSTM) layer, and finally outputs a 128-dimensional semantic vector representation. The right tower is aimed at the historical use case library, with inputs of pre-computed and stored million-level test case vectors, combined with local sensitive hashing (LSH) technology for index optimization to accelerate approximate nearest neighbor search in large-scale scenarios. In terms of model training, a triplet-based fine-tuning strategy is adopted, using 1 million Anchor-Positive-Negative samples annotated by humans for training, and introducing an improved Triplet Loss function to support dynamic adjustment of the margin parameter, thereby improving the robustness and discriminative ability of the model in terms of distance distribution between positive and negative samples.
[0082] For example, through the incremental processing engine of the double-tower large model, real-time detection and analysis of new test cases can be performed, with a single use case processing delay controlled within 100 milliseconds. This mechanism does not require full recalculation of existing test cases, but only efficiently processes new or changed content, significantly improving system response speed and resource utilization efficiency, making it suitable for large-scale, continuously iterating test case management scenarios.
[0083] In some embodiments, optimization of test cases for the student management system can be achieved by processing 800,000 test cases covering Selenium Web tests and JUnit API tests, focusing on the order processing module (including student registration, tuition payment, and student class reporting). By parsing Selenium scripts to extract XPath element locators and operation sequences, and injecting corresponding labels based on domain knowledge, a hybrid model of GPT-3.5-turbo and CodeBERT is used, combined with 500,000 manually annotated data, and fine-tuned on 4 NVIDIA A100 GPUs for 18 hours. Then the model is applied to detect redundancy at a rate of 2000 test cases per batch, with a similarity threshold range of 0.68 to 0.87, achieving an accuracy of 94.3%. The results show that the test case library is reduced by 48%, with 384,000 remaining, and the test suite execution time is shortened from 6.2 hours to 3.8 hours, with an efficiency improvement of 38.7%, significantly improving the efficiency and quality of test case management.
[0084] In some embodiments, to address the redundancy problem in cross-platform mobile application testing, the goal is to merge equivalent UI test cases on iOS (XCUITest) and Android (Espresso) platforms. First, by mapping accessibilityIdentifier on iOS and resource-id on Android to a common element ID, the identification differences between platforms are eliminated. Then, platform-specific operations (such as iOS swipe and Android pull-down) are converted into unified semantic instructions, achieving standardized expression of execution paths. The results show that in practical applications, 87.6% of cross-platform duplicate test cases are identified, with a misjudgment rate controlled within 5.3%, significantly improving the management efficiency and execution consistency of cross-platform test cases.
[0085] In some embodiments, the test case optimization and deduplication effect based on the hybrid model and unified semantic analysis in this embodiment is shown in Table 1:
[0086] Table 1
[0087]
[0088]
[0089] Compared with the prior art, the embodiment breaks through the limitation of traditional pure text or NLP method in semantic understanding and logical reasoning by simultaneously analyzing the three modal data of the abstract syntax tree of the code, the natural language description and the execution log. The actual execution logic of the test case can be accurately captured by combining the code structure information, the understanding ability of the test intention can be improved by means of the natural language sentence division, and the accuracy and robustness of the similarity judgment of the test case are further enhanced by fusing the runtime behavior data in the execution log, so that more efficient and intelligent test case deduplication and optimization are realized, and the actual needs of the multi-language and large-scale test scene in software testing are met.
[0090] Further, as Figures 1 to 2 As a specific implementation of the method shown, the embodiment provides a test case processing device, as shown in the figure. Figure 6 The device comprises an acquisition module 31, an analysis module 32, a calculation module 33, a determination module 34 and a processing module 35.
[0091] The acquisition module 31 is configured to acquire code files corresponding to a plurality of test cases;
[0092] The analysis module 32 is configured to perform structural analysis on the code files, and extract key operation nodes, natural language sentences and input parameters corresponding to the plurality of test cases respectively;
[0093] The calculation module 33 is configured to calculate the hybrid similarity of the plurality of test cases based on the key operation nodes, the natural language sentences and the input parameters;
[0094] The determination module 34 is configured to determine the test case with a hybrid similarity higher than a similarity threshold as a redundant test case;
[0095] The processing module 35 is configured to perform deduplication processing on the redundant test case through a deep learning model.
[0096] In some examples of the embodiment, the calculation module 33 is specifically configured to perform semantic analysis on the natural language sentences based on the key operation nodes in combination with context labels, identify test cases with logical equivalence under different input parameter combinations, and calculate the hybrid similarity of the test cases with logical equivalence.
[0097] In some examples of the embodiment, the calculation module 33 is specifically further configured to evaluate the hybrid similarity of the test cases in combination with semantic vector cosine similarity, execution path overlap rate, input / output parameter similarity and domain label matching degree.
[0098] In some examples of the present embodiment, the computing module 33 is specifically further configured to utilize semantic reasoning capability in the domain knowledge graph corresponding to different test cases to identify implicit logical equivalences between expressions of different test cases.
[0099] In some examples of the present embodiment, the processing module 35 is specifically configured to utilize a double-tower neural network structure to perform deduplication processing on the redundant test cases, wherein a left tower of the double-tower neural network structure is used to process newly added test cases, and a right tower of the double-tower neural network structure is used to process historical test cases.
[0100] In some examples of the present embodiment, the obtaining module 31 is specifically configured to uniformly map element identifiers corresponding to test cases of different platforms into general identifiers, and convert key operations corresponding to test cases of different platforms into uniform semantic instructions.
[0101] In some examples of the present embodiment, the determining module 34 is specifically further configured to dynamically adjust the similarity threshold according to changes in test coverage of the plurality of test cases.
[0102] It should be noted that other corresponding descriptions of the functions of the test case processing device provided in the present embodiment can be referred to the corresponding descriptions in the Figures 1 to 2 , which will not be repeated here.
[0103] Based on the above method as shown in Figures 1 to 2 , accordingly, the present embodiment also provides a computer readable storage medium having a computer program stored thereon, which is executed by a processor to implement the above method as shown in Figures 1 to 2 .
[0104] Based on such understanding, the technical solution of the present application can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a U disk, a mobile hard disk, etc.), and includes a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods of various implementation scenarios of the present application.
[0105] As shown in Figure 7 , it is a hardware structure schematic diagram of an electronic device, which includes:
[0106] at least one processor 901; and
[0107] a memory 902 in communication connection with the at least one processor 901; wherein
[0108] The memory 902 stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the processing method of the test case as described above.
[0109] Figure 7 The processor 901 is taken as an example in the foregoing.
[0110] The electronic device can further include an input device 903 and a display device 904.
[0111] The processor 901, the memory 902, the input device 903, and the display device 904 can be connected by a bus or other means, Figure 7 The connection by the bus is taken as an example.
[0112] The memory 902 is a non-volatile computer readable storage medium, which can be used to store non-volatile software programs, non-volatile computer executable programs, and modules, such as program instructions / modules corresponding to the processing method of the test case in the embodiments of the present application, for example, Figures 1 to 2 The processor 901 performs various functional applications and data processing by running the non-volatile software programs, instructions, and modules stored in the memory 902, that is, implements the processing method of the test case in the above embodiments.
[0113] The memory 902 can include a program storage area and a data storage area, wherein the program storage area can store an operating system and application programs required by at least one function; the data storage area can store data created according to the use of the processing method of the test case, and the like. In addition, the memory 902 can include a high-speed random access memory, and can also include a non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other non-volatile solid-state memory device. In some embodiments, the memory 902 can optionally include a memory remotely arranged with respect to the processor 901, and these remote memories can be connected to the device performing the processing method of the test case through a network. Examples of the above network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof.
[0114] The input device 903 can receive input user clicks, and generate signal inputs related to user settings and function controls of the processing method of the test case. The display device 904 can include a display screen and other display devices.
[0115] When the one or more modules are stored in the memory 902 and are run by the one or more processors 901, the processing method of the test case in any of the above method embodiments is executed.
[0116] Optionally, the above-mentioned entity device can further include a user interface, a network interface, a camera, a radio frequency (RF) circuit, a sensor, an audio circuit, a WI-FI module, and the like. The user interface can include a display screen, an input unit such as a keyboard, and the like. Optionally, the user interface can further include a USB interface, a card reader interface, and the like. The network interface can optionally include a standard wired interface, a wireless interface (such as a WI-FI interface), and the like.
[0117] Those skilled in the art can understand that the above-mentioned entity device structure provided by the embodiment does not constitute a limitation on the entity device, and can include more or fewer components, or combine certain components, or different component arrangements.
[0118] The storage medium can further include an operating system, a network communication module. The operating system is a program for managing hardware and software resources of the above-mentioned entity device, supporting the running of information processing programs and other software and / or programs. The network communication module is used to realize the communication between the components inside the storage medium, and the communication with other hardware and software in the information processing entity device.
[0119] Through the description of the above embodiments, those skilled in the art can clearly understand that the present application can be realized by means of software and necessary general hardware platforms, or by hardware. By applying the scheme of the embodiment, compared with the prior art, the embodiment acquires the code file corresponding to the test case and performs structured parsing, accurately extracts the key operation node, the natural language sentence, and the input parameter, combines the deep learning model to calculate the hybrid similarity between the test cases, thereby identifying and deduplicating the redundant test cases, significantly improving the program behavior semantic understanding ability, and further identifying the functionally equivalent test scripts in different languages, while improving the accuracy and processing efficiency of test case deduplication, and better meeting the actual needs of multi-language and large-scale test scenarios in software testing.
[0120] It should be noted that, in this paper, relationship terms such as "first" and "second" are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between the entities or operations. Moreover, the terms "include", "contain" or any other variant thereof are intended to cover non-exclusive inclusion, so that the process, method, article or device including a series of elements not only includes those elements, but also includes other elements not explicitly listed or inherent to such process, method, article or device. Without more limitations, the element defined by the statement "including a" does not exclude the presence of another identical element in the process, method, article or device including the element.
[0121] The foregoing detailed description of the application has been presented for purposes of illustration and description. Various modifications and changes can be made to these embodiments without departing from the spirit and scope of the application. It is intended that the scope of the application should not be limited by the particular representative embodiments described in this application. Rather, the scope of the application should be determined only by reference to the appended claims and equivalents thereof.
Claims
1. A method for processing a test case, characterized in that: include: Get the code files corresponding to multiple test cases; Performing structural analysis on the code file to extract key operation nodes, natural language sentences, and input parameters corresponding to the multiple test cases; Calculating a mixed similarity of the plurality of test cases based on the key operation nodes, the natural language sentences, and the input parameters; Determining the test cases whose mixed similarity is higher than the similarity threshold as redundant test cases; The redundant test cases are deduplicated using a deep learning model.
2. The method according to claim 1, characterized in that The calculating the mixed similarity of the plurality of test cases based on the key operation nodes, the natural language sentences and the input parameters includes: Based on the key operation nodes, the natural language sentences are semantically analyzed in combination with context labels to identify test cases that are logically equivalent under different input parameter combinations; Calculate the mixed similarity of the test cases with logical equivalence.
3. The method according to claim 2, characterized in that The calculating of the mixed similarity of the test cases having logical equivalence includes: The hybrid similarity of the test cases is evaluated by combining semantic vector cosine similarity, execution path overlap rate, input and output parameter similarity and domain label matching.
4. The method according to claim 2, characterized in that The method further comprises: By utilizing the semantic reasoning capabilities in the domain knowledge graphs corresponding to different test cases, the implicit logical equivalence between the expressions of different test cases can be identified.
5. The method according to claim 1, wherein The deduplication processing of the redundant test cases by using a deep learning model includes: The redundant test cases are deduplicated using a dual-tower neural network structure, wherein the left tower of the dual-tower neural network structure is used to process new test cases, and the right tower of the dual-tower neural network structure is used to process historical test cases.
6. The method according to claim 1, wherein Before obtaining the code files corresponding to the multiple test cases, the method further includes: The element identifiers corresponding to the test cases of different platforms are uniformly mapped to common identifiers, and the key operations corresponding to the test cases of different platforms are converted into unified semantic instructions.
7. The method according to claim 1, characterized in that The method further comprises: The similarity threshold is dynamically adjusted according to changes in the test coverage of the multiple test cases.
8. A test case processing device, characterized in that: include: An acquisition module is configured to acquire code files corresponding to multiple test cases; A parsing module is configured to perform structural parsing on the code file to extract key operation nodes, natural language sentences, and input parameters corresponding to the multiple test cases; a calculation module configured to calculate the mixed similarity of the plurality of test cases based on the key operation nodes, the natural language sentences and the input parameters; a determination module configured to determine the test cases whose mixed similarity is higher than a similarity threshold as redundant test cases; The processing module is configured to deduplicate the redundant test cases through a deep learning model.
9. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
10. An electronic device comprising a storage medium, a processor, and a computer program stored in the storage medium and executable on the processor, wherein: When the processor executes the computer program, the method according to any one of claims 1 to 7 is implemented.