Test case generation method, device and system and storage medium

By obtaining and integrating test case sets related to parameter scenarios, the problem of low efficiency in the generation of test cases in the existing technology is solved, and the complete test cases are automatically generated and the testing efficiency of the autonomous driving industry is improved.

CN119322741APending Publication Date: 2025-01-17TUS CLOUD CONTROL (BEIJING) TECH LTD
View PDF 0 Cites 0 Cited by

Patent Information

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

AI Technical Summary

Technical Problem

In the prior art, the generation efficiency of test cases is low and requires a lot of manual writing, which is difficult to meet the needs of complex test scenarios in the autonomous driving industry.

Method used

By obtaining the parameter information to be tested, a first test case set related to the parameter length and a second test case set related to the parameter value are generated according to the predefined parameter scenario, and fuse them to generate a complete test case.

Benefits of technology

It improves the efficiency of the generation of test cases, reduces the need for manual writing, saves time and labor costs, and improves testing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119322741A_ABST
    Figure CN119322741A_ABST
Patent Text Reader

Abstract

The invention discloses a test case generation method, device and system and a storage medium, which are used for improving the generation efficiency of test cases. The method comprises the steps that to-be-measured parameter information is obtained, and the to-be-measured parameter information at least comprises a parameter name, a parameter length and a parameter value; generating a first test case set related to the parameter length according to a predefined parameter scene, and generating a second test case set related to the parameter value according to the predefined parameter scene; and fusing the first test case set and the second test case set, and taking a fusion result as a complete test case corresponding to the to-be-tested parameter. By adopting the scheme provided by the invention, the complete test case can be automatically generated, and the generation efficiency of the test case is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer technology, and in particular to a test case generation method, device, system and storage medium. Background Art

[0002] Test cases are test data carefully designed to efficiently discover software defects, as well as the corresponding expected test results. It is a set of test inputs, execution conditions, and expected results compiled for a specific goal, used to verify whether a specific software requirement is met. For the autonomous driving industry, daily testing work requires a large number of test cases due to the large number of test scenarios and complex test situations. In the existing technology, test cases are often generated manually and the possible scenarios of test cases are analyzed, which makes the overall efficiency of writing test cases relatively low.

[0003] Therefore, how to provide a test case generation method to improve the test case generation efficiency has become a technical problem that needs to be solved urgently. Summary of the invention

[0004] The present application provides a test case generation method, device, system and storage medium to improve the test case generation efficiency.

[0005] The present application provides a test case generation method, comprising:

[0006] Acquire parameter information to be tested, wherein the parameter information to be tested at least includes parameter name, parameter length, and parameter value;

[0007] generating a first test case set associated with parameter length according to a predefined parameter scenario, and generating a second test case set associated with parameter value according to the predefined parameter scenario;

[0008] The first test case set and the second test case set are fused, and the fusion result is used as a complete test case corresponding to the parameter to be tested.

[0009] The beneficial effects of the present application are: by obtaining the parameter information to be tested, wherein the parameter information to be tested at least includes the parameter name, parameter length, and parameter value; generating a first test case set related to the parameter length according to a predefined parameter scenario, and generating a second test case set related to the parameter value according to a predefined parameter scenario; fusing the first test case set and the second test case set, and using the fusion result as a complete test case corresponding to the parameter to be tested. In addition, a complete test case can be automatically generated, thereby improving the efficiency of test case generation.

[0010] In one embodiment, the obtaining of the parameter information to be measured includes:

[0011] Obtain a pre-stored table, wherein the table stores at least a parameter name, a parameter type, a parameter length, and a parameter value of a parameter to be measured;

[0012] The parameter information to be measured is obtained from the pre-stored table.

[0013] In one embodiment, the parameter scenario is defined as follows:

[0014] Based on the equivalence class partitioning method and boundary value method, the parameter scenarios that may occur in different types of parameters in software testing are defined.

[0015] In one embodiment, generating a first test case set related to parameter length according to a predefined parameter scenario includes:

[0016] Get the value range of parameter length;

[0017] Obtaining a minimum value and a maximum value of the parameter length according to the value range of the parameter length;

