Test case generation method and device, electronic equipment and storage medium

By obtaining the target parameters and use case parameter values ​​in the step template, and performing logical branch matching to generate test scripts, the problem of low efficiency in the generation of test cases in the existing technology is solved, and efficient generation of automated test cases is achieved.

CN119311574APending Publication Date: 2025-01-14DASHANGSUO FEITAI TESTING TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411213365.2
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-30
Publication Date
2025-01-14

AI Technical Summary

Technical Problem

In the prior art, the generation efficiency of test cases is low, and users need to generate manually, and each test case is reduced, resulting in reduced efficiency.

Method used

By obtaining the target parameters in the step template, logical branch division, matching the use case parameter values, and generating test scripts, the automatic generation of test cases is achieved.

Benefits of technology

It improves the generation efficiency of test cases, realizes automatic generation of test cases, and reduces the complexity and time cost of user manual design.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119311574A_ABST
    Figure CN119311574A_ABST
Patent Text Reader

Abstract

The invention provides a test case generation method and device, electronic equipment and a storage medium, and relates to the technical field of tests.The method comprises the steps that at least one target parameter included in a step template is obtained; the target parameter is a parameter used for performing logic branch division on a step template, the step template is determined based on a target function of the target business, the target function comprises at least one test point, the test points are in one-to-one correspondence with logic branches, and the logic branches are used for representing a test flow of the corresponding test points; aiming at the parameter value set of each use case, searching a target parameter value corresponding to each target parameter in the parameter value set of each use case; determining a target logic branch to which the use case belongs based on at least one target parameter value in all the target parameter values; the test script is generated on the basis of the target logic branches corresponding to all the parameter value sets, the test script is used for generating the test case of the target function, automatic generation of the test case is achieved, and therefore the generation efficiency of the test case is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of testing technology, and in particular to a test case generation method, device, electronic equipment and storage medium. Background Art

[0002] In the process of software development and testing, test cases play a vital role. Test cases are not only the cornerstone of quality assurance, but also a key means to ensure that software products work as expected, meet user needs and comply with industry standards. The design and implementation of test cases aims to verify and evaluate the functionality of the software through a systematic and structured approach.

[0003] In the related art, users are usually required to manually generate each test case, thereby reducing the efficiency of test case generation. Summary of the invention

[0004] The present invention provides a test case generation method, device, electronic device and storage medium, which are used to solve the defect of reducing the generation efficiency of test cases in the prior art.

[0005] The present invention provides a test case generation method, comprising: Acquire at least one target parameter included in the step template; the target parameter is a parameter used to divide the step template into logical branches, the step template is determined based on the target function of the target business, the target function includes at least one test point, the test point corresponds to the logical branch one by one, and the logical branch is used to characterize the test flow of the corresponding test point; For each parameter value set of each use case, searching for a target parameter value corresponding to each target parameter in the parameter value set of the use case; Determine the target logic branch to which the use case belongs based on at least one target parameter value among all the target parameter values; A test script is generated based on the target logic branches corresponding to all the parameter value sets, and the test script is used to generate a test case for the target function.

[0006] According to a test case generation method provided by the present invention, the step of determining a target logic branch to which the test case belongs based on at least one target parameter value among all the target parameter values ​​comprises: Starting from the first target parameter of the step template, matching the target parameter value of the first target parameter in the parameter value set of the use case with the type identification value representing each of the logic branches to obtain each matching result; In a case where a first matching result that matches successfully is included in all the matching results, a logic branch corresponding to the first matching result is determined as a target logic branch to which the use case belongs.

[0007] According to a test case generation method provided by the present invention, the method further includes: When a successful first matching result is not included in all the matching results, the target parameter value of the second target parameter in the parameter value set of the use case is matched with the type identification value representing each other logical branch except the logical branch corresponding to the first matching result to obtain each new matching result, until a successful second matching result is included in all the new matching results, and the logical branch corresponding to the second matching result is determined as the target logical branch to which the use case belongs.

[0008] According to a test case generation method provided by the present invention, the test script is generated based on the target logic branches corresponding to all the parameter value sets, including: For each of the target logic branches, based on the correspondence between the logic branch and the code, calling the initial code corresponding to the target logic branch; Obtain the input parameters required by the initial code; Searching for a parameter value corresponding to the input parameter in a parameter value set of the use case corresponding to the target logic branch; Add the parameter value corresponding to the input parameter to the initial code to obtain the target code corresponding to the target logic branch; The target codes are combined to obtain the test script.

