Test Unit-Based Use Case Generation Method, Device, Equipment, and Storage Medium

By classifying and reconstructing the test failures of the system to be tested, a more comprehensive target test case is generated, which solves the problems of incomplete and inaccurate test cases in the existing technology, and improves the comprehensiveness and accuracy of the construction content items of the test case.

CN115185830BActive Publication Date: 2025-07-22PING AN BANK CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202210731748.3
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-06-25
Publication Date
2025-07-22
Estimated Expiration
2042-06-25

AI Technical Summary

Technical Problem

In the prior art, test cases generated based on a single test failure have the problem of incomplete and inaccurate construction of content items.

Method used

By obtaining several test failures and initial test cases of the system to be tested, a test failure group is obtained by classifying it, and multiple basic test units of each test failure group are determined based on the test failure group and the initial test cases, and finally reconstructing the target test cases of each test failure based on the basic test unit.

Benefits of technology

It enriches the components of test cases, improves the comprehensiveness and accuracy of the content items of the test cases, and ensures the comprehensiveness of the test cases.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115185830B_ABST
    Figure CN115185830B_ABST
Patent Text Reader

Abstract

The present application discloses a test case generation method, apparatus, device and storage medium based on test units. The method includes: obtaining a plurality of test faults and a plurality of initial test cases of a system to be tested, where the plurality of test faults correspond to the plurality of initial test cases one by one; classifying the plurality of test faults to obtain a plurality of test fault groups; determining a plurality of basic test units for each test fault group in the plurality of test fault groups based on the plurality of test fault groups and the plurality of initial test cases; and determining target test cases for each test fault in each test fault group according to the plurality of basic test units. The present application can enrich the constituent units of test cases and improve the comprehensiveness and accuracy of the construction content items of test cases.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and particularly relates to a test case generation method, apparatus, device, and storage medium based on test units. Background Art

[0002] With the continuous expansion of the business scale of the Internet industry, system design has become increasingly complex. During the system design process, test cases are usually used to detect it. Among them, a test case is a test model that identifies a set of test inputs, execution conditions, and expected results for a specific target. The test cases of the existing system to be tested are usually generated based on a single test fault, and the test cases generated in this way have problems of incomplete and inaccurate construction content items. Summary of the Invention

[0003] Embodiments of the present application provide a test case generation method, apparatus, device, and storage medium based on test units, which can enrich the composition units of test cases and improve the comprehensiveness and accuracy of the construction content items of test cases.

[0004] On the one hand, the present application provides a test case generation method based on test units, including:

[0005] Obtain a plurality of test faults and a plurality of initial test cases of the system to be tested, where the plurality of test faults correspond to the plurality of initial test cases one by one;

[0006] Classify the plurality of test faults to obtain a plurality of test fault groups;

[0007] Based on the plurality of test fault groups and the plurality of initial test cases, determine a plurality of basic test units for each test fault group in the plurality of test fault groups;

[0008] According to the plurality of basic test units, determine the target test cases for each test fault in each test fault group.

[0009] In some embodiments of the present application, the system to be tested includes a plurality of functional modules, the plurality of test faults correspond to the plurality of functional modules, and the classifying the plurality of test faults to obtain a plurality of test fault groups includes:

[0010] Obtain the functional module corresponding to each test fault, and determine the type of each test fault according to the functional module;

[0011] Classify the plurality of test faults according to the type of each test fault to obtain a plurality of test fault groups.

[0012] In some embodiments of the present application, determining multiple basic test units for each test failure group among the multiple test failure groups based on the multiple test failure groups and the multiple initial test cases includes:

[0013] Generating basic test cases for each test failure group among the multiple test failure groups based on the multiple test failure groups and the multiple initial test cases;

[0014] Splitting the basic test cases to obtain multiple basic test units for each test failure group.

[0015] In some embodiments of the present application, generating basic test cases for each test failure group among the multiple test failure groups based on the multiple test failure groups and the multiple initial test cases includes:

[0016] Classifying the multiple initial test cases based on the multiple test failure groups to obtain multiple test case sets, where the multiple test case sets correspond one-to-one to the multiple test failure groups;

[0017] Combining the initial test cases of the test case set corresponding to each test failure group among the multiple test failure groups to generate basic test cases for each test failure group.

[0018] In some embodiments of the present application, splitting the basic test cases to obtain multiple basic test units for each test failure group includes:

[0019] Parsing the basic test cases to obtain several attribute fields of the basic test cases;

