CN105955887B - A kind of generation method and system of test data - Google Patents

A kind of generation method and system of test data Download PDF

Info

Publication number
CN105955887B
CN105955887B CN201610288414.8A CN201610288414A CN105955887B CN 105955887 B CN105955887 B CN 105955887B CN 201610288414 A CN201610288414 A CN 201610288414A CN 105955887 B CN105955887 B CN 105955887B
Authority
CN
China
Prior art keywords
data
sequence
test
converted
input signal
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.)
Active
Application number
CN201610288414.8A
Other languages
Chinese (zh)
Other versions
CN105955887A (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.)
Deep Blue Automotive Technology Co ltd
Original Assignee
Chongqing Changan Automobile Co Ltd
Chongqing Changan New Energy Automobile 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 Chongqing Changan Automobile Co Ltd, Chongqing Changan New Energy Automobile Co Ltd filed Critical Chongqing Changan Automobile Co Ltd
Priority to CN201610288414.8A priority Critical patent/CN105955887B/en
Publication of CN105955887A publication Critical patent/CN105955887A/en
Application granted granted Critical
Publication of CN105955887B publication Critical patent/CN105955887B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

This application discloses a kind of method and system of Test cases technology test data, using Excel to test case into edlin and filing, obtain test case list, since the first page test case of test case list, gradually obtain each test case content in every page, and the parameter needed to configure in test case to be converted is substituted according to parameter configuration table, define test data, all input signal initial values in initial value list are assigned to test data, output signal value corresponding with the output signal title sequence in test case to be converted is assigned to test data, then time series and data sequence are converted into corresponding test data, and it is assigned to the corresponding position of input signal title identical with the input signal title that time series and data sequence pair are answered in test data.The present invention files test case using Excel, using Matlab by the automatic generating test case test data of Excel formats.

Description

