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

By constructing truth tables and assignment tables for the MCDC test criteria, test cases are automatically generated, solving the problem of low efficiency in test case writing in the R&D of new energy vehicles, enabling rapid response to changes in market demand, and improving test quality and automation level.

CN121255652APending Publication Date: 2026-01-02FAW JIEFANG AUTOMOTIVE CO
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511556162.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-10-29
Publication Date
2026-01-02

AI Technical Summary

Technical Problem

In the development of new energy vehicles, existing technologies suffer from low efficiency in writing test cases, making it difficult to quickly respond to changes in market demand and impacting the development cycle.

Method used

By constructing truth tables and assignment tables that conform to the MCDC testing criteria, test cases are automatically generated. Using logical expressions and constraints, the assignment table is traversed row by row to generate all test cases related to the logical expressions.

Benefits of technology

It enables the rapid generation of test cases within limited resources and time, improves test response speed and coverage, meets security standard certification, facilitates test automation, and shortens the R&D cycle.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121255652A_ABST
    Figure CN121255652A_ABST
Patent Text Reader

Abstract

The invention discloses a test case generation method and device, electronic equipment, a storage medium and a vehicle, and relates to the technical field of system tests.The test case generation method comprises the steps that a logic expression, variables included in the logic expression and constraint conditions among the variables are obtained; according to the logic expression and the constraint condition, constructing a truth table meeting a preset correction condition judgment coverage test criterion; obtaining a value range of the variable, and generating an assignment table based on the value range and the truth table; and traversing the assignment table line by line, and automatically generating all test cases related to the logic expression. The automatic generation of the test case of the highly coupled system is realized, and the test response speed and coverage are remarkably improved, so that the research and development period is shortened, and the test quality and the automation level are improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of system testing, in particular to a test case generation method, a test case generation device, an electronic device, a storage medium and a vehicle. BACKGROUND

[0002] The new energy vehicle market is highly competitive, and the rapid changes in market demand have higher requirements for the research and development cycle and response speed, especially during the research and development process, various functions of the vehicle need to be tested, and the test method generally adopts hardware-in-the-loop simulation (HIL).

[0003] Currently, the HIL test method is that based on input requirements, a test case covering all requirement contents is first written by a test personnel, and then joint testing is performed. When market demand changes, product requirements are updated and iterated synchronously to respond to market changes.

[0004] Especially for highly coordinated functions, interaction between various subsystems is required, therefore, the variables between various subsystems constitute a set of obvious constraint conditions, various conditions cooperate with each other under certain working conditions, and conflict with each other under certain conditions. In order to verify the rationality of the principle design and the accuracy in the development process of the highly coupled complex system, it is necessary to perform a complete test on the system, but the method of writing a test case covering all requirement contents by a test personnel takes a long time to respond to frequent changes in requirements, has low writing efficiency, and is difficult to quickly respond to requirement changes, which affects the research and development cycle. SUMMARY

[0005] The purpose of the present application is to provide a test case generation method, a test case generation device, an electronic device, a storage medium and a vehicle, which at least solve the problem of how to quickly generate a test case and quickly respond to requirement changes, and solve one of the problems of how to shorten the research and development cycle.

[0006] The present application provides the following solutions:

[0007] According to one aspect of the present application, a test case generation method is provided, comprising:

[0008] obtaining a logical expression, variables included in the logical expression, and constraint conditions between the variables;

[0009] constructing a truth table meeting a predetermined correction condition judgment coverage test criterion according to the logical expression and the constraint conditions;

[0010] obtaining a value range of the variables, and generating an assignment table based on the value range and the truth table;

[0011] Traverse the assignment table row by row, automatically generate all test cases related to the logical expression.

[0012] Further, the method further comprises:

[0013] Based on the logical expression, determine a set of reference test cases, and in the set of reference test cases, determine at least one first reference test case that meets the preset correction condition judgment coverage test criterion;

[0014] Construct a corresponding first truth table for each of the first reference test cases, the first truth table comprising a plurality of test cases based on the first reference test case;

[0015] In response to each of the test cases satisfying the constraint condition, at least one of the first truth tables is merged to obtain the truth table.

[0016] Further, the method further comprises:

[0017] In response to the existence of a first test case that does not satisfy the constraint condition, determine a first variable included in the first test case;

[0018] In other first reference test cases except the first reference test case corresponding to the first test case, determine a second reference test case;

[0019] Determine a second truth table corresponding to the second reference test case, and based on the first variable in the second truth table, find a second test case that satisfies the constraint condition;

[0020] Update the first test case based on the second test case until each of the first test cases satisfies the constraint condition.

[0021] Further, the method further comprises:

[0022] Obtain a first truth table row in the first truth table where the first test case is located, and a second truth table row in the second truth table where the second test case is located;

[0023] Update the first truth table row based on the second truth table row.

[0024] Further, the method further comprises:

[0025] The repeated rows in at least one of the first truth tables are removed, and the at least one first truth table after the repeated rows are removed is combined to obtain the truth table.

[0026] Further, after the generation of all test cases related to the logical expression, the method further comprises:

[0027] Obtaining a change requirement, and adjusting the corresponding logical expression based on the change requirement to determine a changed logical expression;

[0028] Determining a second variable corresponding to the changed logical expression, and a new constraint condition between the second variables;

[0029] Obtaining a new value range corresponding to the second variable, and generating a new test case according to the changed logical expression, the new constraint condition, and the new value range.

[0030] According to two aspects of the present application, a test case generation device is provided, comprising:

[0031] An obtaining module is configured to obtain a logical expression, variables included in the logical expression, and constraint conditions between the variables;

[0032] A constructing module is configured to construct a truth table meeting a predetermined correction condition judgment coverage test criterion according to the logical expression and the constraint conditions;

[0033] An automatic generation module is configured to obtain a value range of the variables, and generate an assignment table based on the value range and the truth table; and automatically generate all test cases related to the logical expression by traversing the assignment table row by row.

[0034] According to three aspects of the present application, an electronic device is provided, comprising a processor, a communication interface, a memory, and a communication bus, wherein the processor, the communication interface, and the memory complete mutual communication through the communication bus;

[0035] The memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the test case generation method.

[0036] According to four aspects of the present application, a computer readable storage medium is provided, comprising a computer program executable by an electronic device, and when the computer program runs on the electronic device, the electronic device executes the steps of the test case generation method.

[0037] According to five aspects of the present application, a vehicle is provided, comprising:

[0038] An electronic device is configured to implement the steps of the test case generation method.

[0039] a processor, the processor running a program, the program performing the steps of the test case generation method when the program is running on data output from the electronic device;

[0040] a storage medium for storing a program, the program performing the steps of the test case generation method when the program is running on data output from the electronic device.

[0041] Through the above scheme, the following beneficial technical effects are obtained:

[0042] The application constructs a truth table conforming to a predetermined modified condition decision coverage (MCDC) test criterion by using a logical expression and a constraint condition, and automatically generates test cases by using the MCDC test criterion as a method and a process, which is a high-efficiency test method under limited resources and time, can verify the correctness of logic in a highly simulated environment, can meet safety standard certification, can integrate defect discovery, and is easy to realize test automation.

[0043] The application generates an assignment table by using a variable value range and the constructed truth table, iterates the assignment table row by row, automatically generates all test cases related to the logical expression, realizes automatic generation of test cases of a highly coupled system, significantly improves test response speed and coverage, and thus shortens a research and development cycle and improves test quality and automation level. BRIEF DESCRIPTION OF DRAWINGS

[0044] Figure 1 is a flowchart of a test case generation method provided by one or more embodiments of the application.

[0045] Figure 2 is a schematic diagram of generating a test case truth table provided by one specific embodiment of the application.

[0046] Figure 3 is a schematic diagram of merging truth tables provided by one specific embodiment of the application.

[0047] Figure 4 is a schematic diagram of generating an assignment table provided by one specific embodiment of the application.

[0048] Figure 5 is a structural diagram of a test case generation device provided by one or more embodiments of the application.

[0049] Figure 6 is a structural block diagram of an electronic device for a test case generation method provided by one or more embodiments of the application. DETAILED DESCRIPTION

[0050] The technical solutions of the present application will be described clearly and completely in connection with the drawings. Obviously, the described embodiments are part of the embodiments of the present application, rather than all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative labor fall within the scope of protection of the present application.