[0020] Splitting the basic test cases according to the several attribute fields to obtain multiple basic test units for each test failure group.

[0021] In some embodiments of the present application, the multiple basic test units correspond to the several attribute fields. Determining target test cases for each test failure in each test failure group based on the multiple basic test units includes:

[0022] Inputting the attribute fields corresponding to each basic test unit among the multiple basic test units into a matching degree prediction model, and outputting, by the matching degree prediction model, the target matching degree between the attribute fields and each test failure in each test failure group;

[0023] Determining target test cases for each test failure according to the target matching degree.

[0024] In some embodiments of the present application, determining the target test case for each test failure according to the target matching degree includes:

[0025] Screening out several target test units for each test failure from the multiple basic test units according to the target matching degree;

[0026] Combining the several target test units to obtain the target test case for each test failure.

[0027] On the other hand, the present application provides a test case generation device based on test units, including:

[0028] A data acquisition unit, configured to acquire several test failures and several initial test cases of a system to be tested, where the several test failures and the several initial test cases correspond one by one;

[0029] A fault classification unit, configured to classify the several test failures to obtain several test failure groups;

[0030] A first determination unit, configured to determine multiple basic test units for each test failure group in the several test failure groups based on the several test failure groups and the several initial test cases;

[0031] A second determination unit, configured to determine the target test case for each test failure in each test failure group according to the multiple basic test units.

[0032] On the other hand, the present application further provides a computer device, where the computer device includes:

[0033] One or more processors;

[0034] A memory; and

[0035] One or more application programs, where the one or more application programs are stored in the memory and are configured to be executed by the processor to implement the steps in the test case generation method based on test units described in any item of the first aspect.

[0036] In a fourth aspect, the present application further provides a computer-readable storage medium, on which a computer program is stored, and the computer program is loaded by a processor to execute the steps in the test case generation method based on test units described in any item of the first aspect.

[0037] The present application integrates several initial test cases based on several test failure groups, determines multiple basic test units for each test failure group, and reconstructs the target test case for each test failure based on the multiple basic test units, which can enrich the constituent units of the test case and improve the comprehensiveness and accuracy of the construction content items of the test case. BRIEF DESCRIPTION OF THE DRAWINGS

[0038] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the following will briefly introduce the drawings required for the description of the embodiments. Obviously, the drawings in the following description are only some embodiments of the present application. For those skilled in the art, without creative efforts, other drawings can be obtained based on these drawings.

[0039] Figure 1 FIG. is a schematic diagram of the scenario of the test unit-based use case generation system provided by the embodiment of the present application;

[0040] Figure 2 FIG. is a schematic flowchart of an embodiment of the test unit-based use case generation method provided by the embodiment of the present application;

[0041] Figure 3 FIG. is a schematic structural diagram of an embodiment of the test unit-based use case generation device provided by the embodiment of the present application;

[0042] Figure 4 FIG. is a schematic structural diagram of an embodiment of the computer device provided by the embodiment of the present application. DETAILED DESCRIPTION OF THE EMBODIMENTS

[0043] The following will clearly and completely describe the technical solutions in the embodiments of the present application in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only some embodiments of the present application, rather than all embodiments. Based on the embodiments of the present application, all other embodiments obtained by those skilled in the art without creative efforts fall within the protection scope of the present application.

[0044] In the description of the present application, it should be understood that the terms "center", "longitudinal", "transverse", "length", "width", "thickness", "upper", "lower", "front", "rear", "left", "right", "vertical", "horizontal", "top", "bottom", "inner", "outer", etc. indicate the orientation or positional relationship based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present application and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore should not be construed as a limitation to the present application. In addition, the terms "first" and "second" are only used for descriptive purposes and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Thus, the features defined with "first" and "second" may explicitly or implicitly include one or more of the described features. In the description of the present application, "a plurality" means two or more unless otherwise specifically defined.

[0045] In this application, the term "exemplary" is used to mean "serving as an example, illustration, or instance". Any embodiment described as "exemplary" in this application is not necessarily to be construed as more preferred or advantageous than other embodiments. The following description is provided to enable any person skilled in the art to make and use this application. In the following description, details are set forth for the purpose of explanation. It should be understood that those of ordinary skill in the art can recognize that this application can be implemented without these specific details. In other instances, well-known structures and processes are not elaborated in detail to avoid obscuring the description of this application with unnecessary details. Therefore, this application is not intended to be limited to the embodiments shown, but is to be accorded the widest scope consistent with the principles and features disclosed in this application.