A kind of generation method and system of test data
Technical field
The present invention relates to modeling softwares to develop technical field of measurement and test, more specifically, being related to a kind of life of test data At method and system.
Background technology
With the transformation that software development model is developed from hand-written code to modeling software, more and more enterprises use The prototype software developing instrument of Simulink, Stateflow or Targetlink of the Matlab that Mathworks companies release. Based on the software development of modelling compared with hand-written code, there is high quality and efficient advantage.Modeling software is developed, After model forming, can based on design specifications carry out early period test verification, without etc. be input to true controller Carrying out test verification.
In modeling software test phase, need according to design objective design test case, and test case need by Control, this requires test cases to need to form formal document.How test case document format is converted into modeling software The executable test data of developing instrument is the problem of software test personnel need research.Currently, tester is mainly according to survey Example on probation writes test data manually, but due to the control parameter of each project difference, can not avoid repeated work, therefore, Working efficiency is low, and can not ensure that test data is completely the same with test case.
To sum up, how a kind of the generation method and system of test data are provided, is ensuring test case and test data one It is those skilled in the art's technical problem urgently to be resolved hurrily that working efficiency is improved while cause property.
Invention content
In view of this, the present invention provides a kind of generation method and system of test data, test case is being ensured to realize Working efficiency is improved while with test data consistency.
A kind of generation method of test data, including:
The total page number n of test case list is calculated, wherein the test case list is Excel lists, including: Test case numbered sequence, input time sequence, input signal title sequence, input number corresponding with input signal title sequence According to sequence, output time series, output signal title sequence and output data sequence corresponding with output signal title sequence, In, n is positive integer;
Since the first page of the test case list, gradually the test case in every page is converted, until n Page all converts, and the transfer process of the test case in every page executes following steps:
The content for a plurality of test case for including is obtained in page to be converted, and calculates the test for including in the page to be converted Use-case item number m, m are positive integer;
Since the page to be converted first test case, gradually each test case is converted, until m Test case all converts, and the transfer process of each test case executes following steps:
The parameter needed to configure in test case to be converted is joined with corresponding in the parameter configuration table for obtaining and storing in advance Several values are substituted, and the parameter configuration table is Excel lists, in the parameter configuration table record have configuration parameter name with And configuration parameter respective value corresponding with the configuration parameter, the parameter needed to configure include:Input time sequence, with it is defeated Enter the corresponding input data sequence of signal name sequence, output time series and output number corresponding with output signal title sequence According to sequence;
The time series for the test case to be converted that parameter configuration is completed is converted into array type by character string type, number Array type is converted to by character string type according to sequence, wherein time series includes input time sequence and output time series, The data sequence includes input data sequence and output data sequence;
Whether the data sequence length of the length of time series and array type that judge array type is identical;
If it is, test data is defined, and will be at the beginning of all input signals in the initial value list that obtained and store in advance Initial value is assigned to the test data, and the initial value list is tested software model corresponding with the test case list The initial value list of all input signals, in the initial value list record have input signal title sequence and with the input The corresponding input signal initial value of signal name sequence;
By the corresponding output letter of output signal title sequence in the test case to be converted completed with the parameter configuration Number value is assigned to the test data, wherein the output signal value is sky;
The time series of array type is converted into corresponding time test data, the data sequence of array type is converted into Corresponding data test data;
The time test data are assigned in the test data and input corresponding with the time test data The corresponding position of the identical input signal title of signal name, while the data test data are assigned to the test data In the identical input signal title of corresponding with data test data input signal title corresponding position.
Preferably, further include:
If it is not, then output information warning, and terminate Test data generation flow.
Preferably, described that the time series of array type is converted into corresponding time test data, the number of array type Being converted into corresponding data test data according to sequence includes:
Judge the signal number for including in the use-case to be measured to be converted that the parameter configuration is completed is with data sequence number It is no identical, wherein the signal number is the number summation of input signal and output signal, and data sequence number is input data The number summation of sequence and output data sequence;
If it is, the time series of array type is converted into corresponding time test data, the data of array type Sequence is converted into corresponding data test data.
Preferably, described that the time series of array type is converted into corresponding time test data, the number of array type Being converted into corresponding data test data according to sequence includes:
It is described to judge whether the input signal for including in the use-case to be measured to be converted that the parameter configuration is completed is included in In all input signal initial values;
If it is, the time series of array type is converted into corresponding time test data, the data of array type Sequence is converted into corresponding data test data.
Preferably, when the time series is relative time, then the transfer process of relative time sequence is:
First data corresponding time of numerical value in the time series is set as 0, the c1 numerical value is corresponding absolutely It is multiplied by default simulation step length after making difference with 1 to the time for the sum of all time points before the c1 time series, wherein c1 is big In 1 positive integer.
A kind of generation system of test data, including:
Computing unit, the total page number n for test case list to be calculated, wherein the test case list is Excel lists, including:Test case numbered sequence, input time sequence, input signal title sequence and input signal title It the corresponding input data sequence of sequence, output time series, output signal title sequence and is answered with output signal title sequence pair Output data sequence, wherein n is positive integer;
Since the first page of the test case list, gradually the test case in every page is converted, until n Page all converts, and the transfer process of the test case in every page executes such as lower unit:
Acquiring unit, the content for obtaining in page to be converted a plurality of test case for including, and calculate described to be converted Test case item the number m, m for including in page are positive integer;
Since the page to be converted first test case, gradually each test case is converted, until m Test case all converts, and the transfer process of each test case executes such as lower unit:
Parameter configuration unit, for by the parameter needed to configure in the test case to be converted ginseng for obtaining and storing in advance The value that parameter is corresponded in number allocation list is substituted, and the parameter configuration table is Excel lists, is recorded in the parameter configuration table Have configuration parameter name and configuration parameter respective value corresponding with the configuration parameter, the parameter needed to configure include: Input time sequence, input data sequence corresponding with input signal title sequence, output time series and with output signal name Claim sequence corresponding output data sequence;
The time series of converting unit, the test case to be converted for completing parameter configuration is converted by character string type For array type, data sequence is converted to array type by character string type, wherein time series include input time sequence and Output time series, the data sequence include input data sequence and output data sequence;
Judging unit, the data sequence length of length of time series and array type for judging array type whether phase Together;
Test data definition unit, in the case where the judging unit is judged as YES, defining test data, and will All input signal initial values are assigned to the test data, the initial value row in the initial value list for obtaining and storing in advance Table is the initial value list of all input signals of tested software model corresponding with the test case list, the initial value Record has input signal title sequence and input signal initial value corresponding with the input signal title sequence in list;
First assignment unit, for by the output signal title in the test case to be converted completed with the parameter configuration The corresponding output signal value of sequence is assigned to the test data, wherein the output signal value is sky;
Converting unit, for the time series of array type to be converted into corresponding time test data, array type Data sequence is converted into corresponding data test data;
Second assignment unit, for by the time test data be assigned in the test data and with the time The corresponding position of the identical input signal title of the corresponding input signal title of test data, while by the data test data It is assigned to the identical input signal title of corresponding with data test data input signal title in the test data Corresponding position.
Preferably, further include:
Alarm unit in the case where the judging unit is judged as NO, exporting information warning, and terminates to test number According to product process.
Preferably, the converting unit includes:
First judgment sub-unit, the signal for judging to include in use-case to be measured to be converted that the parameter configuration is completed Whether number is identical as data sequence number, wherein the signal number is the number summation of input signal and output signal, data Sequence number is the number summation of input data sequence and output data sequence;
First conversion subunit, in the case where first judgment sub-unit is judged as YES, by array type Time series is converted into corresponding time test data, and the data sequence of array type is converted into corresponding data test data.
Preferably, the converting unit includes:
Second judgment sub-unit, the input letter for judging to include in use-case to be measured to be converted that the parameter configuration is completed Number whether it is included in all input signal initial values;
Second conversion subunit, in the case where second judgment sub-unit is judged as YES, by array type Time series is converted into corresponding time test data, and the data sequence of array type is converted into corresponding data test data.
It can be seen from the above technical scheme that the present invention provides a kind of generation method of test data and system, make Test case list is obtained into edlin and filing to test case with Excel, tests and uses from the first page of test case list Example starts, and gradually obtains each test case content in every page, and substitute test case to be converted according to parameter configuration table In the parameter that needs to configure, define test data, all input signal initial values in initial value list be assigned to the test number According to the corresponding output signal value of output signal title sequence in the test case to be converted completed with parameter configuration is assigned to Then time series and data sequence are converted into corresponding test data by the test data, and be assigned in test data with The corresponding position for the identical input signal title of input signal title that time series and data sequence pair are answered.As can be seen that this Invention files test case using Excel, and the automatic generating test case of Excel formats is tested number using Matlab According to because being the test case of Excel formats of directly reading and change the outfit, the present invention is ensuring test case and test data It is improved work efficiency while consistency.
Description of the drawings
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below There is attached drawing needed in technology description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this The embodiment of invention for those of ordinary skill in the art without creative efforts, can also basis The attached drawing of offer obtains other attached drawings.
Fig. 1 is a kind of generation method flow chart of test data disclosed by the embodiments of the present invention;
Fig. 2 is a kind of structural schematic diagram of the generation system of test data disclosed by the embodiments of the present invention.
Specific implementation mode
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete Site preparation describes, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.It is based on Embodiment in the present invention, it is obtained by those of ordinary skill in the art without making creative efforts every other Embodiment shall fall within the protection scope of the present invention.
The embodiment of the invention discloses a kind of generation method of test data and system, with realize ensure test case with Working efficiency is improved while test data consistency.
Referring to Fig. 1, a kind of generation method flow chart of test data provided in an embodiment of the present invention, including step:
Step S11, the total page number n of test case list is calculated;
It should be noted that API (the Application by opening the corresponding Excel application layer programs of test case Programming Interface, application programming interface) test case list is found, it is used to which test be calculated The total page number n of example list.
Wherein, the test case list is Excel lists, including:Test case numbered sequence, input time sequence, Input signal title sequence, input data sequence corresponding with input signal title sequence, output time series, output signal name Claim sequence and output data sequence corresponding with output signal title sequence, wherein n is positive integer.
It should be noted that input signal title sequence refers specifically to test case compared with the input letter that initial value changes Number title sequence, output signal title sequence refer specifically to test case and need the output signal title sequence observed.
The format write of test case list is referring specifically to table 1:
Table 1
From table 1 it follows that the format write of test case list is:First row indicates test case number TestCaseNr, secondary series indicate that input time sequence InputTime, third row indicate input signal title sequence InputVaribles, the 4th row indicate the corresponding input data sequence InputValue of third row input signal title sequence, the Five row indicate output time series OutputTime, and the 6th row indicate output signal title sequence OutputVaribles, the 7th Row indicate the corresponding output data sequence OutputValue of the 6th row output signal title sequence.
It should be noted that the test case if necessary to distinguish different function with different pages, can also increase page, respectively The format of page is identical.
To keep test case list more perfect, some row can also be increased in test case list, to describe test case Test main points, such as test case title etc..
Step S12, judge whether the i pages of number of pages in test case list is less than n+1, if so, thening follow the steps Otherwise S13 terminates Test data generation flow;
Step S13, the content for a plurality of test case for including in i pages is obtained, and calculates the test for including in described i pages and uses Example item number m, m are positive integer;
Step S14, by the parameter needed to configure in j test case with right in the parameter configuration table for obtaining and storing in advance The value of parameter is answered to be substituted;
The parameter configuration table is Excel lists, in the parameter configuration table record have configuration parameter name and with institute The corresponding configuration parameter respective value of configuration parameter is stated, the parameter needed to configure includes:Input time sequence and input signal The corresponding input data sequence of title sequence, output time series and output data sequence corresponding with output signal title sequence Row.
The format write of parameter configuration table is referring to table 2:
Table 2
From Table 2, it can be seen that the first row of parameter configuration table indicates that configuration parameter name, secondary series indicate configuration parameter Respective value.
Wherein, in rendering parameter allocation list, parameter configuration table is independent one page.
It should be noted that when Parameters variation in test case to be converted, only need accordingly to join in undated parameter allocation list Number.
To keep parameter configuration table more perfect, the row of characterising parameter can also be increased in parameter configuration table.
Step S15, the time series for the test case to be converted that parameter configuration is completed is converted into number by character string type Set type, data sequence are converted to array type by character string type;
Wherein, time series includes input time sequence and output time series, and the data sequence includes input data Sequence and output data sequence.
Whether the data sequence length of the length of time series and array type that step S16, judge array type is identical, such as Fruit is to then follow the steps S17;
Step S17, test data is defined, and all input signals in the initial value list for obtaining and storing in advance are initial Value is assigned to the test data;
Wherein, test data is an empty memory space, and the present invention by test case by converting corresponding test number According to, and test data is added in the empty memory space named with test data, it completes Test cases technology testing number According to process.
It should be noted that institute of the initial value list for tested software model corresponding with the test case list There is the initial value list of input signal, being recorded in the initial value list has input signal title sequence and believe with the input Number corresponding input signal initial value of title sequence.
The format write of initial value list is referring to table 3:
Table 3
Input signal Initial value
sig1 0
sig2 0
sig3 0
sig4 0
sig5 0
From table 3 it is observed that the first row of initial value list indicates input signal title, the second class of the representation input signal The corresponding input signal initial value of title.
After defined herein good initial value, every test case does not have to fill in indeclinable letter again in test case list Number.
For ease of understanding, the row of description signal can also be increased.
Step S18, the output signal title sequence pair in the test case to be converted completed with the parameter configuration is answered Output signal value be assigned to the test data;
Wherein, the output signal value is sky.
Step S19, the time series of array type is converted into corresponding time test data, the data sequence of array type Row are converted into corresponding data test data;
Step S20, by the time test data be assigned in the test data and with the time test data pair The corresponding position for the identical input signal title of input signal title answered, while the data test data being assigned to described The corresponding position of the identical input signal title of corresponding with data test data input signal title in test data;
Step S21, judge whether j items are less than i pages of m+1, if so, thening follow the steps S22, otherwise, execute step S23;
Step S22, j=j+1 is enabled, and returns to step S14;
Step S23, i=i+1 is enabled, and returns to step S12.
Wherein, the format write of test data is referring specifically to table 4:
Table 4
InputTime InputVaribles InputValue OutputTime OutputVaribles OutputValue
*** *** *** *** ***
*** *** *** *** ***
It in summary it can be seen, the generation method of test data provided by the invention, test case compiled using Excel It collects and files, obtain test case list, since the first page test case of test case list, gradually obtain in every page Each test case content, and the parameter needed to configure in test case to be converted is substituted according to parameter configuration table, definition is surveyed Data are tried, all input signal initial values in initial value list are assigned to the test data, will be waited for what parameter configuration was completed The corresponding output signal value of output signal title sequence in transforming test cases is assigned to the test data, then by time sequence Row and data sequence are converted into corresponding test data, and are assigned to and are answered with time series and data sequence pair in test data The corresponding position of the identical input signal title of input signal title.As can be seen that the present invention using Excel to test case into Row filing, using Matlab by the automatic generating test case test data of Excel formats, because being to directly read and change the outfit The test case of Excel formats, so the present invention improves work while ensuring test case with test data consistency Efficiency.
Secondly, the parameter configuration table that the present invention uses, when project variation leads to Parameters variation, test case still can be with It reuses.
Finally, due to which the present invention is directed to the content in the reading Excel file of English by API, therefore, can avoid because of one Secondary property reads too many content to be caused to overflow to Matlab memories.
It should be noted that input time sequence (InputTime) or output time series in test case list (OutputTime) i-th of numerical value in indicates and input data sequence (InputValue) or output data sequence (OutputValue) corresponding i-th of numerical value needs lasting emulation cycle number in.It can certainly usage time axis form table Show which second data changes.
Illustrate the process (note of every Test cases technology test data:The format write output and input is identical, therefore The mode of conversion is also identical):
Assuming that signal number (specific certain test case input signal number or output signal number) is v, time series Array length is L (notes:Time series array is identical as data sequence array length);
From 1 to L, the process that the time series to each signal and numerical value are converted one by one includes:
Judge whether c1 is less than L+1;
If c1 is not less than L+1, by transformed data (including time test data and data test data) assignment To the identical signal of signal domain name corresponding with transformed data in test data;
If c1 is less than L+1, judge whether c1 is equal to 1;
If c1 is equal to 1, judge whether c2 is less than v+1;
If c2 is less than v+1, domain name signal identical with the c2 signal in signal is found in test data, the The c1 value of one row time shaft is 0, and the c1 data of the second column data axis are the c1 numerical value in data sequence;
If c1 is not equal to 1, judge whether c2 is less than v+1;
If c2 is less than v+1, the c1 value of first row time shaft is institute before the c1 value in time series array There is the sum of value to subtract 1 again and then be multiplied by default simulation step length, the c1 data of the second column data axis are c1 in data sequence Numerical value.
Wherein, the time series in the present invention is defined as relative time rather than absolute time, is defined as the excellent of relative time Gesture is, if some point changes in time series, it is only necessary to a point is changed, and if it is absolute time, if One of them time point changes, then all the points thereafter are required for respective change, and are not easy to the modification of test case.
The transfer process of relative time sequence is:
First data corresponding time of numerical value in the time series is set as 0, the c1 numerical value is corresponding absolutely It is multiplied by default simulation step length after making difference with 1 to the time for the sum of all time points before the c1 time series, wherein when input Between each data in sequence InputTime and output time series OutputTime be positive integer.
In order to further optimize the above embodiments, further including step:
If the length of time series of array type and the data sequence length of array type differ, warning letter is exported Breath, and terminate Test data generation flow.
In order to further optimize the above embodiments, step S19 includes:
Step S191, judge the signal number for including in the use-case to be measured to be converted that the parameter configuration is completed and data sequence Whether row number is identical, if so, thening follow the steps S192;
Wherein, the signal number is the number summation of input signal and output signal, and data sequence number is input number According to the number summation of sequence and output data sequence.
Step S192, the time series of array type is converted into corresponding time test data, the data of array type Sequence is converted into corresponding data test data.
It should be noted that when the signal number and data that include in the use-case to be measured to be converted that the parameter configuration is completed When sequence number differs, then information warning is exported, and terminates Test data generation flow.
In order to further optimize the above embodiments, step S19 includes:
Step S193, judge whether the input signal for including in the use-case to be measured to be converted that the parameter configuration is completed all wraps It is contained in all input signal initial values, if so, thening follow the steps S194;
Step S194, the time series of array type is converted into corresponding time test data, the data of array type Sequence is converted into corresponding data test data.
It should be noted that the input signal for including in the use-case to be measured to be converted that the parameter configuration is completed all is not wrapped When being contained in all input signal initial values, information warning is exported, and terminate Test data generation flow.
Corresponding with above method embodiment, the present invention also provides a kind of generation systems of 9 test data.
Referring to Fig. 2, a kind of structural schematic diagram of the generation system of test data provided in an embodiment of the present invention, including:
Computing unit 21, the total page number n for test case list to be calculated, wherein the test case list is Excel lists, including:Test case numbered sequence, input time sequence, input signal title sequence and input signal title It the corresponding input data sequence of sequence, output time series, output signal title sequence and is answered with output signal title sequence pair Output data sequence, wherein n is positive integer;
Since the first page of the test case list, gradually the test case in every page is converted, until n Page all converts, and the transfer process of the test case in every page executes such as lower unit:
Acquiring unit 22, the content for obtaining in page to be converted a plurality of test case for including, and wait turning described in calculating Test case item the number m, m for including in skipping are positive integer;
Since the page to be converted first test case, gradually each test case is converted, until m Test case all converts, and the transfer process of each test case executes such as lower unit:
Parameter configuration unit 23, for by the parameter needed to configure in test case to be converted in advance obtaining and store The value that parameter is corresponded in parameter configuration table is substituted, and the parameter configuration table is Excel lists, is remembered in the parameter configuration table Record has configuration parameter name and configuration parameter respective value corresponding with the configuration parameter, the parameter packet needed to configure It includes:Input time sequence, input data sequence corresponding with input signal title sequence, output time series and and output signal The corresponding output data sequence of title sequence;
The time series of converting unit 24, the test case to be converted for completing parameter configuration is turned by character string type It is changed to array type, data sequence is converted to array type by character string type, wherein time series includes input time sequence And output time series, the data sequence include input data sequence and output data sequence;
Judging unit 25, whether the data sequence length of length of time series and array type for judging array type It is identical, if it is, executing test data definition unit 26;
Test data definition unit 26, in the case where the judging unit 26 is judged as YES, defining test data, And all input signal initial values in the initial value list for obtaining and storing in advance are assigned to the test data, it is described initial Value list is the initial value list of all input signals of tested software model corresponding with the test case list, described first Record has input signal title sequence and input signal corresponding with the input signal title sequence initial in initial value list Value;
First assignment unit 27, for by the output signal name in the test case to be converted completed with the parameter configuration The corresponding output signal value of sequence is claimed to be assigned to the test data, wherein the output signal value is sky;
Converting unit 28, for the time series of array type to be converted into corresponding time test data, array type Data sequence be converted into corresponding data test data;
Second assignment unit 29, for by the time test data be assigned in the test data and with it is described when Between the identical input signal title of the corresponding input signal title of test data corresponding position, while by the data test number According to being assigned in the test data the identical input signal title of corresponding with data test data input signal title Corresponding position.
It in summary it can be seen, the generation system of test data provided by the invention compiles test case using Excel It collects and files, obtain test case list, since the first page test case of test case list, gradually obtain in every page Each test case content, and the parameter needed to configure in test case to be converted is substituted according to parameter configuration table, definition is surveyed Data are tried, all input signal initial values in initial value list are assigned to the test data, will be waited for what parameter configuration was completed The corresponding output signal value of output signal title sequence in transforming test cases is assigned to the test data, then by time sequence Row and data sequence are converted into corresponding test data, and are assigned to and are answered with time series and data sequence pair in test data The corresponding position of the identical input signal title of input signal title.As can be seen that the present invention using Excel to test case into Row filing, using Matlab by the automatic generating test case test data of Excel formats, because being to directly read and change the outfit The test case of Excel formats, so the present invention improves work while ensuring test case with test data consistency Efficiency.
Secondly, the parameter configuration table that the present invention uses, when project variation leads to Parameters variation, test case still can be with It reuses.
Finally, due to which the present invention is directed to the content in the reading Excel file of English by API, therefore, can avoid because of one Secondary property reads too many content to be caused to overflow to Matlab memories.
In order to further optimize the above embodiments, further including:
Alarm unit, in the case where judging unit 25 is judged as NO, exporting information warning, and terminate test data Product process.
Wherein, converting unit 28 includes:
First judgment sub-unit 281, the letter for judging to include in use-case to be measured to be converted that the parameter configuration is completed Whether number number and data sequence number are identical;
Wherein, the signal number is the number summation of input signal and output signal, and data sequence number is input number According to the number summation of sequence and output data sequence;
First conversion subunit 282, in the case where the first judgment sub-unit 281 is judged as YES, by array type Time series be converted into corresponding time test data, the data sequence of array type is converted into corresponding data test number According to.
It should be noted that when the signal number and data that include in the use-case to be measured to be converted that the parameter configuration is completed When sequence number differs, then information warning is exported, and terminates Test data generation flow.
In order to further optimize the above embodiments, converting unit 28 further includes:
Second judgment sub-unit 283, it is defeated for judge to include in use-case to be measured to be converted that the parameter configuration is completed Enter whether signal is included in all input signal initial values;
Second conversion subunit 284, in the case where the second judgment sub-unit 283 is judged as YES, by array type Time series be converted into corresponding time test data, the data sequence of array type is converted into corresponding data test number According to.
It should be noted that the input signal for including in the use-case to be measured to be converted that the parameter configuration is completed all is not wrapped When being contained in all input signal initial values, information warning is exported, and terminate Test data generation flow.
It should be noted that in system embodiment, the concrete operating principle of each component part refers to embodiment of the method pair Part, the present invention is answered not to limit herein.
Finally, it is to be noted that, herein, relational terms such as first and second and the like be used merely to by One entity or operation are distinguished with another entity or operation, without necessarily requiring or implying these entities or operation Between there are any actual relationship or orders.Moreover, the terms "include", "comprise" or its any other variant meaning Covering non-exclusive inclusion, so that the process, method, article or equipment including a series of elements includes not only that A little elements, but also include other elements that are not explicitly listed, or further include for this process, method, article or The intrinsic element of equipment.In the absence of more restrictions, the element limited by sentence "including a ...", is not arranged Except there is also other identical elements in the process, method, article or apparatus that includes the element.
Each embodiment is described by the way of progressive in this specification, the highlights of each of the examples are with other The difference of embodiment, just to refer each other for identical similar portion between each embodiment.
The foregoing description of the disclosed embodiments enables those skilled in the art to implement or use the present invention. Various modifications to these embodiments will be apparent to those skilled in the art, as defined herein General Principle can be realized in other embodiments without departing from the spirit or scope of the present invention.Therefore, of the invention It is not intended to be limited to the embodiments shown herein, and is to fit to and the principles and novel features disclosed herein phase one The widest range caused.