[0009] According to a test case generation method provided by the present invention, the method further includes: receiving each test step block for the target function selected by the user in the step template; Add relevant information of each test step block of the target function in the step template; Based on the target parameters, all test step blocks after adding relevant information are divided into logical branches to obtain logical branches corresponding to the target functions.

[0010] According to a test case generation method provided by the present invention, the method further includes: Receive use case design instructions input by users for use cases; In response to the use case design instruction, displaying a design interface, the design interface including a plurality of parameters corresponding to the use case and a parameter value input box corresponding to each of the parameters; Receiving parameter values ​​input by the user in each of the parameter value input boxes; Based on the parameter values, a parameter value set of the use case is obtained.

[0011] The present invention also provides a test case generating device, comprising: an acquisition unit, configured to acquire at least one target parameter included in a step template; the target parameter is a parameter used to divide the step template into logical branches, the step template is determined based on a target function of a target business, the target function includes at least one test point, the test point corresponds to a logical branch one by one, and the logical branch is used to characterize a test flow of a corresponding test point; A search unit, configured to search for a target parameter value corresponding to each target parameter in the parameter value set of each use case; A first determining unit, configured to determine a target logic branch to which the use case belongs based on at least one target parameter value among all the target parameter values; A generating unit is used to generate a test script based on the target logic branches corresponding to all the parameter value sets, wherein the test script is used to generate a test case for the target function.

[0012] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, any of the test case generation methods described above is implemented.

[0013] The present invention also provides a non-transitory computer-readable storage medium on which a computer program is stored. When the computer program is executed by a processor, the test case generation method described in any one of the above is implemented.

[0014] The present invention also provides a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the test case generating method described above is implemented.

[0015] The test case generation method, device, electronic device and storage medium provided by the present invention obtain at least one target parameter included in the step template for dividing the step template into logical branches, and for the parameter value set of each use case, search for the target parameter value corresponding to each target parameter in the parameter value set of the use case, determine the target logical branch to which the use case belongs based on at least one target parameter value among all the target parameter values, generate a test script based on the target logical branches corresponding to each of all the parameter value sets, and use the test script to generate a test case for the target function, thereby realizing automatic generation of test cases and improving the efficiency of test case generation. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0017] Figure 1 This is one of the flow charts of the test case generation method provided by an embodiment of the present invention.

[0018] Figure 2 It is a logical schematic diagram of a step template provided in an embodiment of the present invention.

[0019] Figure 3 This is the second flowchart of the test case generation method provided in the embodiment of the present invention.

[0020] Figure 4 It is a schematic diagram of the interface of the step template provided in the embodiment of the present invention.

[0021] Figure 5 This is the third flow chart of the test case generation method provided in the embodiment of the present invention.

[0022] Figure 6 This is one of the interface schematic diagrams for baseline creation provided by an embodiment of the present invention.

[0023] Figure 7 This is the second interface schematic diagram of baseline creation provided by an embodiment of the present invention.

[0024] Figure 8 This is the third interface schematic diagram of the baseline creation provided by the embodiment of the present invention.

[0025] Fig. 9 This is one of the interface schematic diagrams of the test design provided by the embodiment of the present invention.

[0026] Fig.10 This is the second interface schematic diagram of the test design provided in the embodiment of the present invention.

[0027] Fig.11 This is the third interface schematic diagram of the test design provided in the embodiment of the present invention.

[0028] Fig.12 This is the fourth interface schematic diagram of the test design provided in the embodiment of the present invention.

[0029] Fig.13 This is the fifth interface schematic diagram of the test design provided in the embodiment of the present invention.

[0030] Fig.14 This is the sixth interface schematic diagram of the test design provided in the embodiment of the present invention.

[0031] Fig.15 This is the seventh interface schematic diagram of the test design provided in the embodiment of the present invention.

[0032] Fig.16 This is the eighth interface schematic diagram of the test design provided in the embodiment of the present invention.

[0033] Fig.17 This is the ninth interface schematic diagram of the test design provided in the embodiment of the present invention.

[0034] Fig.18 It is a schematic diagram of the interface for test case approval provided by an embodiment of the present invention.

[0035] Fig.19 It is a structural schematic diagram of a test case generating device provided by an embodiment of the present invention.

[0036] Fig. 20 It is a schematic diagram of the physical structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0037] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0038] Combine the following Figure 1-Figure 18 The test case generation method of the present invention is described. The execution subject of the test case generation method can be an electronic device such as a terminal, a computer and a server, or a test case generation device set in the electronic device, and the test case generation device can be implemented by software, hardware or a combination of the two.