[0046] It should be noted that since the method of the embodiments of this application is executed in a computer device, the processing objects of each computer device exist in the form of data or information. For example, time, which is actually time information. It can be understood that in subsequent embodiments, if dimensions, quantities, positions, etc. are mentioned, they are all corresponding data existences for the computer device to process, and specific details are not elaborated here.

[0047] The embodiments of this application provide a test unit-based test case generation method, apparatus, device, and storage medium, which will be described in detail below.

[0048] Please refer to Figure 1 , Figure 1 which is a schematic diagram of the scenario of the test unit-based test case generation system provided by the embodiments of this application. The test unit-based test case generation system may include a computer device 100, and a test unit-based test case generation device is integrated in the computer device 100, such as Figure 1 the computer device in

[0049] In the embodiments of this application, the computer device 100 is mainly used to obtain a plurality of test faults and a plurality of initial test cases of the system to be tested, and the plurality of test faults correspond to the plurality of initial test cases one by one; classify the plurality of test faults to obtain a plurality of test fault groups; based on the plurality of test fault groups and the plurality of initial test cases, determine a plurality of basic test units for each test fault group in the plurality of test fault groups; according to the plurality of basic test units, determine the target test cases for each test fault in each test fault group, which can enrich the constituent units of the test cases and improve the comprehensiveness and accuracy of the construction content items of the test cases.

[0050] In the embodiments of the present application, the computer device 100 may be an independent server or a server network or server cluster composed of servers. For example, the computer device 100 described in the embodiments of the present application includes, but is not limited to, a computer, a network host, a single network server, a set of multiple network servers, or a cloud server composed of multiple servers. Among them, the cloud server is composed of a large number of computers or network servers based on cloud computing.

[0051] It can be understood that the computer device 100 used in the embodiments of the present application may be a device that includes both receiving and transmitting hardware, that is, a device having receiving and transmitting hardware capable of performing two-way communication on a two-way communication link. Such devices may include: cellular or other communication devices, which have a single-line display or a multi-line display or cellular or other communication devices without a multi-line display. Specifically, the computer device 100 may specifically be a desktop terminal or a mobile terminal, and the computer device 100 may specifically also be one of a mobile phone, a tablet computer, a laptop computer, etc.

[0052] Those skilled in the art can understand that Figure 1 the application environment shown is only one application scenario of the solution of the present application, and does not constitute a limitation on the application scenario of the solution of the present application. Other application environments may also include more or fewer computer devices than Figure 1 shown. For example Figure 1 only 1 computer device is shown. It can be understood that the test unit-based use case generation system may also include one or more other services, which are not specifically limited here.

[0053] In addition, as Figure 1 shown, the test unit-based use case generation system may also include a memory 200 for storing data, such as a number of test faults, such as test fault A, test fault B, test fault C, etc., and initial test cases corresponding to each test fault among the number of test faults, such as initial test case A corresponding to test fault A, initial test case B corresponding to test fault B, and initial test case C corresponding to test fault C.

[0054] It should be noted that Figure 1 the scenario schematic diagram of the test unit-based use case generation system shown is only an example. The test unit-based use case generation system and scenario described in the embodiments of the present application are for more clearly explaining the technical solution of the embodiments of the present application, and do not constitute a limitation on the technical solution provided by the embodiments of the present application. Those skilled in the art know that with the evolution of the test unit-based use case generation system and the emergence of new business scenarios, the technical solution provided by the embodiments of the present application is equally applicable to similar technical problems.

[0055] First, an embodiment of the present application provides a test case generation method based on test units. The execution subject of the test case generation method based on test units is a test case generation device based on test units. The test case generation device based on test units is applied to a computer device. The test case generation method based on test units includes: obtaining a plurality of test faults and a plurality of initial test cases of a system under test, where the plurality of test faults correspond to the plurality of initial test cases one by one; classifying the plurality of test faults to obtain a plurality of test fault groups; determining a plurality of basic test units for each test fault group in the plurality of test fault groups based on the plurality of test fault groups and the plurality of initial test cases; and determining target test cases for each test fault in each test fault group according to the plurality of basic test units.

[0056] As Figure 2 shown, it is a schematic flowchart of an embodiment of the test case generation method based on test units in an embodiment of the present application. The test case generation method based on test units includes:

[0057] S100. Obtain a plurality of test faults and a plurality of initial test cases of a system under test, where the plurality of test faults correspond to the plurality of initial test cases one by one.

[0058] The system under test is a business system to be tested. For example, the system under test can be a bank loan business system, a bank credit card business system, a bank deposit and withdrawal business system, etc. A plurality of test faults are faults that may occur in the system under test. A plurality of initial test cases are test cases respectively generated based on the plurality of test faults. That is to say, the plurality of test faults correspond to the plurality of initial test cases one by one. For example, if the plurality of test faults include test fault A, test fault B, and test fault C, then the plurality of initial test cases include initial test case A corresponding to test fault A, initial test case B corresponding to test fault B, and initial test case C corresponding to test fault C. And initial test case A is set based on test fault A, initial test case B is set based on test fault B, and initial test case C is set based on test fault C.

[0059] Considering that the plurality of initial test cases are respectively set based on the plurality of test faults, there are problems of incomplete and inaccurate construction content items in the plurality of initial test cases. If the system under test is tested based on the plurality of initial test cases, it is easy to cause incomplete testing. After setting a plurality of initial test cases respectively based on the plurality of test faults of the system under test in this embodiment, a plurality of test faults and a plurality of initial test cases are obtained, so as to reconstruct test cases based on the plurality of test faults and the plurality of initial test cases in subsequent steps.

[0060] S200. Classify the plurality of test faults to obtain a plurality of test fault groups.

[0061] Each of a number of test fault groups contains a number of test faults, and the types of the number of test faults contained in each test fault group are the same. For example, the number of test fault groups includes test fault group A, test fault group B, and test fault group C. Test fault group A contains test faults A, B, and C. Test fault group B contains test faults D, E, and F. Test fault group C contains test faults M, I, and J. Then, test faults A, B, and C are test faults of the same type. Test faults D, E, and F are test faults of the same type. Test faults M, I, and J are test faults of the same type.

[0062] Considering that the initial test cases corresponding to test faults of the same type can be combined, after obtaining a number of test faults and a number of initial test cases of the system under test in this embodiment, the number of test faults is classified, and test faults of the same type are grouped into the same test fault group to obtain a number of test fault groups, so as to perform test case reconstruction based on the number of test fault groups and the number of initial test cases in the subsequent steps.

[0063] In a specific embodiment, step S200 includes:

[0064] S210. Obtain the function module corresponding to each test fault, and determine the type of each test fault according to the function module;

[0065] S220. Classify the number of test faults according to the types of each test fault to obtain a number of test fault groups.

[0066] The system under test includes a number of function modules, and the number of test faults corresponds to the number of function modules. For example, test fault A corresponds to function module A, test fault B corresponds to function module B, and test fault C corresponds to function module C. When classifying the number of test faults in this embodiment, first, the function module corresponding to each test fault is obtained, the type of each test fault is determined according to the function module corresponding to each test fault, and then the number of test faults is classified according to the type of each test fault. Test faults of the same type are grouped into the same test fault group to obtain a number of test fault groups. For example, if function module A and function module B both belong to type A, then test faults A and B both belong to type A, and test faults A and B are grouped into the same test fault group.

[0067] S300. Based on the number of test fault groups and the number of initial test cases, determine multiple basic test units for each test fault group in the number of test fault groups.

[0068] Multiple basic test units are test data units obtained by integrating a number of initial test cases based on test fault groups, and each test fault group corresponds to multiple basic test units. After obtaining a number of test fault groups in this embodiment, a number of initial test cases are integrated based on the number of test fault groups to obtain multiple basic test units corresponding to each test fault group in the number of test fault groups, so as to reconstruct the target test case for each test fault based on the multiple basic test units in subsequent steps.

[0069] In a specific embodiment, step S300 includes:

[0070] S310. Generate basic test cases for each test fault group in the number of test fault groups based on the number of test fault groups and the number of initial test cases;

[0071] S320. Split the basic test cases to obtain multiple basic test units for each test fault group.

[0072] The basic test cases are the combined test cases obtained by combining a number of initial test cases based on a number of test fault groups, and the multiple basic test units of each test fault group are obtained by splitting the basic test cases of each test fault group. When determining the multiple basic test units of each test fault group in this embodiment, first, a number of initial test cases are combined based on a number of test fault groups to obtain the basic test cases of each test fault group in the number of test fault groups, and then the basic test cases of each test fault group are split into multiple basic test units. For example, the basic test case A of test fault group A is split to obtain basic test unit A, basic test unit B, and basic test unit C.

