Test case determination method and device and electronic equipment

By determining centroid cases and clusters in fuzz testing and optimizing test case selection, the high cost and low efficiency problems of traditional fuzz testing methods under multi-dimensional input are solved, and efficient and comprehensive testing results are achieved.

CN120803922APending Publication Date: 2025-10-17HEFEI GUOXUAN HIGH TECH POWER ENERGY
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202510864227.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-06-25
Publication Date
2025-10-17

AI Technical Summary

Technical Problem

Traditional fuzz testing methods have high implementation costs and generate many invalid test cases when performing functional testing on multi-dimensional inputs during the integration testing and system testing phases, resulting in low testing efficiency.

Method used

By obtaining multiple initial test cases, determining the centroid cases and non-centroid cases, clustering to form K clusters, selecting representative test cases for testing, and using multidimensional data similarity and clustering algorithms to optimize test case selection.

Benefits of technology

It reduces testing costs, improves testing efficiency, implements comprehensive functional testing of multi-dimensional data, and avoids the generation of invalid test cases.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120803922A_ABST
    Figure CN120803922A_ABST
Patent Text Reader

Abstract

The invention discloses a test case determination method and device and electronic equipment. The method comprises the following steps: acquiring a plurality of initial test cases for a predetermined function test; determining a first centroid case and a non-centroid case from the plurality of initial test cases; according to the target multi-dimensional data similarity between each non-centroid use case and each centroid use case, determining a second centroid use case from the non-centroid use cases until K centroid use cases are determined; and according to the K clusters, determining a target test case for executing a predetermined function test. According to the method and the device, the technical problems that the implementation cost is high, many invalid test cases exist and the test efficiency is low when the functional test is performed on the multi-dimensional data in the prior art are solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of testing, and in particular to a test case determination method, device and electronic equipment. Background Art

[0002] Traditional fuzz testing methods, such as the fuzz tester AFL and the improved fuzz testing tool AFLFast, are generally gray-box fuzz testing, relying on code coverage feedback mechanisms and program instrumentation. However, due to the high implementation cost and inability to detect requirement deviations, they are rarely used in the integration and system testing phases. Furthermore, integration and system testing often involve multi-dimensional inputs (including inputs of multiple types of data) and continuous events (event streams related to input data). When performing functional testing on multi-dimensional data, traditional fuzz testing methods have high implementation costs, a high number of invalid test cases, and low test efficiency.

[0003] To address the above-mentioned problems, no effective solutions have been proposed so far. Summary of the Invention

[0004] The embodiments of the present invention provide a test case determination method, device and electronic device to at least solve the technical problems in related technologies of high implementation cost, many invalid test cases and low test efficiency when performing functional testing on multidimensional data.

[0005] According to one aspect of an embodiment of the present invention, a test case determination method is provided, comprising: obtaining a plurality of initial test cases for a predetermined functional test, wherein the plurality of initial test cases include a corresponding interface address sequence and a corresponding data sequence, the corresponding data queue includes multidimensional data, and the plurality of initial test cases are used to perform a test operation, the test operation being used to apply the data in the corresponding data sequence to the interface in the corresponding interface address sequence; determining a first centroid case and a non-centroid case from the plurality of initial test cases; determining a second centroid case from the non-centroid case based on the similarity between each non-centroid case and the target multidimensional data corresponding to each centroid case, until K centroid cases are determined, wherein K is a positive integer greater than 1; clustering the non-centroid case to the K centroid case to obtain K clustering clusters; and determining a target test case for performing the predetermined functional test based on the K clustering clusters.

[0006] Optionally, before the target multi-dimensional data similarity corresponding to each non-centroid use case and each centroid use case is determined, the method further comprises: determining dimension data corresponding to each non-centroid use case and each centroid use case at the same interface address; and determining the target multi-dimensional data similarity corresponding to each non-centroid use case and each centroid use case according to the dimension data corresponding to each non-centroid use case and each centroid use case at the same interface address.

[0007] Optionally, the dimension data corresponding to the target non-centroid use case and the target centroid use case at the same interface address is determined by fixing a first interface address sequence of the target non-centroid use case, sliding a second interface address sequence of the target centroid use case from a starting position, and performing a target operation when the first interface address sequence and the second interface address sequence have the same interface address at a target sliding position until the sliding reaches an end position.

[0008] Optionally, after the non-centroid use cases are clustered into the K centroid use cases to obtain K clustering clusters, the method further comprises: determining an intra-cluster average distance corresponding to each of the K clustering clusters and an inter-cluster average distance between the K clustering clusters and the nearest clustering cluster; determining a clustering accuracy index according to the K intra-cluster average distances and the K inter-cluster average distances; and updating the value of K when the clustering accuracy index is lower than a predetermined threshold.

[0009] Optionally, after the non-centroid use cases are clustered into the K centroid use cases to obtain K clustering clusters, the method further comprises: determining a multi-dimensional data similarity between each use case in a target cluster and other use cases in the target cluster; determining a use case to be mutated in the target cluster according to the multi-dimensional data similarity between each use case in the target cluster and other use cases in the target cluster; mutating the use case to be mutated to obtain a mutated use case; determining a first similarity sum of the use case to be mutated and other use cases in the target cluster and a second similarity sum of the mutated use case and other use cases in the target cluster; and determining a use case to be retained in the target cluster from the use case to be mutated and the mutated use case according to the first similarity sum and the second similarity sum.

[0010] Optionally, the target test use case for performing the predetermined function test is determined according to the K clustering clusters, which comprises: updating centroids of the K clustering clusters to obtain updated centroids corresponding to the K clustering clusters, respectively; and determining test use cases corresponding to the K updated centroids as the target test use case.

[0011] Optionally, the obtaining the plurality of initial test cases for the predetermined function test comprises: obtaining a target requirement, wherein the target requirement comprises a requirement of performing the predetermined function test; determining a target input interface according to the predetermined function test; and determining the plurality of initial test cases according to the target requirement and the target input interface.

[0012] According to an aspect of an embodiment of the present application, there is provided a test case determination apparatus, comprising: an obtaining module configured to obtain a plurality of initial test cases for a predetermined function test, wherein the plurality of initial test cases comprise a corresponding sequence of interface addresses and a corresponding sequence of data, the corresponding sequence of data comprising multi-dimensional data for performing a plurality of operations ordered according to a predetermined rule, the operations being configured to act on data in the corresponding sequence of data with respect to interfaces in the corresponding sequence of interface addresses; a first determining module configured to determine a first centroid test case and non-centroid test cases from the plurality of initial test cases; a second determining module configured to determine a second centroid test case from the non-centroid test cases according to a target multi-dimensional data similarity between each non-centroid test case and each centroid test case, until K centroid test cases are determined, wherein K is a positive integer greater than 1; a clustering module configured to cluster the non-centroid test cases into the K centroid test cases to obtain K clusters; and a third determining module configured to determine a target test case for performing the predetermined function test according to the K clusters.

[0013] According to an aspect of an embodiment of the present application, there is provided an electronic device, comprising: a processor; and a memory for storing instructions executable by the processor; wherein the processor is configured to execute the instructions to implement any of the test case determination methods described above.

