CN104850110B - A kind of method and system for establishing test case - Google Patents

A kind of method and system for establishing test case Download PDF

Info

Publication number
CN104850110B
CN104850110B CN201410227714.6A CN201410227714A CN104850110B CN 104850110 B CN104850110 B CN 104850110B CN 201410227714 A CN201410227714 A CN 201410227714A CN 104850110 B CN104850110 B CN 104850110B
Authority
CN
China
Prior art keywords
state
variable
jump condition
test case
transfering
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Expired - Fee Related
Application number
CN201410227714.6A
Other languages
Chinese (zh)
Other versions
CN104850110A (en
Inventor
裴蕾
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Treasure Car Co Ltd
Original Assignee
Beijing Treasure Car Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Treasure Car Co Ltd filed Critical Beijing Treasure Car Co Ltd
Priority to CN201410227714.6A priority Critical patent/CN104850110B/en
Publication of CN104850110A publication Critical patent/CN104850110A/en
Application granted granted Critical
Publication of CN104850110B publication Critical patent/CN104850110B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G05CONTROLLING; REGULATING
    • G05BCONTROL OR REGULATING SYSTEMS IN GENERAL; FUNCTIONAL ELEMENTS OF SUCH SYSTEMS; MONITORING OR TESTING ARRANGEMENTS FOR SUCH SYSTEMS OR ELEMENTS
    • G05B23/00Testing or monitoring of control systems or parts thereof
    • G05B23/02Electric testing or monitoring
    • G05B23/0205Electric testing or monitoring by means of a monitoring system capable of detecting and responding to faults
    • G05B23/0218Electric testing or monitoring by means of a monitoring system capable of detecting and responding to faults characterised by the fault detection method dealing with either existing or incipient faults
    • G05B23/0243Electric testing or monitoring by means of a monitoring system capable of detecting and responding to faults characterised by the fault detection method dealing with either existing or incipient faults model based detection method, e.g. first-principles knowledge model

Abstract

The invention discloses a kind of method and system for establishing test case, the described method comprises the following steps: Step 1: importing model to be measured;Step 2: defining test scene, which is made of multiple continuous states according to certain transfer order;Step 3: corresponding state variable is arranged for each state respectively, jump condition is set for transfer order, corresponding transfering variable is set for each jump condition;Step 4: successively choosing the state variable of each state and the transfering variable of jump condition, combination producing test case.The method and system for establishing test case of the invention solve in the emulation testing of the upper layer algorithm model of the entire car controller software of the prior art, manually perform test case inefficiency, the technical issues of test case coverage rate is not high, portable poor, and test process takes time and effort.

Description

A kind of method and system for establishing test case
Technical field
The present invention relates to controller of new energy automobile technical field more particularly to a kind of methods for establishing test case And system.
Background technique
Entire car controller (Vehicle Control Unit) is the core component of entire new energy automobile control system, it To the normally travel of automobile, safety, Way of Regenerating Energy Feedback, network management, fault diagnosis filter, vehicle state monitoring Etc. functions play key effect.
Currently, the entire car controller development mode of international popular are as follows: first according to functional requirement, (such as using tool software MATLAB/Simulink software modeling emulation) is carried out, establishes basic software control algorithm, and preliminary test is carried out to algorithm Card is realized control algolithm in the controller of a simulation, true or same to control using the controller of simulation It is the controlled device of simulation, carrys out the correctness of verification algorithm.In next step, hardware design and software development are carried out for algorithm, obtained ECU prototype is obtained, and is made a preliminary test using hardware-in-loop simulation to ECU, control object can use PC machine algorithm and carry out mould It is quasi-.Finally, upper real vehicle is verified and is demarcated.
Entire car controller software code includes the bottom layer driving code and upper layer algorithmic code of controller.Upper layer algorithm generation Code can be automatically generated by MATLAB/Simulink, such as MATLAB provides (Real Time between real-time working Workshop) function can carry out the simulation modeling in terms of algorithm from Simulink, and according to required for auto-building model Algorithmic code, and do not have to go to write code manually.In this way, main attention can be concentrated on opening for algorithm by software developer Hair rather than in the realization of specific code, and can be by emulating come the correctness of rapidly verification algorithm.Based on model Real time workshop mode is the development trend of automobile controller software exploitation.
Currently, the emulation testing of the upper layer algorithm model of entire car controller software, usually directly to the defeated of model to be measured The value for entering pumping signal is defined, and then observes the output result of model to be measured.This method needs are held manually one by one The quantity of row test case, inefficiency, test case is often limited, and test case coverage rate is not high, to influence test effect Fruit.In addition, the upper layer algorithm model of entire car controller software is divided into multiple types such as hybrid power, pure electric vehicle, fuel cell, it is right In different types of model to be measured, generally require to separately design test case during above-mentioned emulation testing, test case can Transplantability is poor, and test process is caused to take time and effort.
Summary of the invention
For this purpose, the technical problem to be solved in the present invention is that the upper layer algorithm model of the entire car controller software of the prior art Emulation testing in, manually perform test case inefficiency, test case coverage rate is not high, portable poor, test process It takes time and effort, to propose a kind of method and system for establishing test case to solve the problems, such as this.
In order to solve the above technical problems, the invention adopts the following technical scheme:
A method of establishing test case, comprising the following steps: Step 1: importing model to be measured;Step 2: definition is surveyed Examination hall scape, the test scene are made of multiple continuous states according to certain transfer order;Step 3: being directed to each shape respectively Corresponding state variable is arranged in state, and jump condition is arranged for transfer order, corresponding transfer is arranged for each jump condition Variable;Step 4: successively choosing the state variable of each state and the transfering variable of jump condition, combination producing test is used Example.
As the further improvements in methods for establishing test case of the invention, the process packet for importing model to be measured It includes: by automatically generating script, importing model to be measured, identify the input/output interface and built-in variable of model to be measured.
As the further improvements in methods for establishing test case of the invention, the process packet for defining test scene It includes: being a module by each state description, wherein including the description of each state, pass through arrow mark between two neighboring state Infuse shift direction, and settable jump condition.
It is described " to be arranged respectively for each state as the further improvements in methods for establishing test case of the invention The process of corresponding state variable, for transfer order setting jump condition " includes: that one or more is arranged for each state State variable, wherein the one or more values of each state variable setting;Jump condition is set between two neighboring state, shifts item One or more transfering variables, each one or more values of transfering variable setting are arranged in part.
It is described " successively to choose the shape of each state as the further improvements in methods for establishing test case of the invention The process of state variable and jump condition, combination producing test case " includes: that state variable is chosen from each state, each State variable chooses a value, transfering variable is chosen from each jump condition, each transfering variable chooses a value, according to survey The state of examination hall scape shifts order, successively combines the state variable of value and transfering variable, generates test case.
Based on the same inventive concept, the present invention also proposes a kind of system for establishing test case, comprising: model to be measured imports Module: for importing model to be measured;Test scene definition module: for defining test scene, the test scene is by multiple continuous State constituted according to certain transfer order;State variable and jump condition definition module: for being directed to each state respectively Corresponding state variable is set, jump condition is set for transfer order, corresponding transfer is set for each jump condition and is become Amount;Test cases technology module: it for successively choosing the state variable of each state and the transfering variable of jump condition, combines Generate test case.
As the further improvement of the system for establishing test case of the invention, the model import modul to be measured include to Survey model import unit, for importing model to be measured by automatically generating script, identify model to be measured input/output interface and Built-in variable.
As the further improvement of the system for establishing test case of the invention, the test scene definition module includes surveying Examination hall scape definition unit, for being a module by each state description, wherein including the description of each state, two neighboring shape Shift direction, and settable jump condition are marked by arrow between state.
As the further improvement of the system for establishing test case of the invention, the state variable and jump condition definition Module includes state variable definition unit and jump condition definition unit, and the state variable definition unit is used to be directed to each shape One or more state variables are arranged in state, wherein the one or more values of each state variable setting;The jump condition definition is single Member is for for jump condition is arranged between two neighboring state, one or more transfering variables, Mei Gezhuan to be arranged in jump condition Move the one or more values of variable setting.
As the further improvement of the system for establishing test case of the invention, the Test cases technology module includes surveying Example generation unit on probation, for choosing state variable from each state, each state variable chooses a value, from each transfer Transfering variable is chosen in condition, each transfering variable chooses a value, order is shifted according to the state of test scene, by value State variable and transfering variable successively combine, and generate test case.
The method and system for establishing test case of the invention have the beneficial effect that
(1) method and system for establishing test case of the invention, since the test case of generation is based on the to be measured of importing The coverage rate of model, test case is high;Test scene is made of multiple continuous states according to certain transfer order, Mei Gezhuan Corresponding state variable is arranged in state, and jump condition is arranged in transfer order, and corresponding transfering variable is arranged in each jump condition, herein On the basis of the test case established include state and jump condition, be conducive to the test process of building automation, improve test effect Rate;Import new model to be measured, and establish test case on this basis, can be multiplexed it is previous establish test case process, Keep the portability of test case good, and then keeps establishing for test case more convenient, quick.
(2) method and system for establishing test case of the invention, due to utilizing the script automatic identification model to be measured Input/output interface and built-in variable can guarantee covering for test case so according to this as the basis for establishing test case Lid rate.
(3) method and system for establishing test case of the invention, due to test scene by multiple continuous states according to Certain transfer order is constituted, and each state is described as a module, and includes the description of each state, two neighboring shape Shift direction is marked by arrow between state, and jump condition is set, further completes the foundation of test case on this basis. The definition procedure of state and jump condition is intuitive, visual, makes the friendly interface of test case establishment process, is conducive to improve test The efficiency that use-case is established, and the omission for preventing state or jump condition from defining, caused by test case coverage rate it is inadequate.
(4) method and system for establishing test case of the invention, due to state and its corresponding state variable, transfer item Part and its corresponding transfering variable, are defined, i.e., according to test according to the input/output interface of model to be measured and built-in variable Demand and be defined, thus different model to be measured, the definition of state variable and transfering variable can be according to testing requirement spirit Adjustment living.In turn, it according to the new model to be measured of importing, modifies, or mends to the state and jump condition of previous definition Fill, or directly be multiplexed, so that it may complete the definition of new test scene, it can be seen that, test case establishment process it is removable Plant property is good.
(5) method and system for establishing test case of the invention, due to choosing state variable from each state, each State variable chooses a value, and transfering variable is chosen from each jump condition, and each transfering variable is chosen one and is worth, and according to The state of test scene shifts order, successively combines the state variable of value and transfering variable, regular according to this, generates test and uses Example.In terms of whole process, the automation of test case foundation is realized, improves the efficiency for establishing test case.
Detailed description of the invention
In order to make the content of the present invention more clearly understood, it below according to specific embodiments of the present invention and combines Attached drawing, the present invention is described in further detail, wherein
Fig. 1 is a kind of flow chart of method for establishing test case of the embodiment of the present invention.
Fig. 2 is a kind of method for establishing test case of controller of new energy automobile software of the embodiment of the present invention Schematic diagram.
Fig. 3 is a kind of system for establishing test case of controller of new energy automobile software of the embodiment of the present invention Architecture diagram.
Specific embodiment
Embodiment 1:
As one embodiment of the method for establishing test case of the invention, Fig. 1, which is shown, a kind of establishes test case Method flow chart.In importing model step S1 to be measured, model to be measured is imported;It is fixed in defining test scene step S2 Adopted test scene, the test scene are made of multiple continuous states according to certain transfer order;In definition status variable and In jump condition step S3, corresponding state variable is set for each state respectively, jump condition is set for transfer order, For each jump condition, corresponding transfering variable is set;In generating test case step S4, each state is successively chosen The transfering variable of state variable and jump condition, combination producing test case.
Wherein, in importing model step S1 to be measured, the process for importing model to be measured includes: by automatically generating foot This, imports model to be measured, identifies the input/output interface and built-in variable of model to be measured.
In defining test scene step S2, it is one that the process for defining test scene, which includes: by each state description, A module, wherein include the description of each state, by arrow mark shift direction between two neighboring state, and settable turn Shifting condition.
In definition status variable and jump condition step S3, " corresponding state variable is set for each state respectively, For transfer order, jump condition is set " process include: that one or more state variables are set for each state, wherein often A one or more values of state variable setting;Jump condition is set between two neighboring state, and jump condition is arranged one or more A transfering variable, each one or more values of transfering variable setting.
It is described " successively to choose the state variable and jump condition of each state, group in generating test case step S4 Symphysis is at test case " process include: that state variable is chosen from each state, each state variable chooses a value, from Transfering variable is chosen in each jump condition, each transfering variable chooses a value, order is shifted according to the state of test scene, It successively combines the state variable of value and transfering variable, generates test case.
It can be seen that the method for establishing test case of the present embodiment identifies to be measured in importing model step S1 to be measured The input/output interface and built-in variable of model, and accordingly in defining test scene step S2, definition status and jump condition, And then in definition status variable and jump condition step S3, the corresponding state variable of setting state, corresponding turn of jump condition Variable is moved, on this basis, order is shifted according to state, successively combines the state variable of value and transfering variable, generate and survey Example on probation, test case coverage rate are high;Due to including the corresponding transfering variable of state jump condition in test case, be conducive to reality The automated execution of existing test case, improves testing efficiency;Meanwhile in step sl, different models to be measured is imported, and accordingly Pass sequentially through step S2, S3, S4 and establish test case, can be multiplexed it is previous establish test case process, thus it is portable It is good.
Embodiment 2:
In the present embodiment, a specific application example is provided, the present embodiment is that controller of new energy automobile is soft The method for establishing test case of the emulation testing of part upper layer algorithm model comprising key step it is as described in Example 1, It imports in model step S1 to be measured, imports model to be measured;In defining test scene step S2, test scene, the test are defined Scene is made of multiple continuous states according to certain transfer order;In definition status variable and jump condition step S3, Corresponding state variable is set for each state respectively, jump condition is set for transfer order, for each jump condition Corresponding transfering variable is set;In generating test case step S4, the state variable and transfer of each state are successively chosen The transfering variable of condition, combination producing test case.As it can be seen that be measured model of the test case based on importing generated, test is used The coverage rate of example is high;Test scene is made of multiple continuous states according to certain transfer order, and each state setting corresponds to State variable, jump condition is arranged in transfer order, and each jump condition is arranged corresponding transfering variable, establishes on this basis Test case include state and jump condition, be conducive to building automation test process, improve testing efficiency;It imports newly Model to be measured, and test case is established on this basis, it can be multiplexed the test case process previously established, make test case It is portable good, and then keep establishing for test case more convenient, quick.
Specific steps are as follows:
In importing model step S1 to be measured, using the auto-building model script developed based on Python, import Model to be measured, can automatic identification model to be measured input/output interface and built-in variable.Model based on Python exploitation Automatically generating script is entire car controller software testing technology field common technique means, because without repeating.
Using the input/output interface and built-in variable of the script automatic identification model to be measured, according to this as foundation test The basis of use-case, it is ensured that the coverage rate of test case.
Following steps S2 to S4 is realized based on the visualized graphs configuration interface that Python is developed.Based on Python language Speech exploitation visualized graphs configuration interface technology be entire car controller software testing technology field common technique means, because without It repeats.
In defining test scene step S2, institute is tested according to the input/output interface of model to be measured and definition of internal variable The scene of demand, the scene are made of multiple continuous states according to certain transfer order, are one by each state description A module, wherein include the description of each state, by arrow mark shift direction between two neighboring state, and settable turn Shifting condition.As shown in Fig. 2, the test scene of definition includes starting engine, acceleration, brake, parking and closes the states such as engine. Jump condition is set between acceleration mode and braking state: until speed is met certain condition;In braking state and parking shape Jump condition is set between state: until speed is equal to zero.
As other embodiments, gone back between acceleration mode and braking state, between braking state and dead ship condition Other jump conditions can be respectively set.
As other embodiments, between starting engine status and acceleration mode, dead ship condition and engine shape is closed One or more jump conditions can also be respectively set between state.
Test scene is made of multiple continuous states according to certain transfer order, and each state is described as a mould Block, and include the description of each state, shift direction is marked by arrow between two neighboring state, and transfer item is set Part further completes the foundation of test case on this basis.The definition procedure of state and jump condition is intuitive, visual, makes to survey The friendly interface of example establishment process on probation is conducive to improve the efficiency that test case is established, and prevents state or transfer item The omission that part defines, caused by test case coverage rate it is inadequate.
In definition status variable and jump condition step S3, one or more state variables are set for each state, Wherein each one or more values of state variable setting;Jump condition, jump condition setting one are set between two neighboring state A or multiple transfering variables, each one or more values of transfering variable setting.As shown in Fig. 2, being directed to acceleration mode, being arranged and being somebody's turn to do The corresponding state variable of state be throttle, setting state variable throttle value be throttle=100, throttle= 50, it respectively indicates full throttle and air throttle is half-open.For the jump condition met certain condition until speed, it is arranged and is somebody's turn to do The corresponding transfering variable vehicle of jump condition, the value of setting transfering variable vehicle be vehicle >=50, vehicle >= 100, it respectively indicates until speed is 50km/h and until speed is 100km/h.For braking state, it is arranged corresponding with the state State variable be brake, setting state variable brake value be brake=100, indicate brake pedal step on entirely.For straight To the null jump condition of speed, transfering variable vehicle corresponding with the jump condition is set, transfering variable is set The value of vehicle is vehicle=0, indicates that until speed be 0km/h.
As other embodiments, it is variable pedal that the corresponding state variable of acceleration mode, which can also be arranged, and is arranged The value of state variable pedal is pedal=100, pedal=50, and the aperture amount for respectively indicating accelerator pedal is 100% and 50%. It is, of course, also possible to which the value of state variable pedal is arranged in a section consecutive variations, such as the value of setting state variable pedal Between 50 to 100.
As other embodiments, other corresponding states variables of braking state can also be set, be arranged until vehicle Speed is met certain condition, until the null other corresponding transfering variables of speed.
, it is clear that these embodiments can need flexible choice according to test.
State and its corresponding state variable, jump condition and its corresponding transfering variable, according to the input of model to be measured Output interface and built-in variable are defined, i.e., are defined according to testing requirement, thus different models to be measured, and state becomes The definition of amount and transfering variable can be adjusted flexibly according to testing requirement.In turn, according to the new model to be measured of importing, to previous The state and jump condition of definition are modified, and are perhaps supplemented or are directly multiplexed, so that it may complete determining for new test scene Justice, it can be seen that, the portability of test case establishment process is good.
In generating test case step S4, state variable is chosen from each state, each state variable chooses one Value chooses transfering variable from each jump condition, and each transfering variable chooses a value, shifts according to the state of test scene Order successively combines the state variable of value and transfering variable, generates test case.
As shown in Fig. 2, choosing state variable throttle from acceleration mode, and select the value of the state variable throttle=100;Transfering variable vehicle is selected from the jump condition met certain condition until speed, and selects this turn The value vehicle of shifting variable >=50;State variable brake is chosen from braking state, and selects the value of the state variable brake=100;Transfering variable vehicle is selected from until the null jump condition of speed, and selects the transfering variable Value vehicle=0;Order is shifted according to the state of test scene, it is above-mentioned by the state variable of value and transfering variable successively group It closes, generates test case 1:
throttle=100
vehicle>=50
brake=100
vehicle=0
The connotation of test case 1 is: in acceleration mode, giving full throttle, until speed is 100km/h;When speed is When 100km/h, it is transferred to braking state;In braking state, step on brake pedal entirely, until speed is zero;When speed is When 0km/h, it is transferred to NextState, dead ship condition as shown in Fig. 2.
Analogize according to the above method, generate test case 2:
throttle=100
vehicle>=100
brake=100
vehicle=0
The connotation of test case 2 is: in acceleration mode, giving full throttle, until speed is 100km/h;When speed is When 100km/h, it is transferred to braking state;In braking state, step on brake pedal entirely, until speed is zero;When speed is When 0km/h, it is transferred to NextState.
Generate test case 3:
throttle=50
vehicle>=50
brake=100
vehicle=0
The connotation of test case 3 is: in acceleration mode, throttle valve is half-open, until speed is 50km/h;When speed is When 50km/h, it is transferred to braking state;In braking state, step on brake pedal entirely, until speed is zero;When speed is 0km/ When h, it is transferred to NextState.
Test case 4:
throttle=50
vehicle>=100
brake=100
vehicle=0
The connotation of test case 4 is: in acceleration mode, throttle valve is half-open, until speed is 100km/h;When speed is When 100km/h, it is transferred to braking state;In braking state, step on brake pedal entirely, until speed is zero;When speed is When 0km/h, it is transferred to NextState.
It should be evident that the quantity of test case is as in the state defined in test scene step S2 that defines and transfer item Part, the corresponding state variable of state defined in definition status variable and jump condition step S3 and corresponding turn of jump condition Variable is moved to determine.
State variable is chosen from each state, each state variable is chosen a value, chosen from each jump condition Transfering variable, each transfering variable chooses a value, and shifts order according to the state of test scene, by the state variable of value It is successively combined with transfering variable, it is regular according to this, generate test case.In terms of whole process, test case foundation is realized Automation improves the efficiency for establishing test case.
Embodiment 3:
As one embodiment of the system for establishing test case of the invention, it is whole that Fig. 3 shows a kind of new-energy automobile The system architecture diagram for establishing test case of vehicle controller software.The system comprises model import moduls 100 to be measured, checkout area Scape definition module 200, state variable and jump condition definition module 300, Test cases technology module 400.It is led in model to be measured Enter in module 100, imports model to be measured;In test scene definition module 200, according to the model to be measured of importing, definition test Scene, the test scene are made of multiple continuous states according to certain transfer order;It is fixed in state variable and jump condition In adopted module 300, corresponding state variable is arranged for each state respectively in the test scene based on definition, for transfer time Jump condition is arranged in sequence, and corresponding transfering variable is arranged for each jump condition;In Test cases technology module 400, base In the state variable and jump condition of definition, the state variable of each state and the transfering variable of jump condition are successively chosen, Combination producing test case.As it can be seen that be measured model of the test case based on importing generated, the coverage rate of test case is high;It surveys Examination hall scape is made of multiple continuous states according to certain transfer order, and corresponding state variable, transfer is arranged in each state Jump condition is arranged in order, and corresponding transfering variable is arranged in each jump condition, and the test case established on this basis includes State and jump condition are conducive to the test process of building automation, improve testing efficiency;The new model to be measured of importing, and Test case is established on the basis of this, can be multiplexed the test case process previously established, and keeps the portability of test case good, into And keep establishing for test case more convenient, quick.
Model import modul 100 to be measured includes model import unit to be measured, in the model import unit to be measured, is used Based on Python exploitation auto-building model script, import model to be measured, can automatic identification model to be measured input it is defeated Outgoing interface and built-in variable.Auto-building model script based on Python exploitation is entire car controller software testing technology Field common technique means, because without repeating.
Using the input/output interface and built-in variable of the script automatic identification model to be measured, according to this as foundation test The basis of use-case, it is ensured that the coverage rate of test case.
Test scene definition module 200, state variable and jump condition definition module 300, Test cases technology module 400 Visualized graphs configuration interface based on Python exploitation is realized.Visualized graphs configuration based on Python exploitation Interface tech is entire car controller software testing technology field common technique means, because without repeating.
Test scene definition module 200 includes test scene definition unit, in the test scene definition unit, according to The input/output interface and definition of internal variable of model to be measured test required scene, and the scene is by multiple continuous states It is constituted according to certain transfer order, is a module by each state description, wherein the description comprising each state, adjacent two Shift direction, and settable jump condition are marked by arrow between a state.As shown in Fig. 2, the test scene of definition includes Start engine, acceleration, brake, parking and closes the states such as engine.The setting transfer item between acceleration mode and braking state Part: until speed is met certain condition, jump condition is set between braking state and dead ship condition: until speed is equal to zero.
As other embodiments, gone back between acceleration mode and braking state, between braking state and dead ship condition Other jump conditions can be respectively set.
As other embodiments, between starting engine status and acceleration mode, dead ship condition and engine shape is closed One or more jump conditions can also be respectively set between state.
Test scene is made of multiple continuous states according to certain transfer order, and each state is described as a mould Block, and include the description of each state, shift direction is marked by arrow between two neighboring state, and transfer item is set Part further completes the foundation of test case on this basis.The definition procedure of state and jump condition is intuitive, visual, makes to survey The friendly interface of example establishment process on probation is conducive to improve the efficiency that test case is established, and prevents state or transfer item The omission that part defines, caused by test case coverage rate it is inadequate.
State variable and jump condition definition module 300 include state variable definition unit and jump condition definition unit. In the state variable definition unit, one or more state variables are set for each state, wherein each state variable The one or more values of setting.In the jump condition definition unit, jump condition is set between two neighboring state, is turned Move condition setting one or more transfering variable, each one or more values of transfering variable setting.As shown in Fig. 2, for accelerating State, it is throttle that corresponding with state state variable, which is arranged, be arranged the value of state variable throttle for throttle= 100, throttle=50, respectively indicate full throttle and air throttle is half-open.For the transfer met certain condition until speed Transfering variable vehicle corresponding with the jump condition is arranged in condition, be arranged the value of transfering variable vehicle for vehicle >= 50, vehicle >=100, respectively indicate until speed is 50km/h and until speed is 100km/h.For braking state, setting State variable corresponding with the state is brake, and the value of setting state variable brake is brake=100, indicates that brake pedal is complete It steps on.For until the null jump condition of speed, transfering variable vehicle corresponding with the jump condition, setting are set The value of transfering variable vehicle is vehicle=0, indicates that until speed be 0km/h.
As other embodiments, it is variable pedal that the corresponding state variable of acceleration mode, which can also be arranged, and is arranged The value of state variable pedal is pedal=100, pedal=50, and the aperture amount for respectively indicating accelerator pedal is 100% and 50%. It is, of course, also possible to which the value of state variable pedal is arranged in a section consecutive variations, such as the value of setting state variable pedal Between 50 to 100.
As other embodiments, other corresponding states variables of braking state can also be set, be arranged until vehicle Speed is met certain condition, until the null other corresponding transfering variables of speed.
, it is clear that these embodiments can need flexible choice according to test.
State and its corresponding state variable, jump condition and its corresponding transfering variable, according to the input of model to be measured Output interface and built-in variable are defined, i.e., are defined according to testing requirement, thus different models to be measured, and state becomes The definition of amount and transfering variable can be adjusted flexibly according to testing requirement.In turn, according to the new model to be measured of importing, to previous The state and jump condition of definition are modified, and are perhaps supplemented or are directly multiplexed, so that it may complete determining for new test scene Justice, it can be seen that, the portability of test case establishment process is good.
Test cases technology module 400 includes Test cases technology unit, in the Test cases technology unit, from every State variable is chosen in a state, each state variable chooses a value, transfering variable chosen from each jump condition, each Transfering variable chooses a value, shifts order according to the state of test scene, successively by the state variable of value and transfering variable Combination generates test case.
As shown in Fig. 2, choosing state variable throttle from acceleration mode, and select the value of the state variable throttle=50;Transfering variable vehicle is selected from the jump condition met certain condition until speed, and selects this turn The value vehicle of shifting variable >=50;State variable brake is chosen from braking state, and selects the value of the state variable brake=50;Transfering variable vehicle is selected from until the null jump condition of speed, and selects taking for the transfering variable Value vehicle=0;Order is shifted according to the state of test scene, it is above-mentioned by the state variable of value and transfering variable successively group It closes, generates test case 1:
throttle=100
vehicle>=50
brake=100
vehicle=0
The connotation of test case 1 is: in acceleration mode, giving full throttle, until speed is 50km/h;When speed is When 50km/h, it is transferred to braking state;In braking state, step on brake pedal entirely, until speed is zero;When speed is 0km/ When h, it is transferred to NextState, dead ship condition as shown in Fig. 2.
Analogize according to the above method, generate test case 2:
throttle=100
vehicle>=100
brake=100
vehicle=0
The connotation of test case 2 is: in acceleration mode, giving full throttle, until speed is 100km/h;When speed is When 100km/h, it is transferred to braking state;In braking state, step on brake pedal entirely, until speed is zero;When speed is When 0km/h, it is transferred to NextState.
Generate test case 3:
throttle=50
vehicle>=50
brake=100
vehicle=0
The connotation of test case 3 is: in acceleration mode, throttle valve is half-open, until speed is 50km/h;When speed is When 50km/h, it is transferred to braking state;In braking state, step on brake pedal entirely, until speed is zero;When speed is 0km/ When h, it is transferred to NextState.
Test case 4:
throttle=50
vehicle>=100
brake=100
vehicle=0
The connotation of test case 4 is: in acceleration mode, throttle valve is half-open, until speed is 100km/h;When speed is When 100km/h, it is transferred to braking state;In braking state, step on brake pedal entirely, until speed is zero;When speed is When 0km/h, it is transferred to NextState.
It should be evident that the quantity of test case is as the state defined in test scene definition module 200 and transfer Condition, the corresponding state variable of state defined in state variable and jump condition definition module 300 and jump condition are corresponding Transfering variable determine.
State variable is chosen from each state, each state variable is chosen a value, chosen from each jump condition Transfering variable, each transfering variable chooses a value, and shifts order according to the state of test scene, by the state variable of value It is successively combined with transfering variable, it is regular according to this, generate test case.In terms of whole process, test case foundation is realized Automation improves the efficiency for establishing test case.
Obviously, the above embodiments are merely examples for clarifying the description, and does not limit the embodiments.It is right For those of ordinary skill in the art, can also make on the basis of the above description it is other it is various forms of variation or It changes.There is no necessity and possibility to exhaust all the enbodiments.And it is extended from this it is obvious variation or It changes still within the protection scope of the invention.

Claims (10)

1. a kind of method for establishing test case, it is characterised in that the following steps are included:
Step 1: importing model to be measured;
Step 2: defining test scene, which is made of multiple continuous states according to certain transfer order;
Step 3: corresponding state variable is arranged for each state respectively, jump condition is set for transfer order, for every Corresponding transfering variable is arranged in a jump condition;
Step 4: successively choosing the state variable of each state and the transfering variable of jump condition, combination producing test case;
It is described that corresponding state variable is set for each state respectively, for the process packet of transfer order setting jump condition It includes:
One or more state variables are set for each state, wherein the one or more values of each state variable setting;
Jump condition is set between two neighboring state, and one or more transfering variables, each transfering variable is arranged in jump condition The one or more values of setting;
Corresponding state variable is executed according to the setting value of the state variable, when reaching the setting value of the transfering variable, It is transferred to NextState.
2. establishing the method for test case according to claim 1, it is characterised in that: the process packet for importing model to be measured It includes: by automatically generating script, importing model to be measured, identify the input/output interface and built-in variable of model to be measured.
3. the method according to claim 1 or claim 2 for establishing test case, it is characterised in that: the mistake for defining test scene It is a module that journey, which includes: by each state description, wherein including the description of each state, passes through arrow between two neighboring state Leader infuses shift direction, and settable jump condition.
4. establishing the method for test case according to claim 2, it is characterised in that: described " to be set respectively for each state Set corresponding state variable, for transfer order be arranged jump condition " process include:
One or more state variables are set for each state, wherein the one or more values of each state variable setting;
Jump condition is set between two neighboring state, and one or more transfering variables, each transfering variable is arranged in jump condition The one or more values of setting.
5. the method according to claim 1 or claim 2 for establishing test case, it is characterised in that: described " successively to choose each state State variable and jump condition transfering variable, combination producing test case " process include:
State variable is chosen from each state, each state variable chooses a value,
Transfering variable is chosen from each jump condition, each transfering variable chooses a value,
Order is shifted according to the state of test scene, successively combines the state variable of value and transfering variable, test is generated and uses Example.
6. a kind of system for establishing test case, characterized by comprising:
Model import modul to be measured: for importing model to be measured;
Test scene definition module: for defining test scene, which is turned by multiple continuous states according to certain Order is moved to constitute;
State variable and jump condition definition module: for corresponding state variable to be arranged for each state respectively, for turning It moves order and jump condition is set, corresponding transfering variable is set for each jump condition;
Test cases technology module: for successively choosing the state variable of each state and the transfering variable of jump condition, group Symphysis is at test case;
The state variable and jump condition definition module include state variable definition unit and jump condition definition unit, described State variable definition unit is used to that one or more state variables to be arranged for each state, wherein each state variable setting one A or multiple values;The jump condition definition unit, which is used to be directed between two neighboring state, is arranged jump condition, jump condition One or more transfering variables, each one or more values of transfering variable setting are set;According to the setting value of the state variable Corresponding state variable is executed, when reaching the setting value of the transfering variable, is transferred to NextState.
7. establishing the system of test case according to claim 6, it is characterised in that: the model import modul to be measured includes Model import unit to be measured, for importing model to be measured, identifying the input/output interface of model to be measured by automatically generating script And built-in variable.
8. establishing the system of test case described according to claim 6 or 7, it is characterised in that: the test scene definition module Including test scene definition unit, for being a module by each state description, wherein include the description of each state, it is adjacent Shift direction, and settable jump condition are marked by arrow between two states.
9. establishing the system of test case according to claim 7, it is characterised in that: the state variable and jump condition are fixed Adopted module includes state variable definition unit and jump condition definition unit, and the state variable definition unit is used for for each One or more state variables are arranged in state, wherein the one or more values of each state variable setting;The jump condition definition Unit is used for for jump condition is arranged between two neighboring state, and one or more transfering variables are arranged in jump condition, each The one or more values of transfering variable setting.
10. establishing the system of test case described according to claim 6 or 7, it is characterised in that: the Test cases technology module Including Test cases technology unit, for choosing state variable from each state, each state variable chooses a value, from every Transfering variable is chosen in a jump condition, each transfering variable chooses a value, shifts order according to the state of test scene, will The state variable and transfering variable of value successively combine, and generate test case.
CN201410227714.6A 2014-05-27 2014-05-27 A kind of method and system for establishing test case Expired - Fee Related CN104850110B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410227714.6A CN104850110B (en) 2014-05-27 2014-05-27 A kind of method and system for establishing test case

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410227714.6A CN104850110B (en) 2014-05-27 2014-05-27 A kind of method and system for establishing test case

Publications (2)

Publication Number Publication Date
CN104850110A CN104850110A (en) 2015-08-19
CN104850110B true CN104850110B (en) 2019-04-16

Family

ID=53849822

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410227714.6A Expired - Fee Related CN104850110B (en) 2014-05-27 2014-05-27 A kind of method and system for establishing test case

Country Status (1)

Country Link
CN (1) CN104850110B (en)

Families Citing this family (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
DE102016220913A1 (en) * 2015-11-06 2017-05-11 Ford Global Technologies, Llc Method and device for generating test cases for autonomous vehicles
CN106200612B (en) * 2016-07-07 2019-01-22 百度在线网络技术(北京)有限公司 For testing the method and system of vehicle
CN107807844B (en) * 2017-10-31 2020-09-25 北京新能源汽车股份有限公司 Method and device for generating traffic test scene and computer readable storage medium
CN112180890B (en) * 2019-07-05 2022-01-07 北京新能源汽车股份有限公司 Test case generation method, device and equipment
CN110597730B (en) * 2019-09-20 2023-08-22 中国工商银行股份有限公司 Automatic test case generation method and system based on scene method
CN111190406B (en) * 2019-12-25 2022-11-18 中国航空工业集团公司西安飞机设计研究所 Method for testing undercarriage control system software
CN114076683A (en) * 2020-08-17 2022-02-22 上海汽车集团股份有限公司 Test evaluation method and device for intelligent driving function

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102854877A (en) * 2012-10-12 2013-01-02 山东省科学院自动化研究所 Function test system and test method of automobile body control module
CN103034227A (en) * 2012-09-20 2013-04-10 北京智行鸿远汽车技术有限公司 Testing method in circuit of battery electric vehicle vehicle-control unit model
CN103699122A (en) * 2014-01-09 2014-04-02 上汽通用五菱汽车股份有限公司 Finished car controller test platform and control method

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8612192B2 (en) * 2010-05-24 2013-12-17 GM Global Technology Operations LLC Vehicle simulation system with software-in-the-loop bypass control
US8972928B2 (en) * 2011-08-30 2015-03-03 Uniquesoft, Llc System and method for generating application code

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103034227A (en) * 2012-09-20 2013-04-10 北京智行鸿远汽车技术有限公司 Testing method in circuit of battery electric vehicle vehicle-control unit model
CN102854877A (en) * 2012-10-12 2013-01-02 山东省科学院自动化研究所 Function test system and test method of automobile body control module
CN103699122A (en) * 2014-01-09 2014-04-02 上汽通用五菱汽车股份有限公司 Finished car controller test platform and control method

Also Published As

Publication number Publication date
CN104850110A (en) 2015-08-19

Similar Documents

Publication Publication Date Title
CN104850110B (en) A kind of method and system for establishing test case
Klein et al. Engine in the loop: closed loop test bench control with real-time simulation
CN103336694B (en) The assemble method of a kind of entity behavior modeling and system
CN105159188B (en) A kind of new energy vehicle heterogeneous network emulator and control method
Malikopoulos A multiobjective optimization framework for online stochastic optimal control in hybrid electric vehicles
CN106200625A (en) Hybrid power whole passenger vehicle controller hardware assemblage on-orbit test platform
CN102749208B (en) A kind of actual road test method and system of realizing vehicle automatic transmission
CN110764494A (en) Human-computer hybrid driving automatic driving virtual test platform based on SCANeR
Zhu et al. NCSU year three final technical report
CN110069888A (en) A kind of simulation of airdrome scene and method for optimizing route
CN108241357A (en) Test environment model generating method, device, computer equipment and storage medium
CN104572108B (en) A kind of train network control system software development methodology
Patil et al. Hybrid vehicle model development using ASM-AMESim-Simscape co-simulation for real-time HIL applications
CN103631256B (en) A kind of method of engine signal analog simulation test board and test ECU thereof
CN110414089A (en) The simulated prediction method of vehicle PEMS discharge based on Engine Universal Characteristics
CN103135545B (en) Automatic gearbox controller semi-physical simulation test system
CN103853146B (en) The software load test system and method for engine electronic control unit
CN104679945B (en) System comprehensive estimation method based on colored Petri network
US8751094B2 (en) Method for validation of a graphically based executable control specification using model extraction
Braun et al. Trends in vehicle electric system design: State-of-the Art Summary
CN103543739B (en) A kind of for verifying analogue system and the method for engine idle on off control
CN109491917A (en) A kind of test case processing method and its device
CN103235519B (en) A kind of engine signal Intelligence Simulation and system
CN115454383A (en) Software defined automobile service development process and implementation method
Jones et al. V2x based traffic light assistant for increased efficiency of hybrid & electric vehicles

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
EXSB Decision made by sipo to initiate substantive examination
SE01 Entry into force of request for substantive examination
TA01 Transfer of patent application right

Effective date of registration: 20180419

Address after: No. 188, Miyun District, Miyun District, Beijing, Beijing

Applicant after: Beijing treasure Car Co.,Ltd.

Address before: 102206 Changping District City, Shahe, Sha Yang Road, Beijing

Applicant before: BEIQI FOTON MOTOR Co.,Ltd.

TA01 Transfer of patent application right
GR01 Patent grant
GR01 Patent grant
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20190416

CF01 Termination of patent right due to non-payment of annual fee