[0073] In a specific embodiment, step S310 includes:

[0074] S311. Classify the number of initial test cases based on the number of test fault groups to obtain a number of test case sets, and the number of test case sets corresponds one-to-one with the number of test fault groups;

[0075] S312. Combine the initial test cases of the test case set corresponding to each test fault group in the number of test fault groups to generate the basic test cases of each test fault group.

[0076] The test case set is a set composed of the initial test cases corresponding to the test faults in each test fault group. For example, the test fault group A consists of test fault A, test fault B, and test fault C. The test fault A corresponds to the initial test case A, the test fault B corresponds to the initial test case B, and the test fault C corresponds to the initial test case C. Then, the test case set A corresponding to the test fault group A is a test case set composed of the initial test case A, the initial test case B, and the initial test case C.

[0077] When generating the basic test cases for each test fault group in several test fault groups in this embodiment, first, classify several initial test cases based on several test fault groups to obtain several test case sets, where several test case sets correspond one-to-one with several test fault groups. Then, combine the initial test cases in the test case set corresponding to each test fault group in several test fault groups to generate the basic test cases for each test fault group. For example, the test fault group A corresponds to the test case set A, and the test case set A is composed of the initial test case A, the initial test case B, and the initial test case C. By combining the initial test case A, the initial test case B, and the initial test case C, the basic test case A of the test fault group A can be generated.

[0078] In a specific embodiment, step S320 includes:

[0079] S321. Analyze the basic test cases to obtain several attribute fields of the basic test cases;

[0080] S322. Split the basic test cases according to the several attribute fields to obtain multiple basic test units for each test fault group.

[0081] The several attribute fields are fields parsed from the basic test cases. When splitting the basic test cases to obtain multiple basic test units for each test fault group in this embodiment, first analyze the basic test cases to obtain several attribute fields of the basic test cases, and then split the basic test cases according to the several attribute fields to obtain multiple basic test units for each test fault group.

[0082] S400. Determine the target test cases for each test fault in each test fault group according to the multiple basic test units.

[0083] The target test case is the test case for each test fault in each test fault group reconstructed from multiple basic test units. After determining multiple basic test units for each test fault group in several test fault groups in this embodiment, based on the multiple basic test units, the target test case for each test fault in each test fault group is determined. Reconstructing test cases based on multiple basic test units can enrich the constituent units of test cases, improve the comprehensiveness and accuracy of the constructed content items of test cases, and further improve the comprehensiveness of the test of the system to be tested.

[0084] In a specific embodiment, step S400 includes:

[0085] S410. Input the attribute fields corresponding to each basic test unit in the multiple basic test units into a matching degree prediction model, and output the target matching degree between the attribute fields and each test fault in each test fault group through the matching degree prediction model;

[0086] S420. Determine the target test case for each test fault according to the target matching degree.

[0087] The multiple basic test units obtained by splitting the basic test cases according to several attribute fields correspond to the several attribute fields. After obtaining the multiple basic test units of each test fault group, in this embodiment, the attribute fields corresponding to each basic test unit in the multiple basic test units are input into the matching degree prediction model, and the target matching degree between the attribute fields and each test fault is output through the matching degree prediction model. Then, according to the target matching degree, the target test case for each test fault is determined. Among them, the matching degree prediction model is obtained by training a preset network model based on a preset training sample set. The preset network model can adopt a deep learning model or a machine learning model. For example, a Convolutional Neural Networks (CNN), a De-Convolutional Networks (DN), etc. Determining the target test case for each test fault based on the matching degree prediction model in this embodiment can improve the generation speed of the target test case. For example, if the basic test unit A corresponds to the attribute field A, inputting the attribute field A into the matching degree prediction model, through the matching degree prediction model, the target matching degree between the attribute field A and the basic test unit A, the target matching degree between the attribute field A and the basic test unit B, and the target matching degree between the attribute field A and the basic test unit C can be output.

[0088] The training sample set includes a number of training fields and the true matching degree of each training field in the number of training fields with each test fault. When training a preset network model, first, input the number of training fields in the training sample set into the preset network model, and output the predicted matching degree of each training field with each test fault through the preset network model. Then, determine the loss value according to the predicted matching degree, the true matching degree, and the loss function of the preset network model. When the loss value does not meet the preset condition, correct the model parameters of the preset network model according to the preset parameter learning rate, and continue to execute the step of outputting the predicted matching degree of each training field with each test fault through the preset network model until the loss value meets the preset condition, so as to obtain a matching degree prediction model. Among them, the loss value meeting the preset condition can be that the loss value is less than a preset first threshold, or the difference between the loss values obtained twice before and after is less than a preset second threshold.