[0018] According to the predefined parameter scenarios, parameter scenarios including parameter length equal to the minimum value, equal to the maximum value, greater than the maximum value, less than the minimum value, less than the maximum value and greater than the maximum value and expected results are generated as the first test case set.

[0019] In one embodiment, generating a second test case set related to the parameter value according to a predefined parameter scenario includes:

[0020] Determine, according to the parameter value, a valid equivalence class scenario and an invalid equivalence class scenario in a predefined parameter scenario;

[0021] Determine the expected results of the valid equivalence class scenario as correct, and determine the expected results of the invalid equivalence class scenario as incorrect;

[0022] The effective equivalence class scenario, the invalid equivalence class scenario and the expected effects of each parameter scenario are taken as the second test case set.

[0023] In one embodiment, the method further comprises:

[0024] Read pre-stored test case acquisition rules;

[0025] The complete test cases corresponding to the parameters to be tested are screened and deduplicated according to the pre-stored test case acquisition rules.

[0026] In one embodiment, the test case acquisition rule includes:

[0027] Get all the test cases where each parameter is valid after all the parameter combinations;

[0028] Get all the test cases where each parameter is invalid after all the parameter combinations are obtained;

[0029] Get a test case where one parameter in the test case is valid and the others are invalid.

[0030] The present application also provides a test case generation device, comprising:

[0031] An acquisition module, used to acquire parameter information to be measured, wherein the parameter information to be measured at least includes a parameter name, a parameter length, and a parameter value;

[0032] A generating module, configured to generate a first test case set associated with a parameter length according to a predefined parameter scenario, and to generate a second test case set associated with a parameter value according to a predefined parameter scenario;

[0033] A fusion module is used to fuse the first test case set and the second test case set, and use the fusion result as a complete test case corresponding to the parameter to be tested.

[0034] In one embodiment, the acquisition module includes:

[0035] A first acquisition submodule is used to acquire a pre-stored table, wherein the table stores at least a parameter name, a parameter type, a parameter length, and a parameter value of a parameter to be measured;

[0036] The second acquisition submodule is used to acquire the parameter information to be measured from the pre-stored table.

[0037] In one embodiment, the parameter scenario is defined as follows:

[0038] Based on the equivalence class partitioning method and boundary value method, the parameter scenarios that may occur in different types of parameters in software testing are defined.

[0039] In one embodiment, the generation module comprises:

[0040] The third acquisition submodule is used to obtain the value range of the parameter length;

[0041] A fourth acquisition submodule, used to acquire a minimum value and a maximum value of the parameter length according to the value range of the parameter length;

[0042] A generation submodule is used to generate parameter scenarios including parameter length equal to the minimum value, equal to the maximum value, greater than the maximum value, less than the minimum value, less than the maximum value and greater than the maximum value and expected results as the first test case set according to pre-defined parameter scenarios.

[0043] In one embodiment, the generation module comprises:

[0044] A first determination submodule is used to determine a valid equivalence class scenario and an invalid equivalence class scenario in a predefined parameter scenario according to a parameter value;

[0045] A second determination submodule is used to determine that the expected result of the valid equivalence class scenario is correct, and to determine that the expected result of the invalid equivalence class scenario is wrong;

[0046] The third determination submodule is used to use the expected effects of the valid equivalence class scenarios, the invalid equivalence class scenarios and each parameter scenario as the second test case set.

[0047] In one embodiment, the apparatus further comprises:

[0048] A reading module, used to read pre-stored test case acquisition rules;

[0049] The screening module is used to screen and remove duplicates from the complete test cases corresponding to the parameters to be tested according to the pre-stored test case acquisition rules.

[0050] In one embodiment, the test case acquisition rule includes:

[0051] Get all the test cases where each parameter is valid after all the parameter combinations;

[0052] Get all the test cases where each parameter is invalid after all the parameter combinations are obtained;

[0053] Get a test case where one parameter in the test case is valid and the others are invalid.

[0054] The present application also provides a test case generation system, comprising:

[0055] at least one processor; and,

[0056] a memory communicatively connected to the at least one processor; wherein,

[0057] The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to implement the test case generation method recorded in any of the above embodiments.