[0051] The modern new energy vehicle thermal management system can realize heat exchange, and can also be understood as a dispatch center. From the architecture, the battery pack is the only energy source of the new energy vehicle, the refrigerant circulation, the coolant circulation and the air conditioning channel are highly matched, and many components such as the multi-way valve, the chiller and the heat exchanger can connect the originally independent functions. In order to efficiently utilize and distribute each portion of heat and cold, the interaction between the subsystems is required, and the system should consider each subsystem as a whole to consider the thermal management target or the power target. In the thermal management system, when meeting the differentiated temperature requirements of the battery, the electric drive and the passenger compartment, the balance between the energy utilization rate, the cruising range, the charging performance and the passenger comfort of the vehicle should also be considered, and therefore, the new energy vehicle thermal management system architecture is highly coupled. In the highly coupled thermal management system, the variables between the subsystems constitute a set of obvious constraint conditions, and the conditions cooperate with each other under certain working conditions, and conflict with each other under certain conditions.

[0052] In order to verify the rationality of the principle design and the accuracy in the development process of the highly coupled complex system, it is necessary to test the system completely, but due to the constraints of research and development cost and time, it is unacceptable to test the system in detail in the industry, and the MCDC test is the gold standard for testing each safety-critical system. The MCDC test in the HIL environment can verify the correctness of the logic in the highly simulated environment, can meet the safety standard certification, can integrate the discovered defects, and is easy to realize test automation. Based on this, the embodiment provides a test case generation method, which can be applied to the modern new energy vehicle thermal management system, but is not limited to the system, and the embodiment only illustrates the thermal management system.

[0053] Figure 1 is a flowchart of a test case generation method provided by one or more embodiments of the present application.

[0054] As Figure 1 shown, the test case generation method includes:

[0055] Step S1, obtaining a logic expression, variables included in the logic expression, and constraint conditions between the variables.

[0056] In the embodiment, the constraint conditions between variables can be determined according to the coupling relationship between the subsystems and the mutual exclusion and dependency relationship between the variables. The constraint condition can be one or more.

[0057] By analyzing the requirements, the logical requirements for generating the test cases are obtained, so that the logical expressions, the variables included in the logical expressions, and the constraint conditions between the variables are obtained according to the obtained logical requirements.

[0058] In step S2, a truth table meeting the predetermined correction condition judgment coverage test criterion is constructed according to the logical expressions and the constraint conditions.

[0059] It should be noted that in the actual development and testing process of the new energy vehicle model, the HIL test is a necessary link before the real vehicle test. The HIL test should discover as many problems as possible in the shortest possible time, and therefore, the criterion of the minimum test case based on MCDC is a feasible solution.

[0060] The MCDC test criterion is that in a logical system, there are N elements affecting the logical result. In order to verify the influence of each element on the system when testing the system, the designed test case should be able to show the influence of each element on the system alone, and when the element changes, the system also changes, that is, the influence of the remaining factors on the system is shielded, and only the influence of the element is retained. When the MCDC test criterion is applied, when there are N variables in a logical expression, N+1 test cases are required to cover all logical situations.

[0061] In the embodiment, under the correction condition judgment coverage test criterion, a truth table including variable logic is generated for each logical expression and the corresponding constraint condition.

[0062] The truth table is a table with N+1 rows and N columns, each row representing a test case, and each column representing the logical value of each variable in a test case.

[0063] In step S3, the value range of the variable is obtained, and an assignment table is generated based on the value range and the truth table.

[0064] In the embodiment, the value range of the variable can be determined according to the characteristic value range of each sensor or actuator variable. Therefore, according to the determined value range, the truth table and the constraint condition, the variables in the generated truth table are automatically assigned values to generate an assignment table. Each row in the assignment table represents a test case, and each column represents the test value of each variable in the test case.

[0065] In step S4, the assignment table is traversed row by row to automatically generate all test cases related to the logical expressions.

[0066] In the embodiment, the assignment table determines the logic and assignment that can cover all cases of the logic expression, and all test cases of the logic expression can be generated by traversing the assignment table line by line. The test value in the assignment table is converted from the logic value in the truth table and the actual physical range of the corresponding sensor or actuator.