[0089] In a specific embodiment, step S420 includes:

[0090] S421. According to the target matching degree, screen out a number of target test units of each test fault from the multiple basic test units;

[0091] S422. Combine the number of target test units to obtain a target test case for each test fault.

[0092] The number of target test units is the basic test units screened out from the multiple basic test units according to the target matching degree. When determining the target test case of each test fault in this embodiment according to the target matching degree, first, screen out a number of target test units of each test fault from the multiple basic test units according to the target matching degree, and then combine the number of target test units to obtain the target test case of each test fault.

[0093] In a specific implementation manner of the present application, when screening out a number of target test units of each test fault from the multiple basic test units according to the target matching degree, a matching degree threshold can be preset in advance, and then screen out the basic test units with a target matching degree greater than the matching degree threshold from the multiple basic test units as the number of target test units. Of course, in this embodiment, the multiple basic test units can also be sorted according to the target matching degree, and the number of basic test units with the highest matching degree can be screened out from the multiple basic test units as the target test units. The present application does not make any limitations in this regard.

[0094] To better implement the test unit-based use case generation method in the embodiments of the present application, based on the test unit-based use case generation method, an embodiment of the present application also provides a test unit-based use case generation device, as Figure 3 shown, the test unit-based use case generation device 600 includes:

[0095] A data acquisition unit 601, configured to acquire a plurality of test faults and a plurality of initial test cases of a system to be tested, where the plurality of test faults correspond to the plurality of initial test cases one by one;

[0096] A fault classification unit 602, configured to classify the plurality of test faults to obtain a plurality of test fault groups;

[0097] A first determination unit 603, configured to determine a plurality of basic test units for each test fault group in the plurality of test fault groups based on the plurality of test fault groups and the plurality of initial test cases;

[0098] A second determination unit 604, configured to determine a target test case for each test fault in each test fault group according to the plurality of basic test units.

[0099] In the embodiments of the present application, by integrating a plurality of initial test cases based on a plurality of test fault groups, determining a plurality of basic test units for each test fault group, and reconstructing a target test case for each test fault based on the plurality of basic test units, the constituent units of the test cases can be enriched, and the comprehensiveness and accuracy of the construction content items of the test cases can be improved.

[0100] In some embodiments of the present application, the fault classification unit 602 is specifically configured to:

[0101] Obtain a function module corresponding to each test fault, and determine the type of each test fault according to the function module;

[0102] Classify the plurality of test faults according to the type of each test fault to obtain a plurality of test fault groups.

[0103] In some embodiments of the present application, the first determination unit 603 is specifically configured to:

[0104] Generate a basic test case for each test fault group in the plurality of test fault groups based on the plurality of test fault groups and the plurality of initial test cases;

[0105] Split the basic test cases to obtain a plurality of basic test units for each test fault group.

[0106] In some embodiments of the present application, the first determination unit 603 is further specifically configured to:

[0107] Classify the plurality of initial test cases based on the plurality of test fault groups to obtain a plurality of test case sets, where the plurality of test case sets correspond to the plurality of test fault groups one by one;

[0108] Combine the initial test cases corresponding to each test case set of the several test failure groups to generate the basic test cases for each test failure group.

[0109] In some embodiments of the present application, the first determination unit 603 is further specifically configured to:

[0110] Parse the basic test cases to obtain several attribute fields of the basic test cases;

[0111] Split the basic test cases according to the several attribute fields to obtain multiple basic test units for each test failure group.

[0112] In some embodiments of the present application, the second determination unit 604 is specifically configured to:

[0113] Input the attribute fields corresponding to each basic test unit among the multiple basic test units into a matching degree prediction model, and output, through the matching degree prediction model, the target matching degree between the attribute fields and each test failure in each test failure group;

[0114] Determine the target test cases for each test failure according to the target matching degree.

[0115] In some embodiments of the present application, the second determination unit 604 is further specifically configured to:

[0116] Screen out several target test units for each test failure from the multiple basic test units according to the target matching degree;

[0117] Combine the several target test units to obtain the target test cases for each test failure.