Claims (9)

1. a kind of generation method of test data, which is characterized in that including:
The total page number n of test case list is calculated, wherein the test case list is Excel lists, including:Test Use-case numbered sequence, input time sequence, input signal title sequence, input data sequence corresponding with input signal title sequence Row, output time series, output signal title sequence and output data sequence corresponding with output signal title sequence, wherein n For positive integer;
Since the first page of the test case list, gradually the test case in every page is converted, until n pages complete Portion converts, and the transfer process of the test case in every page executes following steps:
The content for a plurality of test case for including is obtained in page to be converted, and calculates the test case for including in the page to be converted Item number m, m are positive integer;
Since the page to be converted first test case, gradually each test case is converted, until m items are surveyed Example on probation all converts, and the transfer process of each test case executes following steps:
The parameter needed to configure in test case to be converted is corresponded into parameter in the parameter configuration table for obtaining and storing in advance Value is substituted, and the parameter configuration table is Excel lists, in the parameter configuration table record have configuration parameter name and with The corresponding configuration parameter respective value of the configuration parameter, the parameter needed to configure include:Input time sequence is believed with input Number corresponding input data sequence of title sequence, output time series and output data sequence corresponding with output signal title sequence Row;
The time series for the test case to be converted that parameter configuration is completed is converted into array type, data sequence by character string type Row by character string type are converted to array type, wherein time series includes input time sequence and output time series, described Data sequence includes input data sequence and output data sequence;
Whether the data sequence length of the length of time series and array type that judge array type is identical;
If it is, test data is defined, and by all input signal initial values in the initial value list for obtaining and storing in advance It is assigned to the test data, the initial value list is all of tested software model corresponding with the test case list The initial value list of input signal, in the initial value list record have input signal title sequence and with the input signal The corresponding input signal initial value of title sequence, the test data include:Input time sequence, input signal title sequence, Input data sequence, output time series, output signal title sequence and output data sequence;
By the corresponding output signal value of output signal title sequence in the test case to be converted completed with the parameter configuration It is assigned to the test data, wherein the output signal value is sky;
The time series of array type is converted into corresponding time test data, the data sequence of array type is converted into corresponding to Data test data;
The time test data are assigned in the test data and input signal corresponding with the time test data The corresponding position of the identical input signal title of title, at the same by the data test data be assigned in the test data with The corresponding position of the identical input signal title of the corresponding input signal title of the data test data.
2. generation method according to claim 1, which is characterized in that further include:
If it is not, then output information warning, and terminate Test data generation flow.
3. generation method according to claim 1, which is characterized in that described to be converted into the time series of array type pair The time test data answered, the data sequence of array type are converted into corresponding data test data and include:
Judge the signal number for including in the use-case to be measured to be converted that the parameter configuration is completed and data sequence number whether phase Together, wherein the signal number is the number summation of input signal and output signal, and data sequence number is input data sequence With the number summation of output data sequence;
If it is, the time series of array type is converted into corresponding time test data, the data sequence of array type It is converted into corresponding data test data.
4. generation method according to claim 1, which is characterized in that described to be converted into the time series of array type pair The time test data answered, the data sequence of array type are converted into corresponding data test data and include:
Judge whether the value for the input signal for including in the use-case to be measured to be converted that the parameter configuration is completed is included in institute It states in all input signal initial values;
If it is, the time series of array type is converted into corresponding time test data, the data sequence of array type It is converted into corresponding data test data.
5. generation method according to claim 1, which is characterized in that when the time series is relative time, then phase Transfer process to time series is:
The first numerical value corresponding time of numerical value in the time series is set as 0, the corresponding absolute time of the c1 numerical value Between for the sum of all time points before the c1 time series and 1 make difference after be multiplied by default simulation step length, wherein c1 is more than 1 Positive integer.
6. a kind of generation system of test data, which is characterized in that including:
Computing unit, the total page number n for test case list to be calculated, wherein the test case list arranges for Excel Table, including:Test case numbered sequence, input signal title sequence, is answered with input signal title sequence pair at input time sequence Input data sequence, output time series, output signal title sequence and output number corresponding with output signal title sequence According to sequence, wherein n is positive integer;
Since the first page of the test case list, gradually the test case in every page is converted, until n pages complete Portion converts, and the transfer process of the test case in every page executes such as lower unit:
Acquiring unit, the content for obtaining in page to be converted a plurality of test case for including, and calculate in the page to be converted Including test case item number m, m be positive integer;
Since the page to be converted first test case, gradually each test case is converted, until m items are surveyed Example on probation all converts, and the transfer process of each test case executes such as lower unit:
Parameter configuration unit, for by the parameter needed to configure in test case to be converted with obtaining in advance and the parameter stored is matched It sets and corresponds to the value of parameter in table and substituted, the parameter configuration table is Excel lists, and there is record in the parameter configuration table matches It sets parameter name and configuration parameter respective value corresponding with the configuration parameter, the parameter needed to configure includes:Input Time series, input data sequence corresponding with input signal title sequence, output time series and with output signal title sequence Arrange corresponding output data sequence;
The time series of converting unit, the test case to be converted for completing parameter configuration is converted to number by character string type Set type, data sequence are converted to array type by character string type, wherein time series includes input time sequence and output Time series, the data sequence include input data sequence and output data sequence;
Whether the data sequence length of judging unit, length of time series and array type for judging array type is identical;
Test data definition unit, in the case where the judging unit is judged as YES, defining test data, and will be advance It obtains and all input signal initial values is assigned to the test data in the initial value list that stores, the initial value list is The initial value list of all input signals of tested software model corresponding with the test case list, the initial value list Middle record has input signal title sequence and input signal initial value corresponding with the input signal title sequence, the survey Trying data includes:Input time sequence, input signal title sequence, input data sequence, output time series, output signal name Claim sequence and output data sequence;
First assignment unit, for by the output signal title sequence in the test case to be converted completed with the parameter configuration Corresponding output signal value is assigned to the test data, wherein the output signal value is sky;
Converting unit, for the time series of array type to be converted into corresponding time test data, the data of array type Sequence is converted into corresponding data test data;
Second assignment unit, for by the time test data be assigned in the test data and with the time test The corresponding position of the identical input signal title of the corresponding input signal title of data, while by the data test data assignment To in the test data the identical input signal title of input signal title corresponding with the data test data it is corresponding Position.
7. generation system according to claim 6, which is characterized in that further include:
Alarm unit in the case where the judging unit is judged as NO, exporting information warning, and terminates test data life At flow.
8. generation system according to claim 6, which is characterized in that the converting unit includes:
First judgment sub-unit, signal number for judging to include in use-case to be measured to be converted that the parameter configuration is completed with Whether data sequence number is identical, wherein the signal number is the number summation of input signal and output signal, data sequence Number is the number summation of input data sequence and output data sequence;
First conversion subunit, in the case where first judgment sub-unit is judged as YES, by the time of array type Sequence is converted into corresponding time test data, and the data sequence of array type is converted into corresponding data test data.
9. generation system according to claim 6, which is characterized in that the converting unit includes:
Second judgment sub-unit, the input signal for judging to include in use-case to be measured to be converted that the parameter configuration is completed Whether value is included in all input signal initial values;
Second conversion subunit, in the case where second judgment sub-unit is judged as YES, by the time of array type Sequence is converted into corresponding time test data, and the data sequence of array type is converted into corresponding data test data.
CN201610288414.8A 2016-05-04 2016-05-04 A kind of generation method and system of test data Active CN105955887B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610288414.8A CN105955887B (en) 2016-05-04 2016-05-04 A kind of generation method and system of test data

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610288414.8A CN105955887B (en) 2016-05-04 2016-05-04 A kind of generation method and system of test data