[0014] According to an aspect of an embodiment of the present application, there is provided a computer readable storage medium, when instructions in the computer readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to perform any of the test case determination methods described above.

[0015] In the embodiment of the present application, a plurality of initial test cases for a predetermined function test are acquired, wherein the plurality of initial test cases comprise corresponding interface address sequences and corresponding data sequences, the corresponding data sequences comprise multi-dimensional data, the plurality of initial test cases are used to perform a test operation, and the test operation is used to apply data in the corresponding data sequences to interfaces in the corresponding interface address sequences; a first centroid case and non-centroid cases are determined from the plurality of initial test cases; a second centroid case is determined from the non-centroid cases according to a target multi-dimensional data similarity of each non-centroid case to each centroid case, until K centroid cases are determined, wherein K is a positive integer greater than 1; the non-centroid cases are clustered into the K centroid cases to obtain K clustering clusters; and a target test case for performing the predetermined function test is determined according to the K clustering clusters. The present application selects K centroid cases, classifies similar test cases into a category, obtains K clustering clusters, selects representative cases from the K clustering clusters for testing, reduces the time cost, improves the test efficiency, and achieves comprehensive testing, thereby solving the technical problems of high implementation cost and many invalid test cases and low test efficiency in related art when performing functional testing on multi-dimensional data. BRIEF DESCRIPTION OF DRAWINGS

[0016] The accompanying drawings, which are included to provide a further understanding of the application and are incorporated in and constitute a part of this application, illustrate embodiments of the application and together with the description serve to explain the application. In the drawings:

[0017] Figure 1 FIG. 1 is a flowchart of a test case determination method according to an embodiment of the present application;

[0018] Figure 2 FIG. 2 is a flowchart of test case generation provided by an optional embodiment of the present application;

[0019] Figure 3 FIG. 3 is a schematic diagram of sliding determination of data similarity provided by an optional embodiment of the present application;

[0020] Figure 4 FIG. 4 is a flowchart of using the contour coefficient method to evaluate and select the optimal k value provided by an optional embodiment of the present application;

[0021] Figure 5 FIG. 5 is a structural block diagram of a test case determination apparatus according to an embodiment of the present application. DETAILED DESCRIPTION

[0022] In the following, the technical solutions in the embodiments of the present application will be described clearly and completely with reference to the drawings in the embodiments of the present application. Obviously, the described embodiments are only a part of the embodiments of the present application, rather than all the embodiments of the present application. Based on the embodiments in the present application, all the other embodiments obtained by a person of ordinary skill in the art without creative effort should fall into the protection scope of the present application.

[0023] It should be noted that the terms "first", "second" and the like in the description and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and do not necessarily indicate a specific order or sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments of the application described herein can be implemented in other than the order illustrated or described herein. In addition, the terms "comprise" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product or device that includes a list of steps or units does not necessarily limit to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to such processes, methods, products or devices.

[0024] Embodiment 1

[0025] According to the embodiments of the present application, an embodiment of a test case determination method is provided. It should be noted that the steps shown in the flowchart of the drawings can be executed in a computer system such as a set of computer executable instructions, and although the logical order is shown in the flowchart, in some cases, the steps shown or described herein can be executed in a different order.

[0026] Figure 1 is a flowchart of a test case determination method according to an embodiment of the present application, as shown in Figure 1 the method comprises the following steps:

[0027] In step S102, a plurality of initial test cases for predetermined function testing are obtained, wherein the plurality of initial test cases include a corresponding interface address sequence and a corresponding data sequence, the corresponding data sequence includes multi-dimensional data, and the plurality of initial test cases are used to perform a test operation, and the test operation is used to apply data in the corresponding data sequence to an interface in the corresponding interface address sequence.

[0028] In step S102, a plurality of initial test cases for predetermined function testing are obtained.

[0029] Among them, the pre-determined function test refers to a series of test activities planned in advance according to the functional requirements of the software, aiming to verify whether the software runs in the expected way. These tests can include unit testing, integration testing and system testing, etc., to ensure the quality, reliability and stability of the software.

[0030] Among them, the multiple initial test cases are a set of basic test scripts or instruction sequences created to start the fuzz testing. Each test case contains a set of expected input data and operation sequences to trigger specific functions or behaviors of the software.

[0031] Among them, the interface address sequence refers to the list or sequence of interfaces in the software that receive input and perform functions. Each interface has a unique identifier (address) for internal positioning and calling. Optionally, the order of interface addresses in the test case can indicate the order of interfaces to be operated during testing.

[0032] Among them, the data sequence corresponds to the interface address sequence, and the data sequence refers to the specific input data that each interface will receive in the test case. These data can be one-dimensional or multi-dimensional, including but not limited to numbers, strings, byte streams, etc. The specific input data is applied to the corresponding interface.

[0033] From the above interface address sequence and data sequence, it can be seen that the test case is composed of an interface address sequence and a data sequence, for example, use case a can be represented as follows.

[0034] {“interface”:[“number_0”,“wait”,“device_0_device_1_byte_array_0”,“number_1”,“number_2”],“data”:[1200,1,0x3101202000,3.2,4.2]}.

[0035] Among them, the multi-dimensional data refers to a complex data set containing multiple different data types and structures, which is different from single-type input (such as simple integers or strings). For example, in a test case, not only integer values need to be provided to the software, but also different integer values acting on different interfaces need to be included to provide floating-point numbers, byte stream arrays and strings in specific formats. The combination of these multi-dimensional data can more comprehensively, systematically and quickly test the software's ability to handle different types of data.

[0036] The test operation refers to the actual input and output behavior in the test environment according to the interface address sequence and data sequence defined in the test case. The test operation simulates the use scenario of the software in the real world, and evaluates the correctness, performance and security of the software by observing the response of the software to different data in the test case.

[0037] Through this step, a series of initial test cases for predetermined function testing are obtained. These test cases not only contain address sequences for different interfaces of the software, but also contain multi-dimensional data sequences acting on these interfaces, providing a basis for subsequent test operations.

[0038] Since the initial test cases contain multi-dimensional data, it ensures that the test can touch different parts of the software, thereby improving the overall coverage of the test. The simulation of multi-dimensional data and continuous event flow makes the test case closer to the actual use case, and can better predict and evaluate the performance of the software in a complex environment.

[0039] Step S104, determining a first centroid case and a non-centroid case from a plurality of initial test cases;

[0040] In step S104 provided in the present application, a first centroid case and a non-centroid case are determined.

[0041] The centroid case is a test case that represents the center point of a cluster in the case clustering stage of fuzzy testing. The test cases within a cluster have the highest similarity to the centroid case, while the similarity to the centroid cases of different clusters is relatively low. The selection of the centroid case is crucial to the subsequent case mutation and clustering process, as it affects the formation of clusters and the diversity of test cases.

[0042] The first centroid case is randomly selected in the initial stage of the clustering algorithm. This selection is random, but the selection of subsequent centroid cases will be based on the similarity to the first centroid case.

[0043] The non-centroid case refers to the initial test cases other than the test cases selected as centroid cases.