[0039] Figure 1 FIG. 1 is one of the flow charts of the test case generation method provided by an embodiment of the present invention. Figure 1 As shown, the test case generation method includes the following steps: Step 101, obtain at least one target parameter included in the step template; the target parameter is a parameter used to divide the step template into logical branches, the step template is determined based on the target function of the target business, the target function includes at least one test point, the test point corresponds to the logical branch one by one, and the logical branch is used to characterize the test process of the corresponding test point.

[0040] For example, the user can determine and store the step template including each target function in the target business in advance based on the content of each target function in the target business. When a test case needs to be generated, the step template of the target business is obtained and the step template of the target business is parsed to obtain each target parameter input by the user for logically branching the step template.

[0041] Step 102: for each use case parameter value set, search the parameter value set of the use case for a target parameter value corresponding to each target parameter.

[0042] For example, the user can set various test points for the target function based on the content of the target function, and design a corresponding parameter value set of the use case for each test point. Assuming that the target business is a financial management business, and the target function is a stock buying function, the parameter value set of the use case is shown in Table 1. In Table 1, parameter value sets of use cases 1 to 5 are included, and each parameter value set includes the parameter value of parameter A, the parameter value of parameter B, the parameter value of parameter C, the parameter value of parameter N, the parameter value of parameter M, and the parameter value of the result.

[0043] Table 1

[0044] Since the parameter value sets of the step template and the use case are both for the same target function, the target parameter values ​​corresponding to the target parameters included in the step template can be found in Table 1.

[0045] Step 103: Determine the target logic branch to which the use case belongs based on at least one target parameter value among all the target parameter values.

[0046] For example, when the target parameter value of each target parameter is obtained, each target parameter value is matched with each logic branch to determine the target logic branch to which each use case belongs.

[0047] Step 104: Generate a test script based on the target logic branches corresponding to all the parameter value sets, wherein the test script is used to generate a test case for the target function.

[0048] For example, when determining the target logical branch to which each use case belongs, the code corresponding to each logical branch is called, a test script is generated based on the code corresponding to each logical branch, and a test case is generated based on the test script, and the generated test case is synchronized to the Automation Test Framework (ATF), so that ATF executes the generated test case of the target function.

[0049] The test case generation method provided by the present invention obtains at least one target parameter included in the step template for dividing the logical branches in the step template, searches for the target parameter value corresponding to each target parameter in the parameter value set of each use case for the parameter value set, determines the target logical branch to which the use case belongs based on at least one target parameter value among all the target parameter values, generates a test script based on the target logical branches corresponding to each of all the parameter value sets, and uses the test case to generate a test case for the target function, thereby realizing the automatic generation of test cases and improving the generation efficiency of test cases.

[0050] In one embodiment, the above step 103 determines the target logic branch to which the use case belongs based on at least one target parameter value among all the target parameter values, which can be specifically implemented by the following steps: Starting from the first target parameter of the step template, the target parameter value of the first target parameter in the parameter value set of the use case is matched with the type identification value representing each of the logical branches to obtain each matching result; when all the matching results include a first matching result that is successfully matched, the logical branch corresponding to the first matching result is determined as the target logical branch to which the use case belongs.

[0051] For example, taking the target parameters as N and M, and the logical branches including logical branch 1 with type identification value n2, logical branch 2 with type identification value n1 and M=m1, and logical branch 3 with type identification value n1 and M=m2 as examples, combined with Table 1, starting from the first target parameter N, the target parameter value of target parameter N in use cases 1, 2 and 3 is n1, and the target parameter value of target parameter N in use cases 4 and 5 is n2. Then, the target parameter value n1 and the target parameter value n2 are matched with the type identification values ​​of logical branch 1, logical branch 2 and logical branch 3 respectively. It can be concluded that the target parameter value n2 of target parameter N in use cases 4 and 5 both matches the type identification value of logical branch 1, so it can be determined that the target logical branches to which use cases 4 and 5 belong are both logical branch 1.

[0052] In one embodiment, the above step 103 determines the target logic branch to which the use case belongs based on at least one target parameter value among all the target parameter values, which can be specifically implemented by the following steps: When a successful first matching result is not included in all the matching results, the target parameter value of the second target parameter in the parameter value set of the use case is matched with the type identification value representing each other logical branch except the logical branch corresponding to the first matching result to obtain each new matching result, until a successful second matching result is included in all the new matching results, and the logical branch corresponding to the second matching result is determined as the target logical branch to which the use case belongs.