[0058] The present application also provides a computer-readable storage medium. When the instructions in the storage medium are executed by a processor corresponding to the test case generation system, the test case generation system can implement the test case generation method recorded in any of the above embodiments.

[0059] Other features and advantages of the present application will be described in the following description, and partly become apparent from the description, or be understood by practicing the present application. The purpose and other advantages of the present application can be realized and obtained by the structures specifically pointed out in the written description, claims, and drawings.

[0060] The technical solution of the present application is further described in detail below through the accompanying drawings and embodiments. BRIEF DESCRIPTION OF THE DRAWINGS

[0061] The accompanying drawings are used to provide a further understanding of the present application and constitute a part of the specification. Together with the embodiments of the present application, they are used to explain the present application and do not constitute a limitation of the present application. In the accompanying drawings:

[0062] Figure 1 A flowchart of a test case generation method in one embodiment of the present application;

[0063] Figure 2 This is a schematic diagram of the structure of a test case generation device in one embodiment of the present application;

[0064] Figure 3 A schematic diagram of the hardware structure of a test case generation system in one embodiment of the present application. DETAILED DESCRIPTION

[0065] The preferred embodiments of the present application are described below in conjunction with the accompanying drawings. It should be understood that the preferred embodiments described herein are only used to illustrate and explain the present application and are not used to limit the present application.

[0066] The method provided by the present application automatically writes the initial file of the test case according to the pre-configured needs. For example, the initial file can be an EXCEL table, etc., to store the parameter information to be tested. Then, the initial file is parsed by openpyxl in python, and different test case sets are generated according to different test case generation methods, and then the different test case sets generated are merged to obtain a complete test case set. Furthermore, there is no need to manually write test cases, which improves the efficiency of test case generation.

[0067] In addition, in order to avoid a large number of repeated test scenarios, you can also set different test case acquisition rules to filter out appropriate test cases from the complete test case set and reasonably cover possible scenarios, thereby improving the overall testing efficiency.

[0068] Figure 1 Flow chart of a test case generation method in one embodiment of the present application, such as Figure 1 As shown, the method can be implemented as the following steps S101-S103:

[0069] In step S101, the parameter information to be tested is obtained, wherein the parameter information to be tested at least includes a parameter name, a parameter length, and a parameter value;

[0070] In step S102, a first test case set related to parameter length is generated according to a predefined parameter scenario, and a second test case set related to parameter value is generated according to a predefined parameter scenario;

[0071] In step S103, the first test case set and the second test case set are fused, and the fusion result is used as a complete test case corresponding to the parameter to be tested.

[0072] In the present application, the parameter information to be measured is obtained, wherein the parameter information to be measured at least includes parameter name, parameter length, and parameter value. In one embodiment, the parameter information to be measured is pre-stored in advance. When obtaining the parameter information to be measured, a pre-stored table is first obtained, in which at least the parameter name, parameter type, parameter length, and parameter value of the parameter to be measured are stored; then, the parameter information to be measured is obtained from the pre-stored table. There are many forms of pre-stored tables. As shown in Table 1, taking admission information as an example, an example of a pre-stored table of parameters to be measured is given. Then, the parameter information to be measured can be obtained from the pre-stored table through Table 1, and the demand for the parameter information to be measured corresponding to each parameter can be determined.

[0073] Table 1 Example of pre-stored table of parameters to be tested

[0074]

[0075] Furthermore, a first test case set related to parameter length can be generated according to a predefined parameter scenario, and a second test case set related to parameter value can be generated according to a predefined parameter scenario. Among them, the parameter scenario is a general scenario that may appear in advance according to different types of parameter types in software testing. For example, when the parameter type is a string, the corresponding parameter scenario can be predefined as: an empty string, a non-empty string, a string of all letters, a string of all numbers, a string containing special characters, a string containing numbers, a string containing letters, a string containing uppercase letters, a string containing lowercase letters, a string containing spaces, a string containing punctuation marks, etc. When the parameter type is a number, the corresponding parameter scenario can be predefined as: an integer, a decimal, zero, a negative number, etc. When the parameter type is a date, the corresponding parameter scenario can be predefined as: a normal date, an illegal format, a zero date, a negative date, etc. In addition, the parameter scenarios of different parameter types can also be customized visually, for example, the parameter length, the value range, etc. can be customized according to different situations.