[0044] By determining the first centroid case, the subsequent clustering process can form clusters around this centroid case, which helps to classify similar test cases, thereby generating new test cases with greater differences in the mutation phase, improving the efficiency and coverage of the test.

[0045] Step S106, determine a second centroid use case from the non-centroid use cases according to the target multidimensional data similarity corresponding to each non-centroid use case and each centroid use case, until K centroid use cases are determined, wherein K is a positive integer greater than 1;

[0046] In the step S106 provided in the present application, the target multidimensional data similarity is determined.

[0047] Among them, the target multidimensional data similarity is involved, which is an index for quantifying the similarity between test cases, especially when dealing with test cases containing multiple types of data and continuous event streams. The calculation of similarity considers factors such as data type, feature, numerical range, etc., to measure the similarity of two test cases in input data dimensions.

[0048] Among them, K centroid use cases are involved, where K is a positive integer determined by a user or algorithm in advance, representing the number of clusters formed by the clustering algorithm. The process of selecting K centroid use cases is actually the process of determining how many clusters the entire test case set will be divided into.

[0049] This step is a strategy for determining multiple centroid use cases in the process of fuzzy test case clustering. After selecting the first centroid use case, subsequent centroid use cases are selected from the non-centroid use case set, and this selection process is based on the target multidimensional data similarity between non-centroid use cases and existing centroid use cases. Specifically, the algorithm calculates the similarity between each non-centroid use case and all existing centroid use cases, and selects the non-centroid use case with the lowest average similarity as the next centroid use case. This process is repeated until the number of K centroid use cases is reached.

[0050] Through iterative calculation and selection of centroid use cases, the clustering algorithm can gradually form the most reasonable cluster distribution, ensuring that the use cases in each cluster have high similarity, while the use cases in different clusters have obvious differences, which helps to comprehensively cover the function and performance test points of the software.

[0051] Step S108, cluster the non-centroid use cases into K centroid use cases to obtain K clustering clusters;

[0052] In the step S108 provided in the present application, the non-centroid use cases are clustered into K centroid use cases to obtain K clustering clusters.

[0053] Among them, the clustering cluster is involved, which is the result of use case clustering. Each cluster contains a series of similar test cases, which have high similarity with the centroid use case of the cluster. The formation of clustering clusters helps to manage and understand the diversity of test cases.

[0054] The non-centroid test cases are clustered according to their similarity with the K centroid test cases. The purpose of clustering is to group test cases with similar characteristics into the same cluster, and the selection of K determines the number of final clusters and the distribution of test cases. By assigning non-centroid test cases to the clusters of K centroid test cases, the number of duplicate test cases can be significantly reduced. The test cases in each cluster have high similarity, which means that after testing the representative test case in a cluster, the test results of other test cases in the cluster can be inferred, thereby saving time and computing resources. The selection of K centroid test cases and the clustering process ensure the comprehensiveness of the test case set. Each cluster represents a class of test cases that cover different parts of the software input space. Proper selection of K can ensure maximum test coverage.

[0055] In step S110, target test cases for performing the predetermined function test are determined according to the K clustering clusters.

[0056] In step S110, target test cases for performing the predetermined function test are determined according to the K clustering clusters.

[0057] Among them, the target test case refers to the test case selected from the K clustering clusters for performing the predetermined function test. These test cases are selected because they can effectively cover various aspects of software functions, while having sufficient representativeness to reveal the behavior of software under different input conditions.

[0058] Through the above steps S102-S110, a plurality of initial test cases for the predetermined function test are obtained, wherein the plurality of initial test cases include corresponding interface address sequences and corresponding data sequences, the corresponding data sequences include multi-dimensional data, and the plurality of initial test cases are used to perform a test operation for applying data in the corresponding data sequences to interfaces in the corresponding interface address sequences; from the plurality of initial test cases, a first centroid test case and non-centroid test cases are determined; from the non-centroid test cases, a second centroid test case is determined according to the similarity of each non-centroid test case with the target multi-dimensional data corresponding to each centroid test case, until K centroid test cases are determined, wherein K is a positive integer greater than 1; the non-centroid test cases are clustered into the K centroid test cases to obtain K clustering clusters; and target test cases for performing the predetermined function test are determined according to the K clustering clusters. The present application selects K centroid test cases, groups similar test cases into one category to obtain K clustering clusters, selects representative test cases from the K clustering clusters for testing, reduces the time spent, improves the test efficiency, and achieves comprehensive testing effect, thereby solving the technical problems of high implementation cost and many invalid test cases in related art for functional testing of multi-dimensional data, and low test efficiency.

[0059] For example, in related technologies, fuzz testing techniques are often used when performing functional testing on multidimensional data. However, fuzz testing techniques are costly to implement and generate many invalid test cases. Furthermore, testing all test cases is time-consuming, and testing only a subset of test cases can result in incomplete testing. The present invention, through the aforementioned steps, not only saves costs but also improves testing efficiency and achieves comprehensive testing, thereby addressing these issues.

[0060] As an optional embodiment, before determining the similarity of the target multidimensional data corresponding to each non-centroid use case and each centroid use case respectively, it also includes: determining the dimensional data corresponding to each non-centroid use case and each centroid use case at the same interface address; and determining the similarity of the target multidimensional data corresponding to each non-centroid use case and each centroid use case respectively based on the dimensional data corresponding to each non-centroid use case and each centroid use case at the same interface address.

[0061] In this embodiment, the process of determining the similarity between each non-centroid case and the target multidimensional data corresponding to each centroid case is described.

[0062] This involves identical interface addresses. In software testing, an interface address refers to the interaction point or data entry point provided by the software. Identical interface addresses mean that two use cases share a specific function or data entry point.

[0063] Among them, dimensional data is involved. Dimensional data refers to the various data items that constitute the multidimensional data space. Each data item corresponds to an aspect of software input, such as numbers, strings, arrays, etc.

[0064] Before calculating the similarity of multidimensional data, the fuzz testing algorithm needs to perform two preliminary steps: first, determine the dimensional data of the non-centroid use case and the centroid use case under the same interface address; second, based on these dimensional data, calculate the target multidimensional data similarity between the two.

[0065] For example, use case a is expressed as follows.

[0066] {"interface":["number_0","wait","device_0_device_1_byte_array_0","number_1","number_2"],"data":[1200,1,0x3101202000,3.2,4.2]}.

[0067] Use case b can be expressed as follows.

[0068] {“interface”:[“number_0”,“wait”,“device_0_device_1_byte_array_0”,“number_1”,“number_2”,“wait”,“number_2”],“data”:[1000,1,0x3101202000,3.2,4.2,1,3.5]}.

[0069] The overlapping part of use case a and use case b has five same interface addresses: “number_0”, “wait”, “device_0_device_1_byte_array_0”, “number_1”, and “number_2”. The similarity of the target multi-dimensional data corresponding to each non-centroid use case and each centroid use case is determined according to the corresponding dimensional data under the same interface address.

[0070] Comparing the dimensional data under the same interface address ensures that the comparison of use cases is carried out in a meaningful input space, avoiding the interference of irrelevant dimensions, and makes the clustering result more accurate. Through detailed dimensional data analysis, the test boundary and potential vulnerability area of the software can be more accurately identified, so as to generate more exploratory test cases in the subsequent mutation process, and improve the comprehensiveness and depth of the test.