[0053] For example, the target logical branch to which use cases 1 to 3 belong cannot be determined based only on the target parameter value of target parameter N, that is, to determine that the first matching result that does not include a successful match is not included in all matching results, the second target parameter M needs to be further traversed. The target parameter value of target parameter M in use case 4 is m1, and the target parameter value of target parameter M in use case 5 is m2. However, use cases 4 and 5 have determined their target logical branches based on the target parameter value of target parameter N. Therefore, there is no need to divide use cases 4 and 5 based on the second target parameter M. Only use case 1, use case 2, and use case 3 need to be divided. The target parameter value of M in use cases 1 and 2 is m1, and the target parameter value of target parameter M in use case 3 is m2. Then the target parameter value m1 and the target parameter value m2 are matched with the type identification values ​​of logical branch 2 and logical branch 3 respectively. It can be concluded that the target parameter value of target parameter M in use cases 1 and 2 both match the type identification value of logical branch 2, and the target parameter value of target parameter M in use case 3 matches the type identification value of logical branch 3. Therefore, it can be determined that the target logical branches to which use cases 1 and 2 belong are both logical branch 2, and the target logical branch to which use case 3 belongs is logical branch 3. Figure 2 is a logical diagram of a step template provided in an embodiment of the present invention, such as Figure 2 As shown, the target parameters include N and M, each dotted box corresponds to a logical branch, and it is finally determined that the target logical branches to which use case 4 and use case 5 belong are both logical branch 1, the target logical branches to which use case 1 and use case 2 belong are logical branch 2, and the target logical branches to which use case 3 belongs are both logical branch 3.

[0054] In this embodiment, by traversing the target parameter values ​​of each use case for the target parameters, the logical branch to which each use case belongs is determined based on the matching results of the target parameter values ​​and the type identification values ​​of each logical branch, thereby automatically determining the logical branch to which the use case belongs, and further improving the efficiency of test case generation.

[0055] In one embodiment, the above step 104 generates a test script based on the target logic branches corresponding to all the parameter value sets, which can be specifically implemented by the following steps: For each of the target logic branches, based on the correspondence between the logic branch and the code, call the initial code corresponding to the target logic branch; obtain the input parameters required by the initial code; search for the parameter value corresponding to the input parameter in the parameter value set of the use case corresponding to the target logic branch; add the parameter value corresponding to the input parameter to the initial code to obtain the target code corresponding to the target logic branch; combine the target codes to obtain the test script.

[0056] For example, each logical branch corresponds to a piece of underlying initial code, so when determining the target logical branch to which each use case belongs, for each target logical branch, the initial code corresponding to the target logical branch can be determined based on the correspondence between the logical branch and the code, the initial code can be parsed to determine the input parameters required by the initial code, and the parameter values ​​corresponding to the input parameters required by the initial code can be searched in the parameter value set of the use case corresponding to the target logical branch. For example, if the input parameters required by the initial code are A, B and C, then the parameter value of A, the parameter value of B and the parameter value of C in the parameter value set of the use case are added to the initial code to obtain the target code corresponding to the target logical branch, that is, the complete code, and all the target codes are combined to obtain the test script of the target function, and a test case is generated based on the test script, and the generated test case is synchronized to ATF, so that ATF executes the generated test case of the target function.

[0057] In this embodiment, the initial code corresponding to each target logic branch is called, and the parameter values ​​required for the initial code are automatically added to obtain each target code. All target codes are combined to finally obtain the test script of the target function. Automated test cases are generated based on the test scripts, thereby improving the efficiency of test case generation.

[0058] In one embodiment, Figure 3 FIG. 2 is a flow chart of the test case generation method provided by an embodiment of the present invention. Figure 3 As shown, before the above step 101, the test case generation method further includes the following steps: Step 301: Receive each test step block for the target function selected by the user in the step template.

[0059] For example, based on the analysis of the target function, the user determines the target parameters required for the target function, and inputs the target parameters through an interface, so that the electronic device receives the target parameters input by the user; and based on the analysis of the test points of the target function, determines which test step blocks are required to complete each test point, and inputs the determined test step blocks in sequence through the interface, so that the electronic device receives all test step blocks for the target function input by the user. Figure 4 is a schematic diagram of an interface of a step template provided in an embodiment of the present invention, such as Figure 4 As shown, the user clicks the logic branch control, drags all the test step blocks required for the target function into the step template interface in sequence, and connects all the test step blocks in the order of execution, so that the electronic device receives all the test step blocks for the target function input by the user.

