System use case regression planning method, device, equipment and storage medium
By identifying the association between changed modules and test cases in the software system, constructing a candidate test case set, and performing recommendation and ranking, the problem of inaccurate test case recommendation in existing technologies is solved, thereby improving regression testing efficiency and test case coverage.
Patent Information
- Application Number
- CN202311099950.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-29
- Publication Date
- 2025-11-11
- Estimated Expiration
- 2043-08-29
AI Technical Summary
Existing technologies cannot accurately recommend test cases when software system business changes, resulting in low regression testing efficiency and incomplete test case coverage.
By identifying the changed modules in the target system, searching for related target use cases based on a preset database, constructing a candidate use case set, and recommending and ranking them based on the use case risk coefficient and module risk coefficient, a use case sequence is obtained, thus realizing system use case regression planning.
It enables accurate recommendation of test cases when system business changes, improves regression testing efficiency, and ensures that test cases cover sufficient scenarios.
Smart Images

Figure CN118796651B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of testing technology, and in particular to a system use case regression planning method, apparatus, device, and storage medium. Background Technology
[0002] Currently, to meet business needs, software systems are frequently modified throughout their lifecycle to add new features or modify existing ones. After introducing new features and adjusting existing code, regression testing is often required to ensure that the modifications have not introduced errors into the software system.
[0003] Currently, when testing software systems, whether test cases can cover more business scenarios relies entirely on the tester's experience, with no awareness of the call chain through which the test cases pass. Therefore, when system business changes occur, it's impossible to accurately recommend test cases, leading to low regression testing efficiency and incomplete test case coverage.
[0004] The above content is only used to help understand the technical solution of the present invention and does not represent an admission that the above content is prior art. Summary of the Invention
[0005] The main objective of this invention is to provide a system use case regression planning method, apparatus, device, and storage medium, aiming to solve the technical problem that existing technologies cannot accurately recommend test cases when system business changes, resulting in low regression testing efficiency and incomplete use case coverage.
[0006] To achieve the above objectives, the present invention provides a system use case regression planning method, the method comprising the following steps:
[0007] When there are business changes in the target system, identify the changed modules in the target system;
[0008] Based on a preset database, at least one target use case associated with the change module is found, and a candidate use case set is constructed based on the target use case;
[0009] The target use cases in the candidate use case set are recommended and ranked to obtain a use case sequence;
[0010] Based on the use case sequence, perform use case regression planning on the target system.
[0011] Optionally, the step of recommending and ranking the target use cases in the candidate use case set to obtain a use case sequence includes:
[0012] Determine the use case risk coefficient for the target use case;
[0013] Determine the module risk coefficient of the modified module;
[0014] The recommendation coefficient for each target use case in the candidate use case set is determined based on the use case risk coefficient and the module risk coefficient.
[0015] Based on the recommendation coefficient, the target use cases in the candidate use case set are recommended and ranked to obtain a use case sequence.
[0016] Optionally, determining the module risk coefficient of the modified module includes:
[0017] Determine the module popularity and module complexity of the modified module;
[0018] The environmental adaptability of the modified module is determined based on the module complexity.
[0019] The module risk coefficient of the modified module is obtained by normalizing the module popularity, module complexity, and environmental adaptability.
[0020] Optionally, determining the module popularity and module complexity of the modified module includes:
[0021] Based on the preset database, the target link corresponding to the change module is found, and the link call count of the target link is obtained;
[0022] The module popularity of the modified module is determined based on the number of times the link is called;
[0023] Obtain at least one decision node in the change module and determine the decision type corresponding to each decision node;
[0024] The module complexity of the change module is determined based on the determination type.
[0025] Optionally, determining the environmental adaptability of the modified module based on the module complexity includes:
[0026] The node number of each decision node is determined based on the decision type of each decision node;
[0027] Obtain the node execution time sequence of the change module;
[0028] Generate a node execution path sequence based on the node number, the node execution time order, and the module complexity;
[0029] The node execution path sequence is input into a preset model to obtain the test consumption time of the change module;
[0030] The environmental adaptability of the modified module is determined based on the test duration.
[0031] Optionally, determining the use case risk coefficient of the target use case includes:
[0032] Based on a preset database, target links associated with the target use case are found;
[0033] Determine the link risk level of the target link;
[0034] Obtain the historical execution information of the target use case;
[0035] The failure information of the target test case is determined based on the historical test information;
[0036] The use case risk coefficient of the target use case is determined based on the failure information and the link risk level.
[0037] Optionally, determining the link risk level of the target link includes:
[0038] Obtain the historical call information of the target link;
[0039] Based on the historical call information, the link length, number of link branches, and number of link calls of the target link are determined;
[0040] Obtain the business scenario information of the change module;
[0041] A business weight allocation strategy is generated based on the aforementioned business scenario information;
[0042] Based on the business weight allocation strategy, the link length, the number of link branches, and the number of link calls are normalized to obtain the link risk level of the target link.
[0043] Furthermore, to achieve the above objectives, the present invention also proposes a system use case regression planning device, the system use case regression planning device comprising:
[0044] The change detection module is used to identify the change module in the target system when there are business changes in the target system.
[0045] The use case selection module is used to find at least one target use case associated with the change module based on a preset database, and to construct a candidate use case set based on the target use case;
[0046] The use case recommendation module is used to recommend and rank the target use cases in the candidate use case set to obtain a use case sequence;
[0047] The regression planning module is used to perform use case regression planning on the target system based on the use case sequence.
[0048] Furthermore, to achieve the above objectives, the present invention also proposes a system use case regression planning device, which includes: a memory, a processor, and a system use case regression planning program stored in the memory and executable on the processor. The system use case regression planning program is configured to implement the steps of the system use case regression planning method described above.
[0049] Furthermore, to achieve the above objectives, the present invention also proposes a storage medium storing a system use case regression planning program, which, when executed by a processor, implements the steps of the system use case regression planning method described above.
[0050] This invention identifies the changed module in the target system when business changes occur, searches for at least one target use case associated with the changed module based on a preset database, constructs a candidate use case set based on the target use cases, recommends and ranks the target use cases in the candidate use case set to obtain a use case sequence, and performs use case regression planning on the target system based on the use case sequence. Because this invention constructs a candidate use case set containing target use cases associated with the changed module, recommends and ranks the use cases in the candidate use case set, and performs use case regression planning on the target system based on the accurately obtained use case sequence after recommendation and ranking, it can accurately recommend test cases when system business changes occur, effectively improving regression testing efficiency and ensuring sufficient use case coverage. Attached Figure Description
[0051] Figure 1 This is a schematic diagram of the system use case regression planning device for the hardware operating environment involved in the embodiments of the present invention;
[0052] Figure 2 This is a flowchart illustrating the first embodiment of the system use case regression planning method of the present invention;
[0053] Figure 3 This is a flowchart illustrating the second embodiment of the system use case regression planning method of the present invention;
[0054] Figure 4 This is a flowchart illustrating the third embodiment of the system use case regression planning method of the present invention;
[0055] Figure 5 This is a structural block diagram of the first embodiment of the system use case regression planning device of the present invention.
[0056] The realization of the objective, functional features and advantages of the present invention will be further explained in conjunction with the embodiments and with reference to the accompanying drawings. Detailed Implementation
[0057] It should be understood that the specific embodiments described herein are for illustrative purposes only and are not intended to limit the scope of the invention.
[0058] Reference Figure 1 , Figure 1 This is a schematic diagram of the system use case regression planning device structure of the hardware operating environment involved in the embodiments of the present invention.
[0059] like Figure 1 As shown, the system's use case regression planning device may include: a processor 1001, such as a central processing unit (CPU), a communication bus 1002, a user interface 1003, a network interface 1004, and a memory 1005. The communication bus 1002 is used to enable communication between these components. The user interface 1003 may include a display screen or an input unit such as a keyboard; optionally, the user interface 1003 may also include a standard wired interface or a wireless interface. The network interface 1004 may optionally include a standard wired interface or a wireless interface (such as a Wireless-Fidelity (Wi-Fi) interface). The memory 1005 may be high-speed random access memory (RAM) or stable non-volatile memory (NVM), such as a disk storage device. Optionally, the memory 1005 may also be a storage device independent of the aforementioned processor 1001.
[0060] Those skilled in the art will understand that Figure 1 The structure shown does not constitute a limitation on the system use case regression planning device and may include more or fewer components than shown, or combine certain components, or have different component arrangements.
[0061] like Figure 1 As shown, the memory 1005, which serves as a storage medium, may include an operating system, a network communication module, a user interface module, and a system use case regression planning program.
[0062] exist Figure 1 In the system use case regression planning device shown, the network interface 1004 is mainly used for data communication with the network server; the user interface 1003 is mainly used for data interaction with the user; the processor 1001 and the memory 1005 in the system use case regression planning device of the present invention can be set in the system use case regression planning device, and the system use case regression planning device calls the system use case regression planning program stored in the memory 1005 through the processor 1001 and executes the system use case regression planning method provided in the embodiment of the present invention.
[0063] This invention provides a system use case regression planning method, referring to... Figure 2 , Figure 2 This is a flowchart illustrating the first embodiment of a system use case regression planning method according to the present invention.
[0064] In this embodiment, the system use case regression planning method includes the following steps:
[0065] Step S10: When there are business changes in the target system, identify the changed modules in the target system.
[0066] It should be understood that the execution subject of the method in this embodiment can be a system use case regression planning device with data processing, network communication and program running functions, such as a computer, or other devices or equipment that can achieve the same or similar functions. Here, the above-mentioned system use case regression planning device (hereinafter referred to as regression planning device) is used as an example for explanation.
[0067] It should be noted that the changed module can be a code module or functional module in the target system that has undergone business changes. The aforementioned target system can be a software system that requires regression testing, such as a complex distributed system.
[0068] Step S20: Find at least one target use case associated with the change module based on the preset database, and construct a candidate use case set based on the target use case.
[0069] It should be noted that the preset database can be a pre-built graph database containing the correspondence between use cases and functional modules. The preset database mentioned above stores the relationships between use cases, links, and modules.
[0070] Understandably, regression planning devices can pre-establish the relationship between code call paths corresponding to use cases and functional modules. For example, for distributed Java system applications, non-intrusive code instrumentation of Java application code can be performed through technologies such as Java Agent and bytecode enhancement to establish the relationship between use cases, links, and modules, and then stored in a database.
[0071] It should be understood that regression planning equipment can continuously update and quickly query the aforementioned relational data. This "use case-link-module" relationship is typically stored in a graph database. Since this correspondence can be dynamic—modules, links, and use cases may change with different iterations—the aforementioned methods involve a continuous updating process of the current relationships. With this relationship layer, the graph database allows for rapid queries. For example, one can quickly query which links and modules a use case flows through by its ID, or quickly reverse-engineer related links and use cases by using a piece of code corresponding to a module. When a functional module of a distributed system changes, the use case tracing data of the distributed system can be used for reverse accurate identification and recommendation of use cases requiring regression.
[0072] Step S30: Rank the target use cases in the candidate use case set to obtain a use case sequence.
[0073] It should be noted that the test case sequence can be a sequence constructed based on the order of test cases after calculating the recommendation coefficient for each test case in the candidate test case set and sorting them. The order of test cases in the test case sequence can be used as the priority order after test case regression.
[0074] It should be understood that the target use cases associated with the change module in the candidate use case set can be one or more. This embodiment obtains the use case recommendation order by recommending and ranking the target use cases in the candidate use case set, and constructs a use case sequence based on the use case recommendation order.
[0075] It is understood that this embodiment can preprocess the change module, preprocess the target use cases and links associated with the change module, calculate the recommendation coefficient of each target use case in the candidate use case set based on the module preprocessing result, the use case preprocessing result, and the link preprocessing result, and then rank the target use cases in the candidate use case set based on the recommendation coefficient to obtain the use case sequence.
[0076] Step S40: Perform use case regression planning on the target system based on the use case sequence.
[0077] It should be noted that this embodiment implements reverse use case recommendations at the system application level and code level when changes occur in the distributed system, so that when business changes occur in the distributed system, the scope of use case regression can be accurately determined through system-level means.
[0078] This embodiment identifies the changed module in the target system when business changes occur, searches for at least one target use case associated with the changed module based on a preset database, constructs a candidate use case set based on the target use cases, recommends and ranks the target use cases in the candidate use case set to obtain a use case sequence, and performs use case regression planning on the target system based on the use case sequence. Because this embodiment constructs a candidate use case set containing target use cases associated with the changed module, recommends and ranks the use cases in the candidate use case set, and performs use case regression planning on the target system based on the accurately obtained use case sequence after recommendation and ranking, it can accurately recommend test cases when system business changes occur, effectively improving regression testing efficiency and ensuring sufficient use case coverage.
[0079] refer to Figure 3 , Figure 3 This is a flowchart illustrating a second embodiment of a system use case regression planning method according to the present invention.
[0080] Based on the first embodiment described above, in this embodiment, step S30 includes:
[0081] Step S31: Determine the use case risk coefficient of the target use case.
[0082] It is understood that this embodiment can obtain the use case risk coefficient of the target use case by preprocessing the target use case.
[0083] Step S32: Determine the module risk coefficient of the modified module.
[0084] It is understood that this embodiment can obtain the module risk coefficient of the changed module by preprocessing the changed module.
[0085] Furthermore, in order to accurately calculate the module risk coefficient of the changed module, step S32 above may include:
[0086] Step S321: Determine the module popularity and module complexity of the modified module;
[0087] Step S322: Determine the environmental adaptability of the modified module based on the module complexity;
[0088] Step S323: Normalize the module popularity, module complexity, and environmental adaptability to obtain the module risk coefficient of the modified module.
[0089] It should be noted that module popularity can refer to the frequency of calls to the modified module. The module complexity mentioned above represents the complexity and hidden risks of the functional module. The environmental adaptability mentioned above can be the time consumed by the execution path sequence corresponding to the functional module when completing regression testing.
[0090] Understandably, the regression planning device calculates the module heat of the changed module through distributed link tracing, obtains the module complexity of the changed module through static code scanning, and obtains the environmental adaptability of the functional module based on the module complexity through static code scanning.
[0091] It should be understood that the regression planning module assigns weights to the module popularity, module complexity, and environmental adaptability. Based on these weights, it performs a weighted sum of the module popularity, module complexity, and environmental adaptability to obtain the module risk coefficient of the changed module, referring to Formula 1 below. Formula 1 is the formula for calculating the module risk coefficient, where h(m) is the module popularity, Com(m) is the module complexity, and S(m) is the environmental adaptability. For example, the weight of module popularity can be 0.2, the weight of module complexity can be 0.5, and the weight of environmental adaptability can be 0.3.
[0092] R(m) = h(m) * 0.2 + Com(m) * 0.5 + S(m) * 0.3 (Formula 1)
[0093] For example, referring to Table 1 below, which is a schematic table for calculating the risk coefficient of a functional module, the module's popularity, complexity, and environmental adaptability are weighted respectively to obtain the weighted module risk coefficient.
[0094] Table 1
[0095]
[0096] Furthermore, in order to accurately calculate module heat and module complexity, step S321 above may include:
[0097] Step S3211: Based on the preset database, find the target link corresponding to the change module, and obtain the link call count of the target link;
[0098] Step S3212: Determine the module popularity of the modified module based on the number of link calls;
[0099] Step S3213: Obtain at least one decision node in the change module and determine the decision type corresponding to each decision node;
[0100] Step S3214: Determine the module complexity of the change module based on the determination type.
[0101] Understandably, regression planning devices can use distributed link tracing technology to collect the distributed call paths that online traffic requests traverse, down to the module level, establish and store the mapping relationship between links and modules. The number of modules traversed by each request is counted, and the number of calls to each module is used as the module's popularity.
[0102] For example, count(m1) = 1, count(m2) = 3, count(m3) = 10, where m represents the module name. Normalizing count, we choose the min-max normalization module, which performs a linear transformation on the original data, mapping the data values to the range [0, 1], resulting in h(m1) = 0.1, h(m2) = 0.4, and h(m3) = 1.
[0103] It should be understood that the regression programming device calculates the cyclomatic complexity of each module, representing the module's complexity. The higher the complexity, the higher the risk of code hiding. For example, the cyclomatic complexities of the above modules are calculated to be 5, 7, and 11. After normalizing the data from 0 to 1 for the above modules, we get Com(m1) = 0, Com(m2) = 0.33, and Com(m3) = 1, respectively.
[0104] It's important to note that when calculating the cyclomatic complexity of each module, the decision nodes within that module are retrieved. The decision complexity is then set for the decision type corresponding to each decision node. This setting can be based on the test results of each type of node in historical regression testing. A higher number of errors in historical regression testing will result in a higher decision complexity.
[0105] For example, for decision nodes such as case nodes and if-else nodes, since more complex logic can be nested, a larger decision complexity value can be set; for decision nodes such as catch nodes, since the corresponding logic is relatively simple, a smaller decision complexity value can be set.
[0106] Furthermore, in order to accurately calculate environmental fitness, step S322 above may include:
[0107] Step S3221: Determine the node number of each decision node based on the decision type of each decision node;
[0108] Step S3222: Obtain the node execution time sequence of the change module;
[0109] Step S3223: Generate a node execution path sequence based on the node number, the node execution time order, and the module complexity;
[0110] Step S3224: Input the node execution path sequence into the preset model to obtain the test consumption time of the change module;
[0111] Step S3225: Determine the environmental adaptability of the modified module based on the test consumption time.
[0112] It should be noted that the regression planning device can set a corresponding number for each decision node based on the node type of each decision node. For example, the if node can be set to number 1 and the case node can be set to number 2.
[0113] It should be understood that after determining the decision complexity corresponding to the decision node, the regression planning device can generate a corresponding execution path sequence for each module. The execution path sequence is an ordered sequence containing each decision node. Each element in the sequence consists of a tuple, which includes the sequence number of the decision node and the decision complexity value of the decision node. The execution path sequence includes the tuple elements of all decision nodes arranged according to the execution order of the module's execution path.
[0114] For example, the regression planning device obtains the execution time sequence of the nodes in the change module. Based on the node execution time sequence, the following decision nodes are included in sequence: for, if, if, for, if, if, for, and if. Assuming that the sequence number of the decision node for is 5 and the decision complexity is 3, and the sequence number of the decision node if is 1 and the decision complexity is 4, the execution path sequence corresponding to the above modules can be determined. After obtaining the execution path sequence, the execution path sequence can be input into the pre-trained model to obtain the environmental fitness value output by the model.
[0115] Understandably, when training a model, regression planning equipment obtains the execution path sequence corresponding to the module in the current complex distributed system's historical regression test, as well as the time consumed by the module in the historical regression test to complete the regression test. These two sets of data are then input into the model for training. After training is completed, by inputting the module's execution path sequence into the model, the predicted time required for the regression test can be obtained, and this time value is determined as the environmental fitness value.
[0116] It should be noted that different runtime environments and frameworks can affect module performance, especially in complex scenarios like distributed systems where the impact is even greater. Therefore, this solution incorporates information about the current code's execution path to determine its suitability for the current runtime environment.
[0117] Step S33: Determine the recommendation coefficient of each target use case in the candidate use case set based on the use case risk coefficient and the module risk coefficient.
[0118] It is understood that the recommendation coefficient of each target use case in the candidate use case set is calculated with reference to the following formula 2, where R(M) is the module risk coefficient and R(case) is the use case risk coefficient.
[0119] S(case) = R(case) * R(M) (Formula 2)
[0120] For example, in a system iteration, a developer modified the code of the payment interface. At this time, the risk coefficient of the module corresponding to the payment interface is 0.94, and the risk coefficient of one of the use cases is 0.42. Another developer also modified the code of the notification interface. The risk coefficient of the module corresponding to the notification interface is 0.84, and the risk coefficient of the use case is 0.35 after the above calculation.
[0121] When modifying the payment module, the module risk coefficient is unique because the module is associated with 3 use cases, and each use case will have 1 risk coefficient, which are 0.42, 0.30 and 0.52 respectively; when modifying the notification module, the risk coefficients of the corresponding 2 associated use cases are 0.35 and 0.76 respectively, as shown in Table 2 below. Table 2 is a risk coefficient illustration table.
[0122] Table 2
[0123] Modify module name Module risk coefficient Use Case Risk Coefficient Payment 0.94 0.42, 0.30, 0.52 (c1, c2, c3) notify 0.84 0.35, 0.76(c4, c5)
[0124] Step S34: Based on the recommendation coefficient, the target use cases in the candidate use case set are recommended and ranked to obtain a use case sequence.
[0125] After modifying the payment and notification modules, the recommendation coefficients for all use cases are shown in Table 3 below. The recommendation coefficient S(case) for each use case in the candidate use case set X is calculated and sorted. The final recommendation range is filtered based on a certain threshold. The sorted use case order is: C5, C3, C1, C4, C2. This order can be directly used as the priority order after use case regression. The use case sequence is constructed based on the use case order.
[0126] Table 3
[0127] Scope of affected use cases Final recommendation coefficient R(c) for the use case C1 0.39 C2 0.28 C3 0.49 C4 0.29 C5 0.64
[0128] This embodiment determines the use case risk coefficient of the target use case and the module risk coefficient of the change module. Based on the use case risk coefficient and the module risk coefficient, it determines the recommendation coefficient of each target use case in the candidate use case set. Based on the recommendation coefficient, it ranks the target use cases in the candidate use case set to obtain a use case sequence. Because this embodiment determines the recommendation coefficient of each target use case in the candidate use case set based on the use case risk coefficient of the target use case and the module risk coefficient of the change module, and ranks the target use cases in the candidate use case set based on the recommendation coefficient to obtain a use case sequence, it can accurately recommend use cases and improve regression testing efficiency.
[0129] refer to Figure 4 , Figure 4This is a flowchart illustrating the third embodiment of a system use case regression planning method according to the present invention.
[0130] Based on the second embodiment described above, in this embodiment, step S31 includes:
[0131] Step S311: Locate the target link associated with the target use case based on the preset database;
[0132] Step S312: Determine the link risk level of the target link;
[0133] Step S313: Obtain the historical execution information of the target use case;
[0134] Step S314: Determine the failure information of the target test case based on the historical test information;
[0135] Step S315: Determine the use case risk coefficient of the target use case based on the failure information and the link risk level.
[0136] It should be noted that historical execution information can be log information from the historical execution of the target use case. The aforementioned failure information can be the number of times the target use case failed to execute historically. The aforementioned preset database can be a pre-built graph database storing the relationships between "use case - link - module".
[0137] It is understood that this embodiment obtains the set of links associated with the target and calculates the risk level of each target link in the set based on the link factors of the target links. The link factors may include three factors: link call length, number of link call branches, and number of link calls.
[0138] In practical implementation, the regression planning device can calculate the final use case risk coefficient by combining the number of failures of the target use case. For example, if the historical execution failure count of the target use case is 4, the execution failure counts of other use cases are normalized together to obtain E(case). Assuming that the execution failure counts of other use cases are 2, 0, 10, 3, 0, 5, the maximum number of failures is 10, and the minimum number of failures is 0, then after normalization using the minimum-maximum normalization method, E(case) = 0.4. Finally, the risk coefficient R(case) of the recharge use case = link risk level R * (1 + E(case)) = 0.3 * (1 + 0.4) = 0.42.
[0139] Furthermore, in order to accurately calculate the link risk level, step S312 above may include:
[0140] Step S3121: Obtain the historical call information of the target link;
[0141] Step S3122: Determine the link length, number of link branches, and number of link calls of the target link based on the historical call information;
[0142] Step S3123: Obtain the business scenario information of the change module;
[0143] Step S3124: Generate a business weight allocation strategy based on the business scenario information;
[0144] Step S3125: Based on the business weight allocation strategy, normalize the link length, the number of link branches, and the number of link calls to obtain the link risk level of the target link.
[0145] It is understood that this embodiment uses a mobile phone top-up scenario as an example. The target use case completes a successful top-up operation. The user chooses to log in to the operator's official website or use a mobile app to top up. The user needs to register and log in to their account first, then select the mobile phone top-up function, enter the mobile phone number and top-up amount, select the payment method and perform the payment operation to complete the top-up. After the payment is completed, the top-up order is closed and a payment success message notification is sent.
[0146] If the target use case has been run 100 times historically, with 4 failures, it involves at least 5 system call chains, such as Login, Recharge, Order, Payment, and Notice. The call chain will vary depending on the scenario type. For example, the recharge method can be either the official website or the App, and the payment method can be either Alipay, WeChat Pay, or other payment methods.
[0147] Abstracting and simplifying the above scenario, we can conclude that the target link length is 5, the number of branches is 2*3=6, and the number of historical calls is 500.
[0148] Based on this scenario and the three factors mentioned above, we propose three indices affecting link risk, namely the link length index, the link branch number index, and the link call count index, along with their calculation formulas:
[0149] Link length index = (link length - 2) / 10, 0 for length less than or equal to 2;
[0150] The link branch number index = (number of branches - 3) / 10, and 0 if the number of branches is less than or equal to 3;
[0151] Link call count index = (link call count - 200) / 1000, 0 if the number of calls is less than or equal to 200;
[0152] In actual mobile phone top-up scenarios, the link length index represents the system call depth, which means that the cross-system complexity that the test needs to focus on is higher, so it is given a weight of 0.3; the link branch number index represents the number of different branch scenarios, which means that the test needs to consider more dimensions or test case parameters when designing test cases, so it is given a higher weight of 0.5; the link call count index represents the traffic volume of the target link in real business, which is also an important factor affecting the test weight, so it is given a weight of 0.2.
[0153] Therefore, the target link risk level R = link length index * 0.3 + link branch index * 0.5 + link call count index * 0.2 = 0.3.
[0154] This embodiment finds the target link associated with the target use case based on a preset database; determines the link risk level of the target link; obtains the historical execution information of the target use case; determines the failure information of the target use case based on the historical test information; and determines the use case risk coefficient of the target use case based on the failure information and the link risk level. Because this embodiment determines the use case risk coefficient of the target use case based on the failure information of the target use case and the risk level of the target link associated with the target use case, the risk coefficient of the target use case associated with the change module is accurately calculated, thus improving the accuracy of use case recommendation.
[0155] Furthermore, this embodiment of the invention also proposes a storage medium storing a system use case regression planning program, which, when executed by a processor, implements the steps of the system use case regression planning method described above.
[0156] Since this storage medium adopts all the technical solutions of all the above embodiments, it has at least all the beneficial effects brought about by the technical solutions of the above embodiments, which will not be repeated here.
[0157] Reference Figure 5 , Figure 5 This is a structural block diagram of the first embodiment of the system use case regression planning device of the present invention.
[0158] like Figure 5 As shown, the system use case regression planning device proposed in this embodiment of the invention includes:
[0159] The change detection module 10 is used to identify the change module in the target system when there is a business change in the target system.
[0160] The use case selection module 20 is used to find at least one target use case associated with the change module based on a preset database, and to construct a candidate use case set based on the target use cases;
[0161] The use case recommendation module 30 is used to recommend and rank the target use cases in the candidate use case set to obtain a use case sequence;
[0162] The regression planning module 40 is used to perform use case regression planning on the target system based on the use case sequence.
[0163] Furthermore, the use case recommendation module 30 is also used to determine the use case risk coefficient of the target use case; determine the module risk coefficient of the change module; determine the recommendation coefficient of each target use case in the candidate use case set based on the use case risk coefficient and the module risk coefficient; and recommend and rank the target use cases in the candidate use case set based on the recommendation coefficient to obtain a use case sequence.
[0164] Furthermore, the use case recommendation module 30 is also used to determine the module popularity and module complexity of the change module; determine the environmental adaptability of the change module based on the module complexity; and normalize the module popularity, the module complexity, and the environmental adaptability to obtain the module risk coefficient of the change module.
[0165] Furthermore, the use case recommendation module 30 is also used to find the target link corresponding to the change module based on the preset database, and obtain the link call count of the target link; determine the module popularity of the change module based on the link call count; obtain at least one decision node in the change module, and determine the decision type corresponding to each decision node; and determine the module complexity of the change module based on the decision type.
[0166] Furthermore, the use case recommendation module 30 is also used to determine the node number of each decision node based on the decision type of each decision node; obtain the node execution time sequence of the change module; generate a node execution path sequence based on the node number, the node execution time sequence and the module complexity; input the node execution path sequence into a preset model to obtain the test consumption time of the change module; and determine the environmental adaptability of the change module based on the test consumption time.
[0167] Furthermore, the use case recommendation module 30 is also used to find target links associated with the target use case based on a preset database; determine the link risk level of the target link; obtain historical execution information of the target use case; determine the failure information of the target use case based on the historical test information; and determine the use case risk coefficient of the target use case based on the failure information and the link risk level.
[0168] Furthermore, the use case recommendation module 30 is also used to obtain historical call information of the target link; determine the link length, number of link branches, and number of link calls of the target link based on the historical call information; obtain the business scenario information of the change module; generate a business weight allocation strategy based on the business scenario information; and normalize the link length, number of link branches, and number of link calls based on the business weight allocation strategy to obtain the link risk level of the target link.
[0169] This embodiment identifies the changed module in the target system when business changes occur, searches for at least one target use case associated with the changed module based on a preset database, constructs a candidate use case set based on the target use cases, recommends and ranks the target use cases in the candidate use case set to obtain a use case sequence, and performs use case regression planning on the target system based on the use case sequence. Because this embodiment constructs a candidate use case set containing target use cases associated with the changed module, recommends and ranks the use cases in the candidate use case set, and performs use case regression planning on the target system based on the accurately obtained use case sequence after recommendation and ranking, it can accurately recommend test cases when system business changes occur, effectively improving regression testing efficiency and ensuring sufficient use case coverage.
[0170] It should be understood that the above are merely illustrative examples and do not constitute any limitation on the technical solutions of the present invention. In specific applications, those skilled in the art can make settings as needed, and the present invention does not impose any restrictions on this.
[0171] It should be noted that the workflow described above is merely illustrative and does not limit the scope of protection of this invention. In practical applications, those skilled in the art can select some or all of the workflow to achieve the purpose of this embodiment according to actual needs, and no restrictions are imposed here.
[0172] In addition, for technical details not described in detail in this embodiment, please refer to the system use case regression planning method provided in any embodiment of the present invention, which will not be repeated here.
[0173] Furthermore, it should be noted that, in this document, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or system that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or system. Unless otherwise specified, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or system that includes that element.
[0174] The sequence numbers of the above embodiments of the present invention are for descriptive purposes only and do not represent the superiority or inferiority of the embodiments.
[0175] Through the above description of the embodiments, those skilled in the art can clearly understand that the methods of the above embodiments can be implemented by means of software plus necessary general-purpose hardware platforms. Of course, they can also be implemented by hardware, but in many cases the former is a better implementation method. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product is stored in a storage medium (such as read-only memory (ROM) / RAM, magnetic disk, optical disk) and includes several instructions to cause a terminal device (which may be a mobile phone, computer, server, or network device, etc.) to execute the methods described in the various embodiments of the present invention.
[0176] The above are merely preferred embodiments of the present invention and do not limit the scope of the patent. Any equivalent structural or procedural transformations made based on the description and drawings of the present invention, or direct or indirect applications in other related technical fields, are similarly included within the scope of patent protection of the present invention.
Claims
1. A system use case regression planning method, characterized in that, The system use case regression planning method includes: When there are business changes in the target system, identify the changed modules in the target system; The system searches for at least one target use case associated with the change module based on a preset database, and constructs a candidate use case set based on the target use case; wherein, the preset database is a graph database containing the relationship between use cases, links, and modules; through the change module, combined with the relationship between use cases, links, and modules in the graph database, the system performs a reverse query in the graph database to find the associated target links and target use cases; The target use cases in the candidate use case set are recommended and ranked to obtain a use case sequence; Based on the use case sequence, perform use case regression planning on the target system; The step of recommending and ranking the target use cases in the candidate use case set to obtain a use case sequence includes: Determine the use case risk coefficient for the target use case; The module popularity and module complexity of the change module are determined; the environmental adaptability of the change module is determined based on the module complexity; the module popularity, module complexity, and environmental adaptability are normalized to obtain the module risk coefficient of the change module; wherein, the module popularity is determined based on the number of link calls of the target link corresponding to the change module; The recommendation coefficient for each target use case in the candidate use case set is determined based on the use case risk coefficient and the module risk coefficient. Based on the recommendation coefficient, the target use cases in the candidate use case set are recommended and ranked to obtain a use case sequence; The step of determining the environmental adaptability of the modified module based on the module complexity includes: The node number of each decision node is determined based on the decision type of each decision node; Obtain the node execution time sequence of the change module; Generate a node execution path sequence based on the node number, the node execution time order, and the module complexity; The node execution path sequence is input into a preset model to obtain the test consumption time of the change module; The environmental adaptability of the modified module is determined based on the test duration.
2. The system use case regression planning method as described in claim 1, characterized in that, Determining the module popularity and module complexity of the modified module includes: Based on the preset database, the target link corresponding to the change module is found, and the link call count of the target link is obtained; The module popularity of the modified module is determined based on the number of times the link is called; Obtain at least one decision node in the change module and determine the decision type corresponding to each decision node; The module complexity of the change module is determined based on the determination type.
3. The system use case regression planning method as described in claim 1, characterized in that, Determining the use case risk coefficient of the target use case includes: Based on a preset database, target links associated with the target use case are found; Determine the link risk level of the target link; Obtain the historical execution information of the target use case; The failure information of the target use case is determined based on the historical execution information; The use case risk coefficient of the target use case is determined based on the failure information and the link risk level.
4. The system use case regression planning method as described in claim 3, characterized in that, Determining the link risk level of the target link includes: Obtain the historical call information of the target link; Based on the historical call information, the link length, number of link branches, and number of link calls of the target link are determined; Obtain the business scenario information of the change module; A business weight allocation strategy is generated based on the aforementioned business scenario information; Based on the business weight allocation strategy, the link length, the number of link branches, and the number of link calls are normalized to obtain the link risk level of the target link.
5. A system use case regression planning device, characterized in that, The system use case regression planning device includes: The change detection module is used to identify the change module in the target system when there are business changes in the target system. The use case selection module is used to find at least one target use case associated with the change module based on a preset database, and to construct a candidate use case set based on the target use case; wherein, the preset database is a graph database containing the relationship between use cases, links, and modules; through the change module, combined with the relationship between use cases, links, and modules in the graph database, the associated target links and target use cases are queried in reverse in the graph database; A use case recommendation module is used to recommend and rank target use cases in the candidate use case set to obtain a use case sequence. The process of recommending and ranking target use cases in the candidate use case set to obtain a use case sequence includes: determining the use case risk coefficient of the target use case; determining the module popularity and module complexity of the change module; determining the environment adaptability of the change module based on the module complexity; and normalizing the module popularity, module complexity, and environment adaptability to obtain the module risk coefficient of the change module. The module popularity is determined based on the number of link calls to the target link corresponding to the change module. The process of normalizing the use case risk coefficient and the module complexity is further normalized to obtain the module risk coefficient. The risk coefficient determines the recommendation coefficient of each target use case in the candidate use case set; based on the recommendation coefficient, the target use cases in the candidate use case set are recommended and ranked to obtain a use case sequence; the determination of the environmental adaptability of the change module based on the module complexity includes: determining the node number of each decision node based on the decision type of each decision node; obtaining the node execution time sequence of the change module; generating a node execution path sequence based on the node number, the node execution time sequence, and the module complexity; inputting the node execution path sequence into a preset model to obtain the test consumption time of the change module; and determining the environmental adaptability of the change module based on the test consumption time. The regression planning module is used to perform use case regression planning on the target system based on the use case sequence.
6. A system use case regression planning device, characterized in that, The system use case regression planning device includes: a memory, a processor, and a system use case regression planning program stored in the memory and executable on the processor, wherein the system use case regression planning program is configured to implement the system use case regression planning method as described in any one of claims 1 to 4.
7. A storage medium, characterized in that, The storage medium stores a system use case regression planning program, which, when executed by a processor, implements the system use case regression planning method as described in any one of claims 1 to 4.
Citation Information
Patent Citations
Rapid software system regression testing method and device
CN106354631A
Test case screening method and device and medium
CN111274126A