[0071] As an optional embodiment, determining the dimensional data corresponding to each non-centroid use case and each centroid use case under the same interface address comprises: fixing the first interface address sequence of the target non-centroid use case, sliding the second interface address sequence of the target centroid use case from the starting position, performing a target operation in the case that the first interface address sequence and the second interface address sequence have the same interface address at the target sliding position, and sliding to the end position, to obtain the dimensional data corresponding to the target non-centroid use case and the target centroid use case under the same interface address, wherein the target operation is to determine the dimensional data corresponding under the same interface address.

[0072] In this embodiment, the way of determining the dimensional data corresponding under the same interface address is illustrated.

[0073] Here, the first interface address sequence and the second interface address sequence are involved. In fuzz testing, a test case is composed of a series of interface calls and data inputs. The first interface address sequence refers to the interface call sequence of the target non-centroid use case, and the second interface address sequence refers to the interface call sequence of the target centroid use case.

[0074] Wherein, the target sliding position is the relative position of the second interface address sequence on the first interface address sequence when calculating the similarity. The sliding process is used to find the overlapping part of the two sequences in order to compare their similarity in the overlapping part.

[0075] Wherein, the target operation is specifically to determine the dimension data of the two use cases operating at the interface when the first interface address sequence and the second interface address sequence have the same interface address at a certain sliding position. In order to determine the similarity between the use cases subsequently.

[0076] By aligning the interface call sequence of the centroid use case with the previously fixed non-centroid use case sequence, starting from the initial position, sliding to find the overlapping part of the two sequences. When the same interface address of the two sequences is found to overlap during the sliding process, the target operation is performed, and the specific dimension data of the two use cases operating at this interface address is recorded. Continue to slide the second interface address sequence until its end no longer overlaps with the first interface address sequence, and complete all possible comparisons. In this way, all dimension data of the non-centroid use case and the centroid use case operating at the same interface address can be collected, and this sliding window technique can ensure that no potential association and similarity is missed, thereby laying the foundation for subsequent similarity calculation. By determining the dimension data at the same interface address through the sliding window, the similarity between the use cases can be more accurately calculated.

[0077] As an optional embodiment, after clustering the non-centroid use cases into K centroid use cases to obtain K clustering clusters, it further includes: determining the intra-cluster average distance of the K clustering clusters respectively, and the inter-cluster average distance between the K clustering clusters and the nearest clustering cluster respectively; determining the clustering accuracy index according to the K intra-cluster average distances and the K inter-cluster average distances; updating the value of K according to the condition that the clustering accuracy index is lower than a predetermined threshold.

[0078] In this embodiment, the process of updating the value of K is explained.

[0079] Wherein, the intra-cluster average distance refers to the average value of the distance (usually represented by the inverse number of multidimensional data similarity) from all non-centroid use cases in a clustering cluster to the centroid use case of the cluster. It reflects the closeness of the test use cases in the cluster, and the smaller the intra-cluster average distance, the more similar the use cases in the cluster.

[0080] Wherein, the inter-cluster average distance refers to the average value of the distance between the centroid use cases of two different clustering clusters. It measures the difference between different clusters, and the larger the inter-cluster average distance, the higher the differentiation between clusters.

[0081] This involves the Clustering Accuracy Index, a metric calculated based on the average intra-cluster distance and the average inter-cluster distance, used to evaluate the effectiveness of a clustering algorithm. An ideal clustering algorithm will have a small average intra-cluster distance and a large average inter-cluster distance. This results in a higher Clustering Accuracy Index, indicating better clustering results.

[0082] This involves a predetermined threshold. In clustering algorithms, a predetermined threshold is a pre-set standard value used to determine whether the clustering accuracy index has achieved the expected clustering effect. If the current clustering accuracy index is lower than this threshold, it means that the current K value may not be the optimal solution and needs to be adjusted.

[0083] This step describes how to evaluate the clustering effectiveness of the fuzzy test case clustering algorithm by calculating the average distances within and between clusters, and then adjust the K value based on the evaluation results. By calculating the clustering accuracy index, the quality of the current clustering effect can be assessed, and the K value can be adjusted based on the evaluation results to obtain more reasonable clusters, ensuring that the test cases within a cluster have similar characteristics and that there are significant differences between clusters. Clusters with a higher clustering accuracy index mean that test resources can be used more efficiently on the test cases within those clusters. However, areas with a lower clustering accuracy index require more testing resources and more detailed test analysis.

[0084] As an optional embodiment, after clustering non-centroid use cases into K centroid use cases to obtain K cluster clusters, it also includes: determining the multidimensional data similarity between each use case in the target cluster and other use cases in the cluster; determining the use cases to be mutated in the target cluster based on the multidimensional data similarity between each use case in the target cluster and other use cases in the cluster; mutating the use cases to be mutated to obtain mutated use cases; determining a first similarity sum between the use cases to be mutated and other use cases in the cluster, and a second similarity sum between the mutated use cases and other use cases in the cluster; and determining, based on the first similarity sum and the second similarity sum, from the use cases to be mutated and the mutated use cases, the use cases to be retained in the target cluster.

[0085] In this embodiment, the relevant content of variation is involved.

[0086] Among them, the use cases to be mutated are involved. In the target cluster, they are screened out as candidate use cases for subsequent mutation operations based on specific multidimensional data similarity standards.

[0087] Among them, mutation use cases are involved, and new test cases are generated from the use cases to be mutated through mutation operations (such as data replacement, operation combination adjustment, etc.) to cover more test scenarios.

[0088] Wherein, the first sum and the second sum of similarity refer to the sum of multi-dimensional data similarity between the to-be-varied use case and the varied use case and all other use cases in the target cluster, respectively, for evaluating the representativeness of the use case in the cluster.

[0089] According to the multi-dimensional data similarity, those use cases with lower similarity to other use cases in the cluster are selected as to-be-varied use cases. These use cases have higher variation value and can help to expand the test coverage. The selected to-be-varied use cases are varied to generate varied use cases. The first sum of similarity between the to-be-varied use case and other use cases in the cluster and the second sum of similarity between the varied use case and other use cases in the cluster are calculated. According to the comparison result of the first sum of similarity and the second sum of similarity, it is determined whether to retain the to-be-varied use case or the varied use case in the target cluster. Generally, if the second sum of similarity between the varied use case and other use cases in the cluster is lower, it indicates that the varied use case can more effectively explore the uncovered area in the cluster, and therefore the varied use case is more inclined to be retained.

[0090] Through clustering and the retention decision of varied use cases, the test use case set can be effectively managed and optimized, and the waste of test resources can be avoided. The introduction of varied use cases helps to discover subtle differences and potential software defects between use cases in the cluster, thereby enhancing the test coverage. The selection of varied use cases is based on their similarity to other use cases in the cluster, which makes the test more targeted.

[0091] As an optional embodiment, determining the target test use case for performing the predetermined function test according to the K clustering clusters comprises: updating the centroids of the K clustering clusters to obtain updated centroids corresponding to the K clustering clusters, respectively; and determining the test use cases corresponding to the K updated centroids as the target test use cases.