[0060] Step 302: Add relevant information of each test step block of the target function to the step template.

[0061] For example, for each test step block, the user can add corresponding model input parameters, model output parameters, output parameter verification and other related information based on the requirements of the test point.

[0062] Step 303: Based on the target parameters, all the test step blocks after adding the relevant information are divided into logical branches to obtain the logical branches corresponding to the target functions.

[0063] For example, Figure 4 As shown, the target function includes test step block N0001 to test step block N0008. The path from test step block N0006 to test step block N0008 can be divided by the target parameter bsflag. For example, when bsflag is 0S#sell, 11#intend to sell, 15#confirm to sell, 3b#after-hours price sell, the executed test step blocks are test step block N0006 to test step block N0008 in sequence; when bsflag is 08#buy, 10#intend to buy, 14#confirm to buy, 3a#after-hours price buy, the executed test step blocks are test step block N0006 to test step block N0008 in sequence. The steps are test step block N0007 and test step block N0008 in sequence. When bsflag is 0S#sell, 11#intend to sell, 15#confirm to sell, 3b#after-hours price to sell, the logic branch includes test step block N0001 to test step block N0008 executed in sequence. When bsflag is 08#buy, 10#intend to buy, 14#confirm to buy, 3a#after-hours price to buy, the logic branch includes test step block N0001 to test step block N0005, as well as test step block N0007 and test step block N0008 executed in sequence. Figure 2 As shown, logic branch 1 includes test step blocks such as step 01, step 02, step 06 and result 3 in sequence; logic branch 2 includes test step blocks such as step 01, step 02, step 03, step 04 and result 1 in sequence; logic branch 3 includes test step blocks such as step 01, step 02, step 05 and result 2 in sequence.

[0064] In this embodiment, the user can select various test step blocks for the target function in the step template, and build the automated execution process of the target function through the graphical form of the test step blocks. This can be completed by simply dragging and adding relevant information. The user does not need to have code writing knowledge, thereby reducing the complexity of test case generation.

[0065] In one embodiment, Figure 5 FIG. 3 is a flow chart of the test case generation method provided by an embodiment of the present invention. Figure 5 As shown, before the above step 101, the test case generation method further includes the following steps: Step 501: Receive a use case design instruction input by a user for a use case.

[0066] Step 502: In response to the use case design instruction, a design interface is displayed, wherein the design interface includes a plurality of parameters corresponding to the use case and a parameter value input box corresponding to each of the parameters.

[0067] Step 503: receiving the parameter values ​​input by the user in each parameter value input box.

[0068] Step 504: Based on the parameter values, obtain a parameter value set of the use case.

[0069] For example, before conducting software testing, it is very important to define a baseline, because the baseline will provide a clear starting point and reference standard for subsequent testing activities. A baseline usually refers to a stable state of software at a specific development stage (such as functional completion, version release, etc.), including various aspects such as code, documentation, configuration, and environment. Based on this baseline, the test goals and requirements can be clarified, and then the test plan can be designed and executed. Therefore, before software testing, a baseline needs to be created first. Figure 6 is one of the interface schematic diagrams of baseline creation provided by an embodiment of the present invention, such as Figure 6 As shown, the user clicks the test design control of the test management platform, and then clicks the version management control in the test design to enter the version management interface; Figure 7 This is the second schematic diagram of the interface for creating a baseline provided by an embodiment of the present invention. Figure 7 As shown, in the version management interface, the user clicks on the new control to enter the new interface; Figure 8 This is the third interface diagram of baseline creation provided by an embodiment of the present invention, such as Figure 8 As shown in the figure, add relevant information in the edit line of the new interface, then click to complete the editing control, and then click Save to create a version of the baseline. Test design can be added based on the created baseline version. Test design can be added in two ways. The first way is to copy the design, which is suitable for the reuse or modification of existing designs. The second way is to add a new design, which is suitable for completing a new one. Fig. 9 is one of the interface diagrams of the test design provided by the embodiment of the present invention, such as Fig. 9 As shown, for copying a design, first click the design baseline control in the test design, then select the target version of the previously created baseline, then open the baseline pull panel, select the baseline version to copy from in the baseline pull panel, then check the design or directory to copy, right-click the checked design or directory, and click Pull Design to complete the design copy.