Publications (2)

Publication Number Publication Date
CN105955887A CN105955887A (en) 2016-09-21
CN105955887B true CN105955887B (en) 2018-10-19

Family

ID=56913651

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610288414.8A Active CN105955887B (en) 2016-05-04 2016-05-04 A kind of generation method and system of test data

Country Status (1)

Country Link
CN (1) CN105955887B (en)

Families Citing this family (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106484621B (en) * 2016-10-13 2018-12-14 北京润科通用技术有限公司 A kind of method for generating test case and device
CN106771453B (en) * 2016-11-16 2020-10-02 广州视源电子科技股份有限公司 Testing method and device for oscilloscope
CN109298702A (en) * 2017-07-24 2019-02-01 长城汽车股份有限公司 ECU automatic test approach and system
CN107766256A (en) * 2017-11-23 2018-03-06 中广核工程有限公司 A kind of method for transformation and system of software unit testing use-case
CN109146615A (en) * 2018-07-27 2019-01-04 厦门正黎明冶金机械有限公司 A kind of apparatus control system being loaded into for third party system data
CN108958312A (en) * 2018-09-06 2018-12-07 广东芬尼克兹节能设备有限公司 A kind of temperature output control method, device, terminal device and readable storage medium storing program for executing
CN109800539B (en) * 2019-02-27 2020-06-05 北京世冠金洋科技发展有限公司 Simulation test method and system
CN111628912B (en) * 2020-05-28 2021-08-03 深圳华锐金融技术股份有限公司 Resource-related data processing method and device, computer equipment and storage medium
CN113297068A (en) * 2021-04-20 2021-08-24 惠州市德赛西威汽车电子股份有限公司 Tessy-based method for processing input and output into fixed template in batch and storage medium thereof

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7761841B1 (en) * 2005-04-29 2010-07-20 Sprint Communications Company L.P. Enhanced data loading for test management tool
CN103699478A (en) * 2012-09-27 2014-04-02 ***股份有限公司 Test case generation system and test case generation method
CN104636254A (en) * 2015-01-16 2015-05-20 北京创毅视讯科技有限公司 Method and device for generating test case, testing method and testing equipment
CN105373476A (en) * 2015-11-17 2016-03-02 北京新能源汽车股份有限公司 Method and system for generating automatic test case in automobile controller

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6961873B2 (en) * 2001-09-14 2005-11-01 Siemens Communications, Inc. Environment based data driven automated test engine for GUI applications

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7761841B1 (en) * 2005-04-29 2010-07-20 Sprint Communications Company L.P. Enhanced data loading for test management tool
CN103699478A (en) * 2012-09-27 2014-04-02 ***股份有限公司 Test case generation system and test case generation method
CN104636254A (en) * 2015-01-16 2015-05-20 北京创毅视讯科技有限公司 Method and device for generating test case, testing method and testing equipment
CN105373476A (en) * 2015-11-17 2016-03-02 北京新能源汽车股份有限公司 Method and system for generating automatic test case in automobile controller

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
"Towards Automatic Model-In-the-Loop Testing of Electronic Vehicle Information Centers";Domenico Amalfitano 等;《Proceedings of the 2014 international workshop on Long-term industrial collaboration on software engineering》;20140916;第9-12页 *

Also Published As

Publication number Publication date
CN105955887A (en) 2016-09-21

Similar Documents

Publication Publication Date Title
CN105955887B (en) A kind of generation method and system of test data
CN105607897B (en) Chip register code automatic generation method and its system
CN100573537C (en) A kind of SOC chip system grade verification system and method
CN102402430B (en) One utilizes script to generate random test example method and system
CN100514296C (en) Automation emulation method and system
CN102841950B (en) The method and device that a kind of logic storage unit is verified automatically
CN109189619B (en) I2C bus compatibility test method, system, storage medium and equipment
CN101504692A (en) System and method for validating and testing on-chip system
CN114327476A (en) Chip design file generation method and device and chip design method and device
JP4853312B2 (en) Behavioral synthesis apparatus, method, and program having test bench generation function
CN102201022A (en) Method and device for checking field programmable gate array (FPGA)
CN107885500A (en) A kind of runtime environment generation method towards AUTOSAR software architectures
CN110134596A (en) The generation method and terminal device of test document
CN105158673B (en) A kind of generation method and device of ATE boards file
US8180610B2 (en) Model-based diagnostic interface for a vehicle health management system having a system model with a system nomeclature
Heuer et al. Defining variability in activity diagrams and Petri nets
CN103020396B (en) A kind of method that automatic generation is asserted and device
CN103246782B (en) A kind of rational unrestricted choice Workflow net is to the conversion method of MSVL
CN109725900B (en) SMV (simple message modeling) model construction method of register transmission level Verilog code
CN114548027A (en) Method for tracking signal in verification system, electronic device and storage medium
CN105740579A (en) Building method for connecting UVM verification platform
CN105677560A (en) Testing method, device and system
CN101858953A (en) ARM (Advanced RISC Machines) core chip based automatic test system and method of digital-to-analog converter
JP2011524039A (en) Method and apparatus for determining repetitive bit value patterns
CN110221955A (en) Test report generating means

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
EE01 Entry into force of recordation of patent licensing contract
EE01 Entry into force of recordation of patent licensing contract

Application publication date: 20160921

Assignee: CHONGQING CHANGAN NEW ENERGY AUTOMOBILE TECHNOLOGY Co.,Ltd.

Assignor: Chongqing Changan Automobile Co.,Ltd.|CHONGQING CHANG'AN NEW ENERGY AUTOMOBILE Co.,Ltd.

Contract record no.: 2018500000022

Denomination of invention: Test data generation method and system

Granted publication date: 20181019

License type: Exclusive License

Record date: 20181130

TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20190110

Address after: 401133 room 208, 2 house, 39 Yonghe Road, Yu Zui Town, Jiangbei District, Chongqing

Patentee after: CHONGQING CHANGAN NEW ENERGY AUTOMOBILE TECHNOLOGY Co.,Ltd.

Address before: 400023, No. 260, Jianxin East Road, Jiangbei District, Chongqing

Co-patentee before: CHONGQING CHANG'AN NEW ENERGY AUTOMOBILE Co.,Ltd.

Patentee before: Chongqing Changan Automobile Co.,Ltd.

CP01 Change in the name or title of a patent holder
CP01 Change in the name or title of a patent holder

Address after: 401133 room 208, 2 house, 39 Yonghe Road, Yu Zui Town, Jiangbei District, Chongqing

Patentee after: Deep Blue Automotive Technology Co.,Ltd.

Address before: 401133 room 208, 2 house, 39 Yonghe Road, Yu Zui Town, Jiangbei District, Chongqing

Patentee before: CHONGQING CHANGAN NEW ENERGY AUTOMOBILE TECHNOLOGY Co.,Ltd.