Automatic simulation test method for modeling through test requirements
Through SysML, the test requirements are modeled and automated simulation tests are solved, and the problems of disconnection between automated testing and system design, insufficient expression of test requirements and insufficient adaptability are achieved, and the consistency of test and design and an efficient automated testing process are achieved.
Patent Information
- Application Number
- CN202510166427.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-14
- Publication Date
- 2025-06-06
- Estimated Expiration
- 2045-02-14
AI Technical Summary
The existing automated testing methods are out of touch with system design, making it difficult to effectively express complex testing needs, and lack of adaptability and flexibility, resulting in a decrease in test coverage and an extended development cycle.
Completely model the test requirements through SysML, automatically generate test cases and engineering files required for automated simulation tests, and call simulation tools to implement automated simulation tests.
It achieves consistency between tests and designs, improves the accuracy and efficiency of tests, and reduces the need for manual participation and test case updates in regression tests.
Smart Images

Figure CN120104480A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to an automated simulation test method through test requirement modeling, and belongs to the technical field of computers. Background Art
[0002] At present, in the field of testing, the research on automated testing has made great progress, which has improved the efficiency and coverage of testing, but there are still some shortcomings:
[0003] 1) Disconnection between automated testing and system design: Traditional automated testing is rarely directly integrated with the system design phase. This means that testers need to start writing test cases and executing tests after the system design is completed, which prolongs the development cycle. At the same time, the consistency between the test process and the system design cannot be guaranteed.
[0004] 2) Expression and understanding of test requirements: Existing methods often lack an effective way to express complex test requirements, especially for system-level test requirements, which leads to incomplete testing and inaccurate test cases. The modeling of test requirements often remains at the stage of being viewed by testers or automatically generating test cases, and it is difficult to directly participate in the process of automated simulation testing.
[0005] 3) Lack of adaptability and flexibility: As software systems continue to evolve, test cases also need to be constantly updated to match new requirements. Existing automated testing methods often have difficulty adapting to these changes quickly, resulting in reduced test coverage.
[0006] The above shortcomings make it impossible to realize automated simulation testing after modeling the test requirements during the automated testing process, and it is difficult to further improve the accuracy and efficiency of the test. Summary of the invention
[0007] The technical problem solved by the present invention is: to overcome the shortcomings of the prior art, to provide an automated simulation testing method through test requirement modeling, to completely model the test requirements through SysML, to automatically generate test cases and engineering files (including model files, connection relationships, simulation parameter information) required for automated simulation testing, and to call simulation tools to implement automated simulation testing.
[0008] The technical solution of the present invention is: an automated simulation test method through test requirement modeling, comprising:
[0009] S-1 models the system under test and obtains a module definition diagram of the system under test; the module definition diagram describes the relationship between the modules in the system, and describes whether the module participates in the test simulation, the parameters of the module, and the behavior of the module; the module definition diagram also includes simulation parameter information;
[0010] S-2 automatically generates a parameter diagram through a module definition diagram, wherein the parameter diagram describes the variable transfer relationship of each module participating in the simulation test in the system under test, and the parameter diagram contains the model, input port and output port corresponding to the module participating in the simulation;
[0011] S-3 In the parameter diagram, manually connect the input ports and output ports between models according to the variable transfer relationship of the module;
[0012] S-4 models the test requirements of the system under test and obtains a state machine diagram based on the test requirements, including states and state transition conditions;
[0013] S-5 automatically generates test cases based on the parameter definitions of the modules in the module definition diagram and the states and transition conditions in the state machine diagram;
[0014] S-6 defines simulation engineering parameters;
[0015] S-7 calls the modeling tool to generate a model file based on the module definition diagram or imports an existing model file, and generates a model connection diagram based on the parameter diagram;
[0016] S-8 uses model files, model wiring diagrams, and simulation parameters to form project files, imports the project files into simulation tools, and builds simulation projects;
[0017] S-9 executes test cases;
[0018] S-10 collects simulation results, records, analyzes and displays them.
[0019] Preferably, in S-1, the parameters of the module include: input parameters, output parameters, and internal parameters;
[0020] The module's behavior includes: initialization behavior, iteration behavior, and whether to use an existing model file;
[0021] The simulation parameter information includes the range of each simulation parameter.
[0022] Preferably, the simulation engineering parameters in S-6 include a simulation step size.
[0023] Preferably, executing the test case includes:
[0024] Assign values to simulation parameters;
[0025] Set test inputs, including initial parameters and parameter modifications during simulation;
[0026] Simulation control, including starting simulation and stopping simulation;
[0027] Simulation result judgment.
[0028] In a second aspect, an automated simulation test system is provided through test requirement modeling, characterized in that it includes: a test requirement modeling unit, a test case generation unit, a project file generation unit, and a test case execution analysis unit; wherein:
[0029] The test requirement modeling unit is used to model the system under test, including a module definition subunit, a parameter definition subunit and a state description subunit; wherein the module definition subunit models the system under test, obtains a module definition diagram, outputs it to the parameter definition subunit, outputs the simulation parameters in the module definition diagram to the engineering file generation unit, and outputs the parameter definition of the module in the module definition diagram to the test case generation unit; the parameter definition subunit automatically generates a parameter diagram based on the module definition diagram and outputs it to the engineering file generation unit; the state description subunit models the test requirements of the system under test, generates a state machine diagram based on the test requirements, and outputs it to the test case generation unit;
[0030] The test case generation unit automatically generates test cases according to the parameter definitions of the modules in the module definition diagram and the states and transition conditions in the state machine diagram, and outputs the test cases to the test case execution analysis unit;
[0031] The project file generation unit defines simulation project parameters, calls a modeling tool to generate a model file or imports an existing model file according to a module definition diagram, generates a model connection diagram according to a parameter diagram, forms a project file using the model file, the model connection diagram, and simulation parameters, and outputs the project file to a test case execution analysis unit;
[0032] The test case execution and analysis unit executes test cases, collects simulation results, and records, analyzes and displays them.
[0033] Preferably, after the parameter definition subunit automatically generates the parameter diagram based on the module definition diagram, the input ports and output ports between the models are manually connected according to the variable transfer relationship of the modules.
[0034] Preferably, the module definition diagram generated by the test requirement modeling unit is used to describe the relationship between the modules in the system under test, and to describe whether the module participates in the test simulation, the parameters of the module and the behavior of the module; at the same time, the module definition diagram also includes simulation parameter information; wherein:
[0035] The parameters of the module include: input parameters, output parameters, and internal parameters;
[0036] The module's behavior includes: initialization behavior, iteration behavior, and whether to use an existing model file;
[0037] The simulation parameter information includes the range of each simulation parameter.
[0038] Preferably, when the test case execution analysis unit executes the test case:
[0039] Assign values to simulation parameters;
[0040] Set test inputs, including initial parameters and parameter modifications during simulation;
[0041] Simulation control, including starting simulation and stopping simulation;
[0042] Simulation result judgment.
[0043] Compared with the prior art, the present invention has the following advantages:
[0044] (1) The present invention can realize automated testing of the system under test only after modeling the test requirements, without additional manual participation. Since SysML is often used in system design, test requirement modeling can often be performed in the design stage, thereby ensuring the consistency of testing and design and improving the accuracy of testing;
[0045] (2) Due to less manual involvement, the present invention does not need to redesign the test and update the test cases during regression testing. Instead, regression testing can be automatically completed by simply updating the test requirement modeling, which greatly improves the efficiency of the test. BRIEF DESCRIPTION OF THE DRAWINGS
[0046] Figure 1 A schematic diagram of the test requirement modeling and automated test simulation method of the present invention;
[0047] Figure 2 It is an application flow chart of the automated test simulation method of the present invention;
[0048] Figure 3 It is a schematic diagram of module definition of an embodiment of the present invention;
[0049] Figure 4 Schematic diagram of parameters of an embodiment of the present invention;
[0050] Figure 5 Schematic diagram of a state machine according to an embodiment of the present invention. DETAILED DESCRIPTION
[0051] The present invention provides the following technical solutions: an automated simulation test method based on test requirement modeling, which completely models the test requirements through SysML (system modeling language), can automatically generate test cases and engineering files (including model files, connection relationships, simulation parameter information) required for automated simulation testing, and call simulation tools to implement automated simulation testing. Figure 1 As shown, the test requirement modeling includes the following parts:
[0052] 1) The module definition diagram describes the relationship between the modules in the system, whether the module participates in the test simulation, the module parameters and the module behavior. The module definition diagram also contains simulation parameter information. In the initial state, the simulation parameter information gives the range of each simulation parameter.
[0053] 2) Describe the variable transfer relationship of the modules involved in the simulation test in the system through the parameter diagram, that is, the connection relationship diagram of the model in the simulation test. The models and ports in the parameter diagram are automatically generated by the module definition diagram.
[0054] 3) Model the system test requirements through the state machine diagram, and describe the test decision basis in the test through the transfer conditions and states.
[0055] After completing the test requirement modeling, the test engineering files and test cases are generated through automated methods, and the simulation project is called to realize automated simulation testing. The engineering files include model files, connection relationships, and simulation parameter information.
[0056] 1) Model files are automatically generated through module definition diagrams. The modules in the module definition diagram contain model parameters and behavior descriptions, which can be converted into a certain modeling language and call modeling tools to generate model files. At the same time, the existing model files corresponding to the modules can also be directly specified in the module definition diagram for use in test simulation tests.
[0057] 2) The connection relationship is generated through the parameter diagram.
[0058] 3) Test cases are generated through state machine diagrams.
[0059] like Figure 2 As shown, the process of the automated testing method includes:
[0060] (1-1) Use the module definition diagram to model the modules of the system under test, and define the module's parameters (input parameters, output parameters, internal parameters), behaviors (initialization behaviors and iteration behaviors), whether to participate in simulation, and whether to use existing model files.
[0061] (1-2) The parameter diagram is automatically generated through the module definition diagram, where the parameter diagram already contains the models and ports corresponding to the modules involved in the simulation.
[0062] (1-3) In the parameter diagram, the input ports and output ports between models are manually connected according to the variable transfer relationship of the module.
[0063] (1-4) Use state machine diagrams to model the test requirements of the system under test.
[0064] (1-5) Test cases are automatically generated based on the module parameter definitions in the module definition diagram and the states and transition conditions in the state machine diagram.
[0065] (1-6) Define simulation engineering parameters (such as simulation step length)
[0066] (1-7) Call the modeling tool to generate a model file based on the module definition diagram or import an existing model file, and generate a model connection diagram based on the parameter diagram.
[0067] (1-8) Import the project files (model files, model connection diagrams, simulation parameter information) into the simulation tool software to build a simulation project.
[0068] (1-9) Execute the test case. The specific steps include setting simulation parameters, setting test input (including initial parameters and parameter modification during simulation), simulation control (start simulation, stop simulation), and judging simulation results.
[0069] (1-10) Collect simulation results, record, analyze and display them.
[0070] Example:
[0071] A temperature control function test of a temperature control system is used to illustrate the concept and technical effect of the present invention.
[0072] First, use the module definition diagram to model the test target temperature control system. Here, a simplified model is used to model the temperature control system as Figure 3 As shown, the Unreal prefix means that the module will not be used as a digital model in simulation testing. Figure 3 The medium temperature control system is an overall concept, which includes two modules: heater and ambient temperature, so it does not need to participate in simulation. The two modules of heater and ambient temperature are prefixed with Real, indicating that the two modules will participate in simulation testing as digital models. The modules participating in the simulation test will have two parts: value and operation (behavior). The value part has three types: input port, output port and parameter, which correspond to the parameter types of the model in model-based system engineering. They are prefixed with Input, Output and Parameter for software identification. The operation part can define the function of the module, which can participate in test case generation and model generation. In the example, this function is used to calculate the heating power output of the heater model and the temperature of the ambient temperature model.
[0073] After the temperature control system is modeled using the module definition diagram, the model and port information can be read through the software to generate a model and port information and module definition Figure 1 The parameter diagram is as follows: Figure 4 As shown, the tester can then connect the input ports of the model in the parameter graph to the output ports according to the internal relationship of the test target.
[0074] After determining the test requirements, the test requirements can be modeled through the state machine diagram. Figure 5 In the example in, the test requirements of the temperature control function of the temperature control system are modeled. The parameters used in the modeling can be ensured to be consistent with the module definition diagram through software to avoid errors. In the example, the temperature control system has two states, heating and non-heating. When the power switch is turned on, the heating state or non-heating state is entered according to the comparison of the target temperature of the heater model and the temperature of the ambient temperature model. The heating state will adjust the heating power output of the heater to 1000, and the non-heating state will adjust the heating power output of the heater to 0. After that, a judgment will be made every 20 seconds. When the temperature of the ambient temperature model is greater than or equal to the target temperature of the target heater model, the non-heating state will be entered, otherwise it will enter the heating state. Through the algorithm, a state migration path from the start state to the stop state can be parsed. Through a certain algorithm, the initial values of the model parameters and the transfer conditions in the initial path are assigned to obtain test cases.
[0075] After completing the above modeling in the test requirement modeling software of the present invention, the modeling tool can be called through the module definition diagram to automatically generate a model file, or the existing model file corresponding to the module can be directly specified in the module definition diagram. In this example, only two model files will be generated, namely the heater and the ambient temperature. Then extract the connection relationship in the parameter diagram and generate the test case through a certain algorithm. Finally, define the simulation project parameters in the test requirement modeling software. The user operates the test requirement modeling software to execute the test, which will import the project files (model files, model connection diagrams, simulation parameter information) into the simulation tool software, build a simulation project and execute the test case. For example, according to Figure 4 A generated test case will be executed according to the following process:
[0076] 1) Set the initial parameters: target temperature 25℃, initial temperature 20℃;
[0077] 2) Start simulation;
[0078] 3) Set the power switch port of the heater to 1;
[0079] 4) Assert the temperature port of the ambient temperature < the target temperature parameter of the heater;
[0080] 4) Assert that the heating power output port of the heater is 1000;
[0081] 5) After 20 seconds, assert that the temperature port of the ambient temperature is >= the target temperature parameter of the heater
[0082] 6) Assert whether the heating power output port of the heater is 0;
[0083] 7) Set the power switch port of the heater to 0;
[0084] 8) The simulation ends.
[0085] The contents not described in detail in the specification of the present invention belong to the prior art known to the professional and technical personnel in this field.
Claims
1. An automated simulation test method based on test requirement modeling, characterized in that include: S-1 models the system under test and obtains a module definition diagram of the system under test; the module definition diagram describes the relationship between the modules in the system, and describes whether the module participates in the test simulation, the parameters of the module, and the behavior of the module; the module definition diagram also includes simulation parameter information; S-2 automatically generates a parameter diagram through a module definition diagram, wherein the parameter diagram describes the variable transfer relationship of each module participating in the simulation test in the system under test, and the parameter diagram contains the model, input port and output port corresponding to the module participating in the simulation; S-3 In the parameter diagram, manually connect the input ports and output ports between models according to the variable transfer relationship of the module; S-4 models the test requirements of the system under test and obtains a state machine diagram based on the test requirements, including states and state transition conditions; S-5 automatically generates test cases based on the parameter definitions of the modules in the module definition diagram and the states and transition conditions in the state machine diagram; S-6 defines simulation engineering parameters; S-7 calls the modeling tool to generate a model file based on the module definition diagram or imports an existing model file, and generates a model connection diagram based on the parameter diagram; S-8 uses model files, model wiring diagrams, and simulation parameters to form project files, imports the project files into simulation tools, and builds simulation projects; S-9 executes test cases; S-10 collects simulation results, records, analyzes and displays them.
2. The automated simulation test method according to claim 1, characterized in that: In S-1, the module parameters include: input parameters, output parameters, and internal parameters; The module's behavior includes: initialization behavior, iteration behavior, and whether to use an existing model file; The simulation parameter information includes the range of each simulation parameter.
3. The automated simulation test method according to claim 1, characterized in that: The simulation engineering parameters in S-6 include the simulation step size.
4. The automated simulation test method according to claim 1, characterized in that: Execution of test cases includes: Assign values to simulation parameters; Set test inputs, including initial parameters and parameter modifications during simulation; Simulation control, including starting simulation and stopping simulation; Simulation result judgment.
5. An automated simulation test system based on test requirement modeling, characterized in that include: Test requirement modeling unit, test case generation unit, engineering file generation unit, test case execution analysis unit; among which: The test requirement modeling unit is used to model the system under test, including a module definition subunit, a parameter definition subunit and a state description subunit; wherein the module definition subunit models the system under test, obtains a module definition diagram, outputs it to the parameter definition subunit, outputs the simulation parameters in the module definition diagram to the engineering file generation unit, and outputs the parameter definition of the module in the module definition diagram to the test case generation unit; the parameter definition subunit automatically generates a parameter diagram based on the module definition diagram and outputs it to the engineering file generation unit; the state description subunit models the test requirements of the system under test, generates a state machine diagram based on the test requirements, and outputs it to the test case generation unit; The test case generation unit automatically generates test cases according to the parameter definitions of the modules in the module definition diagram and the states and transition conditions in the state machine diagram, and outputs the test cases to the test case execution analysis unit; The project file generation unit defines simulation project parameters, calls a modeling tool to generate a model file or imports an existing model file according to a module definition diagram, generates a model connection diagram according to a parameter diagram, forms a project file using the model file, the model connection diagram, and simulation parameters, and outputs the project file to a test case execution analysis unit; The test case execution and analysis unit executes test cases, collects simulation results, and records, analyzes and displays them.
6. The automated simulation test system according to claim 5, characterized in that: After the parameter definition subunit automatically generates the parameter diagram based on the module definition diagram, the input ports and output ports between models are manually connected according to the variable transfer relationship of the module.
7. The automated simulation test system according to claim 5, characterized in that: The module definition diagram generated by the test requirement modeling unit is used to describe the relationship between the modules in the system under test, and to describe whether the module participates in the test simulation, the parameters of the module, and the behavior of the module; At the same time, the module definition diagram also contains simulation parameter information; among which: The parameters of the module include: input parameters, output parameters, and internal parameters; The module's behavior includes: initialization behavior, iteration behavior, and whether to use an existing model file; The simulation parameter information includes the range of each simulation parameter.
8. The automated simulation test system according to claim 5, characterized in that: When the test case execution analysis unit executes a test case: Assign values to simulation parameters; Set test inputs, including initial parameters and parameter modifications during simulation; Simulation control, including starting simulation and stopping simulation; Simulation result judgment.
Citation Information
Patent Citations
Method and device for generating satellite-borne software test case
CN112015639A
MBSE-based integrated aircraft design method and system
CN115659516A
Component-level test method and device for state machine model
CN117724968A
Unmanned aerial vehicle path planning method and system combining visual model and improved TD3
CN118605601A
Controlling an internal combustion engine using an operating parameter map derived from a trainable model
US20240003308A1