[0118] An embodiment of the present application further provides a computer device, which integrates any one of the test unit-based use case generation devices provided in the embodiments of the present application. The computer device includes:

[0119] One or more processors;

[0120] A memory; and

[0121] One or more applications, where the one or more applications are stored in the memory and are configured to be executed by the processor to perform the steps in the test unit-based use case generation method in any one of the embodiments of the test unit-based use case generation method provided above.

[0122] An embodiment of the present application further provides a computer device, which integrates any one of the test unit-based use case generation devices provided in the embodiments of the present application. As Figure 4As shown, it shows a schematic structural diagram of a computer device involved in an embodiment of the present application. Specifically:

[0123] The computer device may include a processor 701 with one or more processing cores, a memory 702 of one or more computer-readable storage media, a power supply 703, an input unit 704, and other components. Those skilled in the art can understand that Figure 4 the computer device structure shown in does not constitute a limitation on the computer device, and may include more or fewer components than shown, or combine certain components, or have different component arrangements. Among them:

[0124] The processor 701 is the control center of the computer device, connecting various parts of the entire computer device through various interfaces and lines. By running or executing software programs and / or modules stored in the memory 702, and by calling data stored in the memory 702, it executes various functions of the computer device and processes data, thereby monitoring the computer device as a whole. Optionally, the processor 701 may include one or more processing cores; preferably, the processor 701 may integrate an application processor and a modem processor. Among them, the application processor mainly processes the operating system, user interface, application programs, etc., and the modem processor mainly processes wireless communication. It can be understood that the above modem processor may not be integrated into the processor 701 either.

[0125] The memory 702 can be used to store software programs and modules. The processor 701 executes various functional applications and data processing by running the software programs and modules stored in the memory 702. The memory 702 may mainly include a program storage area and a data storage area. Among them, the program storage area can store the operating system, application programs required for at least one function (such as a sound playback function, an image playback function, etc.), etc.; the data storage area can store data created according to the use of the computer device. In addition, the memory 702 may include high-speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, a flash memory device, or other volatile solid-state storage devices. Correspondingly, the memory 702 may also include a memory controller to provide the processor 701 with access to the memory 702.

[0126] The computer device also includes a power supply 703 that powers each component. Preferably, the power supply 703 can be logically connected to the processor 701 through a power management system, so as to realize functions such as management of charging, discharging, and power consumption management through the power management system. The power supply 703 may also include any components such as one or more DC or AC power supplies, a recharge system, a power failure detection circuit, a power converter or inverter, and a power status indicator.

[0127] The computer device may further include an input unit 704, which may be used to receive input digital or character information, and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function controls.

[0128] Although not shown, the computer device may further include a display unit, etc., which will not be elaborated here. Specifically, in this embodiment, the processor 701 in the computer device will load the executable files corresponding to the processes of one or more application programs into the memory 702 according to the following instructions, and the processor 701 will run the application programs stored in the memory 702 to implement various functions as follows:

[0129] Obtain a number of test faults of the system to be tested and a number of initial test cases, where the number of test faults corresponds to the number of initial test cases one by one;

[0130] Classify the number of test faults to obtain a number of test fault groups;

[0131] Based on the number of test fault groups and the number of initial test cases, determine multiple basic test units for each test fault group in the number of test fault groups;

[0132] According to the multiple basic test units, determine the target test cases for each test fault in each test fault group.

[0133] Those of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructions, or by controlling relevant hardware through instructions. The instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.

[0134] For this reason, the embodiments of the present application provide a computer-readable storage medium, which may include: read-only memory (ROM, Read Only Memory), random access memory (RAM, Random Access Memory), magnetic disk or optical disc, etc. A computer program is stored thereon, and the computer program is loaded by a processor to execute the steps in any one of the use case generation methods based on test units provided by the embodiments of the present application. For example, when the computer program is loaded by a processor, the following steps may be executed:

[0135] Obtain a number of test faults of the system to be tested and a number of initial test cases, where the number of test faults corresponds to the number of initial test cases one by one;

[0136] Classify the number of test faults to obtain a number of test fault groups;

[0137] Based on the several test failure groups and the several initial test cases, determine multiple basic test units for each test failure group in the several test failure groups;

[0138] According to the multiple basic test units, determine the target test cases for each test failure in each test failure group.

[0139] In the above embodiments, the descriptions of the respective embodiments have their own emphases. For the parts not detailed in a certain embodiment, reference may be made to the detailed descriptions of other embodiments above, and details will not be repeated here.