[0076] First, by combining the parameter type and all the default custom scenarios, you can automatically get all the exhaustive test case scenarios that appear, for example:

[0077] Username equals empty string

[0078] Username equals a non-empty string

[0079] Username contains special characters

[0080] Username contains a string of numbers

[0081] Username contains letters

[0082] The username contains a string containing uppercase letters ...

[0084] Class number equals integer

[0085] Class number equals decimal

[0086] The class number is equal to a negative number ...

[0088] Then, by combining the parameter name, parameter type, parameter value, and whether the parameters to be tested are required, the expected effect corresponding to the test case can be determined. Then, the test case and the expected effect form a corresponding test case set.

[0089] In one embodiment of the present application, a first test case set is generated by a boundary value method: first, obtain the value range of the parameter length. Specifically, obtain the corresponding parameter length according to the parameter name. As shown in Table 1, the parameter length corresponding to the user name is [5, 20], and the parameter length corresponding to the class number is (0, 5]. Then, the minimum value and maximum value of the parameter length can be obtained according to the value range of the parameter length. Then, according to the predefined parameter scenarios, a parameter scenario including a parameter length equal to the minimum value, equal to the maximum value, greater than the maximum value, less than the minimum value, less than the maximum value and greater than the maximum value and the expected results are generated as the first test case set. For example, the parameter length corresponding to the user name is [5, 20], the corresponding maximum value is determined to be 20, and the minimum value is determined to be 5, then the corresponding first test case set is generated as follows:

[0090] Table 2 Example of the first test case set

[0091]

[0092]

[0093] It can be understood that when the parameter length is a fixed parameter length value, the corresponding parameter scenarios including parameter length equal to the fixed parameter length value, greater than the fixed parameter length value, and less than the fixed parameter length value and expected results are generated as the first test case set according to the pre-defined parameter scenarios.

[0094] In another embodiment of the present application, a first test case set is generated by an equivalence class partitioning method: specifically, valid equivalence class scenarios and invalid equivalence class scenarios in predefined parameter scenarios are determined according to parameter values. The expected result of the valid equivalence class scenario is determined to be correct, and the expected result of the invalid equivalence class scenario is determined to be wrong. The expected effects of the valid equivalence class scenario, the invalid equivalence class scenario, and each parameter scenario are used as the second test case set. For example, according to openpyxl, each row of data is read, and then a row of data is a separate parameter. By obtaining the parameter name corresponding to the parameter scenario combination, different test cases corresponding to the parameter type are obtained by exhaustive enumeration. For example, for the user name and parameter scenario: empty, full letters, full numbers, containing special characters, mixed numbers and letters, non-existent, etc., the equivalent class scenarios corresponding to "user name is empty", "user name full letters", "user name full numbers" and the like are formed. Then, by parsing the information of the parameters to be tested, such as parameter name, parameter value, and whether it is required, it is determined that the scenarios that meet the information of the parameters to be tested are valid equivalent scenarios, and the corresponding expected results are determined to be correct; the scenarios that do not meet the information of the parameters to be tested are determined to be invalid equivalent information, and the corresponding expected results are determined to be wrong. For example, through the pre-storage table of the parameters to be tested in Table 1, it can be obtained that the parameter value of the user name is "all letters" and it is required. Therefore, it can be determined that the equivalent scenarios corresponding to "null user name" and "all numbers user name" are invalid equivalent scenarios; the equivalent scenarios corresponding to "all letters user name" are valid equivalent scenarios. Then, the expected effects of the valid equivalent scenarios, invalid equivalent scenarios, and each parameter scenario are used as the second test case set. As shown in Table 3, it is an example of the second test case set.

[0095] Table 3 Example of the second test case set

[0096]

[0097]

[0098] Finally, the first test case set and the second test case set are fused, and the fusion result is used as a complete test case corresponding to the parameter to be tested. For example, the first test case set and the second test case set can be arranged and combined by an orthogonal experimental method to generate corresponding orthogonal test cases, and the corresponding expected effect can be determined according to preset logical operation rules. For example, through an "and" operation, the expected results of the first test case set and the expected results of the second test case set are operated to obtain the expected results corresponding to the fused test case. The fused test case and the corresponding expected results constitute a fused test case set, as shown in Table 4, which is an example of a fused test case set.