[0070] For new designs, Fig.10 This is a second schematic diagram of the test design interface provided by an embodiment of the present invention. Fig.10As shown, first right-click the selected design or directory, and then click the new design control, so that the electronic device receives the use case design instruction input by the user, responds to the use case design instruction, and enters Fig.11 The design interface shown, Fig.11 This is the third interface diagram of the test design provided by the embodiment of the present invention. Fig.11 In the design interface shown, add directory information at each level, fill in the design name, select the requirement number, and finally click Save Control to complete the design of the target level. Fig.12 This is a fourth schematic diagram of the test design interface provided by an embodiment of the present invention, such as Fig.12 As shown, first click the edit control to enter the editing state, add the use case number, fill in the use case number according to the project specifications, and use it to form the use case name for generating ATF. Finally, click to complete the edit control to fill in the use case number. Fig.13 This is a fifth schematic diagram of the test design interface provided by an embodiment of the present invention, such as Fig.13 As shown, first click the edit control to enter the editing state, select the dimension parameter (that is, the parameter corresponding to the use case mentioned above), click to check the dimension parameter to be combined, then click the select parameter value control, the parameter selection interface pops up, then click the parameter value of the combination you want to participate in, and click Finish to complete the filling of the dimension parameter, so that the electronic device receives the parameter value entered by the user in each parameter value input box, and all parameter values ​​constitute the parameter value set of the use case. Further, Fig.14 This is the sixth interface diagram of the test design provided by the embodiment of the present invention, such as Fig.14 As shown, you can also add constraint descriptions, constraint formulas, steps, etc. in the test design interface. Finally, click Add to complete the filling of constraint conditions. The test design can be completed through the above content.

[0071] Fig.15 This is the seventh interface diagram of the test design provided by the embodiment of the present invention, such as Fig.15 As shown, when the test script of the target function is obtained, click the Generate Use Case control to generate the test case of the target function; Fig.16 This is an eighth schematic diagram of the test design interface provided by an embodiment of the present invention, such as Fig.16 As shown, after generating the test case for the target function, click the case synchronization to ATF control so that the generated test case for the target function can be transferred to ATF, so that ATF can execute the generated test case for the target function. Finally, click Save Design Control to complete the entire test case generation process.

[0072] It should be noted that after generating the test cases for the target functions, the test cases need to be reviewed. Fig.17 This is a ninth interface diagram of the test design provided by the embodiment of the present invention. Fig.17As shown, click the test design control in sequence, select the baseline version, select the requirement number, right-click the bond normal purchase function, click the Submit Approval control, and send the test case to the approval department.

[0073] Fig.18 is a schematic diagram of the interface for test case approval provided by an embodiment of the present invention, such as Fig.18 As shown, click the merge management control to enter the merge management interface, where you can review and modify the sent test cases. The review and modification include merge to baseline, reject, and reset. Merge to baseline includes merging the selected content into the baseline, reject includes rejecting the application for merging into the baseline, and reset means rolling back the edited content to the content when the merge application was submitted.

[0074] The embodiments of the present invention form a standardized method for generating automated test cases, which changes the current situation of irregular test case design. Test cases are directly generated through step templates, which is efficient, easy to review and easy to maintain, and greatly saves the test case construction cycle: the automated execution process is built in a graphical form, which can be completed by simply dragging and dropping, with a low entry threshold and can be operated by business personnel.

[0075] The test case generating device provided by the present invention is described below. The test case generating device described below and the test case generating method described above can be referred to each other.

[0076] Fig.19 is a schematic diagram of the structure of a test case generating device provided by an embodiment of the present invention, such as Fig.19 As shown, the test case generating device 1900 includes an acquiring unit 1901, a searching unit 1902, a first determining unit 1903 and a generating unit 1904; wherein: The acquisition unit 1901 is used to acquire at least one target parameter included in the step template; the target parameter is a parameter used to divide the step template into logical branches, the step template is determined based on the target function of the target business, the target function includes at least one test point, the test point corresponds to the logical branch one by one, and the logical branch is used to characterize the test flow of the corresponding test point; A searching unit 1902 is configured to search, for each use case parameter value set, for a target parameter value corresponding to each target parameter in the use case parameter value set; A first determining unit 1903 is configured to determine a target logic branch to which the use case belongs based on at least one target parameter value among all the target parameter values; The generating unit 1904 is used to generate a test script based on the target logic branches corresponding to all the parameter value sets, and the test script is used to generate a test case for the target function.