[0067] The all test cases of the logic expression generated by the embodiment can meet the requirement of fast response and greatly improve the test efficiency in the real test link.

[0068] In the embodiment, one logic expression can be designed with multiple benchmark test cases to obtain a group of benchmark test cases of the logic expression. For example, a logic expression Y is (A or B) and (C or D), and the benchmark test cases can be designed as [(True, False, True, False), (True, False, False, True), (False, True, True, False), (False, True, False, True)].

[0069] Further, in the group of benchmark test cases, at least one first benchmark test case that meets the preset correction condition judgment coverage test criterion is determined. For example, the constraint condition of Y is that the variables A and C cannot be true at the same time, and the benchmark test case (True, False, True, False) is removed, and the other three benchmark test cases are the first benchmark test cases. It should be noted that if there is no constraint relationship between the group of benchmark test cases, one group of benchmark test cases can be selected in the actual test process.

[0070] The first benchmark test case is selected one by one to construct the corresponding truth table. In the embodiment, the truth table corresponding to the first benchmark test case is the first truth table for convenience of description. If each test case meets the constraint condition, at least one first truth table is merged to obtain the truth table. Further, in the merging process, the repeated truth table rows need to be removed, and one truth table row in the repeated truth table rows can be retained.

[0071] In the embodiment, if there is a first test case that does not meet the constraint condition, the first variable included in the first test case is determined. The first test case that does not meet the constraint condition can be one or more, and the first variable can also be one or more. For each variable of each first test case, a second benchmark test case is determined in the other first benchmark test cases except the first benchmark test case corresponding to the first test case. The second truth table is determined one by one, and the following implementation is performed for each determined second truth table.

[0072] determining a second truth table corresponding to the second benchmark test case, and based on the first variable, searching for a second test case satisfying the constraint condition in the second truth table. Updating the first test case based on the second test case, further, obtaining a first truth table row in the first truth table where the first test case is located, and a second truth table row in the second truth table where the second test case is located; updating the first truth table row based on the second truth table row until each first test case satisfies the constraint condition, and obtaining a final truth table.

[0073] In combination with the above embodiments, exemplary, Figure 2 is a schematic diagram for generating a test case truth table provided by one specific embodiment of the present application. As shown in Figure 2 , a set of benchmark test cases are generated for a logical expression; it is checked whether each benchmark case satisfies all constraint conditions, and the benchmark test cases that do not satisfy the conditions are removed. In the remaining benchmark test cases (i.e., the first benchmark case), a benchmark test case is randomly selected, denoted as b, and a truth table of the logical expression is generated. The content in the truth table is the logical value of each variable in each test case; it is checked whether each test case satisfies all constraint conditions, and if yes, f is output. Figure 3 is a schematic diagram for merging truth tables provided by one specific embodiment of the present application. In combination with Figure 3 , if not, the variable (i.e., the first variable) in the test case used for separate display is denoted as x, the truth table row (i.e., the first truth table) corresponding to the test case is denoted as f(x), and the benchmark test case is reselected. A benchmark test case is selected from the remaining benchmark test cases, denoted as b1, a new truth table (the second truth table) is re-generated, denoted as f1, and the truth table row where the variable x is located is found from the new truth table, denoted as f1(x). If f1(x) satisfies the constraint condition, f1(x) is filled back to the position of f(x), and it is checked whether there is a test case in f that coincides with b1. If not, b1 is added to f, and f is output. If not, the benchmark test case that satisfies the MCDC test criterion is reselected. The newly selected benchmark test case is denoted as b2, a new f2 is re-generated, and the f2(x) where the variable x is located is found from f2. It is judged whether f2(x) satisfies the constraint condition. If yes, f2(x) is filled back to f(x), and it is checked whether there is a test case in f that coincides with b2. If not, b2 is added to f2, and f is output. If not, the above process is repeated until all test cases satisfy the constraint condition, and a logical truth table f is output. If there are more than one variables that do not satisfy the constraint condition in f, a truth table row that satisfies the constraint condition is reselected for each variable that does not satisfy the constraint condition, until the truth table f satisfies the MCDC test criterion and the constraint condition.