[0092] In this embodiment, the process of determining the target test use case is illustrated.

[0093] Wherein, the centroid is involved. In clustering analysis, the centroid is the average position of all points in a cluster, which is usually used to represent the central feature of the cluster. The centroid use case is a typical test use case representing the characteristics of a clustering cluster.

[0094] Wherein, the updated centroid is involved. Since the centroid of the clustering cluster may change after clustering of the use cases, it needs to be recalculated to reflect the new features of the use cases in the cluster.

[0095] After the test case mutation or re-clustering, the updated centroid of each cluster needs to be calculated. This usually involves recalculating the multidimensional continuous data similarity of all test cases within the cluster, and then selecting a test case (or the average features of test cases) as the new cluster center to reflect the latest state of the features within the cluster. After the update process is completed, each clustering cluster will have an updated centroid, and the centroid test case or feature set is the latest representative of the test cases within the cluster. From each updated centroid corresponding to the clustering cluster, one or more test cases are selected as target test cases, which will be used to perform the predetermined function test. These test cases usually contain the main features of multidimensional input and continuous events within the cluster, and can effectively cover the software functions.

[0096] As an optional embodiment, obtaining a plurality of initial test cases for the predetermined function test includes: obtaining a target requirement, wherein the target requirement includes a requirement for performing the predetermined function test; determining a target input interface according to the predetermined function test; and determining the plurality of initial test cases according to the target requirement and the target input interface.

[0097] In this embodiment, the process of determining the plurality of initial test cases is described.

[0098] Here, the target requirement is referred to, which refers to the requirements and expectations related to the predetermined function test, which can be a function description in the software specification or user requirement document, used to guide the design of test cases.

[0099] Here, the target input interface is referred to, which refers to the input point in the software system directly related to the predetermined function test, including API interface, function parameter, system input, etc., which receives external input to trigger the execution of software functions.

[0100] First, the target of the predetermined function test is determined, which usually needs to refer to the specification document, design document or user requirement of the software, to ensure that the test can verify the expected function of the software. Based on the target requirement, the input interface directly related to the test function is identified. This step requires the tester to understand the software architecture and data flow, to ensure that the test case can cover all important input paths. Finally, according to the target requirement and the target input interface, a series of initial test cases are designed. These test cases need to cover various input types and conditions, including normal and abnormal conditions, to ensure the comprehensiveness of the test.

[0101] By designing initial test cases based on target requirements and input interfaces, it can ensure that specific software functions are covered by testing, and improve the relevance and effectiveness of testing. Careful design of initial test cases can reduce unnecessary subsequent test case generation and repeated testing, saving time and computing resources and improving testing efficiency. Test cases designed based on clear target requirements and input interfaces are easier to understand and maintain, which is crucial for the long-term sustainability and team collaboration of software testing.

[0102] Based on the above embodiments and optional embodiments, an optional implementation is provided, which is described in detail below.

[0103] In related technologies, as a core technology of automated software testing, fuzz testing triggers potential defects by injecting guided random inputs into target systems. According to the degree of analysis of internal program information, fuzz testing can be classified into white-box fuzz testing, gray-box fuzz testing and black-box fuzz testing.

[0104] Traditional fuzz testing methods, such as the fuzz tester AFL and the improved fuzz testing tool AFLFast, are generally gray-box fuzz testing, relying on code coverage feedback mechanisms and program instrumentation. However, due to the high cost of technical implementation and the inability to detect requirement deviations, they are rarely used in integration testing and system testing phases. In addition, integration testing and system testing often involve multi-dimensional input (including input of multiple types of data) and continuous events (event streams related between input data), and when performing functional testing on multi-dimensional data, the cost of implementing fuzz testing technology is relatively high, generating a large number of invalid test cases. And if all test cases are tested, it will consume a lot of time, and if only some test cases are selected for testing, there may be the technical problem of incomplete testing.

[0105] In view of this, the optional implementation of the present application provides a test case determination method, particularly a multi-dimensional continuous data similarity guided fuzz test case generation method. For multi-dimensional input and continuous events, it determines the similarity of multi-dimensional continuous data by using a similarity index that measures multi-dimensional input and continuous event cases, to select test cases for testing.

[0106] Specifically, it provides a multi-dimensional continuous data similarity guided fuzz test case generation method, which calculates the similarity between multi-dimensional input continuous event cases, clusters the cases, generates new cases by mutating cluster edge cases, and finally clusters multiple clusters to select cases, achieving the technical effects of low cost, comprehensive testing and high testing efficiency. The method is applicable to integration testing and system testing, has a relatively low technical implementation cost, and can quickly cover more different characteristic inputs, reducing invalid test inputs.

[0107] The execution steps include initial test case set generation, test case clustering, test case mutation, and re-clustering.

[0108] The specific generation method includes the following steps:

[0109] S1: initial test case generation.

[0110] The tester selects some input interfaces of the system to be tested according to the target requirements, such as a data flow diagram, an interface table, or experience, for generating test cases, wherein the test cases include an interface address sequence and a data sequence. A test case is composed of an interface address sequence and a data sequence. For parallel interface modification operations, i.e., interface modification operations between, before, or after the waiting operations, the interface addresses are sorted in ASCII order or lexicographical order.

[0111] The input interface is composed of an interface address or variable name, an interface data type, a numerical range, a value range of an encoded byte stream field, and the like. The test cases are written according to the requirements, and one or a small number of test cases can be written for each requirement. The test cases are used to perform interface modification operations, and the interface modification operations and the waiting operations are combined in chronological order. The interface modification operation includes an interface address or variable name to be modified (hereinafter referred to as an interface address) and new data. The waiting operation includes a “wait” string for alignment with the interface address and a waiting time.

[0112] S2: test case clustering.

[0113] The specific test case clustering method includes the following steps:

[0114] S2.1: selecting initial centroids. The number k of centroids is specified by the tester at the beginning. Any one test case is randomly selected as the first centroid. The multidimensional continuous data similarity between each non-centroid test case and the first centroid is calculated using a method for calculating the multidimensional continuous data similarity between test cases. A test case with the smallest multidimensional continuous data similarity is selected as another centroid. The sum of the multidimensional continuous data similarity between each non-centroid test case and all the centroids is continuously calculated, and a test case with the smallest sum of the multidimensional continuous data similarity is selected as another centroid, until the number of centroids reaches k.

[0115] As described above, the dimension data corresponding to each non-centroid test case and each centroid test case at the same interface address is determined; and the target multidimensional data similarity corresponding to each non-centroid test case and each centroid test case is determined according to the dimension data corresponding to each non-centroid test case and each centroid test case at the same interface address.

[0116] Specifically, the method for calculating the multidimensional continuous data similarity between test cases is as follows:

[0117] Fix one interface address sequence of a use case, slide another interface address sequence of a use case, so that the two interface address sequences have an overlap. At each sliding position, if the interface addresses of the overlapping part are the same, calculate the similarity between the two data corresponding to the interface addresses. The similarity between the data is mapped to the range of [0, 1] according to the data type and the feature selection method, and 1 represents that the two data are completely the same, and 0 represents that the two data are completely different. Add all the similarities and then divide by the length of the overlapping part as the similarity of each sliding position. Finally, select the maximum similarity in the sliding position as the multi-dimensional continuous data similarity between the two use cases.

