Test method, device, computer equipment and storage medium based on use case network
By constructing a use case network and locating and obtaining associated test case nodes, the problem of balancing test reliability and efficiency in traditional testing methods is solved, and an efficient and reliable testing process is achieved.
Patent Information
- Application Number
- CN202010213641.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-03-24
- Publication Date
- 2024-09-17
- Estimated Expiration
- 2040-03-24
AI Technical Summary
When traditional testing methods pursue test reliability, they often lead to a decrease in testing efficiency, making it difficult to take into account both.
By building a use case-based network, after receiving test instructions, locate test case nodes from the preset use case network, obtain directly connected and indirectly connected use case nodes, calculate the distance, and determine whether there is an intermediate distance smaller than the preset threshold, thereby obtaining the association test cases and use these test cases to perform test operations.
It improves testing efficiency and reliability and ensures the accuracy and efficiency of test results without traversing all test cases.
Smart Images

Figure CN111475404B
Abstract
Description
Technical Field
[0001] The present application relates to the field of computers, and in particular to a test method, apparatus, computer equipment and storage medium based on a use case network. Background Art
[0002] Test cases are used to test a computer product. In traditional testing methods, testers retrieve designed test cases from a preset test case library and then use the test cases to perform testing operations. Therefore, in order to fully complete a test, traditional testing methods require testers to accurately provide or call comprehensive test cases, so the reliability of the test results is directly related to the level of the tester. If the traversal method is used to test all test cases to improve test reliability, it will inevitably cause a decrease in test efficiency. Therefore, the traditional testing method cannot take into account both test reliability and test efficiency. Summary of the invention
[0003] The main purpose of this application is to provide a test method, apparatus, computer equipment and storage medium based on a use case network, aiming to achieve reliable testing, thereby taking into account both test reliability and test efficiency.
[0004] In order to achieve the above-mentioned invention object, the present application proposes a test method based on a use case network, comprising the following steps:
[0005] receiving a test instruction, wherein the test instruction specifies a first test case;
[0006] Locating a first use case node corresponding to the first test case from a preset use case network, wherein the use case network includes a plurality of use case nodes, and the plurality of use case nodes correspond to a plurality of preset test cases respectively;
[0007] Acquire a second use case node directly connected to the first use case node, and acquire a second test case corresponding to the second use case node according to the correspondence between the use case node and the test case;
[0008] According to a preset distance calculation method, the distance between the first use case node and the indirect node is calculated, thereby obtaining a plurality of intermediate distances corresponding to a plurality of indirect nodes one by one; wherein the indirect node refers to other nodes in the use case network except the first use case node and the second use case node;
[0009] Determine whether there is an intermediate distance less than a preset distance threshold;
[0010] If there is an intermediate distance less than the preset distance threshold, the intermediate distance less than the preset distance threshold is recorded as the target distance, and according to the preset correspondence relationship between distance-use case node-test case, a third test case corresponding to the target distance is obtained;
[0011] A test operation is performed using the first test case, the second test case, and the third test case.
[0012] Furthermore, before the step of locating the first use case node corresponding to the first test case from a preset use case network, wherein the use case network includes a plurality of use case nodes, and the plurality of use case nodes respectively correspond to a plurality of preset test cases, the step includes:
[0013] Constructing an n-dimensional space coordinate system in a preset virtual space, where n is an integer greater than 1;
[0014] Acquire n feature data of the first test case, and map the feature data into spatial coordinate values according to a preset mapping method, so as to obtain n spatial coordinate values of different dimensions respectively corresponding to the n feature data;
[0015] In the n-dimensional space coordinate system, a first use case node consisting of the n space coordinate values is generated, so as to establish a corresponding relationship between the first use case node and the first test case.
[0016] Furthermore, the feature data includes a first introduction text of the first test case, the first introduction text is a natural language text, and the step of mapping the feature data into a spatial coordinate value according to a preset mapping method includes:
[0017] By querying a preset word vector library, a plurality of first word vectors corresponding to all words in the first introduction text are obtained, and the plurality of first word vectors are sequentially connected to obtain a first introduction vector;
[0018] Acquire a standard case corresponding to the first test case from a preset standard case library, wherein the standard case is marked with a second introduction text;
[0019] By querying a preset word vector library, a plurality of second word vectors corresponding to all words in the second introduction text are obtained, and the plurality of second word vectors are sequentially connected to obtain a second introduction vector;
[0020] According to a preset vector similarity calculation method, a vector similarity value between the first introduction vector and the second introduction vector is calculated, and the vector similarity value is used as a spatial coordinate value corresponding to the first introduction text.
[0021] Furthermore, the step of calculating the distance between the first use case node and the indirect node according to a preset distance calculation method includes:
[0022] Obtaining the first coordinate point (A1, A2, ..., Ai, ..., An) of the first use case node, and obtaining the second coordinate point (B1, B2, ..., Bi, ..., Bn) of the indirect node;
[0023] Using the formula:
[0024] Calculate the distance M between the first use case node and the indirect node, where Ai is the coordinate value of the i-th dimension coordinate of the first coordinate point, and Bi is the coordinate value of the i-th dimension coordinate of the second coordinate point.
[0025] Further, each of the test cases has p versions, and the step of performing a test operation using the first test case, the second test case, and the third test case includes:
[0026] Constructing the first, second, ..., p-th batch test groups, wherein the first batch test group includes all the first test cases, the second test cases, and the third test cases of the first version; the second batch test group includes all the first test cases, the second test cases, and the third test cases of the second version; ...; the p-th batch test group includes all the first test cases, the second test cases, and the third test cases of the p-th version;
[0027] According to the first, second, ..., p-th batch test groups, p test operations are performed in sequence.
[0028] Furthermore, the step of sequentially performing p test operations according to the first, second, ..., and p-th batch test groups includes:
[0029] Obtaining the total number of the first test case, the second test case, and the third test case, and obtaining a product value of the total number multiplied by p;
[0030] Determining whether the product value is greater than a preset product threshold;
[0031] If the product value is greater than a preset product threshold, p test operations are performed in sequence according to the first, second, ..., pth batch test groups, and after each test operation is completed, a preset snapshot technology is used to generate a test snapshot for the test operation results and the test cases corresponding to the test operation results.
[0032] The present application provides a test device based on a use case network, comprising:
[0033] A test instruction receiving unit, configured to receive a test instruction, wherein the test instruction specifies a first test case;
[0034] A first use case node locating unit, used to locate a first use case node corresponding to the first test case from a preset use case network, wherein the use case network includes a plurality of use case nodes, and the plurality of use case nodes correspond to a plurality of preset test cases respectively;
[0035] A second test case acquisition unit, configured to acquire a second use case node directly connected to the first use case node, and acquire a second test case corresponding to the second use case node according to a correspondence between the use case node and the test case;
[0036] An intermediate distance calculation unit, configured to calculate the distance between the first use case node and the indirect node according to a preset distance calculation method, thereby obtaining a plurality of intermediate distances corresponding to a plurality of indirect nodes one by one; wherein the indirect node refers to other nodes in the use case network except the first use case node and the second use case node;
[0037] An intermediate distance determination unit, used to determine whether there is an intermediate distance less than a preset distance threshold;
[0038] A third test case acquisition unit, configured to record the intermediate distance less than the preset distance threshold as a target distance if there is an intermediate distance less than the preset distance threshold, and acquire a third test case corresponding to the target distance according to a preset correspondence relationship between distance-case node-test case;
[0039] The test execution unit is used to execute a test operation using the first test case, the second test case and the third test case.
[0040] The present application provides a computer device, including a memory and a processor, wherein the memory stores a computer program, and the processor implements the steps of any one of the above methods when executing the computer program.
[0041] The present application provides a computer-readable storage medium having a computer program stored thereon, and when the computer program is executed by a processor, the steps of any of the above-mentioned methods are implemented.
[0042] The test method, device, computer equipment and storage medium based on the use case network of the present application receive a test instruction; locate a first use case node from a preset use case network; obtain a second use case node directly connected to the first use case node, and obtain a second test case corresponding to the second use case node; calculate the distance between the first use case node and the indirect node, so as to obtain multiple intermediate distances corresponding to multiple indirect nodes one by one; if there is an intermediate distance less than a preset distance threshold, the intermediate distance less than the preset distance threshold is recorded as the target distance, and according to the preset distance-use case node-test case correspondence, a third test case corresponding to the target distance is obtained; and the first test case, the second test case and the third test case are used to perform the test operation. Thus, both test reliability and test efficiency are taken into account. BRIEF DESCRIPTION OF THE DRAWINGS
[0043] Figure 1 A flowchart of a test method based on a use case network according to an embodiment of the present application;
[0044] Figure 2 A schematic block diagram of the structure of a test device based on a use case network according to an embodiment of the present application;
[0045] Figure 3 A schematic block diagram of the structure of a computer device according to an embodiment of the present application.
[0046] The realization of the purpose, functional features and advantages of this application will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0047] In order to make the purpose, technical solution and advantages of the present application more clearly understood, the present application is further described in detail below in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0048] Reference Figure 1 The present application provides a test method based on a use case network, comprising the following steps:
[0049] S1. Receive a test instruction, wherein the test instruction specifies a first test case;
[0050] S2. Locate a first use case node corresponding to the first test case from a preset use case network, where the use case network includes a plurality of use case nodes, and the plurality of use case nodes correspond to a plurality of preset test cases respectively;
[0051] S3, obtaining a second use case node directly connected to the first use case node, and obtaining a second test case corresponding to the second use case node according to the correspondence between the use case node and the test case;
[0052] S4. Calculate the distance between the first use case node and the indirect node according to a preset distance calculation method, thereby obtaining a plurality of intermediate distances corresponding to a plurality of indirect nodes one by one; wherein the indirect node refers to other nodes in the use case network except the first use case node and the second use case node;
[0053] S5. Determine whether there is an intermediate distance that is less than a preset distance threshold;
[0054] S6. If there is an intermediate distance less than the preset distance threshold, the intermediate distance less than the preset distance threshold is recorded as the target distance, and according to the preset correspondence relationship between distance-use case node-test case, a third test case corresponding to the target distance is obtained;
[0055] S7. Perform a test operation using the first test case, the second test case, and the third test case.
[0056] The present application pre-designs a use case network, which includes multiple use case nodes, each of which corresponds to a plurality of preset test cases, thereby forming an associated network consisting of multiple test cases. When performing a test, only a specified test case (e.g., a first test case) needs to be provided, and the second test case and the third test case associated with the first test case can be obtained using the use case network, thereby achieving reliable testing without traversing all test cases, thereby taking into account both test reliability and test efficiency.
[0057] As described in step S1 above, a test instruction is received, wherein the test instruction specifies a first test case. The test instruction can perform any feasible type of test on any feasible computer product, such as stress testing on a software product, stress testing on a communication interface, etc. The test instruction specifies the first test case, that is, the first test case is the core test case in the test process and is a test case that must be executed.
[0058] As described in step S2 above, the first use case node corresponding to the first test case is located from the preset use case network, and the use case network includes multiple use case nodes, and the multiple use case nodes correspond to multiple preset test cases respectively. The present application is pre-designed with a use case network, so that the association relationship between different test cases is mapped in the use case network, so that the test case associated with the first test case can be obtained through the use case network, and there is no need to traverse all test cases for testing, so that the efficiency of the test is improved. Among them, the method for forming the use case network can be any feasible method, such as obtaining the feature data of the specified test case, and then mapping the feature data to a specified high-dimensional vector in the high-dimensional space, and then relative to the origin in the high-dimensional space, the end point pointed to by the specified high-dimensional vector is used as the use case node representing the specified test case, thereby mapping the specified test case in the high-dimensional space; all test cases are mapped in the high-dimensional space in turn, and then different use case nodes are selectively connected to form the use case network.
[0059] As described in step S3 above, a second use case node directly connected to the first use case node is obtained, and a second test case corresponding to the second use case node is obtained according to the correspondence between the use case node and the test case. In the use case network, the test case represented by the second use case node directly connected to the first use case node is directly related to the first test case, so the second test case needs to be used during testing. Therefore, according to the correspondence between the use case node and the test case, the second test case corresponding to the second use case node is obtained. Wherein, the use case network is composed of a plurality of nodes and the lines between the nodes, wherein some nodes do not have a direct connection, for example, node A is directly connected to node B, and node B is directly connected to node C, but node A and node C do not have a direct connection relationship, at this time, node A and node B are called directly connected, node B and node C are called directly connected, but node A and node C are only indirectly connected.
[0060] As described in step S4 above, according to a preset distance calculation method, the distance between the first use case node and the indirect node is calculated, thereby obtaining a plurality of intermediate distances corresponding to a plurality of indirect nodes one by one; wherein the indirect node refers to other nodes in the use case network except the first use case node and the second use case node. The distance calculation method may be any feasible calculation method, such as a Euclidean distance calculation method. In the use case network, in addition to the use case node directly connected to the first use case node, there are other nodes associated with the first use case node, that is, use case nodes that are closer to the first use case node. Therefore, the present application not only adopts a direct connection relationship, but also adopts a distance value as a basis for judging whether it is associated with the first use case node, thereby making the setting of the use case node more flexible and hierarchical, and making the overall test more flexible.
[0061] As described in step S5 above, it is determined whether there is an intermediate distance less than the preset distance threshold. If there is an intermediate distance less than the preset distance threshold, the use case node corresponding to the intermediate distance is the node related to the first use case node; conversely, if there is no intermediate distance less than the preset distance threshold, the result of the determination of whether the distance value is associated with the first use case node is 0, that is, only the second test case of the direct connection relationship needs to be considered.
[0062] As described in the above step S6, if there is an intermediate distance less than the preset distance threshold, the intermediate distance less than the preset distance threshold is recorded as the target distance, and according to the preset correspondence between distance-use case node-test case, the third test case corresponding to the target distance is obtained. The intermediate distance less than the preset distance threshold indicates that it is related to the first test case, so the intermediate distance less than the preset distance threshold is recorded as the target distance. Then the third test case corresponding to the target distance is obtained for use in subsequent test operations. Among them, when the number of intermediate distances less than the preset distance threshold is 1, the corresponding target distance is also 1, and the corresponding third test case is also 1; when the number of intermediate distances less than the preset distance threshold is multiple, the corresponding target distance is also multiple, and the corresponding third test case is also multiple. In fact, the number of test cases used in the test process is relatively large, and generally the number of third test cases will be more than 1, of course, there is also the possibility of only 1.
[0063] As described in step S7 above, the test operation is performed using the first test case, the second test case, and the third test case. The test operation can be any feasible test operation, such as using the test cases to test in sequence, testing all of the first test cases, the second test cases, and the third test cases in sequence, thereby obtaining the same number of test results as all of the first test cases, the second test cases, and the third test cases. Therefore, when receiving a test instruction, the present application only needs to know the specified first test case, and then automatically obtain the associated second test case and the third test case, which is efficient and reliable.
[0064] In one embodiment, before step S2 of locating the first use case node corresponding to the first test case from a preset use case network, where the use case network includes a plurality of use case nodes, and the plurality of use case nodes respectively correspond to a plurality of preset test cases, the method includes:
[0065] S11. constructing an n-dimensional space coordinate system in a preset virtual space, where n is an integer greater than 1;
[0066] S12, obtaining n feature data of the first test case, and mapping the feature data into space coordinate values according to a preset mapping method, so as to obtain n space coordinate values of different dimensions respectively corresponding to the n feature data;
[0067] S13. In the n-dimensional space coordinate system, generate a first use case node composed of the n space coordinate values, thereby establishing a corresponding relationship between the first use case node and the first test case.
[0068] As described above, the corresponding relationship between the first use case node and the first test case is established. The use case network in the present application is in an n-dimensional virtual space. Accordingly, the use case nodes in the use case network also have n-dimensional coordinates, so that the coordinates of one dimension can reflect a feature data, so that the use case node can fully represent the test case. Therefore, the n feature data of the first test case are obtained, and according to the preset mapping method, the feature data are mapped to spatial coordinate values, so as to obtain n spatial coordinate values of different dimensions corresponding to the n feature data respectively; in the n-dimensional spatial coordinate system, a first use case node composed of the n spatial coordinate values is generated, so as to establish the corresponding relationship between the first use case node and the first test case. The feature data can be any feasible data, such as the type of the first test case, the first introduction text of the first test case, the total number of parameters involved in the first test case, and the like.
[0069] In one embodiment, the feature data includes a first introduction text of the first test case, the first introduction text is a natural language text, and the step S12 of mapping the feature data into a spatial coordinate value according to a preset mapping method includes:
[0070] S1201, by querying a preset word vector library, thereby obtaining a plurality of first word vectors corresponding to all words in the first introduction text, and sequentially connecting the plurality of first word vectors to obtain a first introduction vector;
[0071] S1202: Acquire a standard case corresponding to the first test case from a preset standard case library, wherein the standard case is marked with a second introduction text;
[0072] S1203, by querying a preset word vector library, thereby obtaining a plurality of second word vectors corresponding to all words in the second introduction text, and sequentially connecting the plurality of second word vectors to obtain a second introduction vector;
[0073] S1204. Calculate the vector similarity value between the first introduction vector and the second introduction vector according to a preset vector similarity calculation method, and use the vector similarity value as the spatial coordinate value corresponding to the first introduction text.
[0074] As described above, the feature data is mapped to a spatial coordinate value according to a preset mapping method. Since the test case is designed by the tester, the first introduction text can best reflect the characteristics of the first test case. Then obtain multiple first word vectors corresponding to all the words in the first introduction text, and connect the multiple first word vectors in sequence to obtain the first introduction vector; and obtain multiple second word vectors corresponding to all the words in the second introduction text, and connect the multiple second word vectors in sequence to obtain the second introduction vector; then calculate the vector similarity value between the first introduction vector and the second introduction vector, and use the vector similarity value as the spatial coordinate value corresponding to the first introduction text. Thus, the first introduction text is mapped to a spatial coordinate value whose value is the vector similarity value. Among them, due to the use of the comparison design of the standard case, it is possible to convert the text description into a similar numerical value, realize quantitative analysis, and obtain the exact spatial coordinate value. Among them, the vector distance calculation method can be any feasible algorithm, such as the cosine similarity algorithm.
[0075] In one embodiment, the step S4 of calculating the distance between the first use case node and the indirect node according to a preset distance calculation method includes:
[0076] S401, obtaining a first coordinate point (A1, A2, ..., Ai, ..., An) of the first use case node, and obtaining a second coordinate point (B1, B2, ..., Bi, ..., Bn) of an indirect node;
[0077] S402, using the formula:
[0078] Calculate the distance M between the first use case node and the indirect node, where Ai is the coordinate value of the i-th dimension coordinate of the first coordinate point, and Bi is the coordinate value of the i-th dimension coordinate of the second coordinate point.
[0079] As described above, the distance between the first use case node and the indirect node is calculated according to the preset distance calculation method. The present application adopts a special distance calculation method to more accurately screen out the third use case node associated with the first use case node. That is, the formula is used:
[0080] Calculate the distance M between the first use case node and the indirect node. Since the distance M calculation formula not only considers the coordinate difference between the nodes, but also considers the angle difference between the nodes (compared to the origin of the coordinate system), the distance value can be calculated more accurately. Therefore, when designing the third use case node, there are more options (that is, one more angle factor can be used), making the node design more flexible.
[0081] In one embodiment, the test cases each have p versions, and the step S7 of performing a test operation using the first test case, the second test case, and the third test case includes:
[0082] S701, construct the first, second, ..., p-th batch test groups, wherein the first batch test group includes all the first test cases, the second test cases and the third test cases of the first version; the second batch test group includes all the first test cases, the second test cases and the third test cases of the second version; ...; the p-th batch test group includes all the first test cases, the second test cases and the third test cases of the p-th version;
[0083] S702: Execute p test operations in sequence according to the first, second, ..., pth batch test groups.
[0084] As described above, it is realized that the test operation is performed using the first test case, the second test case and the third test case. Ordinary test cases do not have the concept of version, or in other words, each test case has only one version of itself, so that only a single test can be performed during the test, and it is difficult to modify the test (i.e., modify the test case, and then use the modified test case for testing). The present application adopts a design in which the test case has p versions, and adopts a batch test method to achieve fast and flexible testing. Construct the first, second, ..., pth batch test group, and perform p test operations in sequence according to the first, second, ..., pth batch test group, so that p batch test results can be obtained. Thereby making the test more comprehensive and more flexible.
[0085] In one embodiment, the step S702 of sequentially performing p test operations according to the first, second, ..., and p-th batch test groups includes:
[0086] S7021. Obtain the total number of the first test case, the second test case, and the third test case, and obtain the product value of the total number multiplied by p;
[0087] S7022. Determine whether the product value is greater than a preset product threshold;
[0088] S7023. If the product value is greater than a preset product threshold, p test operations are performed in sequence according to the first, second, ..., pth batch test groups, and after each test operation is completed, a preset snapshot technology is used to generate a test snapshot for the test operation results and the test cases corresponding to the test operation results.
[0089] As described above, it is realized that p test operations are performed in sequence according to the first, second, ..., and p-th batch test groups. Among them, a snapshot is a fully available copy of a specified data set, and is a state record of data storage at a certain moment. In this application, it is a state record of data storage of test operation results and test cases corresponding to the test operation results. This application uses a preset snapshot technology to generate test snapshots for test operation results and test cases corresponding to the test operation results, thereby generating p test snapshots, and each test snapshot includes a test operation result and a corresponding test case. Wherein the test operation result is, for example, a test result report. However, the ordinary test method can only generate a test report, which cannot be associated with the corresponding test case (because after the test, the corresponding test case may be modified), and its test report is not a batch test report. However, this application obtains the total number of the first test case, the second test case, and the third test case, and obtains the product value of the total number multiplied by p; and determines whether the product value is greater than the preset product threshold, and first determines the total number of times a single test needs to be performed. If the product value is greater than the preset product threshold, it indicates that the total number of tests is too many. If a snapshot is generated for the test results of each test case, a large amount of computer resources will be consumed. Therefore, after each test operation is completed, a test snapshot is generated for the test operation results and the test cases corresponding to the test operation results using the preset snapshot technology, and the test results are stored in the form of batch snapshots. Therefore, the test results and the corresponding test cases can be obtained only through batch snapshots, which improves the pertinence and reliability of the test results (that is, since the corresponding test cases are snapshotted, there is no need to worry about the loss of test cases due to modifications).
[0090] The test method based on the use case network of the present application receives a test instruction; locates a first use case node from a preset use case network; obtains a second use case node directly connected to the first use case node, and obtains a second test case corresponding to the second use case node; calculates the distance between the first use case node and the indirect node, thereby obtaining multiple intermediate distances corresponding to multiple indirect nodes one by one; if there is an intermediate distance less than a preset distance threshold, the intermediate distance less than the preset distance threshold is recorded as the target distance, and according to the preset distance-use case node-test case correspondence, a third test case corresponding to the target distance is obtained; and the first test case, the second test case and the third test case are used to perform the test operation. Thus, both test reliability and test efficiency are taken into account.
[0091] Reference Figure 2 , the embodiment of the present application provides a test device based on a use case network, including:
[0092] A test instruction receiving unit 10, configured to receive a test instruction, wherein the test instruction specifies a first test case;
[0093] A first use case node locating unit 20, configured to locate a first use case node corresponding to the first test case from a preset use case network, wherein the use case network includes a plurality of use case nodes, and the plurality of use case nodes correspond to a plurality of preset test cases respectively;
[0094] A second test case acquisition unit 30, configured to acquire a second use case node directly connected to the first use case node, and acquire a second test case corresponding to the second use case node according to a correspondence between the use case node and the test case;
[0095] The intermediate distance calculation unit 40 is used to calculate the distance between the first use case node and the indirect node according to a preset distance calculation method, so as to obtain a plurality of intermediate distances corresponding to a plurality of indirect nodes one by one; wherein the indirect node refers to other nodes in the use case network except the first use case node and the second use case node;
[0096] The intermediate distance determination unit 50 is used to determine whether there is an intermediate distance less than a preset distance threshold;
[0097] A third test case acquisition unit 60 is used to record the intermediate distance less than the preset distance threshold as the target distance if there is an intermediate distance less than the preset distance threshold, and acquire a third test case corresponding to the target distance according to a preset correspondence relationship between distance-case node-test case;
[0098] The test execution unit 70 is used to execute a test operation using the first test case, the second test case and the third test case.
[0099] The operations performed by the above units correspond one-to-one to the steps of the test method based on the use case network in the aforementioned implementation mode, and will not be repeated here.
[0100] In one embodiment, the device comprises:
[0101] A coordinate system construction unit, used to construct an n-dimensional space coordinate system in a preset virtual space, where n is an integer greater than 1;
[0102] A coordinate value mapping unit, used to obtain n feature data of the first test case, and map the feature data into spatial coordinate values according to a preset mapping method, so as to obtain n spatial coordinate values of different dimensions corresponding to the n feature data respectively;
[0103] The corresponding relationship building unit is used to generate a first use case node composed of the n spatial coordinate values in the n-dimensional spatial coordinate system, so as to establish a corresponding relationship between the first use case node and the first test case.
[0104] The operations performed by the above units correspond one-to-one to the steps of the test method based on the use case network in the aforementioned implementation mode, and will not be repeated here.
[0105] In one embodiment, the feature data includes a first introduction text of the first test case, the first introduction text is a natural language text, and the coordinate value mapping unit includes:
[0106] A first introduction vector generating subunit is used to obtain a plurality of first word vectors corresponding to all words in the first introduction text by querying a preset word vector library, and sequentially connect the plurality of first word vectors to obtain a first introduction vector;
[0107] A standard case acquisition subunit, configured to acquire a standard case corresponding to the first test case from a preset standard case library, wherein the standard case is annotated with a second introduction text;
[0108] A second introduction vector generating subunit is used to obtain a plurality of second word vectors corresponding to all words in the second introduction text by querying a preset word vector library, and sequentially connect the plurality of second word vectors to obtain a second introduction vector;
[0109] The coordinate value mapping subunit is used to calculate the vector similarity value between the first introduction vector and the second introduction vector according to a preset vector similarity calculation method, and use the vector similarity value as the spatial coordinate value corresponding to the first introduction text.
[0110] The operations performed by the above sub-units correspond one-to-one to the steps of the test method based on the use case network in the aforementioned implementation mode, and will not be repeated here.
[0111] In one embodiment, the intermediate distance calculation unit 40 includes:
[0112] A coordinate point acquisition subunit, used to acquire a first coordinate point (A1, A2, ..., Ai, ..., An) of the first use case node, and to acquire a second coordinate point (B1, B2, ..., Bi, ..., Bn) of an indirect node;
[0113] The distance M calculation subunit is used to adopt the formula:
[0114] Calculate the distance M between the first use case node and the indirect node, where Ai is the coordinate value of the i-th dimension coordinate of the first coordinate point, and Bi is the coordinate value of the i-th dimension coordinate of the second coordinate point.
[0115] The operations performed by the above sub-units correspond one-to-one to the steps of the test method based on the use case network in the aforementioned implementation mode, and will not be repeated here.
[0116] In one embodiment, the test cases each have p versions, and the test execution unit 70 includes:
[0117] A test group construction subunit is used to construct the first, second, ..., and p-th batch test groups, wherein the first batch test group includes all of the first test cases, the second test cases, and the third test cases of the first version; the second batch test group includes all of the first test cases, the second test cases, and the third test cases of the second version; ...; the p-th batch test group includes all of the first test cases, the second test cases, and the third test cases of the p-th version;
[0118] The test execution subunit is used to execute p test operations in sequence according to the first, second, ..., pth batch test groups.
[0119] The operations performed by the above sub-units correspond one-to-one to the steps of the test method based on the use case network in the aforementioned implementation mode, and will not be repeated here.
[0120] In one embodiment, the execution test subunit includes:
[0121] A product value acquisition module, used to acquire the total number of the first test case, the second test case and the third test case, and acquire a product value of the total number multiplied by p;
[0122] A product value judgment module, used to judge whether the product value is greater than a preset product threshold;
[0123] The snapshot generation module is used to execute p test operations in sequence according to the first, second, ..., pth batch test groups if the product value is greater than a preset product threshold, and after each test operation is completed, generate a test snapshot for the test operation result and the test case corresponding to the test operation result using a preset snapshot technology.
[0124] The operations performed by the above modules respectively correspond one-to-one to the steps of the test method based on the use case network in the aforementioned implementation method, and will not be repeated here.
[0125] The test device based on the use case network of the present application receives a test instruction; locates a first use case node from a preset use case network; obtains a second use case node directly connected to the first use case node, and obtains a second test case corresponding to the second use case node; calculates the distance between the first use case node and the indirect node, thereby obtaining multiple intermediate distances corresponding to multiple indirect nodes one by one; if there is an intermediate distance less than a preset distance threshold, the intermediate distance less than the preset distance threshold is recorded as the target distance, and according to the preset distance-use case node-test case correspondence, a third test case corresponding to the target distance is obtained; and the first test case, the second test case and the third test case are used to perform the test operation. Thus, both test reliability and test efficiency are taken into account.
[0126] Reference Figure 3 In an embodiment of the present invention, a computer device is also provided, which may be a server, and its internal structure may be as shown in the figure. The computer device includes a processor, a memory, a network interface and a database connected via a system bus. Among them, the processor designed by the computer is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program and a database. The memory provides an environment for the operation of the operating system and the computer program in the non-volatile storage medium. The database of the computer device is used to store data used in a test method based on a use case network. The network interface of the computer device is used to communicate with an external terminal through a network connection. When the computer program is executed by the processor, a test method based on a use case network is implemented.
[0127] The above-mentioned processor executes the above-mentioned test method based on the use case network, wherein the steps included in the method correspond one-to-one to the steps of executing the test method based on the use case network of the aforementioned implementation method, and are not repeated here.
[0128] Those skilled in the art will appreciate that the structure shown in the figure is merely a block diagram of a portion of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied.
[0129] The computer device of the present application receives a test instruction; locates a first use case node from a preset use case network; obtains a second use case node directly connected to the first use case node, and obtains a second test case corresponding to the second use case node; calculates the distance between the first use case node and the indirect node, thereby obtaining multiple intermediate distances corresponding to multiple indirect nodes one by one; if there is an intermediate distance less than a preset distance threshold, the intermediate distance less than the preset distance threshold is recorded as the target distance, and according to the preset distance-use case node-test case correspondence, a third test case corresponding to the target distance is obtained; and the first test case, the second test case and the third test case are used to perform the test operation. Thus, both test reliability and test efficiency are taken into account.
[0130] An embodiment of the present application also provides a computer-readable storage medium having a computer program stored thereon. When the computer program is executed by a processor, the test method based on a use case network is implemented. The steps included in the method correspond one-to-one to the steps of executing the test method based on a use case network of the aforementioned implementation method, and are not repeated here.
[0131] The computer-readable storage medium of the present application receives a test instruction; locates a first use case node from a preset use case network; obtains a second use case node directly connected to the first use case node, and obtains a second test case corresponding to the second use case node; calculates the distance between the first use case node and the indirect node, thereby obtaining multiple intermediate distances corresponding to multiple indirect nodes one by one; if there is an intermediate distance less than a preset distance threshold, the intermediate distance less than the preset distance threshold is recorded as a target distance, and according to the preset distance-use case node-test case correspondence, a third test case corresponding to the target distance is obtained; and the first test case, the second test case and the third test case are used to perform a test operation. Thus, both test reliability and test efficiency are taken into account.
[0132] Those of ordinary skill in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage medium. When the computer program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, any reference to memory, storage, database or other media provided in this application and used in the embodiments may include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM) or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in many forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double data rate SDRAM (SSRSDRAM), enhanced SDRAM (ESDRAM), synchronous link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0133] It should be noted that, in this article, the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, device, article or method including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, device, article or method. In the absence of further restrictions, an element defined by the sentence "includes a ..." does not exclude the existence of other identical elements in the process, device, article or method including the element.
[0134] The above description is only a preferred embodiment of the present application, and does not limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A test method based on a use case network, characterized in that: include: receiving a test instruction, wherein the test instruction specifies a first test case; Locating a first use case node corresponding to the first test case from a preset use case network, wherein the use case network includes a plurality of use case nodes, and the plurality of use case nodes correspond to a plurality of preset test cases respectively; Acquire a second use case node directly connected to the first use case node, and acquire a second test case corresponding to the second use case node according to the correspondence between the use case node and the test case; According to a preset distance calculation method, the distance between the first use case node and the indirect node is calculated, thereby obtaining a plurality of intermediate distances corresponding to a plurality of indirect nodes one by one; wherein the indirect node refers to other nodes in the use case network except the first use case node and the second use case node; Determine whether there is an intermediate distance less than a preset distance threshold; If there is an intermediate distance less than the preset distance threshold, the intermediate distance less than the preset distance threshold is recorded as the target distance, and according to the preset correspondence relationship between distance-use case node-test case, a third test case corresponding to the target distance is obtained; Performing a test operation using the first test case, the second test case, and the third test case; Before the step of locating the first use case node corresponding to the first test case from a preset use case network, where the use case network includes a plurality of use case nodes, and the plurality of use case nodes correspond to a plurality of preset test cases respectively, the method further comprises: Constructing an n-dimensional space coordinate system in a preset virtual space, where n is an integer greater than 1; Acquire n feature data of the first test case, and map the feature data into spatial coordinate values according to a preset mapping method, so as to obtain n spatial coordinate values of different dimensions respectively corresponding to the n feature data; In the n-dimensional space coordinate system, a first use case node consisting of the n space coordinate values is generated, thereby establishing a corresponding relationship between the first use case node and the first test case; The feature data includes a first introduction text of the first test case, the first introduction text is a natural language text, and the step of mapping the feature data into a spatial coordinate value according to a preset mapping method includes: By querying a preset word vector library, a plurality of first word vectors corresponding to all words in the first introduction text are obtained, and the plurality of first word vectors are sequentially connected to obtain a first introduction vector; Acquire a standard case corresponding to the first test case from a preset standard case library, wherein the standard case is marked with a second introduction text; By querying a preset word vector library, a plurality of second word vectors corresponding to all words in the second introduction text are obtained, and the plurality of second word vectors are sequentially connected to obtain a second introduction vector; According to a preset vector similarity calculation method, a vector similarity value between the first introduction vector and the second introduction vector is calculated, and the vector similarity value is used as a spatial coordinate value corresponding to the first introduction text.
2. The test method based on the use case network according to claim 1, characterized in that: The step of calculating the distance between the first use case node and the indirect node according to a preset distance calculation method includes: Obtaining the first coordinate point (A1, A2, ..., Ai, ..., An) of the first use case node, and obtaining the second coordinate point (B1, B2, ..., Bi, ..., Bn) of the indirect node; Using the formula: , calculate the distance M between the first use case node and the indirect node, where Ai is the coordinate value of the i-th dimension coordinate of the first coordinate point, and Bi is the coordinate value of the i-th dimension coordinate of the second coordinate point.
3. The test method based on the use case network according to claim 1, characterized in that: The test cases each have p versions, and the step of performing a test operation using the first test case, the second test case, and the third test case includes: Constructing the first, second, ..., p-th batch test groups, wherein the first batch test group includes all the first test cases, the second test cases, and the third test cases of the first version; the second batch test group includes all the first test cases, the second test cases, and the third test cases of the second version; ...; the p-th batch test group includes all the first test cases, the second test cases, and the third test cases of the p-th version; According to the first, second, ..., p-th batch test groups, p test operations are performed in sequence.
4. The test method based on the use case network according to claim 3, characterized in that: The step of sequentially performing p test operations according to the first, second, ..., and p-th batch test groups includes: Obtaining the total number of the first test case, the second test case, and the third test case, and obtaining a product value of the total number multiplied by p; Determining whether the product value is greater than a preset product threshold; If the product value is greater than a preset product threshold, p test operations are performed in sequence according to the first, second, ..., pth batch test groups, and after each test operation is completed, a preset snapshot technology is used to generate a test snapshot for the test operation results and the test cases corresponding to the test operation results.
5. A test device based on a use case network, characterized in that: include: A test instruction receiving unit, configured to receive a test instruction, wherein the test instruction specifies a first test case; A first use case node locating unit, used to locate a first use case node corresponding to the first test case from a preset use case network, wherein the use case network includes a plurality of use case nodes, and the plurality of use case nodes correspond to a plurality of preset test cases respectively; A second test case acquisition unit, configured to acquire a second use case node directly connected to the first use case node, and acquire a second test case corresponding to the second use case node according to a correspondence between the use case node and the test case; An intermediate distance calculation unit, configured to calculate the distance between the first use case node and the indirect node according to a preset distance calculation method, thereby obtaining a plurality of intermediate distances corresponding to a plurality of indirect nodes one by one; wherein the indirect node refers to other nodes in the use case network except the first use case node and the second use case node; An intermediate distance determination unit, used to determine whether there is an intermediate distance less than a preset distance threshold; A third test case acquisition unit, configured to record the intermediate distance less than the preset distance threshold as a target distance if there is an intermediate distance less than the preset distance threshold, and acquire a third test case corresponding to the target distance according to a preset correspondence relationship between distance-case node-test case; A test execution unit, configured to execute a test operation using the first test case, the second test case, and the third test case; A coordinate system construction unit, used to construct an n-dimensional space coordinate system in a preset virtual space, where n is an integer greater than 1; A coordinate value mapping unit, used to obtain n feature data of the first test case, and map the feature data into spatial coordinate values according to a preset mapping method, so as to obtain n spatial coordinate values of different dimensions corresponding to the n feature data respectively; A corresponding relationship building unit, used for generating a first use case node composed of the n spatial coordinate values in the n-dimensional spatial coordinate system, thereby establishing a corresponding relationship between the first use case node and the first test case; The coordinate value mapping unit comprises: A first introduction vector generating subunit is used to obtain a plurality of first word vectors corresponding to all words in the first introduction text by querying a preset word vector library, and sequentially connect the plurality of first word vectors to obtain a first introduction vector; A standard case acquisition subunit, configured to acquire a standard case corresponding to the first test case from a preset standard case library, wherein the standard case is annotated with a second introduction text; A second introduction vector generating subunit is used to obtain a plurality of second word vectors corresponding to all words in the second introduction text by querying a preset word vector library, and sequentially connect the plurality of second word vectors to obtain a second introduction vector; The coordinate value mapping subunit is used to calculate the vector similarity value between the first introduction vector and the second introduction vector according to a preset vector similarity calculation method, and use the vector similarity value as the spatial coordinate value corresponding to the first introduction text.
6. A computer device comprising a memory and a processor, wherein the memory stores a computer program, characterized in that: When the processor executes the computer program, the steps of the method according to any one of claims 1 to 4 are implemented.
7. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the method according to any one of claims 1 to 4 are implemented.