[0074] In this embodiment, if the demand changes, the logical expression and the value range of its variable may change. Then the change demand can be obtained, and the corresponding logical expression is adjusted based on the change demand to determine the changed logical expression; the second variable corresponding to the changed logical expression and the new constraint condition between the second variables are determined; the new value range corresponding to the second variable is obtained, and the new test case is generated according to the changed logical expression, the new constraint condition and the new value range. By sorting out the demand change point, adjusting the changed logical expression and the related variable and the value range thereof, the test case of HIL test can be automatically generated to meet the demand of rapid response.

[0075] Figure 4 is a schematic diagram of generating an assignment table provided by one specific embodiment of the present application. As shown in Figure 4 , the logical expression Y is obtained. Still taking Y=(A or B) and (C or D) as an example, the constraint condition is that AC cannot be true at the same time, then three benchmark test cases meeting the MCDC test criterion are selected from the four benchmark test cases, so as to generate the truth table f of the logical expression Y, each variable is assigned a value in combination with the value range of each variable, so as to generate the assignment table g, and according to the assignment table g, a group of test cases can be automatically generated for the logical expression Y. The automatically generated test cases meet the MCDC test criterion and do not conflict with the constraint condition.

[0076] In this embodiment, the test environment is built on the HIL platform, including core components such as real-time processors, I / O interfaces and simulation models. It is ensured that the system under test (such as ECU) is correctly connected with the simulation model. Then the generated test case set is applied to the HIL test platform, the test case is executed and the test result is recorded. During the test process, the running state of the system under test is continuously monitored to ensure the accuracy and effectiveness of the test.

[0077] The test case tested by the HIL test platform in this embodiment can respond to changes and iteration in a timely manner, and can reduce the proportion of manually written test cases. While reducing the error rate and improving the work efficiency, more efforts can be paid to the remaining key links of HIL test.

[0078] Based on the above embodiment, the system logic expression and the constraint condition between variables are analyzed, the benchmark case is generated based on the MCDC criterion, and the test case that does not meet the constraint is dynamically removed; the truth table and the assignment table that meet the coverage requirement and satisfy the system coupling relationship are automatically constructed, and finally the test case set that can be directly executed is output. The problems of low test case writing efficiency and difficulty in quickly responding to requirement changes can be solved. When the requirement changes, only the corresponding logic expression and constraint condition need to be adjusted to quickly regenerate the test case, which significantly improves the test response speed and coverage, and is suitable for the HIL test link of the new energy thermal management system with high coupling and frequent requirement iteration, can effectively shorten the research and development cycle, and improve the test quality and automation level.

[0079] Figure 5 is a structural diagram of a test case generation device provided by one or more embodiments of the present application.

[0080] As shown in Figure 5 , the test case generation device comprises an acquisition module, a construction module and an automatic generation module.

[0081] The acquisition module is configured to acquire a logic expression, variables included in the logic expression, and constraint conditions between the variables.

[0082] The construction module is configured to construct a truth table that meets the predetermined correction condition judgment coverage test criterion according to the logic expression and the constraint condition.

[0083] The automatic generation module is configured to acquire a value range of the variables, generate an assignment table based on the value range and the truth table, and automatically generate all test cases related to the logic expression by traversing the assignment table row by row.

[0084] The construction module is configured to determine a group of benchmark test cases based on the logic expression, determine at least one first benchmark test case that meets the predetermined correction condition judgment coverage test criterion in the group of benchmark test cases, and construct a corresponding first truth table for the first benchmark test case one by one, the first truth table comprising a plurality of test cases based on the first benchmark test case. In response to each test case meeting the constraint condition, at least one first truth table is merged to obtain the truth table.