[0118] As described above, fix the first interface address sequence of the target non-centroid use case, slide the second interface address sequence of the target centroid use case from the starting position, perform a target operation in the case that the first interface address sequence and the second interface address sequence have the same interface address at the target sliding position, until sliding to the end position, and obtain the dimension data corresponding to the target non-centroid use case and the target centroid use case under the same interface address, wherein the target operation is to determine the dimension data corresponding to the same interface address.

[0119] S2.2: Assign non-centroid use cases to the nearest centroid to form clusters and update the centroid.

[0120] Calculate the multi-dimensional continuous data similarity between each non-centroid use case and each centroid, and assign it to the cluster where the centroid with the maximum multi-dimensional continuous data similarity is located. Calculate the sum of the multi-dimensional continuous data similarity between each use case in the cluster and other use cases in the cluster, and select the maximum sum as the new centroid.

[0121] S2.3: Evaluate and select the optimal k value using the silhouette coefficient method.

[0122] Starting from the current k value, perform S2.1 and S2.2 and calculate the silhouette coefficient, increment the k value, perform S2.1 and S2.2 and calculate the new silhouette coefficient. Until the new silhouette coefficient is less than the previous silhouette coefficient, select the previous k value for clustering.

[0123] As described above, determine the cluster internal average distance corresponding to each of the K cluster clusters, and the cluster inter average distance between the K cluster clusters and the nearest cluster cluster; determine the clustering accuracy index according to the K cluster internal average distance and the K cluster inter average distance; update the value of K according to the case that the clustering accuracy index is lower than the predetermined threshold.

[0124] S3: Test case mutation.

[0125] Select several use cases in each cluster with the minimum sum of multi-dimensional continuous data similarity with all other use cases in the cluster to join a mutation seed queue. Take out the use cases from the queue one by one, and get new use cases by mutation.

[0126] S2.2 is performed for new use cases. When a new use case is assigned to a cluster different from its seed, its seed is re-queued. Otherwise, when the sum of the multi-dimensional data similarity of the new use case to all other use cases in the cluster is lower than its seed, it is added to the queue of mutant seeds instead of its seed.

[0127] As described above, the multi-dimensional data similarity of each use case in the target cluster to other use cases in the cluster is determined; the use case to be mutated in the target cluster is determined according to the multi-dimensional data similarity of each use case in the target cluster to other use cases in the cluster; the use case to be mutated is mutated to obtain a mutant use case; the first sum of similarity of the use case to be mutated to other use cases in the cluster and the second sum of similarity of the mutant use case to other use cases in the cluster are determined; and the use case to be retained in the target cluster is determined from the use case to be mutated and the mutant use case according to the first sum of similarity and the second sum of similarity.

[0128] Specifically, the mutation of the new use case is that, based on a use case, a parallel interface modification operation is replaced by any one or any combination of the following repeated operations, but the length of the replaced use case is between 80% and 120% of the original length.

[0129] 1. Null;

[0130] 2. Parallel interface modification operation of the tested use case (including itself);

[0131] 3. Randomly generate a number of operations or null, and replace one operation in 2.

[0132] S4: Re-clustering. The tester sets the number of mutations and the threshold of the silhouette coefficient calculation required for re-clustering. After a certain number of mutations, S2 and S3 are re-executed. If the time consumption of S2.3 exceeds the threshold, a certain proportion (such as 50%) of use cases in each cluster are randomly sampled to calculate the silhouette coefficient.

[0133] The application will be described in detail below with reference to specific embodiments.

[0134] Figure 2 is a flowchart of the generation of test cases provided by the optional embodiment of the application, that is, the test case meeting the requirements can also be generated by this method. As shown in Figure 2 the specific generation method includes the following steps:

[0135] S1: Initial test case generation.

[0136] The tester selects some input interfaces of the system under test according to the data flow chart, interface table or experience to generate test cases, and the input interface is composed of interface address or variable name, interface data type, numerical range, value range of encoded byte stream field, etc. For example, Table 1 is a sequence table of some input interfaces provided by an optional embodiment of the present application, and Table 1 is a selected part of the input interfaces. Then, test cases are written according to requirements, and only one or a small number of test cases are written for each requirement. The test case is composed of interface modification operations and waiting operations in time sequence. The interface modification operation includes the interface address to be modified (hereinafter referred to as interface address) and new data. The waiting operation includes the "wait" string for aligning with the interface address and the waiting time.

[0137] The test case is composed of an interface address sequence and a data sequence.

[0138] For example:

[0139] The test case a can be expressed in the following form.

[0140] { "interface" : [ "number_0", "wait", "device_0_device_1_byte_array_0", "number_1", "number_2" ], "data" : [ 1200, 1, 0x3101202000, 3.2, 4.2 ]}.

[0141] The test case b can be expressed in the following form.

[0142] { "interface" : [ "number_0", "wait", "device_0_device_1_byte_array_0", "number_1", "number_2", "wait", "number_2" ], "data" : [ 1000, 1, 0x3101202000, 3.2, 4.2, 1, 3.5 ]}.

[0143] Table 1 is a sequence table of some input interfaces provided by an optional embodiment of the present application. As shown in Table 1, for the parallel interface modification operation, i.e. the interface modification operation between, before or after the waiting operation, the interface address is sorted in ASCII order or lexicographical order.

[0144] Table 1

[0145]

[0146] S2: Test case clustering.

[0147] The specific test case clustering method includes the following steps:

[0148] S2.1: Select initial centroids. Initially, the number of centroids k is specified by the tester. Randomly select any one use case as the first centroid.

[0149] Table 2 is a table of similarity provided by an optional embodiment of the present application, in which use case b is selected as the first centroid. The similarity of each non-centroid use case to the first centroid is calculated using the method of calculating the similarity of multi-dimensional continuous data between use cases. A use case with the smallest similarity of multi-dimensional continuous data is selected as another centroid. In Table 2, the similarity between use case f and use case b is the smallest, so use case f is selected as the second centroid. Continue to calculate the sum of the similarity of multi-dimensional continuous data between each non-centroid use case and all centroids, and select a use case with the smallest sum of similarity of multi-dimensional continuous data as another centroid, until the number of centroids reaches k. In Table 2, the sum of the similarity between use case e and use case b and use case f is the smallest, so use case e is selected as the third centroid.

[0150] Table 2

[0151] a b c d e f a - 0.8828 0.8901 0.8456 0.7012 0.6789 b 0.8828 - 0.9012 0.8123 0.5345 0.5012 c 0.8901 0.9012 - 0.7890 0.7234 0.6453 d 0.8456 0.8123 0.7890 - 0.7567 0.6019 e 0.7012 0.5345 0.7234 0.7567 - 0.5678 f 0.6789 0.5012 0.6453 0.6019 0.5678 -

[0152] Specifically, the method of calculating the similarity of multi-dimensional continuous data between use cases is as follows:

