A test case generation method, device, electronic device and storage medium
By generating and training a test case model based on business systems, and automatically generating a target test case set, the problems of incomplete coverage and poor generalization of test cases in the prior art are solved, and wider applicability and coverage are achieved.
Patent Information
- Application Number
- CN202111572818.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-12-21
- Publication Date
- 2025-06-17
- Estimated Expiration
- 2041-12-21
AI Technical Summary
The prior art is prone to incomplete coverage of functions or requirements when generating test cases, and the generated test cases are poorly versatile and are only applicable to specific programming languages and/or specific business systems.
By determining the target business system and its atomic modules, a first configuration set and a second configuration set are generated, and the test case model is trained using these configuration sets to automatically generate the target test case set.
Improves the universality of test cases, avoids the incomplete coverage problems that may arise when writing test cases manually, and is suitable for a variety of programming languages and business systems.
Smart Images

Figure CN114328201B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of software testing, and particularly to a test case generation method, an apparatus, an electronic device, and a storage medium. Background Art
[0002] Testing is a crucial part in the application software project cycle. When the application software is launched or delivered, the quality and functions of the application software are generally verified by testing the application software. Specifically, the method for testing the application software includes: determining test requirements according to the application software; generating test cases according to the test requirements; executing the generated test cases; after the test cases are executed, analyzing the execution results of the test cases, and finally determining whether the application software to be tested meets the conditions for being launched or delivered according to the obtained execution results.
[0003] The disadvantages or deficiencies of the above method for testing application software include that when testing the application software by using the above method, there are problems such as incomplete coverage of functions or requirements due to manual writing of test cases, and poor generality due to the generated test cases being only applicable to specific programming languages and / or specific business systems. Summary of the Invention
[0004] In view of the problems in the prior art, embodiments of the present disclosure provide a test case generation method, an apparatus, an electronic device, and a storage medium.
[0005] The present disclosure provides a test case generation method, including:
[0006] Determine a target business system, and determine atomic modules that make up the target business system. Based on the atomic modules, generate a first configuration set; wherein, the first configuration set includes multiple first value combinations;
[0007] Input the first value combinations corresponding to the atomic modules with dependency relationships into a test case model set respectively to generate a target test case set corresponding to the target business system;
[0008] Wherein, the test case model set includes multiple test case models, the test case models correspond to the atomic modules one by one, and the test case models are obtained by training according to second value combinations included in a second configuration set. The second configuration set includes multiple second value combinations, and the second configuration set is generated by a function factor module based on the atomic modules.
[0009] According to the test case generation method provided by the present disclosure, the generating the first configuration set based on the atomic modules includes:
[0010] Obtain the first configuration item of the atomic module, and obtain the basic value data of the first configuration item;
[0011] Based on a preset combined test tool, process the basic value data to generate the first configuration set including a plurality of the first value combinations.
[0012] According to a test case generation method provided by the present disclosure, the function factor module is generated by the following method:
[0013] Determine the dependent atomic module and the dependent-on atomic module among the atomic modules having a dependency relationship;
[0014] Determine the dependent configuration item corresponding to the dependent atomic module in the first configuration item, and obtain the function execution result obtained by executing the dependent-on atomic module;
[0015] Add the dependent configuration item corresponding to the dependent atomic module and the function execution result to the dependent atomic module to obtain the function factor module.
[0016] According to a test case generation method provided by the present disclosure, the generation of the second configuration set includes:
[0017] Obtain the second configuration item of the function factor module, and obtain the target value data of the second configuration item;
[0018] Based on the preset combined test tool, process the target value data to generate the second configuration set including a plurality of the second value combinations.
[0019] According to a test case generation method provided by the present disclosure, the step of respectively inputting the first value combinations corresponding to the atomic modules having a dependency relationship into the test case model set to generate the target test case set corresponding to the target business system includes:
[0020] Determine the dependent configuration item corresponding to the dependent-on atomic module in the first configuration item, add it to the first value combination corresponding to the dependent-on atomic module, and input the obtained data result into the test case model corresponding to the dependent-on atomic module to generate a service execution result;
[0021] Input the service execution result, the first value combination corresponding to the dependent atomic module, and the dependent configuration item corresponding to the dependent atomic module into the test case model corresponding to the dependent atomic module respectively to generate the target test case set corresponding to the target business system.
[0022] The present disclosure also provides a test case generation device, including:
[0023] A determining unit, configured to determine a target business system, determine atomic modules that make up the target business system, and generate a first configuration set based on the atomic modules; wherein, the first configuration set includes multiple first value combinations;
[0024] A generating unit, configured to respectively input the first value combinations corresponding to the atomic modules with dependency relationships into a test case model set, and generate a target test case set corresponding to the target business system;
[0025] Wherein, the test case model set includes multiple test case models, the test case models correspond to the atomic modules one by one, and the test case models are obtained by training according to second value combinations included in a second configuration set, the second configuration set includes multiple second value combinations, and the second configuration set is generated by a function factor module based on the atomic modules.
[0026] According to a test case generation device provided by the present disclosure, the determining unit includes:
[0027] An obtaining subunit, configured to obtain a first configuration item of the atomic module, and obtain basic value data of the first configuration item;
[0028] A generating subunit, configured to process the basic value data based on a preset combinatorial testing tool, and generate the first configuration set including multiple first value combinations.
[0029] According to a test case generation device provided by the present disclosure, the device further includes: a function factor module generation unit, configured to:
[0030] Determine a dependent atomic module and a dependent-on atomic module among the atomic modules with dependency relationships;
[0031] Determine a dependent configuration item corresponding to the dependent atomic module in the first configuration item, and obtain a function execution result obtained by executing the dependent-on atomic module;
[0032] Add the dependent configuration item corresponding to the dependent atomic module and the function execution result to the dependent atomic module to obtain the function factor module.
[0033] According to a test case generation device provided by the present disclosure, the device further includes: a second configuration set generation unit, configured to:
[0034] Obtain a second configuration item of the function factor module, and obtain target value data of the second configuration item;
[0035] Based on the preset combined test tool, process the target value data to generate the second configuration set including a plurality of the second value combinations.
[0036] According to a test case generation device provided by the present disclosure, the generation unit includes:
[0037] A determination subunit, configured to determine the dependency configuration items corresponding to the dependent atomic modules in the first configuration items, add them to the first value combination corresponding to the dependent atomic modules, and input the obtained data result into the test case model corresponding to the dependent atomic modules to generate a service execution result;
[0038] A generation subunit, configured to respectively input the service execution result, the first value combination corresponding to the dependent atomic module, and the dependency configuration items corresponding to the dependent atomic module into the test case model corresponding to the dependent atomic module to generate the target test case set corresponding to the target service system.
[0039] The present disclosure also provides an electronic device, including a memory, a processor, and a computer program stored on the memory and executable on the processor. When the processor executes the program, the steps of any one of the above-mentioned test case generation methods are implemented.
[0040] The present disclosure 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 steps of any one of the above-mentioned test case generation methods are implemented.
[0041] A test case generation method, device, electronic device, and storage medium provided by the present disclosure determine a target service system, determine atomic modules that make up the target service system, and generate a first configuration set based on the atomic modules; wherein, the first configuration set includes a plurality of first value combinations; input the first value combinations corresponding to the atomic modules with dependency relationships into a set of test case models respectively to automatically generate a target test case set corresponding to the target service system; avoiding problems that may occur when writing test cases manually, and the situation that test cases generated by using conventional test case generation techniques are only applicable to specific programming languages and / or specific service systems, and improving its versatility. Description of the Drawings
[0042] In order to more clearly illustrate the technical solutions in the present disclosure or the prior art, the following will briefly introduce the drawings required for use in the embodiments or the prior art description. Obviously, the drawings in the following description are some embodiments of the present disclosure. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0043] Figure 1 It is a schematic flowchart of a test case generation method provided by an embodiment of the present disclosure;
[0044] Figure 2 It is a schematic flowchart of training a test case model in the test case generation method provided by an embodiment of the present disclosure;
[0045] Figure 3 It is a schematic flowchart of generating a first configuration set in the test case generation method provided by an embodiment of the present disclosure;
[0046] Figure 4 It is a schematic flowchart of obtaining a functional factor module in the test case generation method provided by an embodiment of the present disclosure;
[0047] Figure 5 It is an example diagram of obtaining a functional factor module in the test case generation method provided by an embodiment of the present disclosure;
[0048] Figure 6 It is a schematic flowchart of generating a second configuration set in the test case generation method provided by an embodiment of the present disclosure;
[0049] Figure 7 It is an example diagram of the application of an atomic module in the test case generation method provided by an embodiment of the present disclosure;
[0050] Figure 8 It is a schematic flowchart of generating a target test case set in the test case generation method provided by an embodiment of the present disclosure;
[0051] Figure 9 It is an example diagram of generating a target test case set in the test case generation method provided by an embodiment of the present disclosure;
[0052] Figure 10 It is a schematic structural diagram of a test case generation device provided by an embodiment of the present disclosure;
[0053] Figure 11 It is a schematic hardware structure diagram of an electronic device provided by an embodiment of the present disclosure. Detailed implementation manners
[0054] To make the objectives, technical solutions, and advantages of the embodiments of the present disclosure clearer, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present disclosure. Apparently, the described embodiments are some, but not all, of the embodiments of the present disclosure. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in the present disclosure without creative efforts shall fall within the protection scope of the embodiments of the present disclosure.
[0055] The accompanying drawings are for illustration only and are not drawn to scale. As used herein, the terms "preferred" and similar terms are used to indicate approximation rather than degree, and are intended to account for the inherent deviations in measured or calculated values that would be recognized by a person of ordinary skill in the art. It should be noted that in this specification, the expressions such as "first", "second", "third", etc. are only used to distinguish one feature from another, and do not represent any limitation on the features, especially not any order of precedence.
[0056] It should also be understood that expressions such as "including", "including having", "containing" and / or "containing having" in this specification are open-ended rather than closed-ended expressions, which mean that the stated features, elements and / or components exist, but do not exclude the existence of one or more other features, elements, components and / or their combinations. In addition, when describing the embodiments of the present application, the use of "may" means "one or more embodiments of the present application". And the term "exemplary" is intended to refer to an example or illustration.
[0057] Unless otherwise defined, all terms used herein (including engineering terms and scientific and technical terms) have the same meaning as commonly understood by a person of ordinary skill in the art to which this application belongs. It should also be understood that unless clearly stated in this application, words defined in a common dictionary should be interpreted as having a meaning consistent with their meaning in the context of the related art, and should not be interpreted in an idealized or overly formal sense.
[0058] To solve the problems existing in the prior art, embodiments of the present disclosure provide a test case generation method, an apparatus, an electronic device, and a storage medium.
[0059] First, the noun terms involved in one or more embodiments of the present disclosure are explained.
[0060] The target business system refers to a business system in which the configuration items included have multiple dependencies and multiple functions.
[0061] An atomic module refers to the smallest functional unit obtained by splitting the target business system, with several functions being independent of each other and including a finite number of discrete configuration items.
[0062] Combinatorial testing is a method for generating test cases. It abstracts the application under test as a system affected by multiple factors; among them, the values of each factor are discrete and finite.
[0063] The preset combinatorial testing tool refers to PICT (Pairwise Independent Combinatorial Testing tool, a tool for automatically generating test cases).
[0064] Figure 1 It is a schematic flowchart of a test case generation method provided according to an embodiment of the present disclosure. As Figure 1 shown, the method includes:
[0065] Step 101, determine the target business system, determine the atomic modules that make up the target business system, and generate a first configuration set based on the atomic modules.
[0066] Among them, the first configuration set includes multiple first value combinations.
[0067] Specifically, determining the atomic modules that make up the target business system means splitting the target business system to obtain multiple atomic modules with independent functions and containing limited discrete configuration items that make up the target business system.
[0068] Correspondingly, the first configuration set refers to a data set obtained by processing the values of at least one configuration item included in the atomic modules that make up the target business system.
[0069] Step 102, respectively input the first value combinations corresponding to the atomic modules with dependency relationships into the test case model set to generate a target test case set corresponding to the target business system.
[0070] Among them, the test case model set includes multiple test case models. The test case models correspond to the atomic modules one by one, and the test case models are obtained by training according to the second value combinations included in the second configuration set. The second configuration set includes multiple second value combinations, and the second configuration set is generated by a functional factor module based on the atomic modules.
[0071] Specifically, the atomic modules with dependency relationships refer to at least two atomic modules with dependency relationships among the atomic modules that make up the target business system.
[0072] The target test case set corresponding to the target business system refers to the set of all target test cases used to test the target business system.
[0073] Furthermore, the second configuration set refers to a data set obtained by processing the values of at least one configuration item included in the functional factor module based on the atomic modules.
[0074] Based on the above embodiments, the test case generation method provided by the present invention automatically generates a target test case set by respectively inputting the first value combinations corresponding to the atomic modules with dependency relationships into the test case model set, avoiding the problems that may occur when writing test cases manually, and the situation that the test cases generated by using conventional test case generation technologies are only applicable to specific programming languages and / or specific business systems, and improving its versatility.
[0075] Preferably, based on the above embodiments, the process of training a test case generation model will be described.
[0076] Based on the above embodiments, Figure 2 is a schematic flowchart of training a test case model in a test case generation method provided according to an embodiment of the present disclosure. As Figure 2 shown, the process of training a test case model includes:
[0077] Specifically, as Figure 2 shown, based on atomic modules 1, 2, 3... n, functional factor modules 1, 2, 3... n (n is a positive integer) are respectively obtained.
[0078] Further, the values in at least one configuration item respectively included in the functional factor modules 1, 2, 3... n (n is a positive integer) are processed to respectively obtain second configuration sets 1, 2, 3... n (n is a positive integer). Among them, the second configuration sets 1, 2, 3... n (n is a positive integer) respectively include multiple second value combinations.
[0079] Further, a machine learning model is trained using the multiple second value combinations respectively included in the second configuration sets 1, 2, 3... n (n is a positive integer) to respectively obtain test case models 1, 2, 3... n (n is a positive integer).
[0080] Furthermore, a test case model set is composed of n (n is a positive integer) test case models.
[0081] Based on the above embodiments, Figure 3 is a schematic flowchart of generating a first configuration set in a test case generation method provided according to an embodiment of the present disclosure. As Figure 3 shown, the process of generating a first configuration set includes:
[0082] Step 301, obtain the first configuration item of the atomic module and obtain the basic value data of the first configuration item.
[0083] Specifically, the first configuration item refers to a parameter item that is independent and discrete within the atomic module and includes multiple values.
[0084] Correspondingly, the basic value data refers to all the enumerable value data included in the first configuration item.
[0085] Step 302, based on a preset combinatorial testing tool, process the basic value data to generate a first configuration set including multiple first value combinations.
[0086] Exemplarily, if the basic value data includes a, b, and c; d, e, and f; g and h; then using PICT to process the basic value data a, b, and c, the basic value data d, e, and f, and the basic value data g and h, the first value combinations such as a, d, and g; the first value combination c, e, and g; the first value combination b, d, and h; and the first value combination a, e, and h can be obtained; furthermore, the first configuration set is formed by combining the first value combinations such as a, d, and g; the first value combination c, e, and g; the first value combination b, d, and h; and the first value combination a, e, and h, etc.
[0087] Based on the above embodiments, inputting the multiple first value combinations included in the first configuration set into the test case model set one by one can automatically generate the target test case set corresponding to the target business system.
[0088] Based on the above embodiments, Figure 4 is a schematic flowchart of obtaining the function factor module in the test case generation method provided by an embodiment of the present disclosure. As Figure 4 shown, the process of obtaining the function factor module includes:
[0089] Step 401, determine the dependent atomic module and the dependent-on atomic module in the atomic modules with a dependency relationship.
[0090] Exemplarily, if the atomic modules include atomic module A and atomic module B, and atomic module A depends on atomic module B, then atomic module A belongs to the dependent atomic module, and atomic module B belongs to the dependent-on atomic module.
[0091] Step 402, determine the dependent configuration item corresponding to the dependent atomic module in the first configuration item, and obtain the function execution result obtained by executing the dependent-on atomic module.
[0092] Specifically, the dependent configuration item refers to one or more items in the first configuration item corresponding to the dependent-on atomic module on which the dependent atomic module depends.
[0093] Exemplarily, if the first configuration item corresponding to the dependent-on atomic module includes the first configuration item A, the first configuration item B, the first configuration item C, and the first configuration item D, and the dependent atomic module depends on the first configuration item A, then the first configuration item A is the dependent configuration item of the dependent atomic module.
[0094] The function execution result refers to the execution result obtained after compiling and executing the dependent-on atomic module.
[0095] Step 403, add the dependent configuration item corresponding to the dependent atomic module and the function execution result to the dependent atomic module to obtain the function factor module.
[0096] Based on the above embodiments, by generating the functional factor module, all configurable paths dependent on the atomic modules can be summarized.
[0097] Preferably, in combination with specific application examples, the process of obtaining the functional factor module can be described.
[0098] Based on the above embodiments, Figure 5 is an example diagram of obtaining the functional factor module in the test case generation method provided by an embodiment of the present disclosure. As Figure 5 shown, the example of obtaining the functional factor module includes:
[0099] Specifically, as Figure 5 shown, determine the target business system, and split the target business system to obtain atomic modules 1, atomic modules 2, atomic modules 3... atomic modules n (n is a positive integer) that are functionally independent and constitute the target business system.
[0100] Correspondingly, among the atomic modules that make up the target business system, determine the atomic modules with a dependency relationship as the dependent atomic module 1 and the dependent atomic module 2.
[0101] Further, the first configuration items of the dependent atomic module 1 include the first configuration item A, the first configuration item B, etc. The first configuration items of the dependent atomic module 2 include the first configuration item 1, the first configuration item 2, etc.
[0102] Further, if the dependency configuration item of the dependent atomic module 2 is the first configuration item A, and after compiling and executing the dependent atomic module 1, the execution result of the dependent atomic module 1 is obtained.
[0103] Further, add the first configuration item A and the execution result of the dependent atomic module 1 to the dependent atomic module 2. Furthermore, the functional factor module 2 corresponding to the dependent atomic module 2 is formed by combining the first configuration item A, the execution result of the dependent atomic module 1, and the first configuration item 1, the first configuration item 2, etc. included in the dependent atomic module 2.
[0104] Based on the above embodiments, Figure 6 is a schematic flowchart of generating the second configuration set in the test case generation method provided by an embodiment of the present disclosure. As Figure 6 shown, the process of generating the second configuration set includes:
[0105] Step 601, obtain the second configuration items of the functional factor module, and obtain the target value data of the second configuration items.
[0106] Specifically, the second configuration item refers to a parameter item that is independent and discrete within the functional factor module and contains multiple values.
[0107] Correspondingly, the target value data refers to all the enumerable value data included in the second configuration item.
[0108] Step 602: Based on a preset combined testing tool, process the target value data to generate a second configuration set including multiple second value combinations.
[0109] Exemplarily, if the target value data includes i, j, and k, l, m, and n, o, and p; then use PICT to process the target value data i, j, and k, the target value data l, m, and n, and the target value data o, and p, and the second value combinations i, l, and o, the second value combination k, m, and o, the second value combination j, l, and p, and the second value combination j, m, and p, etc. can be obtained; furthermore, the second configuration set is formed by combining the second value combinations i, l, and o, the second value combination k, m, and o, the second value combination j, l, and p, and the second value combination j, m, and p, etc.
[0110] Based on the above embodiments, the second value combinations included in the generated second configuration set can be used to train and generate a test case model; at the same time, the training accuracy of the test case model is improved.
[0111] Preferably, in combination with the above embodiments, the specific application of the atomic module can be described.
[0112] Based on the above embodiments, Figure 7 is an application example diagram of the atomic module in the test case generation method provided according to an embodiment of the present disclosure. As Figure 7 shown, the process of generating the second configuration set includes:
[0113] Specifically, as Figure 7 shown, the atomic module i (i is a positive integer) is one of all the atomic modules that make up the target business system. And the atomic module i includes the first configuration item 1, the first configuration item 2... the first configuration item n (n is a positive integer).
[0114] Correspondingly, obtain all the first configuration items of the atomic module i, and obtain the basic value data of all the first configuration items, and process the obtained basic value data based on PICT to generate a first configuration set; wherein, the first configuration set includes the first value combination 1, the first value combination 2, etc.
[0115] Further, determine the dependency configuration items of the atomic module i and the dependent modules it depends on, and obtain the function execution results obtained by executing the dependent atomic modules. Add the dependency configuration items and the function execution results of the dependent atomic modules to the atomic module i to obtain the function factor module i. Moreover, the function factor module i includes the second configuration item 1, the second configuration item 2... the second configuration item n (n is a positive integer), the dependency configuration items, and the function execution results of the dependent atomic modules. It should be noted that the dependency configuration items and the function execution results of the dependent atomic modules also belong to the second configuration items.
[0116] Correspondingly, obtain all the second configuration items of the function factor module i, and obtain the target value data of all the second configuration items. Process the obtained target value data based on PICT to generate the second configuration set; wherein, the second configuration set includes the second value combination 1, the second value combination 2, etc.
[0117] Further, use the second value combinations 1, 2, etc. included in the second configuration set to train the machine learning model, and correspondingly obtain the test case model i.
[0118] Based on the above embodiments, Figure 8 is a schematic flowchart of generating a target test case set in the test case generation method provided according to an embodiment of the present disclosure. As Figure 8 shown, the process of generating the target test case set includes:
[0119] Step 801, determine the dependency configuration items corresponding to the dependent atomic modules in the first configuration item, add them to the first value combination corresponding to the dependent atomic modules, and input the obtained data result into the test case model corresponding to the dependent atomic modules to generate the service execution result.
[0120] Step 802, input the service execution result, the first value combination corresponding to the dependent atomic modules, and the dependency configuration items corresponding to the dependent atomic modules into the test case model corresponding to the dependent atomic modules respectively to generate the target test case set corresponding to the target service system.
[0121] Based on the above embodiments, by inputting the service execution result, the first value combination corresponding to the dependent atomic modules, and the dependency configuration items corresponding to the dependent atomic modules into the test case model corresponding to the dependent atomic modules respectively, the target test case set is automatically generated, avoiding the problems that may occur when manually writing test cases, and the situation that the test cases generated by using the conventional test case generation technology are only applicable to specific programming languages and / or specific service systems, improving its versatility.
[0122] Preferably, specific application examples can be combined to describe the process of generating the target test case set.
[0123] Based on the above embodiments, Figure 9 is an example diagram for generating a target test case set in the test case generation method provided according to an embodiment of the present disclosure. As Figure 9 shown, the example of generating a target test case set includes:
[0124] Specifically, as Figure 9 shown, there is a dependency relationship between atomic module i and atomic module j in the target business system, and atomic module j is the dependent atomic module, and the dependent atomic module it depends on is atomic module i.
[0125] Correspondingly, determine the dependency configuration item corresponding to atomic module i in the first configuration item, add it to the first value combination in the first configuration set corresponding to atomic module i, and input the obtained data result into the test case model i corresponding to atomic module i to generate a service execution result.
[0126] Furthermore, input the service execution result output by the test case model i, the first value combination in the first configuration set corresponding to atomic module j, and the dependency configuration item corresponding to atomic module j into the test case model j corresponding to atomic module j respectively to generate the target test case set corresponding to the target business system.
[0127] Based on the above embodiments, Figure 10 is a schematic structural diagram of a test case generation device provided according to an embodiment of the present disclosure. As Figure 10 shown, the test case generation device includes a determination unit 1010 and a generation unit 1020.
[0128] The determination unit 1010 is configured to determine a target business system, determine the atomic modules that make up the target business system, and generate a first configuration set based on the atomic modules; wherein, the first configuration set includes multiple first value combinations.
[0129] Among them, the determination unit 1010 includes: an acquisition subunit and a generation subunit.
[0130] The acquisition subunit is configured to acquire the first configuration item of the atomic module and acquire the basic value data of the first configuration item.
[0131] The generation subunit is configured to process the basic value data based on a preset combinatorial testing tool to generate a first configuration set including multiple first value combinations.
[0132] The generation unit 1020 is configured to input the first value combinations corresponding to the atomic modules with dependency relationships into the test case model set respectively to generate the target test case set corresponding to the target business system;
[0133] Among them, the test case model set includes multiple test case models. The test case models correspond to the atomic modules one by one, and the test case models are obtained by training according to the second value combinations included in the second configuration set. The second configuration set includes multiple second value combinations, and the second configuration set is generated by the functional factor module based on the atomic modules.
[0134] Optionally, the device further includes: a functional factor module generation unit, configured to: determine the dependent atomic module and the dependent-on atomic module in the atomic modules with dependency relationships;
[0135] determine the dependent configuration item corresponding to the dependent atomic module in the first configuration item, and obtain the functional execution result obtained by executing the dependent-on atomic module;
[0136] add the dependent configuration item corresponding to the dependent atomic module and the functional execution result to the dependent atomic module to obtain the functional factor module.
[0137] Optionally, the device further includes: a second configuration set generation unit, configured to: obtain the second configuration item of the functional factor module, and obtain the target value data of the second configuration item;
[0138] Based on a preset combinatorial testing tool, process the target value data to generate a second configuration set including multiple second value combinations.
[0139] Optionally, the generation unit 1020 includes: a determination subunit and a generation subunit.
[0140] The determination subunit is configured to determine the dependent configuration item corresponding to the dependent-on atomic module in the first configuration item, add it to the first value combination corresponding to the dependent-on atomic module, and input the obtained data result into the test case model corresponding to the dependent-on atomic module to generate a service execution result.
[0141] The generation subunit is configured to input the service execution result, the first value combination corresponding to the dependent atomic module, and the dependent configuration item corresponding to the dependent atomic module into the test case model corresponding to the dependent atomic module respectively to generate a target test case set for the target business system.
[0142] Based on the above embodiments, the test case generation device provided by the present invention automatically generates a target test case set by inputting the first value combinations corresponding to the atomic modules with dependency relationships into the test case model set respectively, avoiding the problems that may occur when manually writing test cases, and the situation that the test cases generated by using conventional test case generation technologies are only applicable to specific programming languages and / or specific business systems, and improving its versatility.
[0143] Figure 11It is a schematic diagram of the hardware structure of an electronic device provided according to an embodiment of the present disclosure. As Figure 11 shown, the electronic device may include: a processor 1110, a communications interface 1120, a memory 1130, and a communication bus 1140; wherein, the processor 1110, the communications interface 1120, and the memory 1130 communicate with each other via the communication bus 1140. The processor 1110 may invoke the logical instructions in the memory 1130 to execute the provided test case generation method, which includes: determining a target business system, and determining the atomic modules that make up the target business system, and generating a first configuration set based on the atomic modules; wherein, the first configuration set includes multiple first value combinations; inputting the first value combinations corresponding to the atomic modules with dependency relationships into a test case model set respectively to generate a target test case set corresponding to the target business system; wherein, the test case model set includes multiple test case models, the test case models correspond to the atomic modules one by one, and the test case models are obtained by training according to the second value combinations included in a second configuration set, the second configuration set includes multiple second value combinations, and the second configuration set is generated by a function factor module based on the atomic modules.
[0144] In addition, when the logical instructions in the above-mentioned memory 1130 are implemented in the form of software functional units and sold or used as independent products, they may be stored in a computer-readable storage medium. Based on such an understanding, the technical solution of the embodiment of the present disclosure, in essence, or the part that contributes to the prior art, or a part of this technical solution, may be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the methods described in various embodiments of the present disclosure. The foregoing storage medium includes: various media such as USB flash drives, mobile hard disks, read-only memories (ROM, Read-Only Memory), random access memories (RAM, Random Access Memory), magnetic disks, or optical discs that can store program codes.
[0145] On the other hand, the present disclosure also provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium. The computer program includes program instructions. When the program instructions are executed by a computer, the computer can execute the test case generation method provided in the above embodiments. The method includes: determining a target business system, and determining atomic modules that make up the target business system, and generating a first configuration set based on the atomic modules; wherein the first configuration set includes a plurality of first value combinations; respectively inputting the first value combinations corresponding to the atomic modules with dependency relationships into a test case model set to generate a target test case set corresponding to the target business system; wherein the test case model set includes a plurality of test case models, the test case models correspond to the atomic modules, and the test case models are obtained by training according to second value combinations included in a second configuration set, the second configuration set includes a plurality of the second value combinations, and the second configuration set is generated by a functional factor module obtained based on the atomic modules.
[0146] In another aspect, the present disclosure 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, it is configured to execute the test case generation method provided in the above embodiments. The method includes: determining a target business system, and determining atomic modules that make up the target business system, and generating a first configuration set based on the atomic modules; wherein the first configuration set includes a plurality of first value combinations; respectively inputting the first value combinations corresponding to the atomic modules with dependency relationships into a test case model set to generate a target test case set corresponding to the target business system; wherein the test case model set includes a plurality of test case models, the test case models correspond to the atomic modules, and the test case models are obtained by training according to second value combinations included in a second configuration set, the second configuration set includes a plurality of the second value combinations, and the second configuration set is generated by a functional factor module obtained based on the atomic modules.
[0147] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place, or may be distributed to multiple network units. Some or all of the modules can be selected according to actual needs to achieve the purpose of the solution of this embodiment. A person of ordinary skill in the art can understand and implement it without creative labor.
[0148] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a necessary general hardware platform, and of course, it can also be implemented by hardware. Based on such an understanding, the essence of the above technical solution, or the part that contributes to the prior art, can be embodied in the form of a software product. The computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions for causing 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.
[0149] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present disclosure, rather than to limit them; although the present disclosure has been described in detail with reference to the foregoing embodiments, those of ordinary skill in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or perform equivalent replacements for some of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure.
Claims
1. A test case generation method, characterized in that, Including: Determine the target business system, and determine the atomic modules that make up the target business system. Based on the atomic modules, generate a first configuration set; wherein, the first configuration set contains multiple first value combinations; Input the first value combinations corresponding to the atomic modules with dependencies into the test case model set respectively to generate a target test case set corresponding to the target business system; the target test case set is generated by inputting the business execution results of the dependent atomic modules, the first value combinations corresponding to the dependent atomic modules, and the dependent configuration items corresponding to the dependent atomic modules into the test case models corresponding to the dependent atomic modules respectively; Wherein, the test case model set includes multiple test case models, the test case models correspond to the atomic modules one by one, and the test case models are obtained by training according to the second value combinations included in the second configuration set. The second configuration set contains multiple second value combinations, and the second configuration set is generated by the second configuration items of the function factor modules obtained based on the atomic modules; the function factor modules are obtained by adding the dependent configuration items corresponding to the dependent atomic modules and the function execution results of the dependent atomic modules to the dependent atomic modules; The generating the first configuration set based on the atomic modules includes: Obtain the first configuration items of the atomic modules, and obtain the basic value data of the first configuration items; Based on a preset combinatorial testing tool, process the basic value data to generate the first configuration set containing multiple first value combinations.
2. The test case generation method according to claim 1, characterized in that, The function factor modules are generated by the following method: Determine the dependent atomic modules and the dependent atomic modules among the atomic modules with dependencies; Determine the dependent configuration items corresponding to the dependent atomic modules in the first configuration items, and obtain the function execution results obtained by executing the dependent atomic modules; Add the dependent configuration items corresponding to the dependent atomic modules and the function execution results to the dependent atomic modules to obtain the function factor modules.
3. The test case generation method according to claim 2, characterized in that, The generating method of the second configuration set includes: Obtain the second configuration items of the function factor modules, and obtain the target value data of the second configuration items; Based on the preset combinatorial testing tool, process the target value data to generate the second configuration set containing multiple second value combinations.
4. The test case generation method according to claim 2, characterized in that, The inputting the first value combinations corresponding to the atomic modules with dependencies into the test case model set respectively to generate a target test case set corresponding to the target business system includes: Determine the dependent configuration items corresponding to the dependent atomic modules in the first configuration items, add them to the first value combinations corresponding to the dependent atomic modules, and input the obtained data results into the test case models corresponding to the dependent atomic modules to generate business execution results; Input the business execution result, the first value combination corresponding to the dependent atomic module, and the dependency configuration item corresponding to the dependent atomic module into the test case model corresponding to the dependent atomic module, respectively, to generate the target test case set corresponding to the target business system.
5. A test case generation device, characterized in that, Including: A determination unit, configured to determine a target business system, determine atomic modules that make up the target business system, and generate a first configuration set based on the atomic modules; wherein, the first configuration set includes multiple first value combinations; A generation unit, configured to input the first value combinations corresponding to the atomic modules having a dependency relationship into a test case model set respectively, to generate a target test case set corresponding to the target business system; the target test case set is generated by inputting the business execution result of the dependent atomic module, the first value combination corresponding to the dependent atomic module, and the dependency configuration item corresponding to the dependent atomic module into the test case model corresponding to the dependent atomic module respectively; Wherein, the test case model set includes multiple test case models, the test case models correspond to the atomic modules one by one, and the test case models are obtained by training according to the second value combinations included in the second configuration set, the second configuration set includes multiple second value combinations, and the second configuration set is generated by the second configuration items of the functional factor module obtained based on the atomic modules; the functional factor module is obtained by adding the dependency configuration item corresponding to the dependent atomic module and the function execution result of the dependent atomic module to the dependent atomic module; The determination unit includes: An acquisition subunit, configured to acquire the first configuration item of the atomic module and acquire the basic value data of the first configuration item; A generation subunit, configured to process the basic value data based on a preset combinatorial testing tool to generate the first configuration set including multiple first value combinations.
6. The test case generation device according to claim 5, characterized in that, The apparatus further includes: a functional factor module generation unit, configured to: Determine the dependent atomic module and the dependent atomic module among the atomic modules having a dependency relationship; Determine the dependency configuration item corresponding to the dependent atomic module in the first configuration item, and acquire the function execution result obtained by executing the dependent atomic module; Add the dependency configuration item corresponding to the dependent atomic module and the function execution result to the dependent atomic module to obtain the functional factor module.
7. The test case generation device according to claim 6, characterized in that, The apparatus further includes: a second configuration set generation unit, configured to: Acquire the second configuration item of the functional factor module and acquire the target value data of the second configuration item; Process the target value data based on the preset combinatorial testing tool to generate the second configuration set including multiple second value combinations.
8. The test case generation device according to claim 6, wherein, The generation unit includes: A determination subunit, configured to determine the dependency configuration item corresponding to the dependent atomic module in the first configuration item, add it to the first value combination corresponding to the dependent atomic module, and input the obtained data result into the test case model corresponding to the dependent atomic module to generate a business execution result; A generating subunit, configured to input the service execution result, the first value combination corresponding to the dependent atomic module, and the dependency configuration item corresponding to the dependent atomic module into the test case model corresponding to the dependent atomic module respectively, so as to generate the target test case set corresponding to the target service system.
9. An electronic device, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, wherein, When the processor executes the program, the steps of the test case generation method according to any one of claims 1 to 4 are implemented.
10. A non-transitory computer-readable storage medium, on which a computer program is stored, wherein, When the computer program is executed by a processor, the steps of the test case generation method according to any one of claims 1 to 4 are implemented.
Citation Information
Patent Citations
Method and device for generating a combined test case, storage medium and computer equipment
CN109902002A
Automatic test case generation
US20150254171A1