[0099] Table 4 Example of fused test case set

[0100] Test Cases Expected Results Username is empty, password is empty mistake Username is empty, password is all numbers correct Username length is 5, password length is 1 mistake ……

[0101] Since there will be repeated test scenarios in the fused test case set, in another embodiment of the present application, the pre-stored test case acquisition rules are read, such as obtaining test cases in which each parameter is valid after all parameter combinations, obtaining test cases in which each parameter is invalid after all parameter combinations, and obtaining test cases in which one parameter in the test case is valid and the others are invalid. Then, the complete test cases corresponding to the parameters to be tested are screened and deduplicated according to the pre-stored test case acquisition rules. Furthermore, the test case range is screened by acquiring rules, and the corresponding test cases are directly and automatically generated, thereby removing a large number of repeated test scenarios. Then, when the test process is time-constrained, a large amount of manual work is saved to write test cases and screen the validity of the test cases, thereby saving a large amount of labor costs and improving the overall test efficiency.

[0102] The beneficial effects of the present application are: by obtaining the parameter information to be tested, wherein the parameter information to be tested at least includes the parameter name, parameter length, and parameter value; generating a first test case set related to the parameter length according to a predefined parameter scenario, and generating a second test case set related to the parameter value according to a predefined parameter scenario; fusing the first test case set and the second test case set, and using the fusion result as a complete test case corresponding to the parameter to be tested. In addition, a complete test case can be automatically generated, thereby improving the efficiency of test case generation.

[0103] In one embodiment, the above step S101 may be executed as the following steps A1-A2:

[0104] In step A1, a pre-stored table is obtained, wherein the table stores at least the parameter name, parameter type, parameter length, and parameter value of the parameter to be measured;

[0105] In step A2, the parameter information to be measured is obtained from the pre-stored table.

[0106] In this embodiment, a pre-stored table is obtained, wherein at least the parameter name, parameter type, parameter length, and parameter value of the parameter to be measured are stored in the table. There are many forms of pre-stored tables, as shown in Table 1, taking enrollment information as an example, an example of a pre-stored table of parameters to be measured is given.

[0107] Table 1 Example of pre-stored table of parameters to be tested

[0108]

[0109] Furthermore, the parameter information to be measured can be obtained from the pre-stored table.

[0110] In one embodiment, the method for defining the parameter scenario in step S102 is as follows:

[0111] Based on the equivalence class partitioning method and boundary value method, the parameter scenarios that may occur in different types of parameters in software testing are defined.

[0112] In one embodiment, the generation of the first test case set related to the parameter length according to the predefined parameter scenario in the above step S102 can be implemented as the following steps B1-B3:

[0113] In step B1, the value range of the parameter length is obtained;

[0114] In step B2, the minimum value and the maximum value of the parameter length are obtained according to the value range of the parameter length;

[0115] In step B3, a first test case set is generated based on predefined parameter scenarios, including parameter scenarios in which the parameter length is equal to the minimum value, equal to the maximum value, greater than the maximum value, less than the minimum value, less than the maximum value and greater than the maximum value, and expected results.

[0116] First, obtain the value range of the parameter length. Specifically, obtain the corresponding parameter length according to the parameter name. As shown in Table 1, the parameter length corresponding to the user name is [5, 20], and the parameter length corresponding to the class number is (0, 5].

[0117] Then, the minimum and maximum values ​​of the parameter length can be obtained according to the value range of the parameter length. Then, according to the predefined parameter scenarios, a parameter scenario including parameter length equal to the minimum value, equal to the maximum value, greater than the maximum value, less than the minimum value, less than the maximum value and greater than the maximum value and expected results are generated as the first test case set. For example, the parameter length corresponding to the user name is [5, 20], the corresponding maximum value is determined to be 20, and the minimum value is determined to be 5, then the corresponding first test case set is generated as follows:

[0118] Table 2 Example of the first test case set

[0119] Test Cases Expected Results Username length equals 5 correct Username length equals 20 correct Username length is less than 5 mistake Username length is greater than 20 mistake Username length equals 8 correct ……