[0077] The test case generation device provided by the present invention obtains at least one target parameter included in the step template for dividing the logical branches in the step template, searches for the target parameter value corresponding to each target parameter in the parameter value set of each use case for the parameter value set, determines the target logical branch to which the use case belongs based on at least one target parameter value among all the target parameter values, generates a test script based on the target logical branches corresponding to each of all the parameter value sets, and uses the test case to generate a test case for the target function, thereby realizing the automatic generation of test cases and improving the generation efficiency of test cases.

[0078] Based on any of the foregoing embodiments, the first determining unit 1903 is specifically configured to: Starting from the first target parameter of the step template, matching the target parameter value of the first target parameter in the parameter value set of the use case with the type identification value representing each of the logic branches to obtain each matching result; In a case where a first matching result that matches successfully is included in all the matching results, a logic branch corresponding to the first matching result is determined as a target logic branch to which the use case belongs.

[0079] Based on any of the foregoing embodiments, the first determining unit 1903 is further specifically configured to: When a successful first matching result is not included in all the matching results, the target parameter value of the second target parameter in the parameter value set of the use case is matched with the type identification value representing each other logical branch except the logical branch corresponding to the first matching result to obtain each new matching result, until a successful second matching result is included in all the new matching results, and the logical branch corresponding to the second matching result is determined as the target logical branch to which the use case belongs.

[0080] Based on any of the above embodiments, the generating unit 1904 is specifically used for: For each of the target logic branches, based on the correspondence between the logic branch and the code, calling the initial code corresponding to the target logic branch; Obtain the input parameters required by the initial code; Searching for a parameter value corresponding to the input parameter in a parameter value set of the use case corresponding to the target logic branch; Add the parameter value corresponding to the input parameter to the initial code to obtain the target code corresponding to the target logic branch; The target codes are combined to obtain the test script.

[0081] Based on any of the above embodiments, the test case generating device 1900 further includes: A first receiving unit, configured to receive each test step block for the target function selected by the user in the step template; An adding unit, used for adding relevant information of each test step block of the target function in the step template; The division unit is used to divide all the test step blocks after adding relevant information into logical branches based on the target parameters to obtain the logical branches corresponding to the target functions.

[0082] Based on any of the above embodiments, the test case generating device 1900 further includes: A second receiving unit, configured to receive a use case design instruction input by a user for the use case; A display unit, configured to display a design interface in response to the use case design instruction, wherein the design interface includes a plurality of parameters corresponding to the use case and a parameter value input box corresponding to each of the parameters; A third receiving unit, used to receive parameter values ​​input by the user in each of the parameter value input boxes; The second determining unit is used to obtain a parameter value set of the use case based on each of the parameter values.

[0083] Fig. 20 is a schematic diagram of the physical structure of an electronic device provided by an embodiment of the present invention, such as Fig. 20 As shown, the electronic device may include: a processor 2010, a communication interface 2020, a memory 2030 and a communication bus 2040, wherein the processor 2010, the communication interface 2020 and the memory 2030 communicate with each other through the communication bus 2040. The processor 2010 may call the logic instructions in the memory 2030 to execute the test case generation method, the method comprising: obtaining at least one target parameter included in the step template; the target parameter is a parameter used to divide the step template into logical branches, the step template is determined based on the target function of the target business, the target function includes at least one test point, the test point corresponds to the logical branch one by one, and the logical branch is used to characterize the test flow of the corresponding test point; for the parameter value set of each use case, searching the target parameter value corresponding to each target parameter in the parameter value set of the use case; determining the target logical branch to which the use case belongs based on at least one target parameter value among all the target parameter values; generating a test script based on the target logical branches corresponding to each of the parameter value sets, the test script is used to generate a test case for the target function.

[0084] In addition, the logic instructions in the above-mentioned memory 2030 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention can be essentially or partly embodied in the form of a software product that contributes to the prior art. The computer software product is stored in a storage medium, including several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.

[0085] On the other hand, the present invention also provides a computer program product, which includes a computer program, which can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer can execute the test case generation method provided by the above methods, the method including: obtaining at least one target parameter included in a step template; the target parameter is a parameter used to divide the step template into logical branches, the step template is determined based on the target function of the target business, the target function includes at least one test point, the test point corresponds to a logical branch one by one, and the logical branch is used to characterize the test process of the corresponding test point; for each use case parameter value set, searching the parameter value set of the use case for the target parameter corresponding to each target parameter; determining the target logical branch to which the use case belongs based on at least one target parameter value among all the target parameter values; generating a test script based on the target logical branches corresponding to each of the parameter value sets, the test script is used to generate a test case for the target function.

