Test case generation method, device, electronic device and storage medium
By obtaining and utilizing the priority and competition attributes of attribution links to generate test cases, the problems of low test case generation efficiency and poor flexibility in the existing technology are solved, and efficient and accurate test case generation and rapid iterative adaptation are achieved.
Patent Information
- Application Number
- CN202111363083.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-11-17
- Publication Date
- 2024-10-25
- Estimated Expiration
- 2041-11-17
AI Technical Summary
Test case generation in the existing technology is inefficient, prone to errors, has poor flexibility, and cannot quickly adapt to priority adjustments and demand iterations.
By obtaining multiple attribution links and the priority of each attribution link for test cases to be generated, the competition attributes of attribution links with the same priority are obtained, and test cases with the same priority and different priorities are generated. According to the priority The winning and competing links are determined in order from high to low, and test cases are automatically generated.
It improves the efficiency and accuracy of test case generation, can quickly adapt to demand iterations, and enhances the flexibility of test cases.
Smart Images

Figure CN114185768B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to software testing technology, and in particular to a test case generation method, device, electronic device and storage medium. Background Art
[0002] The attribution system is an important means for Internet products to evaluate the effectiveness of attracting new users and promoting activation. Software quality assurance for the attribution system is also extremely challenging. In abstract terms, attribution is to match user activation data with ad click data to give an attribution evaluation of the advertising effect.
[0003] In the related art, the priority test cases corresponding to each attribution link are manually determined. However, the priority relationship of each attribution link is not static. In some comparative experiments, the priority needs to be adjusted to obtain evaluation data. This requires manual re-adjustment of the priority test cases, which is labor-intensive and inefficient. In addition, manual determination is prone to omissions or errors, making it inconvenient to iterate the adjustment of the priority and having poor flexibility. Summary of the invention
[0004] The present disclosure provides a test case generation method, device, electronic device and storage medium to at least solve the problems of low test case generation efficiency, prone to errors and poor flexibility in related technologies. The technical solution of the present disclosure is as follows:
[0005] According to a first aspect of an embodiment of the present disclosure, a test case generation method is provided, comprising:
[0006] Obtain multiple attribution links of the test case to be generated and the priority of each attribution link, and obtain competition attributes of attribution links with the same priority;
[0007] Generating, according to the competition attributes of the attribution links with the same priority, test cases with the same priority corresponding to the attribution links with the same priority among the multiple attribution links;
[0008] According to the order of priorities of the multiple attribution links from high to low, the attribution link of each priority is determined as a winning link in turn, and the winning link and each attribution link of a priority lower than the priority are determined as competing links of the winning link, and the winning links and competing links of different priorities are determined as different priority test cases.
[0009] Optionally, in descending order of the priorities of the multiple attribution links, the attribution links of each priority are determined as winning links in turn, and the winning link and each attribution link of a priority lower than the priority are determined as competing links of the winning link, and winning links and competing links of different priorities are determined as test cases of different priorities, including:
[0010] Traverse the priorities in descending order, and determine the currently traversed priority as the current priority;
[0011] Determine the attributed link corresponding to the current priority as a winning link and a competing link corresponding to the winning link;
[0012] Determine an attributed link of each priority lower than the current priority as at least one competing link corresponding to the winning link;
[0013] Determine the winning link, a competing link corresponding to the winning link, and at least one competing link corresponding to the winning link as different priority test cases corresponding to the current priority;
[0014] Traverse the next priority level of the current priority level, and determine the next priority level as the new current priority level, and perform the above operations of determining the winning link and the competing link and determining the test cases of different priorities until the next priority level of the current priority level is the lowest priority level.
[0015] Optionally, determining the attribution link of each priority lower than the current priority as the at least one competing link corresponding to the winning link includes:
[0016] Recursively process each attributed link of a priority lower than the current priority to determine at least one competing link corresponding to the winning link.
[0017] Optionally, recursively processing each attribution link with a priority lower than the current priority to determine at least one competing link corresponding to the winning link includes:
[0018] Determine each attribution link of the next priority as a competing link corresponding to the winning link at the next priority;
[0019] The next priority of the next priority is recursively processed according to the above method of determining competing links, until the next priority recursively obtained is the lowest priority and the recursion is terminated to obtain at least one competing link corresponding to each priority level lower than the current priority level of the winning link.
[0020] Optionally, generating, according to the competition attributes of the attribution links with the same priority, test cases with the same priority corresponding to the attribution links with the same priority among the multiple attribution links includes:
[0021] If the number of attribution links with the same priority among the multiple attribution links is at least two, determining the attribution links with the same priority as attribution links with the same priority;
[0022] According to the competition attributes of the links with the same priority, the winning competition attributes are respectively assigned to each link with the same priority, so as to obtain at least two winning links with the same priority;
[0023] For each winning link of the same priority, determining the attribution link of the same priority as a competing link corresponding to the winning link of the same priority;
[0024] The winning link and the corresponding competing link of the same priority are determined as the test cases of the same priority.
[0025] Optionally, also include:
[0026] Obtaining updated priorities of the multiple attribution links, and / or obtaining updated competition attributes of the attribution links with the same priority;
[0027] Regenerate test cases of the same priority corresponding to attribution links of the same priority among the multiple attribution links according to the updated competitive attributes;
[0028] Regenerate test cases of different priorities in the order of the updated priorities from high to low.
[0029] According to a second aspect of an embodiment of the present disclosure, a test case generating device is provided, comprising:
[0030] A configuration acquisition module is configured to execute acquisition of multiple attribution links of the test case to be generated and the priority of each attribution link, and to acquire competition attributes of attribution links with the same priority;
[0031] A same-priority test case generation module is configured to generate same-priority test cases corresponding to attribution links of the same priority among the multiple attribution links according to competition attributes of the same-priority attribution links;
[0032] The different priority use case generation module is configured to execute in the order of the priorities of the multiple attribution links from high to low, determine the attribution link of each priority as the winning link in turn, determine the winning link and each attribution link of a priority lower than the priority as the competing links of the winning link, and determine the winning links and competing links of different priorities as different priority test cases.
[0033] Optionally, the different priority use case generation module includes:
[0034] A traversal unit is configured to traverse the priorities in order from high to low, and determine the currently traversed priority as the current priority;
[0035] A winning link determination unit, configured to determine the attributed link corresponding to the current priority as a winning link and a competing link corresponding to the winning link;
[0036] a contention link determination unit, configured to determine an attribution link of each priority lower than the current priority as at least one contention link corresponding to the winning link;
[0037] A different priority test case generating unit is configured to execute a test case of different priorities corresponding to the current priority by determining the winning link, a competing link corresponding to the winning link, and at least one competing link corresponding to the winning link;
[0038] A traversal control unit is configured to traverse the next priority level of the current priority level, determine the next priority level as the new current priority level, and perform the above-mentioned operations of determining the winning link and the competing link and determining the test cases of different priorities until the next priority level of the current priority level is the lowest priority level.
[0039] Optionally, the contention link determination unit is configured to execute:
[0040] Recursively process each attributed link of a priority lower than the current priority to determine at least one competing link corresponding to the winning link.
[0041] Optionally, the contention link determination unit includes:
[0042] A contention link determination subunit is configured to determine each attributed link of the next priority as a contention link corresponding to the winning link of the next priority;
[0043] The recursive control subunit is configured to perform recursive processing on the next priority of the next priority according to the above-mentioned method of determining the competing links, until the next priority recursively reached is the lowest priority and the recursion is terminated, thereby obtaining at least one competing link corresponding to each priority level lower than the current priority level of the winning link.
[0044] Optionally, the same-priority use case generation module includes:
[0045] a same-priority link determination unit, configured to determine the attribution links with the same priority as the same-priority attribution links if the number of attribution links with the same priority among the multiple attribution links is at least two;
[0046] A winning link determination unit is configured to execute, according to the competition attributes of the links attributed to the same priority, assign the winning competition attributes to each of the links attributed to the same priority, and obtain at least two winning links of the same priority;
[0047] A contention link determination unit is configured to determine, for each winning link of the same priority, the attribution link of the same priority as a contention link corresponding to the winning link of the same priority;
[0048] The same-priority case generation unit is configured to determine the winning link and the corresponding competing link of the same priority as the same-priority test case.
[0049] Optionally, the device further comprises:
[0050] A configuration update acquisition module is configured to execute acquisition of updated priorities of the multiple attribution links, and / or acquisition of updated competition attributes of the attribution links with the same priority;
[0051] A same-priority test case regeneration module is configured to regenerate the same-priority test cases corresponding to the attribution links of the same priority in the multiple attribution links according to the updated competitive attributes;
[0052] The different priority test case regeneration module is configured to regenerate different priority test cases in the order of the updated priorities from high to low.
[0053] According to a third aspect of an embodiment of the present disclosure, there is provided an electronic device, including:
[0054] processor;
[0055] a memory for storing instructions executable by the processor;
[0056] The processor is configured to execute the instructions to implement the test case generation method as described in the first aspect.
[0057] According to a fourth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided. When instructions in the computer storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the test case generation method as described in the first aspect.
[0058] According to a fifth aspect of an embodiment of the present disclosure, a computer program product is provided, comprising a computer program or computer instructions, wherein when the computer program or computer instructions are executed by a processor, the test case generating method as described in the first aspect is implemented.
[0059] The technical solution provided by the embodiments of the present disclosure brings at least the following beneficial effects:
[0060] The disclosed embodiment obtains multiple attribution links of the test cases to be generated and the priority of each attribution link, and obtains the competitive attributes of the attribution links with the same priority, generates the same-priority test cases corresponding to the attribution links with the same priority in the multiple attribution links according to the competitive attributes of the attribution links with the same priority, determines the attribution links of each priority as the winning links in descending order of the priorities of the multiple attribution links, and determines the winning link and each attribution link with a priority lower than the priority as the competitive links of the winning link, and determines the winning links and competitive links of different priorities as test cases with different priorities. Since the same-priority test cases and different-priority test cases can be generated based on the priority and competitive attributes of the attribution links, the automatic generation of priority test cases is realized, the efficiency of test case generation is improved, human errors can be avoided, the accuracy of the generated test cases is improved, and when the requirements are updated, the test cases can be regenerated based on the updated priorities of the attribution links, the requirements iteration can be quickly adapted, and the flexibility of test case generation is improved.
[0061] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0062] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.
[0063] Figure 1 is a flow chart of a test case generation method according to an exemplary embodiment;
[0064] Figure 2 is a block diagram of a test case generating device according to an exemplary embodiment;
[0065] Figure 3 It is a block diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION
[0066] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.
[0067] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0068] When attributing the advertising effect, taking the common DeepLink technology as an example, when a user clicks on an advertisement provided by an advertiser to launch a designated application (Application, App) and enter a designated page, the application will report the click data of entering the page, and then complete actions such as registration, login, and participation in activities according to the guidance. At this time, the application can obtain the user's registration or login activation data, and match the click data with the activation data to obtain the attribution analysis of the advertising effect. This series of attribution processes from user clicks to activation or login is an attribution link. In actual situations, there may be multiple attribution links that can achieve the same activation or login. Which attribution link the activation should be attributed to depends on the priority of each attribution link.
[0069] Software testing of attribution systems generally adopts the data mock method, that is, creating upstream data with expected conditions, then executing the attribution task, and finally verifying whether the attribution result meets expectations. In this case, the combination of priority use cases are designed based on known priority requirements to cover the corresponding use cases.
[0070] The attribution demand involves 10 attribution links, which are A1_1, A1_2, A2_1, A3_1, A4_1, A5_1, A6_1, A6_2, A6_3, and A6_4. There are 6 priorities in total, namely 1, 2, 3, 4, 5, and 6. Among them, there are two attribution links A1_1 and A1_2 at the first level of priority, and four attribution links A6_1, A6_2, A6_3, and A6_4 at the sixth level of priority. Other priorities all have one attribution link.
[0071] In the case of competition (PK) with the same priority, the paid link is attributed first. If both are paid and free, the link with the earlier attribution time wins. For example, if an activation belongs to both A1_1 and A2_2, it will be judged based on the paid and free attributes of the two and the order of click time. Assuming that both are free links and A1_1 is earlier, it will be attributed to A1_1 in the end.
[0072] In the case of competition between different priorities, the higher priority wins. For example, if an activation message belongs to link A1_1, A2_2, A3_1, and A6_3 at the same time, it will eventually be attributed to A1_1.
[0073] Based on the above analysis, we can design the priority test cases shown in Table 1 for testing:
[0074] Table 1 Examples of priority use cases
[0075]
[0076]
[0077] As can be seen from Table 1, when determining the priority test cases, the priority relationships are used for permutation and combination to cover the competitive relationships of the priorities.
[0078] Judging from the above use case design process and results, this method has the disadvantages of large workload and inability to quickly iterate according to requirements.
[0079] Through the above analysis, the process of use case design is a relationship of priority arrangement and combination. Taking the above requirements as an example, calculate the number of use cases that need to be completed.
[0080] The same priority level involves the first and sixth levels. The number of test cases is the number of links involved in each level and the number of winning conditions. Taking the first level as an example, A1_1 and A1_2 are two options for winning; each link has two options for winning (either toll winning or earlier time winning). Therefore, 2×2=4 test cases need to be designed for the first priority level. Similarly, the sixth level is 4×2=8 test cases. Therefore, there are a total of 12 test cases with the same priority level.
[0081] Different priorities involve levels 1 to 5 (level 6 does not exist in different priority designs because it has the lowest priority). Test cases need to traverse every possibility at each level. Taking level 1 as an example, there are two options for choosing A1_1 or A1_2 at level 1. From level 2 to level 5, there is only one link to choose from, and level 6 has 4 options, so a total of 8 test cases are needed to cover the link test of the first priority. Similarly, the situations from level 2 to level 5 can be calculated, with a total of 24 test cases of different priorities.
[0082] Therefore, the above requirements require the design of 36 test cases in total. As more links and conditions are added, the number of test cases will increase exponentially. Manually designing test cases is labor-intensive and the logic is complex, which makes it very easy to make omissions and errors.
[0083] Priority changes are affected by the addition of links and policy changes. Various iterations and comparative experiments are often performed. At this time, the above priority requirements need to be modified, and a lot of calculations are required to obtain the use cases under the new iteration. Moreover, as the number of links and conditions increases, this calculation will become difficult to maintain and less flexible.
[0084] In order to solve the above problems, the present disclosure provides the following technical solutions.
[0085] Figure 1 is a flow chart of a test case generation method according to an exemplary embodiment. Figure 1 As shown, the test case generation method can be used in electronic devices such as computers, and is suitable for testing attribution systems, and includes the following steps.
[0086] In step S11, multiple attribution links of the test case to be generated and the priority of each attribution link are obtained, and the competition attributes of the attribution links with the same priority are obtained.
[0087] The competition attributes are the attributes of attribution links of the same priority participating in the competition. For example, one group of competition attributes may be charged or free, and the winning condition is charged; another group of competition attributes may also be earlier or later, and the winning condition is winning at the earlier time.
[0088] The user can pre-configure multiple attribution links for the test cases to be generated, as well as the priority of each attribution link, and can also configure the competitive attributes of attribution links with the same priority. After the user configuration is completed, the user can directly obtain the multiple attribution links and the priority of each attribution link pre-configured by the user, and obtain the competitive attributes of attribution links with the same priority, so as to facilitate the subsequent automatic generation of test cases.
[0089] By configuring and managing the priority of the attribution link, the problem in related technologies that it is impossible to quickly iterate on demand changes can be solved. When the priority requirement changes, the priority configuration of the corresponding attribution link is updated, and then the use case is regenerated to obtain the test case under the new requirement.
[0090] Priority test cases can be generated based on the multiple attribution links, priorities and competitive attributes obtained. Priority test cases are actually permutations and combinations of priority relationships of attribution links. During the case generation process, test cases with the same priority and test cases with different priorities are generated respectively.
[0091] In step S12, according to the competition attributes of the attribution links with the same priority, the test cases with the same priority corresponding to the attribution links with the same priority in the multiple attribution links are generated.
[0092] The same-priority test cases actually process the attribution links with the same priority relationship separately. In the process of generating the same-priority test cases, each attribution link has a chance to win. The same-priority test cases can be generated by traversing all the attribution links with the same priority.
[0093] When generating a test case with the same priority, it is first necessary to determine the priority with the number of attribution links at the same priority being greater than or equal to 2, and obtain the attribution links of this priority. According to the same set of competition attributes of the attribution links with the same priority, multiple attribution links at the same priority are respectively won once to obtain multiple winning links. For each winning link, the winning link and other attribution links at the same priority are determined as the competing links of the winning link to obtain a test case with the same priority. Among them, the competing link is the attribution link participating in the competition.
[0094] In an exemplary embodiment, the same-priority test cases corresponding to the attribution links of the same priority in the multiple attribution links are generated according to the competition attributes of the attribution links of the same priority, including: if the number of the attribution links of the same priority in the multiple attribution links is at least two, the attribution links of the same priority are determined as the attribution links of the same priority; according to the competition attributes of the attribution links of the same priority, the winning competition attributes are respectively assigned to each of the attribution links of the same priority to obtain at least two winning links of the same priority; for each winning link of the same priority, the attribution link of the same priority is respectively determined as the competing link corresponding to the winning link of the same priority; the winning link of the same priority and the corresponding competing link are determined as the same-priority test cases.
[0095] Traverse the priorities of the attribution links, and for the currently traversed priority, determine the number of attribution links of the priority. If the number of attribution links of the priority is greater than or equal to two, determine the attribution links of the priority as attribution links of the same priority. According to the competitive attributes of the attribution links of the same priority, each attribution link of the same priority wins once, that is, the winning competitive attributes are respectively assigned to each attribution link of the same priority, and at least two winning links of the same priority are obtained. When there are multiple groups of competitive attributes, the winning link is determined for each group of competitive attributes, and each group of competitive attributes obtains at least two winning links of the same priority. For the at least two winning links of the same priority obtained, for each winning link, all the attribution links of the same priority in the attribution link of the same priority are determined as the competing links of the winning link. Each winning link and the corresponding competing link constitute a test case of the same priority. When a priority has at least two attribution links of the same priority, at least two test cases of the same priority can be generated.
[0096] After the test cases of the same priority level as the currently traversed priority level are generated, the next priority level is traversed again, and the test cases of the same priority level corresponding to the traversed priority level are determined in the above manner.
[0097] For example, one group of competitive attributes is "charged" and "free", "charged" is the winning competitive attribute, and another group of competitive attributes is "earlier" and "later", "earlier" is the winning competitive attribute. For each group of competitive attributes, generate corresponding test cases of the same priority. Traverse each attribution link under the same priority, and generate a winning test case of the same priority for each attribution link for the competitive attributes of "charged" and "free", and generate a winning test case of the same priority for each attribution link for the competitive attributes of "earlier" and "later".
[0098] For the competitive attributes of "charged" and "free", a winning test case of the same priority is generated for each attribution link, that is, a winning paid / free case is generated for each attribution link, that is, the winning competitive attribute "charged" is assigned to the currently traversed attribution link, then the attribution link is a charged link, and other attribution links with the same priority are free links, so that the test case of the same priority corresponding to the currently traversed attribution link is obtained. Taking the first-level priority attribution links A1_1 and A2_2 in the above example as an example, the test cases of the same priority as shown in Table 2 can be generated. In Table 2, win represents the winning attribution link, and players represents the competitive link.
[0099] Table 2 Test cases with the same priority 1
[0100]
[0101] For the competitive attributes of "earlier" and "later", a winning test case of the same priority is generated for each attribution link, that is, a winning earlier priority test case is generated for each attribution link, that is, the winning competitive attribute "earlier" is assigned to the currently traversed attribution link, then the attribution link is the earlier link, and other attribution links with the same priority are later links, so that the same priority test case corresponding to the currently traversed attribution link is obtained. Taking the first-level priority attribution links A1_1 and A2_2 in the above example as an example, the same priority test cases shown in Table 3 can be generated. In Table 3, win represents the winning attribution link, and players represents the competitive link.
[0102] Table 3 Test case 2 with the same priority
[0103]
[0104] It should be noted that when there are multiple groups of competitive attributes, the multiple groups of competitive attributes can also be arranged and combined, that is, when the competitive attributes of multiple attribution links in a group of competitive attributes are the same, other groups of competitive attributes can be used to determine the winning link.
[0105] When the number of attribution links with the same priority is at least two, the attribution links with the same priority are determined as attribution links with the same priority, and according to the competition attributes of the attribution links with the same priority, the winning competition attributes are respectively assigned to each attribution link with the same priority, so as to obtain at least two winning links with the same priority. For each winning link with the same priority, the attribution link with the same priority is respectively determined as the competition link corresponding to the winning link, and the winning link with the same priority and the corresponding competition link are determined as test cases with the same priority. In this way, omission of test cases with the same priority can be avoided, and the generated test cases with the same priority are more comprehensive. Moreover, human errors can be avoided, and the accuracy of the generated test cases with the same priority is improved.
[0106] In step S13, in order of the priorities of the multiple attribution links from high to low, the attribution links of each priority are determined as winning links in turn, and the winning link and each attribution link of a priority lower than the priority are determined as competing links of the winning link, and the winning links and competing links of different priorities are determined as test cases of different priorities.
[0107] According to the priorities of multiple attribution links, attribution links with high priorities are respectively determined as winning links, and each attribution link with each priority lower than the priority of the winning link is respectively determined as a competing link of the winning link. The winning links and competing links constitute test cases of different priorities.
[0108] In an exemplary embodiment, in descending order of the priorities of the multiple attribution links, the attribution links of each priority are determined as winning links in turn, and the winning link and each attribution link of a priority lower than the priority are determined as competing links of the winning link, and winning links and competing links of different priorities are determined as test cases of different priorities, including:
[0109] Traverse the priorities in descending order, and determine the currently traversed priority as the current priority;
[0110] Determine the attributed link corresponding to the current priority as a winning link and a competing link corresponding to the winning link;
[0111] Determine an attributed link of each priority lower than the current priority as at least one competing link corresponding to the winning link;
[0112] Determine the winning link, a competing link corresponding to the winning link, and at least one competing link corresponding to the winning link as different priority test cases corresponding to the current priority;
[0113] Traverse the next priority level of the current priority level, and determine the next priority level as the new current priority level, and perform the above operations of determining the winning link and the competing link and determining the test cases of different priorities until the next priority level of the current priority level is the lowest priority level.
[0114] The priorities are traversed in order from high to low, and the currently traversed priority is determined as the current priority. The attribution link corresponding to the current priority is determined as the winning link and a competing link corresponding to the winning link, that is, when the current priority has only one attribution link, the attribution link is determined as the winning link and a competing link corresponding to the winning link. When the current priority has multiple attribution links, the multiple attribution links are determined as the winning link and a competing link corresponding to the winning link. For example, the current priority has two attribution links A1_1 and A2_2, then two winning links A1_1 and A2_2 are obtained. For the winning link A1_1, A1_1 is also a competing link of the winning link A1_1, and for the winning link A2_2, A2_2 is also a competing link of the winning link A2_2.
[0115] After the winning link is determined, each attributed link of each priority lower than the current priority is determined as a competing link corresponding to the winning link. When there is at least one priority lower than the current priority, at least one competing link corresponding to the winning link can be determined. The winning link and all competing links corresponding to the winning link are determined as different priority test cases corresponding to the current priority.
[0116] Traverse the next priority level of the current priority level, and determine the next priority level as the new current priority level, perform the above operations of determining the winning link and the competing link and determining the test cases of different priorities, and stop traversing until the next priority level of the current priority level is the lowest priority level.
[0117] By traversing the priority level to generate different priority level test cases for the current priority level traversed, it is possible to avoid missing a different priority level test case, avoid human errors, and improve the accuracy of the generated different priority level test cases.
[0118] In an exemplary embodiment, determining the attribution link of each priority lower than the current priority as the at least one competing link corresponding to the winning link includes: recursively processing the attribution link of each priority lower than the current priority to determine the at least one competing link corresponding to the winning link.
[0119] Starting from the next priority level of the current priority level, other competing links are equipped for the winning link of the current priority level. The process of processing each priority level is actually a recursive processing process. When processing each priority level, each attributed link in the priority level is determined as the competing link of the winning link at the priority level. After the recursion is completed, the competing links of the winning link at each priority level lower than the current priority level are obtained, that is, at least one competing link corresponding to each winning link is obtained. Determining the competing links of the winning link at each priority level lower than the current priority level by recursive processing can avoid missing competing links, thereby improving the comprehensiveness of the determined test cases of different priorities.
[0120] In an exemplary embodiment, recursively processing each attributed link with a priority lower than the current priority to determine at least one competing link corresponding to the winning link includes:
[0121] Determine each attribution link of the next priority as a competing link corresponding to the winning link at the next priority;
[0122] The next priority of the next priority is recursively processed according to the above method of determining competing links, until the next priority recursively obtained is the lowest priority and the recursion is terminated to obtain at least one competing link corresponding to each priority level lower than the current priority level of the winning link.
[0123] Each attribution link of the next priority level of the current priority level is determined as the competing link corresponding to the winning link in the next priority level. That is, when there is one attribution link in the next priority level, the attribution link is directly determined as the competing link corresponding to each winning link in the next priority level. When there are multiple attribution links in the next priority level, each attribution link is determined as the competing link corresponding to each winning link in the next priority level. For example, if there is one winning link and there are two attribution links in the next priority level, the two attribution links of the next priority level are respectively determined as the competing links of the winning link in the next priority level. That is, the winning link has two competing links in the next priority level. If the next priority level is the lowest priority level or there is only one attribution link in a priority level lower than the next priority level, two test cases with different priorities can be obtained.
[0124] After obtaining the competing links corresponding to the next priority of the winning link, the next priority of the next priority is recursively processed according to the above method of determining the competing links until the next priority recursively obtained is the lowest priority, and the recursion ends to obtain at least one competing link corresponding to each priority lower than the current priority of the winning link.
[0125] By recursively determining the competing links of the winning link at each priority level, it is possible to avoid missing competing links and improve the comprehensiveness of the generated test cases of different priorities.
[0126] When recursively processing the attribution link of each priority level lower than the current priority level, the processing starts from the next priority level of the current priority level. Depending on whether the next priority level recursively reached is the lowest priority level, the processing can be divided into two cases: the next priority level recursively reached is the lowest priority level and the next priority level recursively reached is not the lowest priority level, and the processing can be carried out separately.
[0127] When the next priority level recursively reaches is the lowest priority level, it means that the recursion can end. After traversing each attribution link under the next priority level and adding each attribution link to the competition link of the winning link, a test case with different priorities is generated. In the above example, when recursively reaching the 6th priority level, the 6th priority level is already the last level, so A6_1, A6_2, A6_3, and A6_4 are added to the competition link respectively, and 4 test cases with different priorities are obtained.
[0128] When the next priority recursively reached is not the lowest priority, it means that the recursion needs to continue. After traversing each attribution link under the next priority and adding each attribution link to the competition link of the winning link, recurse again with this configuration, that is, process the next priority of the next priority. Taking the above example as an example, when recursing to a priority other than the 6th priority, such as the 2nd priority, the 2nd priority is not the lowest priority, so traverse the attribution links under the 2nd priority, such as A2_1, and add A2_1 to the competition link. At this time, the configuration is: winning link: A1_1, competition link: [A1_1, A2_1]. Recursively process the next priority again, and the configuration after processing is changed to: winning link: A1_1, competition link: [A1_1, A2_1, A3_1]...Recursively process until the lowest priority is reached, and at least one competition link corresponding to the winning link is obtained. For the above example, through recursive processing, multiple test cases with different priorities can be obtained when the winning link is A1_1, which can be expressed as follows:
[0129] Winning link: A1_1, competing links: [A1_1, A2_1, A3_1, A4_1, A5_1, A6_1];
[0130] Winning link: A1_1, competing links: [A1_1, A2_1, A3_1, A4_1, A5_1, A6_2];
[0131] Winning link: A1_1, competing links: [A1_1, A2_1, A3_1, A4_1, A5_1, A6_3];
[0132] Winning link: A1_1, competing links: [A1_1, A2_1, A3_1, A4_1, A5_1, A6_4].
[0133] The winning links A1_2, A2_1, A3_1, A4_1, and A5_1 are processed respectively to obtain corresponding competing links, that is, corresponding test cases with different priorities.
[0134] The test case generation method provided by the present exemplary embodiment obtains multiple attribution links of the test cases to be generated and the priority of each attribution link, and obtains the competition attributes of the attribution links with the same priority, generates the same-priority test cases corresponding to the attribution links with the same priority in the multiple attribution links according to the competition attributes of the attribution links with the same priority, determines the attribution links of each priority as the winning links in order from high to low priorities of the multiple attribution links, and determines the winning link and each attribution link with a priority lower than the priority as the competition links of the winning link, and determines the winning links and competition links of different priorities as test cases with different priorities. Since the same-priority test cases and different-priority test cases can be generated based on the priority and competition attributes of the attribution links, the automatic generation of priority test cases is realized, the efficiency of test case generation is improved, human errors can be avoided, and the accuracy of the generated test cases is improved. Moreover, when the requirements are updated, the test cases can be regenerated based on the updated priorities of the attribution links, the requirements iteration can be quickly adapted, and the flexibility of test case generation is improved.
[0135] Based on the above technical solution, the method also includes: obtaining the updated priorities of the multiple attribution links, and / or obtaining the updated competition attributes of the attribution links with the same priority; regenerating the same-priority test cases corresponding to the attribution links with the same priority in the multiple attribution links according to the updated competition attributes; and regenerating different priority test cases in order from high to low after the updated priorities.
[0136] After generating the same-priority test cases and different-priority test cases according to the priorities and competitive attributes of multiple attribution links, if the priorities and / or competitive attributes of the multiple attribution links change, then obtain the updated priorities of the multiple attribution links, and / or obtain the updated competitive attributes of the same-priority attribution links; regenerate the same-priority test cases corresponding to the attribution links of the same priority in the multiple attribution links in the above-mentioned manner of generating the same-priority test cases according to the updated competitive attributes; regenerate the different-priority test cases in the order of the updated priorities of the multiple attribution links from high to low according to the above-mentioned manner of generating the different-priority test cases. This achieves that when requirements are updated, test cases can be regenerated based on the updated priorities and competitive attributes of the attribution links, which can quickly adapt to requirement iterations and improve the flexibility of test case generation.
[0137] Figure 2 is a block diagram of a test case generation device according to an exemplary embodiment. Figure 2 The device includes a configuration acquisition module 21, a same-priority use case generation module 22, and a different-priority use case generation module 23.
[0138] The configuration acquisition module 21 is configured to execute acquisition of multiple attribution links of the test case to be generated and the priority of each attribution link, and to acquire competition attributes of attribution links with the same priority;
[0139] The same-priority test case generation module 22 is configured to generate the same-priority test cases corresponding to the attribution links of the same priority in the multiple attribution links according to the competition attributes of the attribution links of the same priority;
[0140] The different priority use case generation module 23 is configured to execute in order of the priorities of the multiple attribution links from high to low, determine the attribution link of each priority as a winning link in turn, and determine the winning link and each attribution link of a priority lower than the priority as competing links of the winning link, and determine the winning links and competing links of different priorities as different priority test cases.
[0141] Optionally, the different priority use case generation module includes:
[0142] A traversal unit is configured to traverse the priorities in order from high to low, and determine the currently traversed priority as the current priority;
[0143] A winning link determination unit, configured to determine the attributed link corresponding to the current priority as a winning link and a competing link corresponding to the winning link;
[0144] a contention link determination unit, configured to determine an attribution link of each priority lower than the current priority as at least one contention link corresponding to the winning link;
[0145] A different priority test case generating unit is configured to execute a test case of different priorities corresponding to the current priority by determining the winning link, a competing link corresponding to the winning link, and at least one competing link corresponding to the winning link;
[0146] A traversal control unit is configured to traverse the next priority level of the current priority level, determine the next priority level as the new current priority level, and perform the above-mentioned operations of determining the winning link and the competing link and determining the test cases of different priorities until the next priority level of the current priority level is the lowest priority level.
[0147] Optionally, the contention link determination unit is configured to execute:
[0148] Recursively process each attributed link of a priority lower than the current priority to determine at least one competing link corresponding to the winning link.
[0149] Optionally, the contention link determination unit includes:
[0150] A contention link determination subunit is configured to determine each attributed link of the next priority as a contention link corresponding to the winning link of the next priority;
[0151] The recursive control subunit is configured to perform recursive processing on the next priority of the next priority according to the above-mentioned method of determining the competing links, until the next priority recursively reached is the lowest priority and the recursion is terminated, thereby obtaining at least one competing link corresponding to each priority level lower than the current priority level of the winning link.
[0152] Optionally, the same-priority use case generation module includes:
[0153] a same-priority link determination unit, configured to determine the attribution links with the same priority as the same-priority attribution links if the number of attribution links with the same priority among the multiple attribution links is at least two;
[0154] A winning link determination unit is configured to execute, according to the competition attributes of the links attributed to the same priority, assign the winning competition attributes to each of the links attributed to the same priority, and obtain at least two winning links of the same priority;
[0155] A contention link determination unit is configured to determine, for each winning link of the same priority, the attribution link of the same priority as a contention link corresponding to the winning link of the same priority;
[0156] The same-priority case generation unit is configured to determine the winning link and the corresponding competing link of the same priority as the same-priority test case.
[0157] Optionally, the device further comprises:
[0158] A configuration update acquisition module is configured to execute acquisition of updated priorities of the multiple attribution links, and / or acquisition of updated competition attributes of the attribution links with the same priority;
[0159] A same-priority test case regeneration module is configured to regenerate the same-priority test cases corresponding to the attribution links of the same priority in the multiple attribution links according to the updated competitive attributes;
[0160] The different priority test case regeneration module is configured to regenerate different priority test cases in the order of the updated priorities from high to low.
[0161] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0162] Figure 3 3 is a block diagram of an electronic device according to an exemplary embodiment. For example, the electronic device 300 may be provided as a computer or a server. Figure 3 The electronic device 300 includes a processing component 322, which further includes one or more processors, and a memory resource represented by a memory 332 for storing instructions executable by the processing component 322, such as an application. The application stored in the memory 332 may include one or more modules, each corresponding to a set of instructions. In addition, the processing component 322 is configured to execute instructions to perform the above-mentioned test case generation method.
[0163] The electronic device 300 may also include a power supply component 326 configured to perform power management of the electronic device 300, a wired or wireless network interface 350 configured to connect the electronic device 300 to a network, and an input / output (I / O) interface 358. The electronic device 300 may operate based on an operating system stored in the memory 332, such as Windows Server™, Mac OS X™, Unix™, Linux™, FreeBSD™ or the like.
[0164] In an exemplary embodiment, a computer-readable storage medium including instructions is also provided, such as a memory 332 including instructions, and the above instructions can be executed by the processing component 322 of the electronic device 300 to complete the above test case generation method. Optionally, the computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0165] In an exemplary embodiment, a computer program product is also provided, including a computer program or a computer instruction, wherein the computer program or the computer instruction implements the above-mentioned test case generating method when executed by a processor.
[0166] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.
[0167] It should be understood that the present invention is not limited to the exact construction that has been described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present invention is limited only by the appended claims.
Claims
1. A test case generation method, It is characterized in that include: Acquire multiple attribution links of the test case to be generated and the priority of each attribution link, and acquire competition attributes of attribution links with the same priority, wherein the competition attributes are attributes of attribution links with the same priority participating in competition; generate the same-priority test cases corresponding to the attribution links with the same priority in the multiple attribution links according to the competition attributes of the attribution links with the same priority; According to the order of priorities of the multiple attribution links from high to low, the attribution links of each priority are determined as winning links in turn, and the winning link and each attribution link of a priority lower than the priority are determined as competing links of the winning link, and the winning links and competing links of different priorities are determined as test cases of different priorities; The step of generating the same-priority test cases corresponding to the attribution links with the same priority among the multiple attribution links according to the competition attributes of the attribution links with the same priority includes: If the number of attribution links with the same priority among the multiple attribution links is at least two, determining the attribution links with the same priority as attribution links with the same priority; According to the competitive attributes of the links with the same priority, the winning competitive attributes are respectively assigned to each link with the same priority, so as to obtain at least two winning links with the same priority; For each winning link of the same priority, determining the attribution link of the same priority as a competing link corresponding to the winning link of the same priority; The winning link and the corresponding competing link of the same priority are determined as the test cases of the same priority.
2. The method according to claim 1, It is characterized in that According to the order of priorities of the multiple attribution links from high to low, the attribution links of each priority are determined as winning links in turn, and the winning link and each attribution link of a priority lower than the priority are determined as competing links of the winning link, and winning links and competing links of different priorities are determined as test cases of different priorities, including: Traverse the priorities in descending order of priority, and determine the currently traversed priority as the current priority; Determine the attributed link corresponding to the current priority as a winning link and a competing link corresponding to the winning link; Determine an attribution link of each priority lower than the current priority as at least one competing link corresponding to the winning link; Determine the winning link, a competing link corresponding to the winning link, and at least one competing link corresponding to the winning link as different priority test cases corresponding to the current priority; Traverse the next priority level of the current priority level, and determine the next priority level as the new current priority level, and perform the above operations of determining the winning link and the competing link and determining the test cases of different priorities until the next priority level of the current priority level is the lowest priority level.
3. The method according to claim 2, It is characterized in that The step of determining the attribution link of each priority lower than the current priority as the at least one competing link corresponding to the winning link includes: Recursively process each attributed link of a priority lower than the current priority to determine at least one competing link corresponding to the winning link.
4. The method according to claim 3, It is characterized in that The recursive processing of each attributed link with a priority lower than the current priority to determine at least one competing link corresponding to the winning link includes: Determine each attribution link of the next priority as a competing link corresponding to the winning link at the next priority; The next priority of the next priority is recursively processed according to the above method of determining competing links, until the next priority recursively obtained is the lowest priority and the recursion is terminated to obtain at least one competing link corresponding to each priority level lower than the current priority level of the winning link.
5. The method according to any one of claims 1 to 4, It is characterized in that Also includes: Obtaining updated priorities of the multiple attribution links, and / or obtaining updated competition attributes of the attribution links with the same priority; Regenerate test cases of the same priority corresponding to attribution links of the same priority among the multiple attribution links according to the updated competitive attributes; Regenerate test cases of different priorities in the order of the updated priorities from high to low.
6. A test case generating device, It is characterized in that include: A configuration acquisition module is configured to execute acquisition of multiple attribution links of the test case to be generated and the priority of each attribution link, and to acquire competition attributes of attribution links with the same priority, wherein the competition attributes are attributes of attribution links with the same priority participating in competition; A same-priority test case generation module is configured to generate same-priority test cases corresponding to attribution links of the same priority among the multiple attribution links according to competition attributes of the same-priority attribution links; A different priority case generation module is configured to perform, in descending order of the priorities of the multiple attribution links, determining the attribution link of each priority as a winning link in turn, and determining the winning link and each attribution link of a priority lower than the priority as competing links of the winning link, and determining the winning links and competing links of different priorities as different priority test cases; The same priority use case generation module includes: a same-priority link determination unit, configured to determine the attribution links with the same priority as the same-priority attribution links if the number of attribution links with the same priority among the multiple attribution links is at least two; A winning link determination unit is configured to execute, according to the competition attributes of the links attributed to the same priority, assign the winning competition attributes to each of the links attributed to the same priority, and obtain at least two winning links of the same priority; A contention link determination unit is configured to determine, for each winning link of the same priority, the attribution link of the same priority as a contention link corresponding to the winning link of the same priority; The same-priority case generation unit is configured to determine the winning link and the corresponding competing link of the same priority as the same-priority test case.
7. The device according to claim 6, It is characterized in that The different priority use case generation module includes: A traversal unit is configured to traverse the priorities in order from high to low, and determine the currently traversed priority as the current priority; A winning link determination unit, configured to determine the attributed link corresponding to the current priority as a winning link and a competing link corresponding to the winning link; a contention link determination unit, configured to determine an attribution link of each priority lower than the current priority as at least one contention link corresponding to the winning link; A different priority test case generating unit is configured to execute a test case of different priorities corresponding to the current priority by determining the winning link, a competing link corresponding to the winning link, and at least one competing link corresponding to the winning link; A traversal control unit is configured to traverse the next priority level of the current priority level, determine the next priority level as the new current priority level, and perform the above-mentioned operations of determining the winning link and the competing link and determining the test cases of different priorities until the next priority level of the current priority level is the lowest priority level.
8. The device according to claim 7, It is characterized in that The contention link determination unit is configured to execute: Recursively process each attributed link of a priority lower than the current priority to determine at least one competing link corresponding to the winning link.
9. The device according to claim 8, It is characterized in that The contention link determination unit comprises: A contention link determination subunit is configured to determine each attributed link of the next priority as a contention link corresponding to the winning link of the next priority; The recursive control subunit is configured to perform recursive processing on the next priority of the next priority according to the above-mentioned method of determining the competing links, until the next priority recursively reaches the lowest priority and the recursion is terminated, thereby obtaining at least one competing link corresponding to each priority level lower than the current priority level of the winning link.
10. The device according to any one of claims 6 to 9, It is characterized in that The device also includes: A configuration update acquisition module is configured to execute acquisition of updated priorities of the multiple attribution links, and / or acquisition of updated competition attributes of the attribution links with the same priority; A same-priority test case regeneration module is configured to regenerate the same-priority test cases corresponding to the attribution links of the same priority in the multiple attribution links according to the updated competitive attributes; The different priority test case regeneration module is configured to regenerate different priority test cases in the order of the updated priorities from high to low.
11. An electronic device, It is characterized in that include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the test case generation method as described in any one of claims 1 to 5.
12. A computer-readable storage medium, when instructions in the computer storage medium are executed by a processor of an electronic device, enables the electronic device to execute the test case generation method according to any one of claims 1 to 6.
13. A computer program product comprising a computer program or computer instructions, It is characterized in that When the computer program or computer instruction is executed by a processor, the test case generation method according to any one of claims 1 to 5 is implemented.
Citation Information
Patent Citations
Method and device for generating test case
CN101984416A
Software testing method, equipment and readable medium
CN110515833A
Regression test method and device for test case and electronic device
CN112346952A
Test prioritization and dynamic test case sequencing
IN201814009794A
Prioritizing test cases using multiple variables
US20140351793A1