[0085] The automatic generation module is further configured to, in response to the existence of the first test case that does not satisfy the constraint condition, determine a first variable included in the first test case; determine a second benchmark test case from other first benchmark test cases except for a first benchmark test case corresponding to the first test case; determine a second truth table corresponding to the second benchmark test case, and based on the first variable in the second truth table, find a second test case that satisfies the constraint condition; update the first test case based on the second test case until each first test case satisfies the constraint condition. Obtain a first truth table row in a first truth table in which the first test case is located, and a second truth table row in a second truth table in which the second test case is located; update the first truth table row based on the second truth table row. Remove duplicate rows in at least one first truth table, combine the at least one first truth table from which the duplicate rows are removed, and obtain a truth table. Obtain a change requirement, and based on the change requirement, adjust a corresponding logical expression to determine a changed logical expression; determine a second variable corresponding to the changed logical expression, and a new constraint condition between the second variables; obtain a new value range corresponding to the second variable, and according to the changed logical expression, the new constraint condition and the new value range, generate a new test case.

[0086] Figure 6 is a kind of electronic equipment structure block diagram provided by the test case generation method of one or more embodiments of the present application.

[0087] As Figure 6 shown, the present application provides an electronic device, comprising: a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory complete mutual communication through the communication bus.

[0088] The memory stores a computer program, and when the computer program is executed by the processor, the processor executes the steps of the test case generation method.

[0089] The present application also provides a computer readable storage medium storing a computer program executable by an electronic device, which causes the electronic device to execute the steps of the test case generation method when the computer program runs on the electronic device.

[0090] The present application also provides a vehicle, comprising:

[0091] The electronic device is used to implement the steps of the test case generation method.

[0092] The processor runs the program, and when the program runs, the data output from the electronic device executes the steps of the test case generation method.

[0093] The storage medium is used to store the program, and when the program runs, the data output from the electronic device executes the steps of the test case generation method.

[0094] The communication bus mentioned above can be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus can be divided into an address bus, a data bus, a control bus, and the like. For the convenience of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or only one type of bus.

[0095] The electronic device includes a hardware layer, an operating system layer running on the hardware layer, and an application layer running on the operating system. The hardware layer includes hardware such as a central processing unit (CPU), a memory management unit (MMU), and a memory. The operating system can be any one or more computer operating systems that implement electronic device control through processes, such as a Linux operating system, a Unix operating system, an Android operating system, an iOS operating system, or a windows operating system. In embodiments of the present application, the electronic device can be a handheld device such as a smartphone or a tablet computer, or an electronic device such as a desktop computer or a portable computer, and is not particularly limited in embodiments of the present application.

[0096] The execution subject of the electronic device control in embodiments of the present application can be an electronic device, or a functional module in the electronic device that can call and execute programs. The electronic device can obtain firmware corresponding to the storage medium, which is provided by a vendor. The firmware corresponding to different storage media can be the same or different, and is not limited herein. After obtaining the firmware corresponding to the storage medium, the electronic device can write the firmware corresponding to the storage medium into the storage medium, specifically by burning the firmware corresponding to the storage medium into the storage medium. The process of burning the firmware into the storage medium can be implemented using existing technology, and is not described in detail in embodiments of the present application.

[0097] The electronic device can also obtain a reset command corresponding to the storage medium, which is provided by a vendor. The reset command corresponding to different storage media can be the same or different, and is not limited herein.

[0098] At this time, the storage medium of the electronic device is the storage medium on which the corresponding firmware is written, and the electronic device can respond to the reset command corresponding to the storage medium in the storage medium on which the corresponding firmware is written, so that the electronic device resets the storage medium on which the corresponding firmware is written according to the reset command corresponding to the storage medium. The process of resetting the storage medium according to the reset command can be implemented in the prior art, and will not be described in detail in the embodiment of the present application.

[0099] For the convenience of description, the above apparatus is described as various units and modules in function. Of course, the functions of the units and modules can be implemented in one or more software and / or hardware in the implementation of the present application.

[0100] Those skilled in the art can understand that, unless otherwise defined, all terms (including technical terms and scientific terms) used herein have the same meaning as commonly understood by those skilled in the art to which the present application belongs. It should also be understood that terms such as those defined in a general dictionary should be understood in the context of the present application and should not be interpreted in an idealized or overly formal sense unless specifically defined.

[0101] For the convenience of description, the above apparatus is described as various units and modules in function. Of course, the functions of the units and modules can be implemented in one or more software and / or hardware in the implementation of the present application.

