A use case generation method, testing method, device and server
By obtaining and comparing the log chains of seed use cases and derivative use cases, the target use cases are automatically filtered out, which solves the problem of low use case generation efficiency and improves the comprehensiveness of testing.
Patent Information
- Application Number
- CN202010346540.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-04-27
- Publication Date
- 2024-12-24
- Estimated Expiration
- 2040-04-27
AI Technical Summary
In the prior art, the use case generation efficiency is low, mainly relying on manual screening, and it is impossible to effectively supplement the test level that seed use cases cannot cover when testing business systems.
By obtaining seed use cases, deriving derivative use cases, and determining the target use cases through log chain comparison, automatically filtering out test-level use cases that are different from seed use cases and can supplement their uncoverable test-level use cases.
It realizes automatic filtering of target use cases, improves the efficiency of use case generation, and improves the comprehensiveness of business system testing.
Smart Images

Figure CN113297058B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the field of testing technology, and in particular to a use case generation method, a testing method, a device and a server. Background Art
[0002] In order to ensure the operation of the business system, it is necessary to perform various types of tests on the business system based on use cases. Use cases can be considered as descriptions of test tasks, mainly including test inputs, test data, and expected results involved in the test tasks.
[0003] Batch generation of use cases is the main way to generate use cases. Specifically, based on setting a seed use case, multiple derived use cases can be derived from the seed use case, and then use cases useful for testing can be screened out from the derived use cases. At present, the above screening process is mainly implemented by manual screening, which makes the efficiency of use case generation extremely low. Therefore, how to provide a use case generation solution to improve the efficiency of use case generation has become a problem that technicians in this field need to solve urgently. Summary of the invention
[0004] In view of this, an embodiment of the present invention provides a use case generation method, a testing method, an apparatus and a server to improve the use case generation efficiency.
[0005] To achieve the above objectives, the embodiments of the present invention provide the following technical solutions:
[0006] In a first aspect, an embodiment of the present invention provides a use case generation method, comprising:
[0007] Get seed use cases;
[0008] Deriving a derivative use case of the seed use case based on the seed use case;
[0009] Determine a first log chain generated by executing a test on the business system using the seed use case, and a second log chain generated by executing a test on the business system using the derived use case;
[0010] Comparing the first log chain and the second log chain;
[0011] According to the log chain comparison result, a target use case is determined from the derived use cases.
[0012] In a second aspect, an embodiment of the present invention provides a testing method, including:
[0013] Get seed use cases;
[0014] Deriving a derivative use case of the seed use case based on the seed use case;
[0015] Determine a first log chain generated by executing a test on the business system using the seed use case, and a second log chain generated by executing a test on the business system using the derived use case;
[0016] Comparing the first log chain and the second log chain;
[0017] According to the log chain comparison result, determine the target use case from the derived use cases;
[0018] The business system is tested using the seed use case and the use cases in the target use case.
[0019] In a third aspect, an embodiment of the present invention provides a use case generation device, comprising:
[0020] Acquisition module, used to obtain seed use cases;
[0021] A derivative module, used for deriving a derivative use case of the seed use case based on the seed use case;
[0022] A log chain determination module, used to determine a first log chain generated by executing a test on the business system using the seed use case, and a second log chain generated by executing a test on the business system using the derived use case;
[0023] A comparison module, used for comparing the first log chain and the second log chain;
[0024] A determination module is used to determine a target use case from the derived use cases according to a log chain comparison result.
[0025] In a fourth aspect, an embodiment of the present invention provides a server comprising at least one memory and at least one processor, wherein the memory stores one or more computer executable instructions, and the processor calls the one or more computer executable instructions to execute the use case generation method as described above, or execute the testing method as described above.
[0026] After obtaining a seed case, the use case generation method provided by the embodiment of the present invention can derive a derivative case of the seed case based on the seed case. In order to supplement the test level that the seed case cannot cover when testing the business system, the embodiment of the present invention needs to screen out a target case that is different from the seed case and can supplement the seed case from the derivative case. To achieve this purpose, the embodiment of the present invention can determine a first log chain generated by executing a test on the business system with the seed case, and determine a second log chain generated by executing a test on the business system with the derivative case, thereby comparing the first log chain and the second log chain to obtain a log chain comparison result. The log chain comparison result can reflect the difference in the test level between the seed case and the derivative case when the business system is tested, and the difference can reflect the test level that the derivative case can cover but the seed case cannot cover. Based on the difference reflected by the log chain comparison result, the embodiment of the present invention can determine a target case that is different from the seed case and can supplement the test level that the seed case cannot cover from the derivative case, thereby automatically screening out a target case useful for testing from the derivative case, and improving the comprehensiveness of the target case executing the test on the business system. It can be seen that the use case generation method provided by the embodiment of the present invention can realize automatic screening of target use cases, improve the efficiency of use case generation, and improve the comprehensiveness of the test execution on the business system. BRIEF DESCRIPTION OF THE DRAWINGS
[0027] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.
[0028] Figure 1 A flowchart of a use case generation method provided by an embodiment of the present invention;
[0029] Figure 2 An example diagram of determining a derivative use case provided for an embodiment of the present invention;
[0030] Figure 3 A flowchart of determining a target use case from a derived use case provided by an embodiment of the present invention;
[0031] Figure 4 Another flow chart of determining a target use case from a derived use case provided by an embodiment of the present invention;
[0032] Figure 5 A flowchart of screening use cases based on target use cases provided by an embodiment of the present invention;
[0033] Figure 6 An example diagram of a use case generation process provided by an embodiment of the present invention;
[0034] Figure 7 A block diagram of a use case generation device provided by an embodiment of the present invention;
[0035] Figure 8 A block diagram of a server provided in accordance with an embodiment of the present invention. DETAILED DESCRIPTION
[0036] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0037] As can be known from the background technology, batch generation of use cases is the main way of use case generation. When a seed use case is set, multiple derived use cases can be obtained by adjusting the use case parameters of the seed use case (such as modifying, combining, etc.); however, there are use cases that are useless for testing in the derived use cases, such as the presence of useless use cases that are repeated with the seed use case in the derived use case, or the same test level as the seed use case for testing the business system. In order to supplement the test level that the seed use case cannot cover when testing the business system and enrich the number of use cases for testing the business system at multiple test levels, the embodiment of the present invention needs to filter out target use cases that are different from the seed use case and can supplement the seed use case from the derived use cases. However, the above-mentioned screening process is currently mainly implemented by manual screening, which results in low efficiency in use case generation.
[0038] To solve the above problems, an embodiment of the present invention provides an improved use case generation method, which realizes automatic screening of derived use cases based on seed use cases, reduces the workload of screening derived use cases, and improves the efficiency of use case generation.
[0039] In an optional implementation, the optional process of the use case generation method provided in the embodiment of the present invention can be as follows: Figure 1 As shown, this process can be executed by the server, refer to Figure 1 , the process may include:
[0040] S11. Get seed use case.
[0041] Optionally, the server may obtain a seed use case from the generated use cases, for example, the seed use case is any generated use case, or the seed use case is a use case selected from the generated use cases.
[0042] Optionally, the seed use case can be a normal use case. A normal use case refers to a use case used for normal testing of a business system. Normal testing is used to test the business system's handling of normal situations. Conversely, an abnormal use case refers to a use case used for abnormal testing of a business system. Abnormal testing is used to test the business system's handling of abnormal situations, such as testing the business system's response to erroneous operations and erroneous messages.
[0043] S12. Derive a derivative use case of the seed use case based on the seed use case.
[0044] The seed use case can be used as the basis for obtaining derived use cases in the embodiments of the present invention; in an optional implementation, the embodiments of the present invention can adjust the use case parameters of the seed use case based on the seed use case (such as mutating, combining, etc.), so as to derive derived use cases of the seed use case. By adjusting the use case parameters of the seed use case once, a derived use case can be derived.
[0045] Optionally, the seed case may include test input, test data and expected results of the seed case, and the test input, test data and expected results may have multiple use case parameters. As an example of combining the use case parameters of the seed case to obtain a derived use case, assuming that the test input of the seed case A has three parameters a, b, and c, and the data type of each parameter is int / boolen / String, then theoretically there can be multiple parameter combinations of a, b, and c parameters, and the use case corresponding to each parameter combination can be used as a derived use case. Among them, int is the identifier for defining an integer type variable, boolen is the value stored by a Boolean object or the value to be converted into a Boolean value, and String represents the data type of a string.
[0046] Of course, the embodiment of the present invention can also modify (i.e., mutate) the use case parameters of the seed use case to obtain a derived use case. Generally speaking, the use cases corresponding to the modified different use case parameters can be used as different derived use cases. In an optional implementation, the embodiment of the present invention can use a preset multi-factor model to modify the use case parameters of the seed use case to obtain a derived derivative use case; the multi-factor model can be associated with multiple mutation factors to modify the use case parameters of the seed use case; for example, see Figure 2 , the embodiment of the present invention can input the seed use case into the multi-factor model, so that the multi-factor model can make multiple different modifications to the use case parameters of the seed use case based on the associated multiple variation factors to derive multiple derived use cases.
[0047] S13: Determine a first log chain generated by executing a test on the business system using the seed use case, and a second log chain generated by executing a test on the business system using the derived use case.
[0048] The embodiment of the present invention can perform tests on the business system based on the seed use case and each derived use case respectively. It can be understood that a use case execution process involves multiple execution nodes of the business system, and each execution node completes its own execution logic, so that the business system finally outputs the test result, and the business system can be tested. During the execution of the use case (such as the seed use case, the derived use case, etc.), the embodiment of the present invention can collect the log information of the execution node of the business system involved in the use case execution process, and link the log information in the execution order of the execution node to obtain the log chain generated by the execution of the use case.
[0049] It should be noted that the log chain can be understood as a sequential data chain including the log information of the execution nodes. When the business system is tested with the seed use case, the embodiment of the present invention can collect the log information of the execution nodes of the business system involved in the execution of the seed use case, and link the log information in the execution order of the execution nodes, thereby obtaining the first log chain generated by the test of the business system with the seed use case; for example, the first log chain can be expressed as: [debug, execution node 1]=>[debug, execution node 2]=>[warn, execution node 3]=>[error, execution node 4], where debug means debugging, warn means warning, and error means error; it can be seen from the first log chain of the above example that the first log chain The execution nodes of the business system involved in the execution of the seed use case, the execution order of the execution nodes, and the log information of the execution nodes can be recorded; for example, in the above example, the execution nodes represented by the first log chain are: execution nodes 1, 2, 3 and 4, and the execution order of the execution nodes is: execution node 1-execution node 2-execution node 3-execution node 4; at the same time, in the above example, warn is the warning information in the log information of execution node 3, and error is the error information in the log information of execution node 4; further, the log information of the execution node in the first log chain can also record: the number of times the execution node is called during the process of testing the business system with the seed use case.
[0050] Similarly, when executing tests on a business system with a derived use case, an embodiment of the present invention can collect log information of execution nodes of the business system involved in the execution process of the derived use case, and link the log information in the execution order of the execution nodes, thereby obtaining a second log chain generated by executing tests on the business system with the derived use case. For the specific content of the second log chain, please refer to the introduction of the first log chain above, which will not be repeated here. It should be noted that executing tests on a business system with a derived use case can generate a second log chain. In the case where multiple derived use cases are derived based on the seed use case, an embodiment of the present invention can execute tests on the business system with each derived use case respectively, thereby generating a second log chain corresponding to each derived use case, and obtaining multiple second log chains.
[0051] S14: Compare the first log chain and the second log chain.
[0052] The embodiment of the present invention can compare the first log chain with the second log chain corresponding to each derived use case to obtain a log chain comparison result. The log chain comparison result can reflect the difference in test levels between the seed use case and the derived use case when testing the business system. Specifically, the difference can reflect the test level that the derived use case can cover but the seed use case cannot cover.
[0053] In an optional implementation, the first log chain may include the execution order of the execution nodes of the business system involved in the seed use case execution process, and the log information of the execution nodes; the second log chain may include the execution order of the execution nodes of the business system involved in the derived use case execution process, and the log information of the execution nodes. By comparing the first log chain with the second log chain, it can be obtained whether the execution order of the execution nodes in the first log chain and the second log chain is the same, whether the log information of the execution nodes in the first log chain and the second log chain is the same, etc., thereby reflecting the difference in the test level between the seed use case and the derived use case when executing the test on the business system.
[0054] S15. According to the log chain comparison result, determine the target use case from the derived use cases.
[0055] The log chain comparison result obtained in step S14 can reflect the difference in the test level between the seed use case and the derived use case when testing the business system, and the difference can specifically reflect the test level that the derived use case can cover but the seed use case cannot cover. Based on this, the embodiment of the present invention can determine the target use case from the derived use case according to the log chain comparison result, which is different from the seed use case and can supplement the test level that the seed use case cannot cover, so as to filter out the target use case that is useful for the test from the derived use case. In an optional implementation, the target use case that is different from the seed use case and can supplement the test level that the seed use case cannot cover can include at least one of the following situations:
[0056] The use cases in the derived use cases that are consistent with the first business scenario of the business system tested by the seed use case and are not repeated with the seed use case are used as target use cases; for ease of explanation, the embodiment of the present invention refers to the business scenario of the business system tested by the seed use case as the first business scenario. It should be noted that when testing the business system, the business system needs to be tested under different business scenarios; the embodiment of the present invention uses the above-mentioned derived use cases as target use cases, and can use target use cases different from the seed use case to test the business system when it is consistent with the first business scenario of the business system tested by the seed use case, thereby enriching the number of use cases that can be used in the first business scenario, so that the target use case can supplement the test level that the seed use case cannot cover in the first business scenario, and can improve the comprehensiveness of the test of the business system; optionally, the target use case described in this paragraph can be a new normal use case or an abnormal use case of the first business scenario;
[0057] The use cases in the derived use cases that do not match the first business scenario of the business system tested by the seed use case and are abnormal use cases are used as target use cases; using the derived use case as the target use case can cover abnormal business scenarios that do not match the first business scenario of the business system tested by the seed use case, so that the derived use case is very likely to cover abnormal situations that are ignored by users. Using the derived use case as the target use case can make the target use case supplement the abnormal tests in business scenarios that the seed use case cannot cover, thereby improving the comprehensiveness of the business system testing.
[0058] After obtaining a seed case, the use case generation method provided by the embodiment of the present invention can derive a derivative case of the seed case based on the seed case. In order to supplement the test level that the seed case cannot cover when testing the business system, the embodiment of the present invention needs to screen out a target case that is different from the seed case and can supplement the seed case from the derivative case. To achieve this purpose, the embodiment of the present invention can determine a first log chain generated by executing a test on the business system with the seed case, and determine a second log chain generated by executing a test on the business system with the derivative case, thereby comparing the first log chain and the second log chain to obtain a log chain comparison result. The log chain comparison result can reflect the difference in the test level between the seed case and the derivative case when the business system is tested, and the difference can reflect the test level that the derivative case can cover but the seed case cannot cover. Based on the difference reflected by the log chain comparison result, the embodiment of the present invention can determine a target case that is different from the seed case and can supplement the test level that the seed case cannot cover from the derivative case, thereby automatically screening out a target case useful for testing from the derivative case, and improving the comprehensiveness of the target case executing the test on the business system. It can be seen that the use case generation method provided by the embodiment of the present invention can realize automatic screening of target use cases, improve the efficiency of use case generation, and improve the comprehensiveness of the test execution on the business system.
[0059] In an optional implementation, the target use case determined from the derived use case may be: a use case in the derived use case that is consistent with the first business scenario of the business system tested by the seed use case and is not repeated with the seed use case. In an embodiment of the present invention, taking the example that the log chain includes the execution order of the execution nodes of the business system involved in the use case execution process, and the log information of the execution nodes (that is, the first log chain may include the execution order of the execution nodes of the business system involved in the seed use case execution process, and the log information of the execution nodes; the second log chain may include the execution order of the execution nodes of the business system involved in the derived use case execution process, and the log information of the execution nodes), Figure 3 shows an optional process for determining target use cases from derived use cases, such as Figure 3 As shown, the process may include:
[0060] Step S21: Compare whether the execution order of the execution nodes in the second log chain is the same as that in the first log chain, and whether the log information of the execution nodes in the second log chain is the same as that in the first log chain.
[0061] In an embodiment of the present invention, whether for a seed use case or a derived use case, the execution order of the execution nodes can reflect the business logic order of the business system involved in the use case execution process; for example, the execution order of the execution nodes in the first log chain can reflect the business logic order of the business system involved in the seed use case execution process. It should be noted that if the business logic order of the business system involved in the seed use case and the derived use case execution process is consistent, then the business scenario of the business system tested by the seed use case and the derived use case is consistent (such as the same); conversely, if the business logic order of the business system involved in the seed use case and the derived use case execution process is inconsistent, then the business scenario of the business system tested by the seed use case and the derived use case is inconsistent. That is to say, by comparing whether the execution order of the execution nodes in the second log chain is the same as that in the first log chain, the embodiment of the present invention can determine whether the business scenario of the business system tested by the derived use case is consistent with that of the seed use case, that is, the embodiment of the present invention can determine whether the business scenario of the business system tested by the derived use case is consistent with the first business scenario.
[0062] While comparing whether the business scenarios of the business systems tested by the derived use cases and the seed use cases are consistent, in order to confirm whether the derived use cases and the seed use cases are repeated, in an optional implementation, the embodiment of the present invention may compare whether the log information of the execution nodes in the second log chain is the same as that in the first log chain; if the execution order of the execution nodes in the second log chain is the same as that in the first log chain, and the log information of the execution nodes is also the same, then it means that the derived use case and the seed use case are repeated; conversely, if the execution order of the execution nodes in the second log chain is the same as that in the first log chain, but the log information of the execution nodes is different, then it means that the business scenario of the business system tested by the derived use case is consistent with that of the seed use case, but is not repeated with the seed use case, and the derived use case may be a use case different from the seed use case that can supplement the test level that the seed use case cannot cover in the first business scenario.
[0063] In an optional implementation, the log information of the execution node may include the number of times the execution node is called and error information (error). The log information of the execution node in the second log chain may be different from that in the first log chain. For example, the number of times the execution node in the second log chain is called is different from the number of times the execution node in the first log chain is called, and / or the log information of the second log chain contains new error information compared to the log information of the first log chain; the presence of new error information in the log information of the second log chain compared to the log information of the first log chain can be understood as the presence of additional new errors in the log information of the second log chain compared to the log information of the first log chain.
[0064] Step S22: If the execution order of the execution nodes in the second log chain is the same as that in the first log chain, and the log information of the execution nodes in the second log chain is different from that in the first log chain, then the derived use case corresponding to the second log chain is used as the target use case.
[0065] For any second log chain, if the execution order of the execution nodes in the second log chain is the same as that in the first log chain, and the log information of the execution nodes in the second log chain is different from the log information of the execution nodes in the first log chain, then the derived use case corresponding to the second log chain can be considered to be: a target use case that is consistent with the first business scenario of the business system tested by the seed use case and is not repeated with the seed use case.
[0066] Step S23: If the execution order of the execution nodes in the second log chain is the same as that in the first log chain, and the log information of the execution nodes in the second log chain is the same as that in the first log chain, then the derived use case corresponding to the second log chain is repeated with the seed use case, and the derived use case corresponding to the second log chain is deleted.
[0067] For any second log chain, if the execution order of the execution nodes in the second log chain is the same as that in the first log chain, and the log information of the execution nodes in the second log chain is the same as that of the execution nodes in the first log chain, then the derived use case corresponding to the second log chain is a use case that is repeated with the seed use case, and the derived use case corresponding to the second log chain is not used as the target use case, and the derived use case corresponding to the second log chain can be deleted.
[0068] based on Figure 3 According to the process shown, the embodiment of the present invention can screen out target use cases that are consistent with the first business scenario of the business system tested by the seed use case and are not repeated with the seed use case from multiple derived use cases, thereby enriching the number of use cases that can be used in the first business scenario, covering multiple test levels of the business system in the first business scenario, improving the efficiency of use case generation, and improving the comprehensiveness of business system testing.
[0069] In a more specific optional implementation, the target use case that is consistent with the first business scenario of the business system tested by the seed use case and does not overlap with the seed use case and that is screened out from the derived use cases by the embodiment of the present invention can be: a new normal use case or an abnormal use case that is consistent with the first business scenario of the business system tested by the seed use case. Screening out new normal use cases that are consistent with the first business scenario from the derived use cases can enrich the number of use cases for normal testing of the business system under the first business scenario, thereby covering normal testing of multiple levels of the business system under the first business scenario; screening out abnormal use cases that are consistent with the first business scenario from the derived use cases can enrich the number of use cases for abnormal testing of the business system under the first business scenario, thereby covering abnormal testing of multiple levels of the business system under the first business scenario.
[0070] In a specific implementation, taking the log information in the log chain including the number of times the execution node is called and the error information as an example, an optional implementation of determining a new normal use case that matches the first business scenario of the business system tested by the seed use case from the derived use case may be:
[0071] If the execution order of the execution nodes in the second log chain is the same as that in the first log chain, and the log information of the second log chain does not contain any new error information compared to the log information of the first log chain, then when the number of calls of the execution node in the second log chain is different from the number of calls of the execution node in the first log chain, the derivative use case corresponding to the second log chain shall be used as the new normal use case of the first business scenario.
[0072] It can be understood that the execution order of the execution nodes in the second log chain is the same as that in the first log chain, indicating that the business scenario of the business system tested by the derived use case corresponding to the second log chain is consistent with the first business scenario of the business system tested by the seed use case; compared with the log information of the first log chain, the log information of the second log chain does not contain new error information, indicating that the derived use case corresponding to the second log chain is a normal use case, but the number of calls of the execution node in the second log chain is different from the number of calls of the execution node in the first log chain, which means that the derived use case corresponding to the second log chain is not repeated with the seed use case; therefore, the derived use case corresponding to the second log chain is a new normal use case of the first business scenario compared to the seed use case. The embodiment of the present invention uses the derived use case corresponding to the second log chain as the target use case to enrich the number of normal use cases of the first business scenario.
[0073] In an optional implementation, an optional implementation of determining an abnormal use case that matches the first business scenario of the business system tested by the seed use case from the derived use case may be:
[0074] If the execution order of the execution nodes in the second log chain is the same as that in the first log chain, and the log information of the second log chain contains new error information compared to the log information of the first log chain, the derivative use case corresponding to the second log chain will be used as the abnormal use case of the first business scenario.
[0075] It can be understood that the execution order of the execution nodes in the second log chain is the same as that in the first log chain, indicating that the business scenario of the business system tested by the derived use case corresponding to the second log chain is consistent with the first business scenario of the business system tested by the seed use case; the log information of the second log chain contains new error information compared to the log information of the first log chain, indicating that the derived use case corresponding to the second log chain is an abnormal use case. The embodiment of the present invention uses the derived use case corresponding to the second log chain as the target use case, which can enrich the number of abnormal use cases in the first business scenario.
[0076] By comparing the first log chain with the second log chain, the embodiment of the present invention can determine the difference in the test level between the seed use case and the derived use case when testing the business system. This difference can reflect the test level that the derived use case can cover but the seed use case cannot cover. Therefore, the embodiment of the present invention can determine the target use case that is consistent with the first business scenario of the business system tested by the seed use case and does not overlap with the seed use case from the derived use case, thereby enriching the number of use cases in the first business scenario, and achieving the purpose of screening out target use cases that are useful for testing from the derived use cases, reducing the workload of screening derived use cases, improving the efficiency of use case generation, and improving the comprehensiveness of testing the business system. Furthermore, the screened target use case can be a new normal use case or an abnormal use case for the first business scenario.
[0077] In another optional implementation, the target use case determined from the derived use case may be: an abnormal use case that does not conform to the first business scenario of the business system tested by the seed use case. In an optional implementation, the embodiment of the present invention may determine the target use case that does not conform to the first business scenario and is an abnormal use case from the multiple derived use cases based on the log chain comparison results of the first log chain and the second log chain. The abnormal use case that does not conform to the first business scenario can cover abnormal situations that are artificially ignored, thereby supplementing the abnormal tests under business scenarios that the seed use case cannot cover.
[0078] Optionally, take the example that the log chain includes the execution order of the execution nodes and the log information of the execution nodes. Figure 4 shows an alternative process for determining target use cases from derived use cases, such as Figure 4 As shown, the process may include:
[0079] Step S31: Compare whether the execution order of the execution nodes in the second log chain is the same as that in the first log chain, and whether the log information of the second log chain contains new error information compared with the log information of the first log chain.
[0080] Based on the comparison of the execution order of the execution nodes of the second log chain and the first log chain, the embodiment of the present invention can determine whether the business scenario of the business system tested by the derived use case corresponding to the second log chain is consistent with the first business scenario; at the same time, the embodiment of the present invention can compare the log information of the second log chain with the log information of the first log chain to see whether there is new error information, so as to determine whether the derived use case corresponding to the second log chain is an abnormal use case.
[0081] Step S32: If the execution order of the execution nodes in the second log chain is different from that in the first log chain, and the log information of the second log chain contains new error information compared to the log information of the first log chain, the derived use case corresponding to the second log chain is used as the target use case.
[0082] For any second log chain, if the execution order of the execution nodes of the second log chain is different from that of the first log chain, it means that the business scenario of the business system tested by the derived use case corresponding to the second log chain is inconsistent with the first business scenario; further, if the log information of the second log chain contains new error information compared to the log information of the first log chain, then the derived use case corresponding to the second log chain is an abnormal use case compared to the seed use case; thus, the embodiment of the present invention can determine the abnormal use case that does not conform to the first business scenario from the derived use case.
[0083] Step S33: If the execution order of the execution nodes in the second log chain is different from that in the first log chain, and the log information of the second log chain does not contain any new error information compared to the log information of the first log chain, then delete the derivative use case corresponding to the second log chain.
[0084] The embodiment of the present invention can filter out abnormal use cases that do not match the first business scenario of the seed use case testing business system from the derived use cases, supplement the abnormal tests under the business scenarios that the seed use case cannot cover, and enrich the abnormal use cases for testing the business system.
[0085] In an optional implementation, based on the target use case determined from multiple derived use cases, the embodiment of the present invention can also support manual screening of the target use cases to obtain the final screened use cases; since the number of target use cases is significantly smaller than that of derived use cases, manual screening based on the target use cases can also greatly reduce the screening workload and improve the efficiency of use case generation. Figure 5 The process of manually screening use cases based on target use cases is shown, which can be referred to:
[0086] Step S40: deduplicate the target use case.
[0087] Step S41: Mark the use case attributes of the target use cases after deduplication and display them.
[0088] Step S42: Screen the displayed use cases to determine the final screened use cases.
[0089] The number of target use cases screened out from the derived use cases may be multiple, among which there may be repeated use cases. The embodiment of the present invention can deduplicate the target use cases screened out from the derived use cases to ensure that the deduplicated target use cases are non-duplicate.
[0090] The target use case may have use case attributes such as consistency, non-compliance, normal use case, abnormal use case, etc. with the first business scenario of the seed use case test business system. For the target use case determined from the derived use case, the embodiment of the present invention can determine the use case attributes corresponding to the target use case, thereby marking the use case attributes of the deduplicated target use case and displaying it; based on the displayed target use case with use case attributes, the embodiment of the present invention can determine the final filtered use case based on the user's filtering operation.
[0091] Optionally, when utilizing a multi-factor model to derive multiple derived use cases based on a seed use case, for the target use cases after deduplication, the embodiment of the present invention may also save the deduplicated use cases in a use case library; thus, the embodiment of the present invention may update the model parameters of the multi-factor model based on the use cases in the use case library, so that the derived use cases derived based on the multi-factor model are more accurate.
[0092] As an optional implementation, Figure 6 An example of a use case generation process provided by an embodiment of the present invention is shown, referring to Figure 6 :
[0093] After determining the seed use case, the embodiment of the present invention may utilize a multi-factor model to derive multiple derived use cases based on the seed use case;
[0094] At the same time, for a seed use case, an embodiment of the present invention can use a seed use case to perform a test on a business system, thereby collecting log information of execution nodes of the business system involved in the execution process of the seed use case, and linking them into a first log chain according to the execution order of the execution nodes; for any derivative use case, an embodiment of the present invention can use a derivative use case to perform a test on a business system, thereby collecting log information of execution nodes of the business system involved in the execution process of the derivative use case, and linking them into a second log chain according to the execution order of the execution nodes;
[0095] Furthermore, the embodiment of the present invention can compare the first log chain and the second log chain, and determine the target use case from the derived use cases based on the preset metamorphosis relationship rules, for example, the target use case is a use case that is consistent with the first business scenario of the seed use case test business system and is not repeated with the seed use case, and / or the target use case is an abnormal use case that is inconsistent with the first business scenario of the seed use case test business system, etc.; it should be noted that the metamorphosis relationship rules can be defined as: a rule for determining a target use case from a derived use case that is consistent with the first business scenario of the seed use case test business system and is not repeated with the seed use case, and / or a rule for determining an abnormal use case from a derived use case that is inconsistent with the first business scenario. The preset metamorphosis relationship rules can refer to the description of the corresponding part of the previous text and will not be repeated here;
[0096] The determined target use cases can be deduplicated and saved in the use case library. Based on the use cases in the use case library, the model parameters of the multi-factor model can be updated.
[0097] Optionally, after deduplication of the target use case, the embodiment of the present invention may further mark the use case attributes of the target use case and display it; thus, based on the user's screening of the displayed use cases, the embodiment of the present invention may determine the final screened use case from the displayed use cases. Of course, as an alternative optional implementation, the embodiment of the present invention may also directly use the target use case as the final screened use case after deduplication.
[0098] In an optional application example, combined with Figure 3 and Figure 4The process shown takes the first business scenario of the seed use case testing the business system as an example, that is, testing the first function activation of the business system (the first function can be a specific function of the business system or any function, for example, the first function is a user comment function of the business system, etc., and the embodiment of the present invention is not limited to this). After deriving multiple derived use cases based on the seed use case, the embodiment of the present invention can determine the first log chain generated by the test of the first function activation of the business system executed by the seed use case, and determine the second log chain generated by the test of the business system executed by the derived use case.
[0099] As an optional implementation of determining the target use case, after comparing the first log chain and the second log chain, if the business scenario of the business system tested by the derived use case corresponding to the second log chain is the first business scenario, and the derived use case is not repeated with the seed use case, then the embodiment of the present invention may use the derived use case as the target use case; in an example, the business scenario of the business system tested by the derived use case is also the first function of the tested business system is turned on, which means that the business scenario of the business system tested by the derived use case is consistent with the first business scenario. At this time, if the derived use case is not repeated with the seed use case, then the embodiment of the present invention may use the derived use case as the target use case;
[0100] In a more specific implementation, when the business scenario of the business system tested by the derived use case is also to test the activation of the first function of the business system, if the log information of the second log chain does not contain any new error information compared to the log information of the first log chain, and the number of calls of the execution node in the second log chain is different from the number of calls of the execution node in the first log chain, then the embodiment of the present invention may use the derived use case as a new normal use case for testing the activation of the first function of the business system; and when the business scenario of the business system tested by the derived use case is to test the activation of the first function of the business system, if the log information of the second log chain contains new error information compared to the log information of the first log chain, then the embodiment of the present invention may use the derived use case as an abnormal use case for testing the activation of the first function of the business system.
[0101] In another optional implementation of determining the target use case, after comparing the first log chain and the second log chain, if the business scenario of the business system tested by the derived use case corresponding to the second log chain is not the first business scenario, and the derived use case is an abnormal use case, then an embodiment of the present invention may use the derived use case as the target use case; in one example, if the business scenario of the business system tested by the derived use case is to test the closure of the first function of the business system, then the business scenario of the business system tested by the derived use case does not match the first business scenario. At this time, if the log information of the second log chain contains new error information compared to the log information of the first log chain, then the derived use case can be used as an abnormal use case for testing the closure of the first function of the business system.
[0102] In an optional implementation, the embodiment of the present invention further provides a testing method based on, for example, Figure 1 After the target use case is determined in the process shown, the embodiment of the present invention uses the seed use case and the use cases in the target use case to test the business system; it can be understood that the seed use case and the target use case can be considered as use cases that are useful for testing the business system. In an optional implementation, the embodiment of the present invention can store the seed use case and the target use case in a test case set, thereby performing tests on the business system based on the use cases in the test case set. Since the target use case can cover the test levels that the seed use case cannot cover, a test case set is formed based on the seed use case and the target use case, and the business system is tested by the use cases in the test case set, which can improve the comprehensiveness of the testing of the business system.
[0103] The use case generation device provided in the embodiment of the present invention is introduced below. The use case generation device described below can be considered as a functional module required to be set by the server to implement the use case generation method provided in the embodiment of the present invention. The content of the use case generation device described below can be referenced to the content of the use case generation method described above.
[0104] In an optional implementation, Figure 7 An optional block diagram of a use case generation device provided by an embodiment of the present invention is shown, and the device may include:
[0105] An acquisition module 100 is used to acquire a seed use case;
[0106] A derivation module 110, configured to derive a derivative use case of the seed use case based on the seed use case;
[0107] The log chain determination module 120 is used to determine a first log chain generated by executing a test on the business system using the seed use case, and a second log chain generated by executing a test on the business system using the derived use case;
[0108] A comparison module 130, configured to compare the first log chain and the second log chain;
[0109] The determination module 140 is used to determine the target use case from the derived use cases according to the log chain comparison result.
[0110] Optionally, the determination module 140 is used to determine the target use case from the derived use case according to the log chain comparison result, which may include:
[0111] According to the log chain comparison result, a target use case is determined from the derived use cases, which is consistent with the first business scenario of the business system tested by the seed use case and is not repeated with the seed use case.
[0112] Optionally, the log chain may include: the execution order of the execution nodes of the business system involved in the execution process of the seed use case or the derivative use case, and the log information of the execution nodes; the comparison module 130, used to compare the first log chain and the second log chain, may include:
[0113] Compare whether the execution order of the execution nodes in the second log chain is the same as that in the first log chain, and whether the log information of the execution nodes in the second log chain is the same as that in the first log chain.
[0114] Optionally, the determination module 140 is used to determine, from the derived use cases, a target use case that is consistent with the first business scenario of the business system tested by the seed use case and is not repeated with the seed use case according to the log chain comparison result, and may include:
[0115] If the execution order of the execution nodes in the second log chain is the same as that in the first log chain, and the log information of the execution nodes in the second log chain is different from that in the first log chain, then the derived use case corresponding to the second log chain is used as the target use case;
[0116] If the execution order of the execution nodes in the second log chain is the same as that in the first log chain, and the log information of the execution nodes in the second log chain is the same as that in the first log chain, then the derived use case corresponding to the second log chain is repeated with the seed use case, and the derived use case corresponding to the second log chain is deleted.
[0117] Optionally, on the one hand, the determination module 140 is used to use the derived use case corresponding to the second log chain as the target use case if the execution order of the execution nodes in the second log chain is the same as that in the first log chain, and the log information of the execution nodes in the second log chain is different from that in the first log chain, and may include:
[0118] If the execution order of the execution nodes in the second log chain is the same as that in the first log chain, and the log information of the second log chain does not contain any new error information compared to the log information of the first log chain, then when the number of calls of the execution node in the second log chain is different from the number of calls of the execution node in the first log chain, the derivative use case corresponding to the second log chain shall be used as the new normal use case of the first business scenario.
[0119] Optionally, on the other hand, the determination module 140 is configured to use the derived use case corresponding to the second log chain as the target use case if the execution order of the execution nodes in the second log chain is the same as that in the first log chain, and the log information of the execution nodes in the second log chain is different from that in the first log chain, and may include:
[0120] If the execution order of the execution nodes in the second log chain is the same as that in the first log chain, and the log information of the second log chain contains new error information compared to the log information of the first log chain, the derivative use case corresponding to the second log chain will be used as the abnormal use case of the first business scenario.
[0121] In another optional implementation, the determination module 140 is used to determine the target use case from the derived use case according to the log chain comparison result, which may include:
[0122] According to the log chain comparison result, determine from the derived use case a target use case that does not conform to the first business scenario of the business system tested by the seed use case and whose log information of the second log chain contains new error information compared to the log information of the first log chain.
[0123] Optionally, the determination module 140 is used to determine, from the derived use case, according to the log chain comparison result, a target use case that does not conform to the first business scenario of the business system tested by the seed use case and the log information of the second log chain has new error information compared with the log information of the first log chain, which may include:
[0124] If the execution order of the execution nodes in the second log chain is different from that in the first log chain, and the log information of the second log chain contains new error information compared with the log information of the first log chain, the derived use case corresponding to the second log chain is used as the target use case;
[0125] If the execution order of the execution nodes in the second log chain is different from that in the first log chain, and the log information of the second log chain does not contain any new error information compared to the log information of the first log chain, the derivative use case corresponding to the second log chain is deleted.
[0126] Optionally, the use case generating device provided by the embodiment of the present invention may also be used for:
[0127] Deduplication is performed on the target use cases; use case attributes are marked on the target use cases after deduplication, and the use cases are displayed; the displayed use cases are screened to determine the final screened use cases.
[0128] Optionally, further, the derivation module 110, used to derive a derived use case of the seed use case based on the seed use case, may include:
[0129] Based on the seed use case, using a preset multi-factor model, modifying the use case parameters of the seed use case to obtain a derived derivative use case;
[0130] After deduplication of the target use case, the use case generation device provided by the embodiment of the present invention can also be used for:
[0131] The model parameters of the multi-factor model are updated according to the use cases in the use case library, and the seed use cases save the target use cases after duplication.
[0132] An embodiment of the present invention further provides a testing device, which can execute a test on the business system using the seed use case and the use cases in the target use case after the use case generation device determines the target use case.
[0133] After obtaining a seed case, the use case generation device provided by the embodiment of the present invention can derive a derivative case of the seed case based on the seed case. In order to supplement the test level that the seed case cannot cover when testing the business system, the embodiment of the present invention needs to screen out a target case that is different from the seed case and can supplement the seed case from the derivative case. To achieve this purpose, the embodiment of the present invention can determine a first log chain generated by executing a test on the business system with the seed case, and determine a second log chain generated by executing a test on the business system with the derivative case, thereby comparing the first log chain and the second log chain to obtain a log chain comparison result. The log chain comparison result can reflect the difference in the test level between the seed case and the derivative case when the business system is tested, and the difference can reflect the test level that the derivative case can cover but the seed case cannot cover. Based on the difference reflected by the log chain comparison result, the embodiment of the present invention can determine a target case that is different from the seed case and can supplement the test level that the seed case cannot cover from the derivative case, thereby automatically screening out a target case useful for testing from the derivative case, and improving the comprehensiveness of the target case executing the test on the business system. It can be seen that the use case generation method provided by the embodiment of the present invention can realize automatic screening of target use cases, improve the efficiency of use case generation, and improve the comprehensiveness of the test execution on the business system.
[0134] The embodiment of the present invention further provides a server, which can implement the use case generation method provided by the embodiment of the present invention by loading the above use case generation device in the form of a program. In an optional implementation, Figure 8 An optional block diagram of a server provided by an embodiment of the present invention is shown, referring to Figure 8 , the server may include: at least one processor 1, at least one communication interface 2, at least one memory 3 and at least one communication bus 4;
[0135] In the embodiment of the present invention, the number of the processor 1, the communication interface 2, the memory 3, and the communication bus 4 is at least one, and the processor 1, the communication interface 2, and the memory 3 communicate with each other through the communication bus 4; obviously, the communication connection diagram of the processor 1, the communication interface 2, the memory 3, and the communication bus 4 shown in the figure is only optional;
[0136] Optionally, the communication interface 2 may be an interface of a communication module for performing network communication;
[0137] Optionally, processor 1 may be a CPU (central processing unit), a GPU (Graphics Processing Unit), an NPU (embedded neural network processor), an FPGA (Field Programmable Gate Array), a TPU (tensor processing unit), an AI chip, an application specific integrated circuit ASIC (Application Specific Integrated Circuit), or one or more integrated circuits configured to implement an embodiment of the present invention.
[0138] The memory 3 may include a high-speed RAM memory, and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.
[0139] The memory 3 stores one or more computer executable instructions, and the processor 1 calls the one or more computer executable instructions to execute the use case generation method provided in the embodiment of the present invention.
[0140] Optionally, in the server provided by the embodiment of the present invention, the memory may also store one or more computer executable instructions for executing the test method provided by the embodiment of the present invention, so that the processor can call the one or more computer executable instructions to execute the test method provided by the embodiment of the present invention.
[0141] An embodiment of the present invention also provides a storage medium, which can store one or more computer-executable instructions, and the one or more computer-executable instructions are used to execute the use case generation method provided by the embodiment of the present invention, or to execute the testing method provided by the embodiment of the present invention.
[0142] The above describes multiple implementation schemes provided by the embodiments of the present invention. The various optional methods introduced in the implementation schemes can be combined and cross-referenced with each other without conflict, thereby extending a variety of possible implementation schemes, which can all be considered as implementation schemes disclosed and open in the embodiments of the present invention.
[0143] Although the embodiments of the present invention are disclosed above, the present invention is not limited thereto. Any person skilled in the art can make various changes and modifications without departing from the spirit and scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the scope defined by the claims.
Claims
1. A use case generation method, comprising: Get seed use cases; Deriving a derived use case of the seed use case based on the seed use case, wherein the derived use case is obtained by adjusting the use case parameters of the seed use case based on the seed use case; Determine a first log chain generated by executing a test on the business system using the seed use case, and a second log chain generated by executing a test on the business system using the derived use case; Comparing the first log chain and the second log chain includes: comparing whether the execution order of the execution nodes in the second log chain is the same as that in the first log chain, and whether the log information of the execution nodes in the second log chain is the same as that in the first log chain; According to the log chain comparison result, a target use case is determined from the derived use cases, where the target use case is a use case determined from the derived use cases that is different from the seed use case and supplements the test level that the seed use case cannot cover.
2. The use case generation method of claim 1, wherein determining the target use case from the derived use case according to the log chain comparison result comprises: According to the log chain comparison result, a target use case is determined from the derived use cases, which is consistent with the first business scenario of the business system tested by the seed use case and is not repeated with the seed use case.
3. According to the use case generation method of claim 2, the log chain comprises: The execution order of the execution nodes of the business system involved in the execution process of the seed use case or the derived use case, and the log information of the execution nodes.
4. According to the use case generation method of claim 3, the step of determining, from the derived use cases, a target use case that is consistent with the first business scenario of the business system tested by the seed use case and is not repeated with the seed use case based on the log chain comparison result, comprises: If the execution order of the execution nodes in the second log chain is the same as that in the first log chain, and the log information of the execution nodes in the second log chain is different from that in the first log chain, then the derived use case corresponding to the second log chain is used as the target use case; If the execution order of the execution nodes in the second log chain is the same as that in the first log chain, and the log information of the execution nodes in the second log chain is the same as that in the first log chain, then the derived use case corresponding to the second log chain is repeated with the seed use case, and the derived use case corresponding to the second log chain is deleted.
5. According to the use case generation method of claim 4, if the execution order of the execution nodes in the second log chain is the same as that in the first log chain, and the log information of the execution nodes in the second log chain is different from that in the first log chain, then taking the derived use case corresponding to the second log chain as the target use case comprises: If the execution order of the execution nodes in the second log chain is the same as that in the first log chain, and the log information of the second log chain does not contain any new error information compared to the log information of the first log chain, then when the number of calls of the execution node in the second log chain is different from the number of calls of the execution node in the first log chain, the derivative use case corresponding to the second log chain shall be used as the new normal use case of the first business scenario.
6. The use case generation method according to claim 4, wherein if the execution order of the execution nodes in the second log chain is the same as that in the first log chain, and the log information of the execution nodes in the second log chain is different from that in the first log chain, then taking the derived use case corresponding to the second log chain as the target use case comprises: If the execution order of the execution nodes in the second log chain is the same as that in the first log chain, and the log information of the second log chain contains new error information compared to the log information of the first log chain, the derivative use case corresponding to the second log chain will be used as the abnormal use case of the first business scenario.
7. According to the use case generation method of claim 1, determining the target use case from the derived use case according to the log chain comparison result comprises: According to the log chain comparison result, determine from the derived use case a target use case that does not conform to the first business scenario of the business system tested by the seed use case and whose log information of the second log chain contains new error information compared to the log information of the first log chain.
8. According to the use case generation method of claim 7, the target use case that is determined from the derived use case according to the log chain comparison result and that does not conform to the first business scenario of the business system tested by the seed use case and the log information of the second log chain has new error information compared with the log information of the first log chain comprises: If the execution order of the execution nodes in the second log chain is different from that in the first log chain, and the log information of the second log chain contains new error information compared with the log information of the first log chain, the derived use case corresponding to the second log chain is used as the target use case; If the execution order of the execution nodes in the second log chain is different from that in the first log chain, and the log information of the second log chain does not contain any new error information compared to the log information of the first log chain, the derivative use case corresponding to the second log chain is deleted.
9. The use case generation method according to any one of claims 1 to 8, further comprising: Deduplication of the target use case; Mark the use case attributes of the target use cases after deduplication and display them; Filter the displayed use cases and determine the final selected use cases.
10. The use case generation method according to claim 9, wherein the derived use case derived from the seed use case based on the seed use case comprises: Based on the seed use case, using a preset multi-factor model, modifying the use case parameters of the seed use case to obtain a derived derivative use case; The method further comprises: The model parameters of the multi-factor model are updated according to the use cases in the use case library, and the seed use cases save the target use cases after duplication is removed.
11. A testing method comprising: Get seed use cases; Deriving a derived use case of the seed use case based on the seed use case, wherein the derived use case is obtained by adjusting the use case parameters of the seed use case based on the seed use case; Determine a first log chain generated by executing a test on the business system using the seed use case, and a second log chain generated by executing a test on the business system using the derived use case; Comparing the first log chain and the second log chain includes: comparing whether the execution order of the execution nodes in the second log chain is the same as that in the first log chain, and whether the log information of the execution nodes in the second log chain is the same as that in the first log chain; According to the log chain comparison result, a target use case is determined from the derived use case, where the target use case is a use case determined from the derived use case that is different from the seed use case and supplements the test level that the seed use case cannot cover; The business system is tested using the seed use case and the use cases in the target use case.
12. A use case generation device, characterized in that: include: Acquisition module, used to obtain seed use cases; A derivation module, used for deriving a derived use case of the seed use case based on the seed use case, wherein the derived use case is obtained by adjusting the use case parameters of the seed use case based on the seed use case; A log chain determination module, used to determine a first log chain generated by executing a test on the business system using the seed use case, and a second log chain generated by executing a test on the business system using the derived use case; A comparison module, for comparing the first log chain and the second log chain, comprising: comparing whether the execution order of the execution nodes in the second log chain is the same as that in the first log chain, and whether the log information of the execution nodes in the second log chain is the same as that in the first log chain; A determination module is used to determine a target use case from the derived use cases according to the log chain comparison result, wherein the target use case is a use case determined from the derived use cases that is different from the seed use case and supplements the test level that the seed use case cannot cover.
13. A server comprising at least one memory and at least one processor, wherein the memory stores one or more computer executable instructions, and the processor calls the one or more computer executable instructions to execute the use case generation method as described in any one of claims 1 to 10, or execute the testing method as described in claim 11.