[0153] Fix the interface address sequence of one use case, and slide the interface address sequence of another use case, so that the two interface address sequences overlap. Figure 3 is a schematic diagram of sliding to determine the similarity between data provided by an optional embodiment of the present application, as shown in Figure 3 In which the interface address sequence of use case a is fixed, and the interface address sequence of use case b is slid, and the gray background in use case b is the overlapping part with use case a. At each sliding position, if the interface addresses of the overlapping part are the same, the similarity between the two data corresponding to the interface addresses is calculated. For example Figure 3 In which at sliding position 0, the overlapping part of use case a and use case b has five identical interface addresses: "number_0", "wait", "device_0_device_1_byte_array_0", "number_1", and "number_2". The similarity between data is selected according to the data type and characteristics to measure the method, and is mapped to the range of [0, 1], 1 represents that the two data are completely the same, and 0 represents that the two data are completely different. For example, for float type data "1200" and "1000", the standard Euclidean distance dSE is calculated to be 1.4142, and then the similarity is calculated as to obtain a similarity of 0.4142. The sum of all similarities is used, and then divided by the length of the overlapping part, as the similarity of each sliding position. Finally, the maximum similarity in the sliding position is selected as the similarity of multi-dimensional continuous data between the two use cases. For exampleFigure 3 In , the maximum multidimensional continuous data similarity between use case a and use case b is 0.8828 at sliding position 0.

[0154] S2.2: Assign non-centroid cases to the nearest centroid to form a cluster and update the centroid.

[0155] Calculate the multidimensional continuous data similarity between each non-centroid use case and each centroid, and assign it to the cluster containing the centroid with the highest multidimensional continuous data similarity. Calculate the sum of the multidimensional continuous data similarities between each use case within the cluster and all other use cases within the cluster. The use case with the largest sum is selected as the new centroid. For example, in Table 2, use cases a, c, and d have the highest multidimensional continuous data similarity with use case b, so they form a cluster with use case b. The sum of the multidimensional continuous data similarities between use case a and all other use cases in the cluster is 2.6185, which is the highest, so it is selected as the new centroid.

[0156] S2.3: Use the silhouette coefficient method to evaluate and select the optimal k value.

[0157] Starting from the current k value, execute S2.1 and S2.2 and calculate the silhouette coefficient. Then, increase the k value, execute S2.1 and S2.2 and calculate the new silhouette coefficient. Until the new silhouette coefficient is less than the previous one, select the previous k value for clustering. Figure 4 Flowchart of using the silhouette coefficient method to evaluate and select the optimal k value provided by an optional embodiment of the invention, such as Figure 4 As shown, calculate the k value.

[0158] S3: Test case mutation. Select several test cases from each cluster whose sum of multidimensional continuous data similarity with all other test cases in the cluster is the smallest and add them to a mutation seed queue. Remove the test cases from the queue one by one and mutate them into new test cases. Execute S2.2 for the new test cases. If the new test case is assigned to a different cluster than its seed, add its seed back to the queue. Otherwise, if the sum of the multidimensional continuous data similarity between the new test case and all other test cases in the cluster is lower than that of its seed, add it as a new seed to the mutation seed queue, replacing its seed.

[0159] Specifically, the mutation to obtain a new use case is to replace the parallel interface modification operations with any one or any combination of the following repetitions based on a use case, but the length of the use case after replacement is between 80% and 120% of the original.

[0160] 1. Empty;

[0161] 2. Parallel interface modification operations for tested use cases (including itself);

[0162] 3. Randomly generate several operations or nothing, and replace one of the operations in 2.

[0163] For example, replace the operation of number_0 = 1200 in case a with null, then the mutation is as follows.

[0164] {“interface”:[“wait”,“device_0_device_1_byte_array_0”,“number_1”,“number_2”],“data”:[1,0x3101202000,3.2,4.2]}.

[0165] Replace the operation of number_2 = 3.5 in case b with the parallel interface modification operation number_0 = 1000 of the tested cases (including itself), then the mutation is as follows.

[0166] {“interface”:[“number_0”,“wait”,“device_0_device_1_byte_array_0”,“number_1”,“number_2”,“wait”,“number_0”],“data”:[1000,1,0x3101202000,3.2,4.2,1,1000]}.

[0167] Replace the sub-sequence after wait in case a with the combination of 2 and 3, then the mutation is as follows.

[0168] {“interface”:[“number_0”,“wait”,“device_0_device_1_byte_array_0”,“number_3”,“wait”,“number_2”],“data”:[1200,1,0x3101202000,0,12,4.2]}.

[0169] S4: Re-clustering. The tester sets the number of mutations and the threshold of silhouette coefficient calculation that need to be re-clustered. After a certain number of mutations, S2 and S3 are re-executed. If the time consumption of S2.3 exceeds the threshold, a certain proportion (such as 50%) of use cases in each cluster are randomly sampled to calculate the silhouette coefficient. Finally, K clusters are obtained, and appropriate use cases are obtained for testing.

[0170] Through the above optional embodiments, at least the following beneficial effects can be achieved:

[0171] (1) For multi-dimensional input and continuous events, the present application provides a similarity index for measuring multi-dimensional input and continuous event use cases, multi-dimensional continuous data similarity. The index can measure the similarity of input with multiple types of data and the related event flow between input data. It can be used to guide the mutation of use cases in black box fuzz testing to generate more different feature use cases in a shorter time.

[0172] (2) A multi-dimensional continuous data similarity guided fuzz testing use case generation method is provided, which performs steps including initial test case set generation, test case clustering, test case mutation, and re-clustering. The method has low implementation cost, requires less code information, and is suitable for black box integration testing and system testing stages.

[0173] It should be noted that for the above-mentioned method embodiments, in order to simply describe, they are all expressed as a series of action combinations, but those skilled in the art should know that the present application is not limited by the order of the described actions, because according to the present application, certain steps can be performed in other order or simultaneously. Secondly, those skilled in the art should know that the embodiments described in the specification all belong to preferred embodiments, and the actions and modules involved are not necessarily necessary for the present application.

[0174] From the above description of the embodiments, those skilled in the art can clearly understand that the method according to the above-mentioned embodiments can be realized by means of software and the necessary general hardware platform, of course, it can also be realized by hardware, but in many cases the former is a better embodiment. Based on such understanding, the technical solutions of the present application can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes a plurality of instructions for making a terminal device (which can be a mobile phone, computer, server, or network device, etc.) execute the method of each embodiment of the present application.

[0175] Embodiment 2

[0176] According to the embodiments of the present application, a device for implementing the above-mentioned test case determination method is also provided, Figure 5 is a structural block diagram of the test case determination device according to the embodiments of the present application, as Figure 5 shown, the device includes an acquisition module 502, a first determination module 504, a second determination module 506, a clustering module 508, and a third determination module 510, which will be described in detail below.