[0102] From the above description of the embodiments, those skilled in the art can clearly understand that the present application can be implemented by means of software and the necessary general hardware platform. Based on such understanding, the technical solutions of the present application can be embodied in the form of a software product, which can be stored in a storage medium, such as a ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions to make a computer device (which can be a personal computer, a server or a network device, etc.) execute the methods described in the various embodiments or some parts of the embodiments of the present application.

[0103] It should be noted that the above embodiments are only used to illustrate the technical solutions of the present application, and are not intended to limit the present application; although the present application has been described in detail with reference to the above embodiments, those skilled in the art should understand that the technical solutions recorded in the above embodiments can be modified, or some or all of the technical features can be replaced by equivalents; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present application.

Claims

1. A test case generation method, characterized in that, The test case generation method includes: Obtain the logical expression, the variables included in the logical expression, and the constraints between the variables; Based on the logical expression and the constraints, construct a truth table that conforms to the preset correction condition judgment coverage test criterion; Obtain the value range of the variable, and generate an assignment table based on the value range and the truth table; The assignment table is traversed line by line to automatically generate all test cases related to the logical expression.

2. The test case generation method according to claim 1, characterized in that, The step of constructing a truth table that conforms to the preset modified condition determination coverage test criterion based on the logical expression and the constraints includes: Based on the logical expression, a set of benchmark test cases is determined, and among the set of benchmark test cases, at least one first benchmark test case that meets the preset correction condition judgment coverage test criterion is determined; For each of the first benchmark test cases, a corresponding first truth table is constructed. The first truth table includes multiple test cases based on the first benchmark test cases. In response to each of the test cases satisfying the constraints, at least one of the first truth tables is merged to obtain the truth table.

3. The test case generation method according to claim 2, characterized in that, The method further includes: In response to the existence of a first test case that does not satisfy the constraints, a first variable included in the first test case is determined; Among the other first benchmark test cases besides the first benchmark test case corresponding to the first test case, determine the second benchmark test case; Determine the second truth table corresponding to the second benchmark test case, and search for the second test case that satisfies the constraint condition in the second truth table based on the first variable; The first test case is updated based on the second test case until each of the first test cases satisfies the constraints.

4. The test case generation method according to claim 3, characterized in that, The step of updating the first test case based on the second test case includes: Obtain the first truth table row in the first truth table containing the first test case, and the second truth table row in the second truth table containing the second test case; Update the first truth table row based on the second truth table row.

5. The test case generation method according to claim 2, characterized in that, The step of merging at least one of the first truth tables to obtain the truth table includes: At least one duplicate row in the first truth table is removed, and the at least one first truth table with duplicate rows removed is merged to obtain the truth table.

6. The test case generation method according to claim 1, characterized in that, After generating all test cases related to the logical expression, the method further includes: Obtain change requests, and adjust the corresponding logical expression based on the change requests to determine the change logical expression; Determine the second variable corresponding to the changed logical expression, and the new constraints between the second variables; Obtain the new value range corresponding to the second variable, and generate new test cases based on the changed logical expression, the new constraint conditions, and the new value range.

7. A test case generation device, characterized in that, The test case generation device includes: The acquisition module is used to acquire the logical expression, the variables included in the logical expression, and the constraints between the variables; The construction module is used to construct a truth table that conforms to the preset correction condition judgment coverage test criterion based on the logical expression and the constraints. An automatic generation module is used to obtain the value range of the variable and generate an assignment table based on the value range and the truth table; the assignment table is traversed row by row to automatically generate all test cases related to the logical expression.

8. An electronic device, characterized in that, include: The processor, communication interface, memory, and communication bus are connected, with the processor, communication interface, and memory communicating with each other via the communication bus. The memory stores a computer program that, when executed by a processor, causes the processor to perform the steps of the test case generation method as described in any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that, The device stores a computer program executable by an electronic device, which, when run on the electronic device, causes the electronic device to perform the steps of the test case generation method as described in any one of claims 1 to 6.

10. A vehicle, characterized in that, include: An electronic device for implementing the steps of the test case generation method as described in any one of claims 1 to 6; A processor that runs a program, which, when running, performs the steps of the test case generation method as described in any one of claims 1 to 6 from data output by the electronic device. A storage medium for storing a program that, when run, performs the steps of the test case generation method as described in any one of claims 1 to 6 on data output from an electronic device.