[0120] It can be understood that when the parameter length is a fixed parameter length value, the corresponding parameter scenarios including parameter length equal to the fixed parameter length value, greater than the fixed parameter length value, and less than the fixed parameter length value and expected results are generated as the first test case set according to the pre-defined parameter scenarios.

[0121] In one embodiment, the generation of the second test case set related to the parameter value according to the predefined parameter scenario in the above step S102 can be implemented as the following steps C1-C3:

[0122] In step C1, valid equivalence class scenarios and invalid equivalence class scenarios in predefined parameter scenarios are determined according to parameter values;

[0123] In step C2, the expected result of the valid equivalence class scenario is determined to be correct, and the expected result of the invalid equivalence class scenario is determined to be wrong;

[0124] In step C3, the expected effects of the valid equivalence class scenarios, the invalid equivalence class scenarios and each parameter scenario are taken as the second test case set.

[0125] In this embodiment, valid equivalence class scenarios and invalid equivalence class scenarios in predefined parameter scenarios are determined according to parameter values. The expected result of the valid equivalence class scenario is determined to be correct, and the expected result of the invalid equivalence class scenario is determined to be wrong. The expected effects of the valid equivalence class scenario, the invalid equivalence class scenario, and each parameter scenario are used as the second test case set.

[0126] For example, according to openpyxl, each row of data is read, and then a row of data is a separate parameter. By obtaining the parameter name corresponding to the parameter scenario combination, different test cases corresponding to the parameter type are obtained by exhaustive enumeration. For example, for the user name and parameter scenarios: empty, all letters, all numbers, containing special characters, mixed numbers and letters, non-existent, etc., the equivalent class scenarios corresponding to "user name is empty", "user name all letters", "user name all numbers" are formed. Then, by parsing the information of the parameters to be tested, such as parameter name, parameter value, and whether it is required, it is determined that the valid equivalent class scenario meets the information of the parameter to be tested, and the corresponding expected result is determined to be correct; it is determined that the invalid equivalent class information does not meet the information of the parameter to be tested, and the corresponding expected result is determined to be wrong. For example, through the pre-storage table of the parameters to be tested in Table 1, the parameter value of the user name can be obtained as "all letters" and it is required. Therefore, it can be determined that the equivalent class scenarios corresponding to "user name is empty", "user name all numbers" and so on are invalid equivalent class scenarios; the equivalent class scenario corresponding to "user name all letters" is a valid equivalent class scenario. Then, the expected effects of the valid equivalence class scenario, the invalid equivalence class scenario and each parameter scenario are taken as the second test case set. As shown in Table 3, it is an example of the second test case set.

[0127] Table 3 Example of the second test case set

[0128] Test Cases Expected Results Username is empty mistake Username full letters correct Username full of numbers mistake Username contains special characters mistake Username mixed with numbers and letters mistake ……

[0129] In one embodiment, the above method can also be implemented as the following steps D1-D2:

[0130] In step D1, read the pre-stored test case acquisition rules;

[0131] In step D2, complete test cases corresponding to the parameters to be tested are screened and deduplicated according to the pre-stored test case acquisition rules.

[0132] In one embodiment, the test case acquisition rule includes:

[0133] Get all the test cases where each parameter is valid after all the parameter combinations;

[0134] Get all the test cases where each parameter is invalid after all the parameter combinations are obtained;

[0135] Get a test case where one parameter in the test case is valid and the others are invalid.

[0136] Figure 2 FIG. 1 is a schematic diagram of a test case generating device in an embodiment of the present application. Figure 2 As shown, including:

[0137] The acquisition module 201 is used to acquire the parameter information to be tested, wherein the parameter information to be tested at least includes a parameter name, a parameter length, and a parameter value;

[0138] A generating module 202, configured to generate a first test case set related to parameter length according to a predefined parameter scenario, and to generate a second test case set related to parameter value according to a predefined parameter scenario;

[0139] The fusion module 203 is used to fuse the first test case set and the second test case set, and use the fusion result as a complete test case corresponding to the parameter to be tested.

[0140] In one embodiment, the acquisition module includes:

[0141] A first acquisition submodule is used to acquire a pre-stored table, wherein the table stores at least a parameter name, a parameter type, a parameter length, and a parameter value of a parameter to be measured;

[0142] The second acquisition submodule is used to acquire the parameter information to be measured from the pre-stored table.

[0143] In one embodiment, the parameter scenario is defined as follows:

[0144] Based on the equivalence class partitioning method and boundary value method, the parameter scenarios that may occur in different types of parameters in software testing are defined.

[0145] In one embodiment, the generation module comprises:

[0146] The third acquisition submodule is used to obtain the value range of the parameter length;

[0147] A fourth acquisition submodule, used to acquire a minimum value and a maximum value of the parameter length according to the value range of the parameter length;

[0148] A generation submodule is used to generate parameter scenarios including parameter length equal to the minimum value, equal to the maximum value, greater than the maximum value, less than the minimum value, less than the maximum value and greater than the maximum value and expected results as the first test case set according to pre-defined parameter scenarios.

[0149] In one embodiment, the generation module comprises:

[0150] A first determination submodule is used to determine a valid equivalence class scenario and an invalid equivalence class scenario in a predefined parameter scenario according to a parameter value;

[0151] A second determination submodule is used to determine that the expected result of the valid equivalence class scenario is correct, and to determine that the expected result of the invalid equivalence class scenario is wrong;

[0152] The third determination submodule is used to use the expected effects of the valid equivalence class scenarios, the invalid equivalence class scenarios and each parameter scenario as the second test case set.

[0153] In one embodiment, the apparatus further comprises:

[0154] A reading module, used to read pre-stored test case acquisition rules;

[0155] The screening module is used to screen and remove duplicates from the complete test cases corresponding to the parameters to be tested according to the pre-stored test case acquisition rules.

[0156] In one embodiment, the test case acquisition rule includes:

[0157] Get all the test cases where each parameter is valid after all the parameter combinations;

[0158] Get all the test cases where each parameter is invalid after all the parameter combinations are obtained;

[0159] Get a test case where one parameter in the test case is valid and the others are invalid.

[0160] Figure 3 FIG. 1 is a schematic diagram of the hardware structure of a test case generation system in an embodiment of the present application. Figure 3 As shown, the test case generation system includes:

[0161] at least one processor 320; and,

[0162] A memory 304 in communication with the at least one processor 320; wherein,

[0163] The memory 304 stores instructions that can be executed by the at least one processor 320, and the instructions are executed by the at least one processor 320 to implement the test case generation method recorded in any of the above embodiments.

[0164] Reference Figure 3 The test case generation system 300 may include one or more of the following components: a processing component 302 , a memory 304 , a power component 306 , a multimedia component 308 , an audio component 310 , an input / output (I / O) interface 312 , and a communication component 316 .

[0165] The processing component 302 generally controls the overall operation of the test case generation system 300. The processing component 302 may include one or more processors 320 to execute instructions to complete all or part of the steps of the above method. In addition, the processing component 302 may include one or more modules to facilitate the interaction between the processing component 302 and other components. For example, the processing component 302 may include a multimedia module to facilitate the interaction between the multimedia component 308 and the processing component 302.

[0166] The memory 304 is configured to store various types of data to support the operation of the test case generation system 300. Examples of such data include instructions for any application or method operating on the test case generation system 300, such as text, pictures, videos, etc. The memory 304 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.

[0167] The power component 306 provides power to various components of the test case generation system 300. The power component 306 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the vehicle control system 300.

[0168] The multimedia component 308 includes a screen that provides an output interface between the test case generation system 300 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 308 may also include a front camera and / or a rear camera. When the test case generation system 300 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and the rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.

[0169] The audio component 310 is configured to output and / or input audio signals. For example, the audio component 310 includes a microphone (MIC), and when the test case generation system 300 is in an operation mode, such as an alarm mode, a recording mode, a speech recognition mode, and a speech output mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 304 or sent via the communication component 316. In some embodiments, the audio component 310 also includes a speaker for outputting audio signals.

[0170] I / O interface 312 provides an interface between processing component 302 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: a home button, a volume button, a start button, and a lock button.

