A test method, device and electronic equipment
By constructing a target knowledge graph and clustering based on entity distance and relevance, test cases are generated, solving the problem of low testing efficiency caused by multi-objective optimization, and achieving dimensionality reduction and efficiency improvement of testing objectives.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- LENOVO (BEIJING) LTD
- Filing Date
- 2022-07-01
- Publication Date
- 2026-04-17
AI Technical Summary
During product testing, multi-objective optimization leads to long computation times, low testing efficiency, and an inability to meet actual needs.
By defining the initial test objectives, constructing a target knowledge graph, and clustering based on entity distance and relevance, test cases are generated after clustering to narrow down the scope of test objectives.
It enables the automatic and effective narrowing of the testing target scope, thereby improving testing efficiency.
Smart Images

Figure CN115061937B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of information processing technology, and more specifically to a testing method, apparatus, and electronic device. Background Technology
[0002] Before a product is launched on the market, it needs to be tested. This testing process typically involves developing a test plan. The test plan needs to consider multiple optimization objectives, such as short testing time, minimal testing materials, efficient use of testing equipment, and comprehensive test coverage. In multi-objective optimization problems, the more objectives there are to optimize, the longer the computation time, and the lower the testing efficiency, making it impossible to meet actual testing needs. Summary of the Invention
[0003] In view of the above, this application provides the following technical solution:
[0004] A testing method, comprising:
[0005] Identify multiple initial test objectives corresponding to the target test task;
[0006] Obtain a target knowledge graph that matches the plurality of initial test targets, wherein the entities in the target knowledge graph are related to the initial test targets;
[0007] Based on the distance between entities in the target knowledge graph, the relevance between each initial test target is determined;
[0008] Based on the relevance, the initial test targets are clustered to obtain the clustered test targets;
[0009] Generate test cases that match the clustered test objectives, so that the target test task can be completed based on the test cases.
[0010] Optionally, the entities in the target knowledge graph include initial test targets, wherein determining the relevance between the initial test targets based on the distance between the entities in the target knowledge graph includes:
[0011] Based on the target knowledge graph, the entity distances between each initial test target are determined;
[0012] The correlation between the initial test targets is determined based on the entity distance between each initial test target.
[0013] Optionally, the entities in the target knowledge graph also include target factors corresponding to the initial test target, wherein determining the relevance between the initial test targets based on the distance between the entities in the target knowledge graph includes:
[0014] Based on the target knowledge graph, determine the entity distances between each target factor;
[0015] Based on the entity distances between the various target factors, determine the entity distances between each initial test target;
[0016] The correlation between the initial test targets is determined based on the entity distance between each initial test target.
[0017] Optionally, it also includes:
[0018] Obtain the semantic description information of the initial test target;
[0019] The semantic description information is parsed to obtain the parsing result;
[0020] Based on the analysis results and the target test task, the target factors corresponding to the initial test target are determined.
[0021] Optionally, the clustering of the initial test targets based on the relevance to obtain clustered test targets includes at least one of the following:
[0022] If the relevance is greater than the relevance threshold, the initial test targets corresponding to the relevance are merged to obtain the first test target after clustering;
[0023] If the relevance is less than the relevance threshold, the two initial test targets corresponding to the relevance are retained to obtain the second and third test targets after clustering.
[0024] Optionally, the step of clustering the initial test targets based on the relevance to obtain clustered test targets includes:
[0025] If the relevance is greater than the relevance threshold, the initial test targets corresponding to the relevance are merged to obtain the first test target;
[0026] If the relevance is less than the relevance threshold, the two initial test targets corresponding to the relevance are retained to obtain the second test target and the third test target;
[0027] The correlation between the first test target, the second test target, and the third test target is recalculated, and the first test target, the second test target, and the third test target are clustered based on the recalculated correlation until the correlation between the clustered test targets is less than the correlation threshold, thus obtaining the clustered test targets.
[0028] Optionally, generating test cases that match the clustered test objective, so that the target test task can be completed based on the test cases, includes:
[0029] Determine the association between the clustered test target and the initial test target;
[0030] Based on the aforementioned associations, the clustered test objectives are optimized to obtain optimized test objectives;
[0031] Generate test cases that match the optimized test objective, so that the target test task can be achieved based on the test cases.
[0032] Optionally, generating test cases that match the clustered test objective includes:
[0033] Generate a test matrix that matches the clustered test target, and determine the test mode based on the target test task;
[0034] Test cases are generated based on the test matrix and the test mode.
[0035] A testing apparatus, comprising:
[0036] The first determining unit is used to determine multiple initial test targets corresponding to the target test task;
[0037] The graph acquisition unit is used to acquire a target knowledge graph that matches the plurality of initial test targets, wherein the entities in the target knowledge graph are related to the initial test targets;
[0038] The second determining unit is used to determine the relevance between each initial test target based on the distance between each entity in the target knowledge graph;
[0039] A clustering unit is used to cluster the initial test targets based on the relevance to obtain clustered test targets.
[0040] The generation unit is used to generate test cases that match the clustered test target, so that the target test task can be completed based on the test cases.
[0041] An electronic device, comprising:
[0042] Memory, used to store applications and the data generated by the running of the applications;
[0043] A processor for executing the application to implement the testing method as described in any of the preceding items.
[0044] As described above, this application discloses a testing method, apparatus, and electronic device, comprising: determining multiple initial test targets corresponding to a target testing task; obtaining a target knowledge graph matching the multiple initial test targets, wherein entities in the target knowledge graph are related to the initial test targets; determining the relevance between each initial test target based on the distance between entities in the target knowledge graph; clustering the initial test targets based on the relevance to obtain clustered test targets; and generating test cases matching the clustered test targets, so as to complete the target testing task based on the test cases. This application achieves automatic and effective narrowing of the scope of test targets based on the distance between entities in the knowledge graph, thereby improving testing efficiency. Attached Figure Description
[0045] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only embodiments of this application. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.
[0046] Figure 1 A flowchart illustrating a testing method provided in an embodiment of this application;
[0047] Figure 2 A schematic diagram of a test matrix for testing battery performance provided in an embodiment of this application;
[0048] Figure 3 This is a schematic diagram illustrating the decomposition of an initial test target according to an embodiment of this application;
[0049] Figure 4 A schematic diagram of the processing flow for an application scenario provided in this application embodiment;
[0050] Figure 5 This is a schematic diagram of a testing device provided in an embodiment of this application. Detailed Implementation
[0051] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0052] This application provides a testing method that can be applied to testing scenarios, such as product testing. The product may include software or hardware products. This testing method can effectively reduce the number of original test targets, achieving dimensionality reduction of test targets and improving testing efficiency.
[0053] See Figure 1 This is a flowchart illustrating a testing method provided in an embodiment of this application. The method may include the following steps:
[0054] S101. Determine multiple initial test targets corresponding to the target test task.
[0055] The target test task refers to the test task that needs to be completed in the current test scenario, such as a test task to test the product's performance or a test task to test the product's lifespan. Different test tasks have different corresponding test objectives. Test objectives can refer to the metrics or dimensions used to test the product. For example, if the target test task is to test product performance, the test objectives could include product usage time, product failure rate, product utilization rate, etc. Therefore, the test objectives that can be determined in the initial state of the current target test task are defined as the initial test objectives.
[0056] S102. Obtain a target knowledge graph that matches multiple initial test targets.
[0057] S103. Based on the distance between entities in the target knowledge graph, determine the relevance between each initial test target.
[0058] Knowledge graphs are essentially knowledge bases of semantic networks, i.e., knowledge bases with directed graphs. They can also be described as data structures composed of entities, relationships, and attributes. In this embodiment, the entities in the target knowledge graph are related to the initial test targets. Therefore, by analyzing the entities in the target knowledge graph, the relationships and distances between entities can be obtained, thereby determining the relevance of each entity and thus the relevance between the initial test targets related to each entity.
[0059] In one implementation, the entities in the target knowledge graph include initial test targets, wherein determining the relevance between the initial test targets based on the distance between the entities in the target knowledge graph includes: determining the entity distance between the initial test targets based on the target knowledge graph; and determining the relevance between the initial test targets based on the entity distance between the initial test targets.
[0060] In this implementation, the initial test targets are entities in the current target knowledge graph. Relationships between entities can be used as edge nodes. An embedding algorithm is used to obtain the embedding vectors corresponding to entity nodes and edge nodes. In the target knowledge graph, the cosine similarity of the embedding vectors of two entity nodes is calculated to obtain the semantic distance between them. This semantic distance is then determined as the entity distance between the initial test targets. The smaller the entity distance between two initial test targets, the more similar they are. Generally, an entity distance threshold can be set, and the calculated entity distance is compared with this threshold to determine the relevance between each initial test target. Alternatively, the relevance between entities can be obtained using the Canopy algorithm based on their attribute similarity. Semantic text data corresponding to the entities can also be obtained, and the similarity of the text data is calculated using the Dice algorithm to determine the relevance between the two entities, thus obtaining the relevance between the initial test targets. Specifically, the formula for calculating the similarity of text data using the Dice algorithm is as follows:
[0061]
[0062] Where S is the text data corresponding to one of the initial test targets, T is the text data corresponding to the other initial test target, and SimDice(S,T) represents the similarity of the text data.
[0063] In this application embodiment, there is no limitation on the calculation method for determining the relevance of entities, as long as the relevance of entities can be obtained to determine the relevance of the initial test target.
[0064] In another implementation, the entities in the target knowledge graph also include target factors corresponding to the initial test targets. The determination of the relevance between the initial test targets based on the distance between each entity in the target knowledge graph includes: determining the entity distance between each target factor based on the target knowledge graph; determining the entity distance between each initial test target based on the entity distance between each target factor; and determining the relevance between the initial test targets based on the entity distance between each initial test target.
[0065] In this implementation, entities in the target knowledge graph can include initial test targets or target factors corresponding to the initial test targets. Target factors refer to factors that can constitute or influence the initial test targets. For example, if the initial test target is test materials, the corresponding target factors can include operators, test equipment, test samples, etc. By calculating the entity distances between target factors and further obtaining the relationship between target factors and the initial test targets, the entity distances between the initial test targets are determined based on the entity distances between target factors and the relationship between target factors and the initial test targets, thus obtaining the relevance between each initial test target. Correspondingly, the entity distances between target factors can be calculated using the aforementioned translation embedding algorithm, or they can be determined based on the cosine distance between entities.
[0066] When determining the target factors corresponding to the initial test objective, we can first obtain the semantic description information of the initial test objective, then parse the semantic description information to obtain the parsing results; based on the parsing results and the target test task, we can determine the target factors corresponding to the initial test objective. The semantic description information can include the target attributes, test scope, and other information of the initial test objective, combined with the requirements of the actual target test task, to determine the target factors.
[0067] In determining the distances between entities in the target knowledge graph and using these distances to determine the relevance of the initial test target, the target knowledge graph can be optimized first. This involves identifying truly existing entity triples, which filters out incorrect entity relationships that existed during the construction of the target knowledge graph. For example, the relationship between entity 1 and entity 2 might be labeled as causal in the target knowledge graph, but is actually a progressive relationship. Therefore, true triples can be identified, reducing the workload of subsequent relevance determination. Specifically, a scoring function can be used to score the relationships between entities. The scoring function outputs a score value; a higher score indicates a higher authenticity of the triple, and a lower score indicates a lower authenticity. Entities can be represented as vectors, and a matrix can be built to represent the pairwise relationships between each entity in the knowledge graph. The entire set of relationships in the knowledge graph is represented as an M×M×N tensor, where M is the number of entities and N is the number of relationships. The scoring function could be:
[0068] f r (h,t)=h T M r t
[0069] Where h is the vector of the head node in the triplet, t is the vector of the tail node, and M... r The matrix is a diagonal matrix used for modeling the relation. Therefore, the scores of the head node h and the tail node t under relation r can be obtained as f. r(h,t).
[0070] S104. Cluster the initial test targets based on relevance to obtain the clustered test targets.
[0071] Initial test targets with high relevance can be identified as similar initial test targets. These initial test targets can be clustered and merged to reduce the number of original initial test targets. This reduces the objective dimension of multi-objective optimization, making the multi-objective optimization algorithm more efficient.
[0072] When clustering initial test targets based on relevance, the number of clustering operations and the final number of clustered test targets can be determined based on the current target test task and the testing capabilities of the test system or equipment used to complete the test. Therefore, the clustering process can be performed only once, or the clustered test targets can be re-analyzed and clustered again; that is, the clustering process can be iterative.
[0073] In one implementation, the clustering of the initial test targets based on relevance to obtain clustered test targets includes at least one of the following: if the relevance is greater than the relevance threshold, the initial test targets corresponding to the relevance are merged to obtain the first clustered test target; if the relevance is less than the relevance threshold, the two initial test targets corresponding to the relevance are retained to obtain the second and third clustered test targets.
[0074] A relevance threshold can be set based on the target testing task. Two initial testing targets with a relevance greater than or equal to the threshold can be considered to belong to the same testing metric type and can be merged. If the relevance is less than the threshold, it indicates that the two initial testing targets have a low correlation and are not suitable for merging; they are retained. This process is repeated for all initial testing targets until all initial testing targets have been merged or retained, resulting in the final clustered testing targets.
[0075] In another implementation, the step of clustering the initial test targets based on relevance to obtain clustered test targets includes: if the relevance is greater than a relevance threshold, merging the initial test targets corresponding to the relevance to obtain a first test target; if the relevance is less than the relevance threshold, retaining the two initial test targets corresponding to the relevance to obtain a second test target and a third test target; recalculating the relevance between the first test target, the second test target, and the third test target, and clustering the first test target, the second test target, and the third test target based on the recalculated relevance, until the relevance between the clustered test targets is less than the relevance threshold, thus obtaining the clustered test targets.
[0076] This implementation involves an iterative clustering process. First, clustering is performed based on the relevance between the initial test targets. Then, a second round of clustering is performed based on the relevance after the first round. If, after the second round, there are still test targets with a relevance greater than a threshold, a third round of clustering is performed on these targets until the relevance between all clustered test targets is less than the threshold, resulting in a clustered set of test targets. It should be noted that the above clustering process uses a relevance greater than the threshold as an example. Depending on the actual application scenario, two initial test targets with a relevance greater than or equal to the threshold can be considered as related initial test targets and clustered accordingly. Furthermore, if multiple rounds of iterative processing are required, the relevance threshold for comparison in each round can be the same or different. For example, after each round of clustering, the relevance between the clustered test targets may decrease compared to the initial relevance. In this case, the relevance threshold can be appropriately reduced in the next round of clustering to minimize the number of test targets.
[0077] S105. Generate test cases that match the clustered test objectives, so that the target test task can be completed based on the test cases.
[0078] Based on the test requirements information corresponding to the target test task and the clustered test objectives, a test matrix can be developed, and test cases can be designed according to the test matrix. In this way, the test objects (such as products) corresponding to the current target test task can be tested according to the test cases to obtain test results.
[0079] In one implementation, generating test cases that match the clustered test objectives includes: generating a test matrix that matches the clustered test objectives, and determining a test pattern based on the target test task; and generating test cases based on the test matrix and the test pattern. The test matrix can be a table generated according to the clustered test objectives, for example, see [link to relevant documentation]. Figure 2 This is a test matrix for testing battery performance according to an embodiment of this application, wherein the clustered test targets (such as...) can be... Figure 2The test matrix (Packs 1-Pack 4) is abstracted as rows in a table, and the test steps are abstracted as columns, thus forming a test matrix to ensure orderly execution of subsequent tests. Correspondingly, the test mode determined based on the target test task can be a mode generated from test configuration information, representing relevant information during test execution, such as execution time, network information, or thread information. For example, the test mode can include a multi-step parallel execution mode or a mode that executes related steps sequentially. Finally, the relevant test data is encapsulated based on the test matrix and test mode to obtain test cases. When the target test task needs to be executed, the test case can be directly called through the processor of the test device to execute the test processing and obtain the final test results, facilitating the discovery of test problems and the improvement of related products.
[0080] In another implementation, generating test cases that match the clustered test objectives to enable the completion of the target test task based on the test cases includes: determining the association between the clustered test objectives and the initial test objectives; optimizing the clustered test objectives based on the association to obtain optimized test objectives; and generating test cases that match the optimized test objectives to enable the completion of the target test task based on the test cases.
[0081] In this implementation, by abstracting the logical relationship between the clustered test objectives and the initial test objectives—that is, obtaining their correlation—the test objectives can be optimized. This optimization process can be based on weight coefficients; different correlations can correspond to different weight coefficients. Specifically, the correlations can include one or more of the following: causal relationships, parallel relationships, progressive relationships, and mutual explanatory relationships. Therefore, the clustered test objectives can be adjusted according to the weight coefficients, and the generation of test cases can improve the accuracy of the final test results.
[0082] This application discloses a testing method, comprising: determining multiple initial test targets corresponding to a target testing task; obtaining a target knowledge graph matching the multiple initial test targets, wherein entities in the target knowledge graph are related to the initial test targets; determining the relevance between each initial test target based on the distance between entities in the target knowledge graph; clustering the initial test targets based on the relevance to obtain clustered test targets; and generating test cases matching the clustered test targets, so as to complete the target testing task based on the test cases. This application achieves automatic and effective narrowing of the scope of test targets based on the distance between entities in the knowledge graph, thereby improving testing efficiency.
[0083] The testing method of this application embodiment is described below with a specific application example. The target testing task is to test battery performance. The initial testing objectives may include test duration, test materials, equipment utilization, test coverage, etc. Decomposing the initial testing objectives yields the corresponding target factors, as shown in [reference needed]. Figure 3 This diagram illustrates the decomposition of an initial testing objective. Decomposing the initial testing objective, testing duration, yields target factors such as operators and test samples. Further decomposition of these target factors is possible; for example, decomposing operators yields job rotation and years of service, while decomposing test samples yields sample cost and sample type. Similarly, decomposing the initial testing objective, testing materials, yields first-level target factors such as operators, test samples, and testing equipment. Decomposing operators yields skills training and years of service, further decomposing test samples yields sample cost and sample type, and further decomposing testing equipment yields factors corresponding to equipment lifespan and equipment efficiency.
[0084] See Figure 4 This is a schematic diagram of the processing flow for an application scenario provided in this application embodiment. First, based on customer needs, the test system requirement information is determined, test items and initial test objectives are obtained, and then a target knowledge graph is constructed based on this information, such as... Figure 4 The rectangle on the right shows a partial schematic of the constructed target knowledge graph. In this target knowledge graph, the initial test target and / or the target factors corresponding to the initial test target can be treated as entities. Therefore, the vector or feature representation of the test target can be derived based on this target knowledge graph. For example, the vector representation of a target entity in the target knowledge graph may include:
[0085] Test time is short T1:(t 11 ,t 12 ,t 13 ,…);
[0086] Test material usage is low, T2:(t) 21 ,t 22 ,t 23 ,…);
[0087] Test instrument utilization rate T3:(t 31 ,t 32 ,t 33 ,…);
[0088] Test coverage T4:(t 41 ,t 42 ,t 43 ,…).
[0089] Then, based on vector or semantic features, the distance between targets is calculated. Then, combined with clustering algorithms, a low-dimensional expression of the high-dimensional space of the test matrix composed of the initial test targets is abstracted, reducing the target dimension of multi-objective optimization, realizing multi-objective optimization, obtaining the clustered test targets, and constructing test cases and generating test plans based on the clustered test targets to complete the test.
[0090] For example, initial test objectives may include T1, T2, T3, T4, etc., and the target factors corresponding to each initial test objective may include s. 11 s 12 s 13 ……,s 21 s 22 s 23 wait.
[0091] After clustering, we get:
[0092] New target S1 after clustering: (s 11 s 12 s 13 …);
[0093] The new target S2 after clustering: (s 21 s 22 s 23 …)wait.
[0094] Then, the logical relationship between the fewer new clustered targets and the initial test targets is abstracted, using the coefficient 'a'. ij To represent the parameter values corresponding to the relationship between the two, we get:
[0095] S1=a 11 *T1+a 12 *T2+a 13 *T3+a 14 *T4
[0096] S2=a E1 *T1+a 22 *T2+a 23 *T3+a 24 *T4
[0097] Finally, a multi-objective optimization algorithm is used to optimize S1 and S2 to obtain the optimization result. This optimization result can be used to generate test cases, and the final test plan can be constructed based on the test cases.
[0098] In the test application scenario embodiments provided in this application, a multi-objective optimization algorithm can be used to generate test cases, quickly finding the optimal solution and improving testing efficiency. By employing knowledge graph clustering and dimensionality reduction, a low-dimensional representation of the high-dimensional space of the test matrix is abstracted, reducing the objective dimensionality of the multi-objective optimization and making the algorithm more efficient. Using a knowledge graph-based approach to reduce the objective dimensionality of multi-objective optimization allows the logical relationships between multiple objectives to be expressed using the knowledge contained in the knowledge graph, which better aligns with the actual business logic, avoids the randomness of manual assignment, and improves test accuracy.
[0099] Another embodiment of this application also provides a testing apparatus, see [link to relevant documentation]. Figure 5 ,include:
[0100] The first determining unit 501 is used to determine multiple initial test targets corresponding to the target test task;
[0101] The graph acquisition unit 502 is used to acquire a target knowledge graph that matches the plurality of initial test targets, wherein the entities in the target knowledge graph are related to the initial test targets;
[0102] The second determining unit 503 is used to determine the relevance between each initial test target based on the distance between each entity in the target knowledge graph;
[0103] Clustering unit 504 is used to cluster the initial test target based on the relevance to obtain the clustered test target;
[0104] The generation unit 505 is used to generate test cases that match the clustered test target, so that the target test task can be completed based on the test cases.
[0105] This application discloses a testing apparatus, comprising: a first determining unit determining multiple initial test targets corresponding to a target testing task; a graph obtaining unit obtaining a target knowledge graph matching the multiple initial test targets, wherein entities in the target knowledge graph are related to the initial test targets; a second determining unit determining the relevance between each initial test target based on the distance between entities in the target knowledge graph; a clustering unit clustering the initial test targets based on the relevance to obtain clustered test targets; and a generation unit generating test cases matching the clustered test targets, so as to complete the target testing task based on the test cases. This application achieves automatic and effective narrowing of the scope of test targets based on the distance between entities in the knowledge graph, thereby improving testing efficiency.
[0106] In one implementation, when the entities in the target knowledge graph include the initial test target, the second determining unit includes:
[0107] The first determining subunit is used to determine the entity distance between each initial test target based on the target knowledge graph;
[0108] The second determining subunit is used to determine the correlation between each initial test target based on the entity distance between each initial test target.
[0109] In another implementation, when the entities in the target knowledge graph also include target factors corresponding to the initial test target, the second determining unit includes:
[0110] The third determining subunit is used to determine the entity distance between each target factor based on the target knowledge graph;
[0111] The fourth determining subunit is used to determine the entity distance between each initial test target based on the entity distance between each target factor;
[0112] The fifth determining subunit is used to determine the correlation between each initial test target based on the entity distance between each initial test target.
[0113] Optionally, the device further includes:
[0114] An information acquisition unit is used to acquire semantic description information of the initial test target;
[0115] The parsing unit is used to parse the semantic description information and obtain the parsing result;
[0116] The third determining unit is used to determine the target factors corresponding to the initial test target based on the analysis results and the target test task.
[0117] In one implementation, the clustering unit includes at least one of the following:
[0118] The merging subunit is used to merge the initial test targets corresponding to the relevance if the relevance is greater than the relevance threshold, so as to obtain the first test target after clustering.
[0119] The retention subunit is used to retain the two initial test targets corresponding to the correlation if the correlation is less than the correlation threshold, so as to obtain the second test target and the third test target after clustering.
[0120] In another embodiment, the clustering unit includes:
[0121] The merging subunit is used to merge the initial test targets corresponding to the relevance if the relevance is greater than the relevance threshold, so as to obtain the first test target;
[0122] The retention subunit is used to retain the two initial test targets corresponding to the correlation if the correlation is less than the correlation threshold, so as to obtain the second test target and the third test target;
[0123] An iterative clustering subunit is used to recalculate the correlation between the first test target, the second test target, and the third test target, and to cluster the first test target, the second test target, and the third test target based on the recalculated correlation, until the correlation between the clustered test targets is less than the correlation threshold, thus obtaining the clustered test targets.
[0124] In one implementation, the generation unit includes:
[0125] The sixth determining subunit is used to determine the association between the clustered test target and the initial test target;
[0126] An optimization subunit is used to optimize the clustered test target based on the association relationship to obtain an optimized test target;
[0127] The first generation subunit is used to generate test cases that match the optimized test objective, so that the target test task can be achieved based on the test cases.
[0128] In another embodiment, the generation unit further includes:
[0129] The second generation subunit is used to generate a test matrix that matches the clustered test target, and to determine the test mode based on the target test task;
[0130] The third generation subunit is used to generate test cases based on the test matrix and the test mode.
[0131] It should be noted that the specific implementation of each unit and subunit in this embodiment can be referred to the corresponding content above, and will not be described in detail here.
[0132] In another embodiment of this application, a readable storage medium is also provided, on which a computer program is stored, which, when executed by a processor, implements the various test steps as described in any of the preceding claims.
[0133] In another embodiment of this application, an electronic device is also provided, which may include:
[0134] Memory, used to store applications and the data generated by the running of the applications;
[0135] A processor for executing the application to implement the test method as described in any of the above.
[0136] It should be noted that the specific implementation of the processor in this embodiment can be referred to the corresponding content above, and will not be described in detail here.
[0137] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to the method section.
[0138] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0139] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.
[0140] The above description of the disclosed embodiments enables those skilled in the art to make or use this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A testing method, comprising: Identify multiple initial test objectives corresponding to the target test task; Obtain a target knowledge graph that matches the plurality of initial test targets, wherein the entities in the target knowledge graph are related to the initial test targets; Based on the distance between entities in the target knowledge graph, the relevance between each initial test target is determined; Based on the relevance, the initial test targets are clustered to obtain the clustered test targets; Determine the association between the clustered test target and the initial test target; Based on the aforementioned associations, the clustered test objectives are optimized to obtain optimized test objectives; Generate test cases that match the optimized test objective, so that the target test task can be achieved based on the test cases; The entities in the target knowledge graph include the initial test target and the target factors corresponding to the initial test target; The step of determining the relevance between each initial test target based on the distance between each entity in the target knowledge graph includes: Based on the target knowledge graph, determine the entity distances between each target factor; Based on the entity distances between the various target factors, determine the entity distances between each initial test target; The correlation between the initial test targets is determined based on the entity distance between each initial test target.
2. The method according to claim 1, further comprising: Obtain the semantic description information of the initial test target; The semantic description information is parsed to obtain the parsing result; Based on the analysis results and the target test task, the target factors corresponding to the initial test target are determined.
3. The method according to claim 1, wherein clustering the initial test targets based on the relevance to obtain clustered test targets includes at least one of the following: If the relevance is greater than the relevance threshold, the initial test targets corresponding to the relevance are merged to obtain the first test target after clustering; If the relevance is less than the relevance threshold, the two initial test targets corresponding to the relevance are retained to obtain the second and third test targets after clustering.
4. The method according to claim 1, wherein clustering the initial test targets based on the relevance to obtain clustered test targets includes: If the relevance is greater than the relevance threshold, the initial test targets corresponding to the relevance are merged to obtain the first test target; If the relevance is less than the relevance threshold, the two initial test targets corresponding to the relevance are retained to obtain the second test target and the third test target; The correlation between the first test target, the second test target, and the third test target is recalculated, and the first test target, the second test target, and the third test target are clustered based on the recalculated correlation until the correlation between the clustered test targets is less than the correlation threshold, thus obtaining the clustered test targets.
5. The method according to claim 1, wherein generating test cases that match the clustered test objective comprises: Generate a test matrix that matches the clustered test target, and determine the test mode based on the target test task; Test cases are generated based on the test matrix and the test mode.
6. A testing apparatus, comprising: The first determining unit is used to determine multiple initial test targets corresponding to the target test task; The graph acquisition unit is used to acquire a target knowledge graph that matches the plurality of initial test targets, wherein the entities in the target knowledge graph are related to the initial test targets; The second determining unit is used to determine the relevance between each initial test target based on the distance between each entity in the target knowledge graph; A clustering unit is used to cluster the initial test targets based on the relevance to obtain clustered test targets. Generation unit, used for: Determine the association between the clustered test target and the initial test target; Based on the aforementioned associations, the clustered test objectives are optimized to obtain optimized test objectives; Generate test cases that match the optimized test objective, so that the target test task can be achieved based on the test cases; The entities in the target knowledge graph include the initial test target and the target factors corresponding to the initial test target; The second determining unit determines the relevance between each initial test target based on the distance between each entity in the target knowledge graph, including: Based on the target knowledge graph, determine the entity distances between each target factor; Based on the entity distances between the various target factors, determine the entity distances between each initial test target; The correlation between the initial test targets is determined based on the entity distance between each initial test target.
7. An electronic device, comprising: Memory, used to store applications and the data generated by the running of the applications; A processor for executing the application to implement the test method as described in any one of claims 1-5.
Citation Information
Patent Citations
Matrix-model-based software testing method
CN104346278A
Test case generation method and device, equipment, storage medium and program
CN113238939A
Knowledge graph construction method and device for cloud computing and storage medium
CN114330720A