[0177] The acquisition module 502 is configured to acquire a plurality of initial test cases for a predetermined function test, wherein the plurality of initial test cases comprise a corresponding interface address sequence and a corresponding data sequence, the corresponding data sequence comprises multi-dimensional data, and the plurality of initial test cases are used to perform a plurality of operations sorted according to a predetermined rule, and the operations are used to apply data in the corresponding data sequence to an interface in the corresponding interface address sequence; the first determination module 504 is connected to the acquisition module 502 and is configured to determine a first centroid test case and a non-centroid test case from the plurality of initial test cases; the second determination module 506 is connected to the first determination module 504 and is configured to determine a second centroid test case from the non-centroid test cases according to a target multi-dimensional data similarity between each non-centroid test case and each centroid test case, until K centroid test cases are determined, wherein K is a positive integer greater than 1; the clustering module 508 is connected to the second determination module 506 and is configured to cluster the non-centroid test cases into the K centroid test cases to obtain K clustering clusters; and the third determination module 510 is connected to the clustering module 508 and is configured to determine a target test case used to perform the predetermined function test according to the K clustering clusters.

[0178] It should be noted that the acquisition module 502, the first determination module 504, the second determination module 506, the clustering module 508, and the third determination module 510 correspond to steps S102 to S110 in the test case determination method, and the plurality of modules and the instances and application scenarios achieved by the corresponding steps are the same, but are not limited to the content disclosed in Embodiment 1.

[0179] Embodiment 3

[0180] According to another aspect of the embodiments of the present application, an electronic device is also provided, which comprises a processor and a memory for storing processor-executable instructions, wherein the processor is configured to execute the instructions to implement any of the test case determination methods.

[0181] Embodiment 4

[0182] According to another aspect of the embodiments of the present application, a computer-readable storage medium is also provided, which, when instructions in the computer-readable storage medium are executed by a processor of an electronic device, enables the electronic device to perform any of the test case determination methods.

[0183] The above-mentioned embodiment numbers of the present application are only for description, and do not represent the advantages and disadvantages of the embodiments.

[0184] In the above-mentioned embodiments of the present application, the description of each embodiment has its own focus, and the parts not described in detail in a certain embodiment can be referred to the related description of other embodiments.

[0185] In several embodiments provided in the present application, it should be understood that the disclosed technology can be implemented by other means. Among them, the above-mentioned device embodiments are only schematic, for example, the division of the units can be a logical function division, and actual implementation can have another division mode, for example, a plurality of 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 displayed or discussed each other can be through some interface, indirect coupling or communication connection between units or modules, which can be electrical or other forms.

[0186] The units described as separate components can or can not be physically separated, and the components shown as units can or can not be physical units, that is, they can be located in one place, or they can be distributed to multiple units. Part or all of the units can be selected according to actual needs to achieve the purpose of the embodiment.

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

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

[0189] The above is only the preferred embodiment of the present application, and it should be pointed out that for ordinary skilled in the art, without departing from the principles of the present application, a number of improvements and refinements can be made, and these improvements and refinements should be considered as the protection scope of the present application.

Claims

1. A test case determination method, characterized in that: include: Acquire a plurality of initial test cases for a predetermined functional test, wherein the plurality of initial test cases include corresponding interface address sequences and corresponding data sequences, the corresponding data sequences include multidimensional data, and the plurality of initial test cases are used to execute test operations, wherein the test operations are used to apply data in the corresponding data sequences to interfaces in the corresponding interface address sequences; Determining a first centroid case and a non-centroid case from the plurality of initial test cases; Determine a second centroid case from the non-centroid case based on the similarity between each non-centroid case and the target multidimensional data corresponding to each centroid case, until K centroid case are determined, where K is a positive integer greater than 1; Clustering the non-centroid use cases into the K centroid use cases to obtain K clusters; A target test case for executing the predetermined functional test is determined based on the K clusters.

2. The method according to claim 1, characterized in that Before the similarity between each non-centroid use case and the target multidimensional data corresponding to each centroid use case, the method further includes: Determine the dimension data corresponding to each of the non-centroid use cases and each of the centroid use cases under the same interface address; Based on the dimensional data corresponding to each non-centroid use case and each centroid use case under the same interface address, the similarity of the target multidimensional data corresponding to each non-centroid use case and each centroid use case is determined.

3. The method according to claim 2, characterized in that The determining of the dimension data corresponding to each non-centroid use case and each centroid use case under the same interface address includes: Fix the first interface address sequence of the target non-centroid use case, slide the second interface address sequence of the target centroid use case from the starting position, and perform the target operation when the first interface address sequence and the second interface address sequence have the same interface address at the target sliding position, until sliding to the end position, and obtain the dimensional data corresponding to the target non-centroid use case and the target centroid use case at the same interface address, wherein the target operation is to determine the dimensional data corresponding to the same interface address.

4. The method according to claim 1, wherein After clustering the non-centroid use cases into the K centroid use cases to obtain K clusters, the method further includes: Determine the average intra-cluster distances corresponding to the K clusters, and the average inter-cluster distances between the K clusters and their nearest neighboring clusters; The clustering accuracy index is determined based on the average distance within K clusters and the average distance between K clusters; In response to the clustering accuracy index being lower than a predetermined threshold, the value of K is updated.

5. The method according to claim 1, wherein After clustering the non-centroid use cases into the K centroid use cases to obtain K clusters, the method further includes: Determine the multidimensional data similarity between each use case in the target cluster and other use cases in the cluster; Determine the use cases to be mutated in the target cluster based on the multi-dimensional data similarity between each use case in the target cluster and other use cases in the cluster; Mutating the use case to be mutated to obtain a mutated use case; Determine a first similarity sum between the use case to be mutated and other use cases in the cluster, and a second similarity sum between the mutated use case and other use cases in the cluster; According to the first similarity sum and the second similarity sum, use cases to be retained in the target cluster are determined from the use cases to be mutated and the mutated use cases.

6. The method according to claim 1, characterized in that Determining a target test case for executing the predetermined functional test based on the K clusters includes: Updating the centroids of the K clusters to obtain updated centroids corresponding to the K clusters respectively; Determine the test cases corresponding to the K updated centroids as the target test cases.

7. The method according to any one of claims 1 to 6, characterized in that The obtaining of a plurality of initial test cases for a predetermined functional test comprises: Obtaining target requirements, wherein the target requirements include requirements for performing the predetermined functional test; Determining a target input interface according to the predetermined functional test; The plurality of initial test cases are determined according to the target requirements and the target input interface.

8. A test case determination device, characterized in that: include: an acquisition module, configured to acquire a plurality of initial test cases for a predetermined functional test, wherein the plurality of initial test cases include corresponding interface address sequences and corresponding data sequences, the corresponding data queues including multidimensional data, and configured to execute a plurality of operations sequenced according to predetermined rules, the operations being configured to apply the data in the corresponding data sequence to the interfaces in the corresponding interface address sequence; A first determining module is configured to determine a first centroid case and a non-centroid case from the plurality of initial test cases; a second determination module, configured to determine a second centroid case from the non-centroid case based on a similarity between each non-centroid case and the target multidimensional data corresponding to each centroid case, until K centroid case are determined, where K is a positive integer greater than 1; A clustering module, configured to cluster the non-centroid use cases into the K centroid use cases to obtain K clusters; The third determining module is configured to determine a target test case for executing the predetermined functional test based on the K clusters.

9. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the test case determination method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that When the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the test case determination method according to any one of claims 1 to 7.