[0171] The communication component 316 is configured to enable the test case generation system 300 to provide the ability to communicate with other devices and cloud platforms in a wired or wireless manner. The test case generation system 300 can access a wireless network based on a communication standard, such as WiFi, 2G or 3G, or a combination thereof. In an exemplary embodiment, the communication component 316 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 316 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.

[0172] In an exemplary embodiment, the test case generation system 300 can be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors or other electronic components to execute the test case generation method described in any of the above embodiments.

[0173] The present application also provides a computer-readable storage medium. When the instructions in the storage medium are executed by a processor corresponding to the test case generation system, the test case generation system can implement the test case generation method recorded in any of the above embodiments.

[0174] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage and optical storage, etc.) that contain computer-usable program code.

[0175] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0176] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0177] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0178] Obviously, those skilled in the art can make various changes and modifications to the present application without departing from the spirit and scope of the present application. Thus, if these modifications and variations of the present application fall within the scope of the claims of the present application and their equivalents, the present application is also intended to include these modifications and variations.

Claims

1. A test case generation method, characterized in that: include: Acquire parameter information to be tested, wherein the parameter information to be tested at least includes parameter name, parameter length, and parameter value; generating a first test case set associated with parameter length according to a predefined parameter scenario, and generating a second test case set associated with parameter value according to the predefined parameter scenario; The first test case set and the second test case set are fused, and the fusion result is used as a complete test case corresponding to the parameter to be tested.

2. The test case generation method according to claim 1, characterized in that: The obtaining of the parameter information to be measured includes: Obtain a pre-stored table, wherein the table stores at least a parameter name, a parameter type, a parameter length, and a parameter value of a parameter to be measured; The parameter information to be measured is obtained from the pre-stored table.

3. The test case generation method according to claim 1, characterized in that: The parameter scenario is defined as follows: Based on the equivalence class partitioning method and boundary value method, the parameter scenarios that may occur in different types of parameters in software testing are defined.

4. The test case generation method according to claim 1, characterized in that: The step of generating a first test case set related to parameter length according to a predefined parameter scenario comprises: Get the value range of parameter length; Obtaining a minimum value and a maximum value of the parameter length according to the value range of the parameter length; According to the predefined parameter scenarios, parameter scenarios including parameter length equal to the minimum value, equal to the maximum value, greater than the maximum value, less than the minimum value, less than the maximum value and greater than the maximum value and expected results are generated as the first test case set.

5. The test case generation method according to claim 1, characterized in that: The generating a second test case set related to the parameter value according to the predefined parameter scenario comprises: Determine, according to the parameter value, a valid equivalence class scenario and an invalid equivalence class scenario in a predefined parameter scenario; Determine the expected results of the valid equivalence class scenario as correct, and determine the expected results of the invalid equivalence class scenario as incorrect; The effective equivalence class scenario, the invalid equivalence class scenario and the expected effects of each parameter scenario are taken as the second test case set.

6. The test case generation method according to claim 1, characterized in that: The method further comprises: Read pre-stored test case acquisition rules; The complete test cases corresponding to the parameters to be tested are screened and deduplicated according to the pre-stored test case acquisition rules.

7. The test case generation method according to claim 6, characterized in that: The test case acquisition rules include: Get all the test cases where each parameter is valid after all the parameter combinations; Get all the test cases where each parameter is invalid after all the parameter combinations are obtained; Get a test case where one parameter in the test case is valid and the others are invalid.

8. A test case generating device, characterized in that: include: An acquisition module, used to acquire parameter information to be measured, wherein the parameter information to be measured at least includes a parameter name, a parameter length, and a parameter value; A generating module, configured to generate a first test case set associated with a parameter length according to a predefined parameter scenario, and to generate a second test case set associated with a parameter value according to a predefined parameter scenario; A fusion module is used to fuse the first test case set and the second test case set, and use the fusion result as a complete test case corresponding to the parameter to be tested.

9. A test case generation system, characterized in that: include: at least one processor; as well as, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to implement the test case generation method according to any one of claims 1 to 7.

10. A computer-readable storage medium, characterized in that: When the instructions in the storage medium are executed by a processor corresponding to the test case generation system, the test case generation system can implement the test case generation method as described in any one of claims 1 to 7.