[0086] On the other hand, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to execute the test case generation method provided by the above-mentioned methods, the method comprising: obtaining at least one target parameter included in a step template; the target parameter is a parameter used to divide the step template into logical branches, the step template is determined based on the target function of the target business, the target function includes at least one test point, the test point corresponds one-to-one to the logical branch, and the logical branch is used to characterize the test process of the corresponding test point; for the parameter value set of each use case, searching the parameter value set of the use case for the target parameter corresponding to each target parameter; determining the target logical branch to which the use case belongs based on at least one target parameter value among all the target parameter values; generating a test script based on the target logical branches corresponding to each of the parameter value sets, the test script being used to generate a test case for the target function.

[0087] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0088] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0089] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A test case generation method, characterized in that: include: Obtaining at least one target parameter included in the step template; The target parameter is a parameter used to divide the step template into logical branches, the step template is determined based on the target function of the target business, the target function includes at least one test point, the test point corresponds to the logical branch one by one, and the logical branch is used to characterize the test flow of the corresponding test point; For each parameter value set of each use case, searching for a target parameter value corresponding to each target parameter in the parameter value set of the use case; Determine the target logic branch to which the use case belongs based on at least one target parameter value among all the target parameter values; A test script is generated based on the target logic branches corresponding to all the parameter value sets, and the test script is used to generate a test case for the target function.

2. The test case generation method according to claim 1, characterized in that: The determining the target logic branch to which the use case belongs based on at least one target parameter value among all the target parameter values ​​comprises: Starting from the first target parameter of the step template, matching the target parameter value of the first target parameter in the parameter value set of the use case with the type identification value representing each of the logic branches to obtain each matching result; In a case where a first matching result that matches successfully is included in all the matching results, a logic branch corresponding to the first matching result is determined as a target logic branch to which the use case belongs.

3. The test case generation method according to claim 2, characterized in that: The method further comprises: When a successful first matching result is not included in all the matching results, the target parameter value of the second target parameter in the parameter value set of the use case is matched with the type identification value representing each other logical branch except the logical branch corresponding to the first matching result to obtain each new matching result, until a successful second matching result is included in all the new matching results, and the logical branch corresponding to the second matching result is determined as the target logical branch to which the use case belongs.

4. The test case generation method according to claim 1, characterized in that: The generating of the test script based on the target logic branches corresponding to all the parameter value sets respectively includes: For each of the target logic branches, based on the correspondence between the logic branch and the code, calling the initial code corresponding to the target logic branch; Obtain the input parameters required by the initial code; Searching for a parameter value corresponding to the input parameter in a parameter value set of the use case corresponding to the target logic branch; Add the parameter value corresponding to the input parameter to the initial code to obtain the target code corresponding to the target logic branch; The target codes are combined to obtain the test script.

5. The test case generation method according to any one of claims 1 to 4, characterized in that: The method further comprises: receiving each test step block for the target function selected by a user in the step template; Add relevant information of each test step block of the target function in the step template; Based on the target parameters, all test step blocks after adding relevant information are divided into logical branches to obtain logical branches corresponding to the target functions.

6. The test case generation method according to any one of claims 1 to 4, characterized in that: The method further comprises: Receive use case design instructions input by users for use cases; In response to the use case design instruction, displaying a design interface, the design interface including a plurality of parameters corresponding to the use case and a parameter value input box corresponding to each of the parameters; Receiving parameter values ​​input by the user in each of the parameter value input boxes; Based on the parameter values, a parameter value set of the use case is obtained.

7. A test case generating device, characterized in that: include: An acquisition unit, configured to acquire at least one target parameter included in the step template; The target parameter is a parameter used to divide the step template into logical branches, the step template is determined based on the target function of the target business, the target function includes at least one test point, the test point corresponds to the logical branch one by one, and the logical branch is used to characterize the test flow of the corresponding test point; A search unit, configured to search for a target parameter value corresponding to each target parameter in the parameter value set of each use case; A first determining unit, configured to determine a target logic branch to which the use case belongs based on at least one target parameter value among all the target parameter values; A generating unit is used to generate a test script based on the target logic branches corresponding to all the parameter value sets, wherein the test script is used to generate a test case for the target function.

8. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the test case generating method according to any one of claims 1 to 6 is implemented.

9. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the test case generating method according to any one of claims 1 to 6 is implemented.

10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the test case generating method according to any one of claims 1 to 6 is implemented.