[0140] In specific implementation, the above units or structures can be implemented as independent entities, or can be combined arbitrarily to be implemented as the same or several entities. For the specific implementation of the above units or structures, reference may be made to the method embodiments above, and details will not be repeated here.

[0141] For the specific implementation of the above operations, reference may be made to the previous embodiments, and details will not be repeated here.

[0142] The above has introduced in detail a test case generation method, device, equipment and storage medium based on test units provided by the embodiments of the present application. Specific examples are used in this article to elaborate on the principle and implementation manner of the present application. The descriptions of the above embodiments are only used to help understand the method and its core idea of the present application; at the same time, for those skilled in the art, according to the idea of the present application, there will be changes in the specific implementation manner and application scope. In summary, the content of this specification should not be construed as a limitation to the present application.

Claims

1. A test unit-based test case generation method, characterized in that, Including: Obtain a number of test faults and a number of initial test cases of the system to be tested, where the number of test faults corresponds one-to-one with the number of initial test cases, the system to be tested includes a number of functional modules, and the number of test faults corresponds to the number of functional modules; Obtain the functional module corresponding to each test fault, and determine the type of each test fault according to the functional module; Classify the number of test faults according to the type of each test fault to obtain a number of test fault groups; Based on the number of test fault groups and the number of initial test cases, generate basic test cases for each test fault group in the number of test fault groups; Split the basic test cases to obtain multiple basic test units for each test fault group in the number of test fault groups; According to the multiple basic test units, determine the target test cases for each test fault in each test fault group.

2. The test unit-based test case generation method according to claim 1, wherein The generating basic test cases for each test fault group in the number of test fault groups based on the number of test fault groups and the number of initial test cases includes: Classify the number of initial test cases based on the number of test fault groups to obtain a number of test case sets, where the number of test case sets corresponds one-to-one with the number of test fault groups; Combine the initial test cases of the test case set corresponding to each test fault group in the number of test fault groups to generate the basic test cases for each test fault group.

3. The test unit-based test case generation method according to claim 1, wherein The splitting the basic test cases to obtain multiple basic test units for each test fault group includes: Parse the basic test cases to obtain several attribute fields of the basic test cases; Split the basic test cases according to the several attribute fields to obtain multiple basic test units for each test fault group.

4. The test unit-based use case generation method according to claim 3, wherein, The multiple basic test units correspond to the several attribute fields, and the determining the target test cases for each test fault in each test fault group according to the multiple basic test units includes: Input the attribute fields corresponding to each basic test unit in the multiple basic test units into a matching degree prediction model, and output the target matching degree between the attribute fields and each test fault in each test fault group through the matching degree prediction model; Determine the target test cases for each test fault according to the target matching degree.

5. The test unit-based test case generation method according to claim 4, wherein The determining the target test cases for each test fault according to the target matching degree includes: Screen out several target test units for each test fault from the multiple basic test units according to the target matching degree; Combine the several target test units to obtain the target test cases for each test fault.

6. A test unit-based test case generation device, characterized in that, Including: A data acquisition unit, configured to obtain a number of test faults and a number of initial test cases of the system to be tested, where the number of test faults corresponds one-to-one with the number of initial test cases, the system to be tested includes a number of functional modules, and the number of test faults corresponds to the number of functional modules; A fault classification unit, configured to obtain a function module corresponding to each test fault, and determine the type of each test fault according to the function module; classify the several test faults according to the type of each test fault to obtain several test fault groups; A first determination unit, configured to generate a basic test case for each test fault group in the several test fault groups based on the several test fault groups and the several initial test cases; split the basic test case to obtain multiple basic test units for each test fault group in the several test fault groups; A second determination unit, configured to determine a target test case for each test fault in each test fault group according to the multiple basic test units.

7. A computer device, characterized in that, The computer device includes: one or more processors; a memory; and one or more applications, wherein the one or more applications are stored in the memory and configured to be executed by the processor to implement the steps in the test unit-based use case generation method according to any one of claims 1 to 5.

8. A computer-readable storage medium, characterized in that, A computer program is stored thereon, and the computer program is loaded by the processor to execute the steps in the test unit-based use case generation method according to any one of claims 1 to 5.

Citation Information

Patent Citations

  • Software multi-fault positioning method and device, electronic equipment and storage medium

    CN110362484A

  • Test method and device based on fault injection, computer equipment and storage medium

    CN111831569A