CN108763070A - Generation method, device and the electronic equipment of test data - Google Patents
Generation method, device and the electronic equipment of test data Download PDFInfo
- Publication number
- CN108763070A CN108763070A CN201810470202.0A CN201810470202A CN108763070A CN 108763070 A CN108763070 A CN 108763070A CN 201810470202 A CN201810470202 A CN 201810470202A CN 108763070 A CN108763070 A CN 108763070A
- Authority
- CN
- China
- Prior art keywords
- data
- test data
- field
- character
- class
- 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.)
- Pending
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3688—Test management for test execution, e.g. scheduling of test suites
Abstract
An embodiment of the present invention provides a kind of generation method of test data, device and electronic equipments, by the requirement documents for obtaining test data, test data demand information is extracted from the requirement documents of acquisition, according to the test data demand information of extraction, generates test data.Test data demand information is extracted based on requirement documents, avoid user prepare in advance it is cumbersome and inconvenient caused by initial data template, and it can not ensure that primary data classes are comprehensive, can not ensure the comprehensive problem of test data type caused by, test data is targetedly generated according to the demand data information of extraction, meets user demand to ensure that the test data generated is comprehensive.
Description
Technical field
The present invention relates to technical field of measurement and test, are set more particularly to a kind of generation method of test data, device and electronics
It is standby.
Background technology
Before completing the first software systems developed or updated and formally coming into operation, need to use test data pair
The software systems carry out functional test, and therefore, the generation of test data is very crucial for the functional test of software systems.It is existing
Some test data generating methods are:According to the primary template data that user provides, test number is generated by default create-rule
According to.For any user, default create-rule includes:According to the data class for the primary template data that the user provides, generate
Test data identical with the data class of primary template data.Such as:The field quantity for being included according to data to data into
Row classification, the primary template data a that user A is provided include 2 fields, i.e., the data class of primary template data is 2 Field Counts
According to then the test data generated is also 2 fields.The characteristics of this method is that the data class of test data and user provide
Primary template data data class it is identical, that is to say, that when user provide primary template data class it is single when, can only
Generate the test data of single kind.But with the development of information technology, the type of data is more and more, the survey of single kind
Examination data cannot be satisfied demand.
In order to solve the problems, such as cannot be satisfied enriched data type demand, when generating test data using the above method,
User is just needed to provide the primary template data for including more data class.For this purpose, when the software systems generation to develop for the first time
When test data, human-edited is needed to go out multiple primary template data for including different data type.When for the soft of update
It when part system generates test data, needs to collect in advance, analysis of history data, include multiple includes different data kind to select
The primary template data of class.
It can be seen that no matter the software systems for which kind of development phase generate test data, to ensure the data class of test data
It is comprehensive, be required for user to prepare a variety of primary template data for respectively including different data type for meeting demand in advance,
Process very complicated, and it is difficult to ensure that the data class of initial data is comprehensive.
Invention content
The embodiment of the present invention is designed to provide a kind of generation method of test data, device and electronic equipment, with reality
The comprehensive purpose for meeting user demand of test data data class that is existing easy to use and can ensureing generation.Particular technique
Scheme is as follows:
In a first aspect, an embodiment of the present invention provides a kind of generation method of test data, this method includes:
Obtain the requirement documents of test data;
Test data demand information is extracted from the requirement documents of acquisition;
According to the test data demand information of extraction, test data is generated.
Optionally, test data demand information is extracted from the requirement documents of acquisition, including:
According to predetermined keyword information, using presupposed information extraction algorithm, extracted from the requirement documents of acquisition and default
The information that key word information is consistent;
Using the information extracted as test data demand information.
Optionally, according to the test data demand information of extraction, generating test data includes:
According to the test data demand information of extraction and preset data modification scheme, the data of test data are determined
The optional character content of each field in type and the test data of each data class;
For each data class of test data, selection should from the optional character content of each field in the data class
The character content of field, and to having selected each field of the character content to be combined, generate the test number of the data class
According to.
Optionally, test data demand information includes data attribute information;
Data attribute information includes:The character of each field in the data of at least one data class and each data class
Type;
The test data of generation includes legal test data, and legal test data includes that type is at least one data kind
Class, and the character types of each field test number identical with the character types of each field in the data of at least one data class
According to;
According to the test data demand information of the extraction, generating test data includes:
It is generated every according to the character types of each field in the data of the data class for data class described in each
A field is corresponding, multiple characters identical with the character types of each field;
For each field in the test data of the data class, select character as the word from multiple characters of generation
The character content of section, and to having selected each field of the character content to be combined, generate legal test data.
Optionally, the test data of generation further includes illegal test data, and illegal test data includes type and at least one
A diverse test data of data;
According to the test data demand information of extraction, generating test data includes:
According at least one data class and preset first data modification scheme, the number of illegal test data is determined
Illegal test data is generated according to the data class of illegal test data according to type;
And/or
The test data of generation further includes illegal test data, and illegal test data includes that type is at least one data kind
Class, the character types of at least one field and at least one field in the test data of at least one data class in each field
The different test data of character types;
According to the test data demand information of the extraction, generating test data includes:
According to the character types of each field in the data of at least one data class and preset second data modification
Scheme determines the character types at least one field in illegal test data, according at least one word in illegal test data
Character types in section, generate illegal test data.
Optionally, data attribute information further include at least one data class data at least one field designated word
Symbol;
Legal test data includes:Type is at least one data class, the character types of each field and at least one number
Character types according to each field in the data of type are identical, and the character of at least one field is identical with the designated character of field
Test data;
According to the character types of each field in the test data of data class, generate each field it is corresponding, with each word
Section the identical multiple characters of character types include:
According at least one in the character types of each field in the data of the data class and the data of the data class
It is corresponding, identical with the character types of each field and specified with the field to generate each field for the designated character of field
The identical multiple characters of character.
Optionally, the test data of generation further includes illegal test data, and illegal test data includes that type is at least one
A data class, the character types of each field are identical as the character types of each field in the data of at least one data class, until
The corresponding character of the few field test data different from the designated character of the field;
According to the test data demand information of the extraction, generating test data includes:
According to the designated character of at least one field in the data of at least one data class and preset third number
According to modification, the character of at least one field in the illegal test data is determined;
According to the character of at least one field in illegal test data, illegal test data is generated.
Optionally, test data demand information includes data attribute information and the output frequency of test data;
According to the test data demand information of the extraction, generating test data includes:
According to output frequency, periodically according to the data attribute information, generates and output test data.
Optionally, the test data of generation includes legal test data and illegal test data;
The generation method of test data further includes:
According to preset statistic frequency, first of illegal test data in the test data of each data class of generation is counted
Second quantity of quantity and legal test data;
First quantity of statistics and the second quantity are exported to user.
Second aspect, an embodiment of the present invention provides a kind of generating means of test data, which includes:
Document acquisition module, the requirement documents for obtaining test data;
Information extraction modules, for extracting test data demand information from the requirement documents of acquisition;
Data generation module generates test data for the test data demand information according to extraction.
Optionally, information extraction modules are specifically used for:
According to predetermined keyword information, using presupposed information extraction algorithm, extracted from the requirement documents of acquisition and default
The information that key word information is consistent;
Using the information extracted as demand data information.
Optionally, data generation module is specifically used for:
According to the test data demand information of extraction and preset data modification scheme, the data of test data are determined
The optional character content of each field in type and the test data of each data class;
For each data class of test data, the word is selected from the optional character content of each field in data class
The character content of section, and to having selected each field of the character content to be combined, generate the test number of the data class
According to.
Optionally, test data demand information includes data attribute information;
Data attribute information includes:The character type of each field in the data of at least one data class and every data class
Type;
The test data of generation includes legal test data, and legal test data includes that type is at least one data kind
Class, and the character types of each field test number identical with the character types of each field in the data of at least one data class
According to;
Data generation module is specifically used for:
For each data class each field is generated according to the character types of each field in the data of data class
Multiple characters corresponding, identical with the character types of each field;
For each field in the test data of the data class, select character as the word from multiple characters of generation
The character content of section, and to having selected each field of character content to be combined, generate legal test data.
Optionally, the test data of generation further includes illegal test data, and illegal test data includes type and at least one
A diverse test data of data;
Data generation module is used for:
According at least one data class and preset first data modification scheme, the number of illegal test data is determined
Illegal test data is generated according to the data class of illegal test data according to type;
And/or
The test data of generation further includes illegal test data, and illegal test data includes that type is at least one data kind
Class, the character types of at least one field and at least one field in the test data of at least one data class in each field
The different test data of character types;
Data generation module is used for:
According to the character types of each field in the data of at least one data class and preset second data modification
Scheme determines the character types at least one field in illegal test data, according at least one word in illegal test data
Character types in section, generate illegal test data.
Optionally, data attribute information further include at least one data class data at least one field designated word
Symbol;
Legal test data includes:Type is at least one data class, the character types of each field and at least one number
Character types according to each field in the data of type are identical, and the character of at least one field is identical as the designated character of the field
Test data;
Data generation module is used for:
According at least one field in the character types of each field in the data of data class and the data of data class
Designated character, generate that each field is corresponding, designated character identical with the character types of each field and with the field
Identical multiple characters.
Optionally, the test data of generation further includes illegal test data, and illegal test data includes that type is at least one
A data class, the character types of each field are identical as the character types of each field in the data of at least one data class, until
The corresponding character of the few field test data different from the designated character of the field;
Data generation module is used for:
According to the designated character of at least one field in the data of at least one data class and preset third number
According to modification, the character of at least one field in illegal test data is determined;
According to the character of at least one field in illegal test data, the illegal test data is generated.
Optionally, test data demand information includes data attribute information and the output frequency of test data;
Data generation module is used for:
According to output frequency, periodically according to data attribute information, generates and output test data.
Optionally, the test data of generation includes legal test data and illegal test data;
The generating means of test data further include:
Statistical module, it is illegal in the test data of each data class of generation for according to preset statistic frequency, counting
First quantity of test data and the second quantity of legal test data;First quantity of statistics and the second quantity are exported
To user.
The third aspect, an embodiment of the present invention provides a kind of electronic equipment, which includes:
Processor, communication interface, memory and communication bus, wherein processor, communication interface, memory pass through communication
Bus completes mutual communication;
Memory, for storing computer program;
Processor when for executing the program stored on memory, realizes any test data of above-mentioned first aspect
The step of generation method.
Fourth aspect is stored with an embodiment of the present invention provides a kind of computer readable storage medium in the storage medium
Computer program realizes the generation method such as any test data of above-mentioned first aspect when the computer program is executed by processor
The step of.
Generation method, device and the electronic equipment of a kind of test data provided in an embodiment of the present invention are tested by obtaining
The requirement documents of data extract test data demand information, according to the test data demand of extraction from the requirement documents of acquisition
Information generates test data.Test data demand information is extracted based on requirement documents, user is avoided and prepares initial data in advance
It is cumbersome and inconvenient caused by template, and can not ensure that primary data classes are comprehensive, can not ensure test data caused by
The comprehensive problem of type targetedly generates test data according to the demand data information of extraction, to ensure generation
Test data is comprehensive to meet user demand.
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.
Fig. 1 is the flow diagram of the generation method of the test data of one embodiment of the invention;
Fig. 2 is the flow diagram of the generation method of the test data of another embodiment of the present invention;
Fig. 3 is the structural schematic diagram of the generating means of the test data of one embodiment of the invention;
Fig. 4 is the structural schematic diagram of the generating means of the test data of another embodiment of the present invention;
Fig. 5 is the structural schematic diagram of the electronic equipment of one embodiment of the invention.
Specific implementation mode
In order to make those skilled in the art more fully understand the technical solution in the present invention, implement below in conjunction with the present invention
Attached drawing in example, technical scheme in the embodiment of the invention is clearly and completely described, it is clear that described embodiment
Only a part of the embodiment of the present invention, instead of all the embodiments.Based on the embodiments of the present invention, the common skill in this field
The every other embodiment that art personnel are obtained without creative efforts belongs to the model that the present invention protects
It encloses.
A kind of generation method of test data provided in an embodiment of the present invention is introduced first below.
The generation method of test data provided in an embodiment of the present invention can be applied to the electronics that can generate test data
Equipment, the equipment include desktop computer, portable computer, internet television, server etc., are not limited thereto, any
The electronic equipment that the embodiment of the present invention may be implemented belongs to the protection domain of the embodiment of the present invention.
As shown in Figure 1, the flow chart of the generation method of the test data of one embodiment of the invention, may include:
S101 obtains the requirement documents of test data.
The requirements document file of test data can be user previously according to the demand editor to test data, can be with
It is user based on current test data demand online editing.Requirement documents can specifically include Word document, Excel document,
HyperText Markup Language (HyperText Markup Language, abbreviation HTML) file or Rapid Prototype Design file
Multiple formats such as (Axure RP files).
The acquisition modes of requirement documents can be specifically the requirement documents for receiving user and submitting.
S102 extracts test data demand information from the requirement documents of acquisition.
Optionally, S102 can specifically include:
According to predetermined keyword information, using presupposed information extraction algorithm, extracted from the requirement documents of acquisition and default
The information that key word information is consistent.
Using the information extracted as test data demand information.
Predetermined keyword information is the technical term for stating user to test data demand, for example, user is to test
The demand of the data attributes such as type, character types, the designated character of data.Specifically, key word information can be " type ",
" user information ", " legal ", " illegal ", " special ", " field ", " number " and " quantity " etc..
Presupposed information extraction algorithm can be by the combination between predetermined keyword information and these key word informations
Content in requirement documents is filtered, is consistent to the combination extracted between key word information or key word information
Information, the information extracted are exactly demand data information.Specifically, presupposed information extraction algorithm can be regular expression.
S103 generates test data according to the test data demand information of extraction.
Since test data demand information is user to the data category such as the type of test data, character types, designated character
Property demand therefore can generate corresponding with test data demand information survey according to the test data demand information of extraction
Try data.
Generation method, device and the electronic equipment of a kind of test data provided in an embodiment of the present invention are tested by obtaining
The requirement documents of data extract test data demand information, according to the test data demand of extraction from the requirement documents of acquisition
Information generates test data.Test data demand information is extracted based on requirement documents, user is avoided and prepares initial data in advance
It is cumbersome and inconvenient caused by template, and can not ensure that primary data classes are comprehensive, can not ensure test data caused by
The comprehensive problem of type targetedly generates test data according to the demand data information of extraction, to ensure generation
Test data is comprehensive to meet user demand.
In practical application, software systems to be come into operation can be to periodically acquire data, or there are data pressures
Situations such as testing requirement, such as:User's sleep quality monitoring system needs to periodically acquire the physiology such as user's heartbeat, blood pressure ginseng
Number or Video Storage System need to test maximum transcoding rate in preset time period.Therefore, in order to ensure in test system to be measured
Data acquisition cycle in exist always test data for obtaining, to reduce without the stand-by period caused by test data, improve and survey
Try efficiency;Or in order to ensure to have in preset time period enough test datas for test system to be measured processing, to realize to data
The test of pressure can be generated and outputed test data with certain output frequency according to testing requirement.
Therefore, optionally, the test data demand information extracted in the S102 of embodiment illustrated in fig. 1 may include data category
The output frequency of property information and test data.
Wherein, data attribute information indicates the attribute of test data, for example, data class, field character types, field
Length, character content etc..
Correspondingly, the S103 of embodiment illustrated in fig. 1, may include:
According to output frequency, periodically according to data attribute information, generates and output test data.
Output frequency can obtain the period of data corresponding frequency with software systems to be come into operation, can also be with
Software systems to be come into operation carry out the corresponding frequency of preset time period of pressure test.
In practical application, after the S103 of embodiment shown in Fig. 1, it can also include the following steps:
The test data of generation is transmitted to test system to be measured, so that the test system to be measured carries out the test data
Processing.
The test data of generation is transmitted to test system to be measured, can be converted into test system to be measured after generating test data
The accessible file is transmitted to test system to be measured by accessible file, can also be directly to be generated as data to be tested
The accessible file of test system to be measured, that is to say, that test data is the accessible file of test system to be measured, can without conversion
It is directly transferred to test system to be measured.It compared with mode of the export data for test, will directly be tested from database with traditional
Data transmission is more convenient to use to test system to be measured, improves testing efficiency.
In view of test data is used to test the function of software systems to be come into operation, which can be inspection software work(
Can whether normal to the reply of valid data, it can also be whether inspection software function is normal to the reply of invalid data.
Therefore, optionally, in embodiment illustrated in fig. 1 of the present invention, the test data of generation may include legal test data
With illegal test data.
Wherein, legal test data is i.e. matched data identical as test data demand information, for example, attribute meets need
Seek the data attribute information that information includes, illegal test data be with the i.e. unmatched data of test data demand information difference,
It is understood that legal test data can there are many data class, and each data class can have different fields
The different character content of character types, illegal test data equally can be there are many data class, and each data class can have
The character content for having different field character types different.The comprehensive of test data has been further expanded as a result, after being conducive to
The continuous function of testing software to be come into operation more fully hereinafter.
Correspondingly, after the S103 of embodiment shown in Fig. 1, the generation method of test data can also include:
According to preset statistic frequency, first of illegal test data in the test data of each data class of generation is counted
Second quantity of quantity and legal test data.
First quantity of statistics and the second quantity are exported to user.
The first quantity of illegal test data and the second quantity of legal test data are counted and exported, can be used for really
Whether the test data generated surely meets demand, to remind related personnel that investigation is asked with the relevant exception of Test data generation process
Topic, can also facilitate user to be analyzed test result using the first quantity and the second quantity.
For example, for determining whether the test data generated meets demand, to remind related personnel to investigate test data
When the abnormal problem of generation, according to test data demand, legal test data 100,000, illegal test data 30,000 should be generated.
But legal test data is 110,000 in statistical result, and illegal test data is 20,000, then can determine the test data of generation not
Meet demand, related personnel is reminded to investigate the relevant abnormal problem of Test data generation process.
User ties test using the second quantity of the first quantity and legal test data of the illegal test data of output
Fruit is analyzed, and the second quantity of the first quantity and legal test data using illegal test data is specifically as follows, and determines
Whether the function to be tested of software systems to be tested is normal.By taking member data as an example:The member data of generation is 100,000, non-meeting
Member's data are 30,000, that is to say, that the first quantity is 30,000, and the second quantity is 100,000.The member of test system to be measured accesses work(
Can, access 110,000 members.User is according to the first quantity and the second quantity of output, it may be determined that the member of test system to be measured
Access function is abnormal, needs to investigate abnormal conditions.
It is given birth in view of test data demand information may include data attribute information, and according to test data demand information
At test data may include legal test data and illegal test data, therefore, optionally, implement shown in Fig. 1 of the present invention
The S103 of example, can specifically include:
According to the test data demand information of extraction and preset data modification scheme, the data of test data are determined
The optional character content of each field in type and the test data of each data class.
For each data class of test data, selection should from the optional character content of each field in the data class
The character content of field, and to having selected each field of the character content to be combined, generate the test data of the data class.
Wherein, data modification scheme can preset and store, and can also be literary from test data demand
Middle acquisition, the preset modification in requirement documents in shelves.Data modification scheme be used for test data demand into
Row modification, to acquisition and the unmatched test data of demand data, for example, it is 2 words to indicate field in test data demand
Segment data, data modification scheme can indicate to increase by 1 field, 3 field datas of acquisition.
Wherein, the data class of test data can be drawn according to the actual test demand of each software system function to be tested
Point.Such as:For the subscriber authentication function of access control system, the data class of test data can be disabled user's letter
The different class of subscribers such as breath, validated user information and special user's information;For the SMS interception work(of mobile phone safe software
Can, the data class of test data can be the different short message classification such as refuse messages, normal short message and blacklist short message.
The data class of test data, which can also be, to be divided according to the different field number of test data.Such as:10
The data class of the test data to be generated of field is 10 field datas, and the data class of the test data of 12 fields is 10
Field data.
Simultaneously as data are made of multiple fields, therefore, for the test data of each data class, it may be determined that group
At the optional character content of each field of the data class test data.Certainly, the data class of legal test data and every
The optional character content of each field in the test data of a data class, is identical with test data demand information.It is non-
In the test data of the data class of method test data and each data class in the optional character content of each field, at least one
It is a to be differed with test data demand information, it is specific which or it is multiple different from demand information, can be according to presetting
Data modification scheme determine.
Such as:For a certain test data that data class is 2 field datas, the optional character of the 1st field be " a1 ",
The optional character of " a2 ", the 2nd field are " b1 ", " b2 " and " b3 ".Select the optional character " a1 " of the 1st field as
The character content of 1 field, selects character content of the optional character " b2 " of the 2nd field as the 2nd field, and to this two
A field is combined, and the data class of generation is that the test data of 2 field datas is a1b2.And so on, the data of generation
Type is that the test data of 2 field datas can also be a1b1, a1b3, a2b2, a2b1 and a2b3.As a result, by can word selection
The determination of symbol, and to having selected optional character to be combined as each field of character content, generate a certain data class
Multiple and different test datas.
Such as:It is 2 field datas that demand data information, which indicates field data, and the character types of the first field are A types, the
The character types of two character fields are that Type B then according to the demand data information and preset modification, determines data kind
Class is 2 fields and 3 field datas, and 3 field datas are exactly to be specified by preset modification.And the test data of 2 fields
In, the optional character content of the first field is A types " a1 ", " a2 ", and the optional character content of " b1 " of Type B, the second field are A
" a3 " of type, " b1 " of Type B, " b2 ", are further combined field, generate the test data of 2 fields, the test of generation
Data may include a1b1, a1b2, a2b1, a2b2 and a1a3, a2a3, b1a3, b1b1, b1b2, wherein a1b1, a1b2,
A2b1, a2b2 be AB types legal test data, a1a3 (AA types), a2a3 (AA types), b1a3 (BA types), b1b1 (BB types),
B1b2 (BB types) is illegal test data.
As shown in Fig. 2, the flow chart of the generation method of the test data of another embodiment of the present invention, may include:
S201 obtains the requirement documents of test data.
S201 is identical as the S101 in embodiment illustrated in fig. 1 of the present invention, and details are not described herein, refers to embodiment illustrated in fig. 1
Description.
S202 extracts test data demand information from the requirement documents of acquisition.
Wherein, test data demand information includes data attribute information.
Data attribute information includes:The character of each field in the data of at least one data class and each data class
Type.
Since test data may be the data of same data class, it is also possible to the data of multiple and different data class,
Therefore, it in data attribute information may include at least one data class.
Based on the demand data information extracted in S202, the test data of generation may include legal test data, legal
It can be at least one data class that test data, which may include type, and the character types of each field and at least one data kind
The identical test data of the character types of each field in the data of class.
For example, in the data attribute information of extraction, data class is 6 field datas and 7 field datas.6 field datas
The 1st field to the 6th field character types be respectively character string, long, floating type, character variable, floating type with
And character string.The character types of 1st field to the 7th field of 7 field datas are respectively character string, long, integer, float
Point-type, character variable, floating type and character string.The legal test data then generated includes:Type is 6 field datas and 7
The test data of field data.And the character types of the 1st field to the 6th field of wherein 6 field datas are respectively word
Accord with string, long, floating type, character variable, floating type and character string.1st field of 7 field datas is to the 7th field
Character types be respectively character string, long, integer, floating type, character variable, floating type and character string.
It is specific to execute following step S203 to S204 when generating above-mentioned legal test data:
S203 is generated each for each data class according to the character types of each field in the data of data class
Field is corresponding, multiple characters identical with the character types of each field.
S204, for each field in the test data of data class, selected from multiple characters of generation character as
The character content of the field, and to having selected each field of character content to be combined, generate legal test data.
Such as:Data class is 2 field datas and 3 field datas.1st field of 2 field datas is to the 2nd field
Character types be respectively character string, long.The character types of 1st field to the 3rd field of 3 field datas are respectively
Character string, long, integer.
For 2 field datas, according to the character types of each field in 2 field datas, generate that the 1st field be corresponding, word
Accord with 3 characters " character string a1 ", " character string a2 " and " character string a3 " that type is character string;The 2nd field is generated to correspond to
, character types be long 2 characters " long a1 " and " long a2 ".
For 3 field datas, according to the character types of each field in 3 field datas, generate that the 1st field be corresponding, word
Accord with 4 characters " character string b1 ", " character string b2 ", " character string b3 " and " character string b4 " that type is character string;Generate the 2nd
3 characters " long b1 ", " long b2 " and " long b3 " that a field is corresponding, character types are long;It is raw
At the 3rd field, corresponding, character types are 2 characters " integer b1 ", " the integer b2 " of integer.
For each field in the test data of 2 field datas, character " character string is selected from multiple characters of generation
Character contents of the a1 " as the 1st field, select character " long a2 " as the 2nd character content, and to having selected in character
Each field held is combined, and generates legal test data " character string a1 longs a2 ".For the test data of 3 field datas
In each field, select character content of the character " character string b1 " as the 1st field from multiple characters of generation, select character
The character content of " long b3 " as the 2nd field selects character content of the character " integer b2 " as the 3rd field, and to choosing
Each field for having selected character content is combined, and generates legal test data " character string a1 longs a2 ".And so on, from each
Repeatedly select kinds of characters as the character content of the field in multiple characters that field generates, and to having selected character content
Field is combined accordingly, until all characters are selected and have carried out the combination of corresponding field.Thus, it is possible to generate symbol
Conjunction data attribute information, multiple and different legal test data.
Based on the demand data information extracted in S202, the test data of generation can also include illegal test data, non-
Method test data may include the type test data different from least one data class.
Illegal test data, data modification scheme specifically can be generated according to demand data information and data modification
It can be preset, can also be in the middle acquisition in test data requirement documents, that is specified in requirement documents repaiies
Change scheme, for extending the comprehensive of test data, generates and the unmatched test data of demand data.
For example, in the data attribute information of extraction, data class is 6 field datas and 7 field datas.What is then generated is non-
Method test data may include at least one of following type test data:Type is the test data of 5 field datas, type
It is the test data of 8 field datas.
It is specific to execute following step S205 when generating above-mentioned illegal test data:
S205 determines illegal test number according at least one data class and preset first data modification scheme
According to data class illegal test data is generated according to the data class of illegal test data.
Wherein, it due to illegally testing including the type test data different from least one data class, sets in advance
The first fixed data modification scheme can specifically include:At least one data class of the illegal test data generated and data category
Property information in data class it is different.
Certainly, due to illegal test data and legal the test data test data that be data attribute information different,
When generating illegal test data, as long as the data attribute information of illegal test data is determined, specifically according to data attribute
The method that information generates illegal test data is identical with the method for generating legal test data according to data attribute information.
In view of data class is the number of field in data, when at least one data class and number of illegal test data
When according at least one of attribute information data class difference, the field number of the illegal test data data class will be more than
Or it is less than the data class.Correspondingly, being more than the illegal test data of the data class for field number, will lack
The case where having more the character type information of field.In this regard, when generating illegal test data, for lacking character type information
Field is had more, the character of any character type can be generated, for the normal field of character type information, can be generated and character
The identical character of type information.
For example, in the data attribute information of extraction, data class is 2 field datas and 3 field datas.2 field datas
The character types of the 1st field to the 2nd field be respectively character string, long.1st field of 3 field datas is to the 3rd
The character types of a field are respectively character string, long, integer.Then repaiied according to data class and preset first data
Change scheme, determines that the data class of illegal test data may include at least one of following type:Type is 1 Field Count
According to type is 4 field datas (exists and have more field, lack character information).Correspondingly, the illegal test number of generation can be with
Including:The illegal test data of 1 field, and the character types of the 1st field of the illegal test data of 1 field are character string;4 fields
Illegal test data, and the character types of the 1st field to the 3rd field of the illegal test data of 4 fields be respectively character string,
The character types of long, integer, the 4th field can be arbitrary.
Optionally, in embodiment illustrated in fig. 2 of the present invention, based on the demand data information extracted in S202, the test of generation
Data can also include illegal test data, and illegal test data may include that type is at least one data class, each field
In in the character types of at least one field and the test data of at least one data class at least one field character types
Different test datas.
For example, in the data attribute information of extraction, data class is 2 field datas and 3 field datas.2 field datas
The character types of the 1st field to the 2nd field be respectively character string, long.1st field of 3 field datas is to the 3rd
The character types of a field are respectively character string, long, integer.Then illegal test data may include in following data extremely
Few one kind:The character types of 1st field of 2 field datas are not character string;The character type of 2nd field of 2 field datas
Type is not long;The character types of 1st field of 3 field datas are not character string;2nd field of 3 field datas
Character types are not long;The character types of 3rd field of 3 field datas are not integer.
Correspondingly, when generating above-mentioned illegal test data, following step is specifically executed:
According to the character types of each field in the data of at least one data class and preset second data modification
Scheme determines the character types at least one field in illegal test data, according at least one word in illegal test data
Character types in section, generate illegal test data.
Wherein, it is at least one data class including type due to illegally testing, the word of at least one field in each field
The type test data different from the character types of at least one field in the test data of at least one data class is accorded with, therefore
Preset second data modification scheme can specifically include:The illegal test data generated and the number in data attribute information
It is identical according to type, in each field of the illegal test data of each data class, the character types of at least one field and data
The character types of respective field are different in attribute information.
For example, in the data attribute information of extraction, data class is 2 field datas and 3 field datas.2 field datas
The character types of the 1st field to the 2nd field be respectively character string, long.1st field of 3 field datas is to the 3rd
The character types of a field are respectively character string, long, integer.Then in each field at least one field character type
Type and preset second data modification scheme, determine the character types at least one field in illegal test data.With
The character types of the 1st field are not the 2nd field in character string and 2 field datas in 2 field datas of illegal test data
Character types be long for:According to the character types at least one field in illegal test data, generation it is non-
Method test data may include:The illegal test data of 2 fields, and the character types of the 1st field of the illegal test data of 2 fields
Be not character string, the 2nd field character types be not long.
Certainly, illegal test data is generated based on the demand data information that S202 in embodiment illustrated in fig. 2 of the present invention is extracted
When, illegal test data can also include that the type test data and type different from least one data class are at least
One data class, in each field the character types of at least one field in the test data of at least one data class at least
The different test data of the character types of one field.That is, the illegal test data generated in Fig. 2 embodiments with it is above-mentioned
The illegal test data generated in alternative embodiment can be collectively as illegal Test data generation.
Optionally, the data attribute information extracted in the S202 of embodiment illustrated in fig. 2 can also include at least one data
The designated character of at least one field in the data of type.Legal test data can also include as a result,:Type is at least one
Data class, the character types of each field are identical as the character types of each field in the data of at least one data class, and extremely
The character test data identical with the designated character of the field of a few field.
Designated character is the demand of user for specific data content.For example, the function of software systems to be come into operation is meeting
Member's user's access, test data is user information.In the data attribute information of extraction, data class is 2 field datas and 3 words
Segment data.The character types of 1st field to the 2nd field of 2 field datas are respectively character string, long, and the 1st word
The designated character of section is " VIP ".The character types of 1st field to the 3rd field of 3 field datas are respectively character string, length
Integer, integer, and the designated character of the 1st field is " VIP ".Then legal test data includes:Type is 2 field datas, 2 words
The character types of 1st field to the 2nd field of segment data are respectively character string, long, and the character of the 1st field is
" VIP " and type are 3 field datas, and the character types of the 1st field to the 3rd field of 3 field datas are respectively character
String, long, integer, and the designated character of the 1st field is " VIP ".
Correspondingly, the S203 in embodiment illustrated in fig. 2 may include:
According at least one in the character types of each field in the data of the data class and the data of the data class
It is corresponding, identical with the character types of each field and specified with the field to generate each field for the designated character of field
The identical multiple characters of character.
For example, in the data attribute information of extraction, data class is 2 field datas and 3 field datas.2 field datas
The character types of the 1st field to the 2nd field be respectively character string, long, and the designated character of the 1st field is
"VIP".The character types of 1st field to the 3rd field of 3 field datas are respectively character string, floating type, integer, and the 1st
The designated character of a field is " VIP ", and the designated character of the 2nd field is " 18.00 ".
For 2 field datas, according to the character types of each field in 2 field datas and the designated character of the 1st field
" VIP " generates 1 character " VIP " that the 1st field is corresponding, character types are character string;Generate the 2nd field it is corresponding,
Character types are 2 characters " long a1 " and " long a2 " of long.
For 3 field datas, according to the character types of each field in 3 field datas and the designated character of the 1st field
The designated character " 18.00 " of " VIP " and the 2nd field generates 1 character that the 1st field is corresponding, character types are character string
"VIP";Generate 1 character " 18.00 " that the 2nd field is corresponding, character types are floating type;The 3rd field is generated to correspond to
, character types be integer 2 characters " integer b1 ", " integer b2 ".
For each field in the test data of 2 field datas, selected from multiple characters of generation character " VIP " as
The character content of 1st field, select character " long a2 " as the 2nd character content, and to having selected each of character content
Field is combined, and generates legal test data " VIP longs a2 ".For each field in the test data of 3 field datas,
Character content of the character " VIP " as the 1st field is selected from multiple characters of generation, selects character " 18.00 " as the 2nd word
The character content of section, selects character content of the character " integer b2 " as the 3rd field, and each field to having selected character content
It is combined, generates legal test data " VIP18.00 longs a2 ".And so on, from multiple characters that each field generates
Character content of the kinds of characters as the field is repeatedly selected, and to having selected the field of character content to carry out the corresponding combination, directly
It is selected to all characters and has carried out the combination of corresponding field.Thus, it is possible to generate meet data attribute information, it is multiple
Different legal test datas.
Based on the demand data information extracted in S202, it is at least one number that the test data of generation, which can also include type,
According to type, the character types of each field are identical as the character types of each field in the data of at least one data class, and at least one
The corresponding character of a field test data different from the designated character of the field.
For example, in the data attribute information of extraction, data class is 2 field datas and 3 field datas.2 field datas
The character types of the 1st field to the 2nd field be respectively character string, long, and the designated character of the 1st field is
"VIP".The character types of 1st field to the 3rd field of 3 field datas are respectively character string, floating type, integer, and the 1st
The designated character of a field is " VIP ", and the designated character of the 2nd field is " 18.00 ".Then illegal test data may include following
It is at least one:The character of 1st field of 2 field datas is " common ";The character of 1st field of 3 field datas is " general
It is logical ";The character of 2nd field of 3 field datas is " 18.30 ".
When generating above-mentioned illegal test data, following step is specifically executed:
According to the designated character of at least one field in the data of at least one data class and preset third number
According to modification, the character of at least one field in illegal test data is determined.
According to the character of at least one field in illegal test data, illegal test data is generated.
Wherein, it is at least one data class, the character types of each field and at least one including type due to illegally testing
The character types of each field are identical in the data of a data class, the designated word of at least one field corresponding character and the field
Accord with different test datas.Therefore, preset third data modification scheme can specifically include:The illegal test number generated
According to data class it is identical as the data class in data attribute information, each field word of the illegal test data of each data class
It is identical as the character types of each field in the data of the data class to accord with type, it is at least one there are in the field of designated character
The corresponding character of field is different from the designated character of the field.
Certainly, due to illegal test data and legal the test data test data that be data attribute information different,
When generating illegal test data, as long as the character of at least one field of illegal test data is determined, specifically according to number
It is phase with the method for generating legal test data according to data attribute information according to the method that attribute information generates illegal test data
With.
For example, in the data attribute information of extraction, data class is 2 field datas and 3 field datas.2 field datas
The character types of the 1st field to the 2nd field be respectively character string, long, and the designated character of the 1st field is
"VIP".The character types of 1st field to the 3rd field of 3 field datas are respectively character string, floating type, integer, and the 1st
The designated character of a field is " VIP ", and the designated character of the 2nd field is " 18.00 ".Then according to the number of at least one data class
The designated character of at least one field and preset third data modification scheme, determine in illegal test data at least in
The character of one field may include at least one of following character:The character of 1st field of 2 field datas is " general
It is logical ";The character of 1st field of 3 field datas is " common ";The character of 2nd field of 3 field datas is " 18.30 ".
Corresponding to above method embodiment, the embodiment of the present invention additionally provides a kind of generating means of test data.
As shown in figure 3, the structural schematic diagram of the generating means of the test data of one embodiment of the invention, may include:
Document acquisition module 301, the requirement documents for obtaining test data.
Information extraction modules 302, for extracting test data demand information from the requirement documents of the acquisition.
Optionally, information extraction modules 302 specifically can be used for:
According to predetermined keyword information, using presupposed information extraction algorithm, from the requirement documents of acquisition extraction with it is described
The information that predetermined keyword information is consistent.
Using the information extracted as demand data information.
Data generation module 303 generates test data for the test data demand information according to extraction.
A kind of generating means of test data provided in an embodiment of the present invention, by obtaining the requirement documents of test data,
Test data demand information is extracted from the requirement documents of acquisition, according to the test data demand information of extraction, generates test number
According to.Extract test data demand information based on requirement documents, avoid user prepare in advance it is cumbersome caused by initial data template
Inconvenience, and can not ensure that primary data classes are comprehensive, can not ensure that test data type is comprehensive caused by and ask
Topic, test data is targetedly generated according to the demand data information of extraction, to ensure that the test data generated is comprehensive
Meet user demand.
Optionally, the test data demand information extracted in embodiment illustrated in fig. 3, may include data attribute information and survey
Try the output frequency of data.
Correspondingly, the data generation module 303 of embodiment illustrated in fig. 3, can be also used for:
According to output frequency, periodically according to the data attribute information, generates and output test data.
It is periodically selected according to the output frequency for each field in the test data to be generated of each data class
Character content of the corresponding any character of the field as the field is selected, and each field is combined, generates the data class
Test data.
In practical application, the data generation module 303 of embodiment illustrated in fig. 3 can be also used for:
The test data of generation is transmitted to test system to be measured, so that the test system to be measured carries out the test data
Processing.
The test data of generation is transmitted to test system to be measured, can be converted into test system to be measured after generating test data
The accessible file is transmitted to test system to be measured by accessible file, can also be directly to be generated as data to be tested
The accessible file of test system to be measured, that is to say, that test data is the accessible file of test system to be measured, can without conversion
It is directly transferred to test system to be measured.It compared with mode of the export data for test, will directly be tested from database with traditional
Data transmission is more convenient to use to test system to be measured, improves testing efficiency.
Optionally, the data generation module 303 in embodiment illustrated in fig. 3 of the present invention, specifically can be used for:
According to the test data demand information of extraction and preset data modification scheme, the data of test data are determined
The optional character content of each field in type and the test data of each data class.
For each of test data data class, selected from the optional character content of each field in the data class
The character content of the field is selected, and to having selected each field of character content to be combined, generates the test number of the data class
According to.
Optionally, the test data demand information in embodiment illustrated in fig. 3 of the present invention may include data attribute information.
Data attribute information may include:Each field in the data of at least one data class and each data class
Character types.
The test data of generation may include legal test data, and legal test data may include that type is at least one
Data class, and the survey identical with the character types of each field in the data of at least one data class of the character types of each field
Try data.
Correspondingly, data generation module 303, specifically can be used for:
For each data class each word is generated according to the character types of each field in the data for changing data class
Section multiple characters corresponding, identical with the character types of each field.
For each field in the test data of the data class, select character as the word from multiple characters of generation
The character content of section, and to having selected each field of character content to be combined, generate legal test data.
Optionally, the test data generated in embodiment illustrated in fig. 3 of the present invention further includes illegal test data, illegal to test
Data may include the type test data different from least one data class.
Correspondingly, data generation module 303, is used for:
According at least one data class and preset first data modification scheme, the number of illegal test data is determined
Illegal test data is generated according to the data class of illegal test data according to type.
And/or
The test data of generation can also include illegal test data, illegal test data may include type be it is described extremely
A few data class, in each field the character types of at least one field in the test data of at least one data class extremely
The different test data of the character types of a field less.
Correspondingly, data generation module 303, is used for:
According to the character types of each field in the data of at least one data class and preset second data modification
Scheme determines the character types at least one field in illegal test data, according at least one word in illegal test data
Character types in section, generate illegal test data.
Optionally, the data attribute information in embodiment illustrated in fig. 3 of the present invention can also include at least one data class
Data at least one field designated character.
Legal test data includes:Type is at least one data class, the character types of each field and at least one number
Character types according to each field in the data of type are identical, and the character of at least one field is identical as the designated character of the field
Test data.
Correspondingly, data generation module 303, is used for:
According at least one in the character types of each field in the data of the data class and the data of the data class
It is corresponding, identical with the character types of each field and specified with the field to generate each field for the designated character of field
The identical multiple characters of character.
Optionally, the test data of the generation in embodiment illustrated in fig. 3 of the present invention can also include illegal test data, non-
Method test data may include that type is at least one data class, the character types of each field and at least one data class
The character types of each field are identical in data, the test different from the designated character of the field of the corresponding character of at least one field
Data.
Correspondingly, data generation module 303, is used for:
According to the designated character of at least one field in the data of at least one data class and preset
Three data modification schemes determine the character of at least one field in the illegal test data;
According to the character of at least one field in illegal test data, illegal test data is generated.
As shown in figure 4, the structural schematic diagram of the generating means of the test data of another embodiment of the present invention, may include:
Document acquisition module 401, the requirement documents for obtaining test data.
Information extraction modules 402, for extracting test data demand information from the requirement documents of the acquisition.
Data generation module 403 generates test data for the test data demand information according to extraction.
Document acquisition module 401, information extraction modules 402 and data generation module 403 are implemented with shown in Fig. 3 of the present invention
301,302 and 303 in example be equal modules.
Wherein, the test data of generation may include legal test data and illegal test data.
Correspondingly, the generating means of test data can also include:
Statistical module 404, for according to preset statistic frequency, counting non-in the test data of each data class of generation
First quantity of method test data and the second quantity of legal test data;By first quantity of statistics and described
Two quantity are exported to user.
The embodiment of the present invention additionally provides a kind of electronic equipment, as shown in figure 5, including processor 501, communication interface 502,
Memory 503 and communication bus 504, wherein processor 501, communication interface 502, it is complete that memory logical 503 crosses communication bus 504
At mutual communication;
Memory 503, for storing computer program.
Processor 501 when for executing the computer program stored on memory 503, realizes following steps:
Obtain the requirement documents of test data;
Test data demand information is extracted from the requirement documents of acquisition;
According to the test data demand information of extraction, test data is generated.
Optionally, test data demand information is extracted from the requirement documents of acquisition, including:
According to predetermined keyword information, using presupposed information extraction algorithm, extracted from the requirement documents of acquisition and default
The information that key word information is consistent;
Using the information extracted as test data demand information.
Optionally, according to the test data demand information of extraction, generating test data includes:
According to the test data demand information of extraction and preset data modification scheme, the data of test data are determined
The optional character content of each field in type and the test data of each data class;
For each data class of test data, selection should from the optional character content of each field in the data class
The character content of field, and to having selected each field of the character content to be combined, generate the test number of the data class
According to.
Optionally, test data demand information includes data attribute information;
Data attribute information includes:The character of each field in the data of at least one data class and each data class
Type;
The test data of generation includes legal test data, and legal test data includes that type is at least one data kind
Class, and the character types of each field test number identical with the character types of each field in the data of at least one data class
According to;
According to the test data demand information of the extraction, generating test data includes:
It is generated every according to the character types of each field in the data of the data class for data class described in each
A field is corresponding, multiple characters identical with the character types of each field;
For each field in the test data of the data class, select character as the word from multiple characters of generation
The character content of section, and to having selected each field of the character content to be combined, generate legal test data.
Optionally, the test data of generation further includes illegal test data, and illegal test data includes type and at least one
A diverse test data of data;
According to the test data demand information of extraction, generating test data includes:
According at least one data class and preset first data modification scheme, the number of illegal test data is determined
Illegal test data is generated according to the data class of illegal test data according to type;
And/or
The test data of generation further includes illegal test data, and illegal test data includes that type is at least one data kind
Class, the character types of at least one field and at least one field in the test data of at least one data class in each field
The different test data of character types;
According to the test data demand information of the extraction, generating test data includes:
According to the character types of each field in the data of at least one data class and preset second data modification
Scheme determines the character types at least one field in illegal test data, according at least one word in illegal test data
Character types in section, generate illegal test data.
Optionally, data attribute information further include at least one data class data at least one field designated word
Symbol;
Legal test data includes:Type is at least one data class, the character types of each field and at least one number
Character types according to each field in the data of type are identical, and the character of at least one field is identical with the designated character of field
Test data;
According to the character types of each field in the test data of data class, generate each field it is corresponding, with each word
Section the identical multiple characters of character types include:
According at least one in the character types of each field in the data of the data class and the data of the data class
It is corresponding, identical with the character types of each field and specified with the field to generate each field for the designated character of field
The identical multiple characters of character.
Optionally, the test data of generation further includes illegal test data, and illegal test data includes that type is at least one
A data class, the character types of each field are identical as the character types of each field in the data of at least one data class, until
The corresponding character of the few field test data different from the designated character of the field;
According to the test data demand information of the extraction, generating test data includes:
According to the designated character of at least one field in the data of at least one data class and preset third number
According to modification, the character of at least one field in the illegal test data is determined;
According to the character of at least one field in illegal test data, illegal test data is generated.
Optionally, test data demand information includes data attribute information and the output frequency of test data;
According to the test data demand information of the extraction, generating test data includes:
According to output frequency, periodically according to the data attribute information, generates and output test data.
Optionally, the test data of generation includes legal test data and illegal test data;
The generation method of test data further includes:
According to preset statistic frequency, first of illegal test data in the test data of each data class of generation is counted
Second quantity of quantity and legal test data;
First quantity of statistics and the second quantity are exported to user.
A kind of electronic equipment provided in an embodiment of the present invention, by obtaining the requirement documents of test data, from the need of acquisition
Extraction test data demand information in document is sought, according to the test data demand information of extraction, generates test data.Based on demand
Document extracts test data demand information, avoids user and prepares cumbersome and inconvenient, Yi Jiwu caused by initial data template in advance
Method ensures that primary data classes are comprehensive, can not ensure the comprehensive problem of test data type caused by, according to extraction
Demand data information targetedly generate test data, to ensure generate test data it is comprehensive be meet user need
It asks.
The communication bus that above-mentioned electronic equipment is mentioned can be Peripheral Component Interconnect standard (Peripheral Component
Interconnect, abbreviation PCI) bus or expanding the industrial standard structure (Extended Industry Standard
Architecture, abbreviation EISA) bus etc..The communication bus can be divided into address bus, data/address bus, controlling bus etc..
For ease of indicating, only indicated with a thick line in figure, it is not intended that an only bus or a type of bus.
Communication interface is for the communication between above-mentioned electronic equipment and other equipment.
Memory may include random access memory (Random Access Memory, abbreviation RAM), can also include
Nonvolatile memory (Non-Volatile Memory, abbreviation NVM), for example, at least a magnetic disk storage.Optionally, it deposits
Reservoir can also be at least one storage device for being located remotely from aforementioned processor.
Above-mentioned processor can be general processor, including central processing unit (Central Processing Unit,
Abbreviation CPU), network processing unit (Network Processor, abbreviation NP) etc.;It can also be digital signal processor
(Digital Signal Processor, abbreviation DSP), application-specific integrated circuit (Application Specific
Integrated Circuit, abbreviation ASIC), field programmable gate array (Field-Programmable Gate Array,
Abbreviation FPGA) either other programmable logic device, discrete gate or transistor logic, discrete hardware components.
One embodiment of the invention additionally provides a kind of computer readable storage medium, the computer readable storage medium memory
Computer program is contained, when which is executed by processor, realizes following steps.
Obtain the requirement documents of test data;
Test data demand information is extracted from the requirement documents of acquisition;
According to the test data demand information of extraction, test data is generated.
Optionally, test data demand information is extracted from the requirement documents of acquisition, including:
According to predetermined keyword information, using presupposed information extraction algorithm, extracted from the requirement documents of acquisition and default
The information that key word information is consistent;
Using the information extracted as test data demand information.
Optionally, according to the test data demand information of extraction, generating test data includes:
According to the test data demand information of extraction and preset data modification scheme, the data of test data are determined
The optional character content of each field in type and the test data of each data class;
For each data class of test data, selection should from the optional character content of each field in the data class
The character content of field, and to having selected each field of the character content to be combined, generate the test number of the data class
According to.
Optionally, test data demand information includes data attribute information;
Data attribute information includes:The character of each field in the data of at least one data class and each data class
Type;
The test data of generation includes legal test data, and legal test data includes that type is at least one data kind
Class, and the character types of each field test number identical with the character types of each field in the data of at least one data class
According to;
According to the test data demand information of the extraction, generating test data includes:
It is generated every according to the character types of each field in the data of the data class for data class described in each
A field is corresponding, multiple characters identical with the character types of each field;
For each field in the test data of the data class, select character as the word from multiple characters of generation
The character content of section, and to having selected each field of the character content to be combined, generate legal test data.
Optionally, the test data of generation further includes illegal test data, and illegal test data includes type and at least one
A diverse test data of data;
According to the test data demand information of extraction, generating test data includes:
According at least one data class and preset first data modification scheme, the number of illegal test data is determined
Illegal test data is generated according to the data class of illegal test data according to type;
And/or
The test data of generation further includes illegal test data, and illegal test data includes that type is at least one data kind
Class, the character types of at least one field and at least one field in the test data of at least one data class in each field
The different test data of character types;
According to the test data demand information of the extraction, generating test data includes:
According to the character types of each field in the data of at least one data class and preset second data modification
Scheme determines the character types at least one field in illegal test data, according at least one word in illegal test data
Character types in section, generate illegal test data.
Optionally, data attribute information further include at least one data class data at least one field designated word
Symbol;
Legal test data includes:Type is at least one data class, the character types of each field and at least one number
Character types according to each field in the data of type are identical, and the character of at least one field is identical with the designated character of field
Test data;
According to the character types of each field in the test data of data class, generate each field it is corresponding, with each word
Section the identical multiple characters of character types include:
According at least one in the character types of each field in the data of the data class and the data of the data class
It is corresponding, identical with the character types of each field and specified with the field to generate each field for the designated character of field
The identical multiple characters of character.
Optionally, the test data of generation further includes illegal test data, and illegal test data includes that type is at least one
A data class, the character types of each field are identical as the character types of each field in the data of at least one data class, until
The corresponding character of the few field test data different from the designated character of the field;
According to the test data demand information of the extraction, generating test data includes:
According to the designated character of at least one field in the data of at least one data class and preset third number
According to modification, the character of at least one field in the illegal test data is determined;
According to the character of at least one field in illegal test data, illegal test data is generated.
Optionally, test data demand information includes data attribute information and the output frequency of test data;
According to the test data demand information of the extraction, generating test data includes:
According to output frequency, periodically according to the data attribute information, generates and output test data.
Optionally, the test data of generation includes legal test data and illegal test data;
The generation method of test data further includes:
According to preset statistic frequency, first of illegal test data in the test data of each data class of generation is counted
Second quantity of quantity and legal test data;
First quantity of statistics and the second quantity are exported to user.
A kind of computer readable storage medium provided in an embodiment of the present invention, is stored with computer program, the computer journey
When sequence is executed by processor, the requirement documents by obtaining test data are realized, the extraction test number from the requirement documents of acquisition
Test data is generated according to the test data demand information of extraction according to demand information.It is needed based on requirement documents extraction test data
Information is sought, user is avoided and prepares in advance cumbersome and inconvenient caused by initial data template, and can not ensure primary data classes
It is comprehensive, can not ensure the comprehensive problem of test data type caused by, needle is had according to the demand data information of extraction
Test data is generated to property, meets user demand to ensure that the test data generated is comprehensive.
Each embodiment in this specification is all made of relevant mode and describes, identical similar portion between each embodiment
Point just to refer each other, and each embodiment focuses on the differences from other embodiments.Especially for device and
For electronic equipment embodiment, since it is substantially similar to the method embodiment, so description is fairly simple, related place referring to
The part of embodiment of the method illustrates.
Herein, relational terms such as first and second and the like be used merely to by an entity or operation with it is another
One entity or operation distinguish, and without necessarily requiring or implying between these entities or operation, there are any this reality
Relationship or sequence.Moreover, the terms "include", "comprise" or its any other variant are intended to the packet of nonexcludability
Contain, so that the process, method, article or equipment including a series of elements includes not only those elements, but also includes
Other elements that are not explicitly listed, or further include for elements inherent to such a process, method, article, or device.
In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that including the element
Process, method, article or equipment in there is also other identical elements.
In the above-described embodiments, can come wholly or partly by software, hardware, firmware or its arbitrary combination real
It is existing.When implemented in software, it can entirely or partly realize in the form of a computer program product.The computer program
Product includes one or more computer instructions.When loading on computers and executing the computer program instructions, all or
It partly generates according to the flow or function described in the embodiment of the present invention.The computer can be all-purpose computer, special meter
Calculation machine, computer network or other programmable devices.The computer instruction can be stored in computer readable storage medium
In, or from a computer readable storage medium to the transmission of another computer readable storage medium, for example, the computer
Instruction can pass through wired (such as coaxial cable, optical fiber, number from a web-site, computer, server or data center
User's line (Digital Subscriber Line, abbreviation DSL)) or wireless (such as infrared, wireless, microwave etc.) mode to another
One web-site, computer, server or data center are transmitted.The computer readable storage medium can be calculated
Any usable medium that machine can access is either comprising numbers such as one or more usable mediums integrated server, data centers
According to storage device.The usable medium can be magnetic medium, and (for example, floppy disk, hard disk, tape), optical medium are (for example, number
General optic disc (Digital Versatile Disc, abbreviation DVD)) or semiconductor medium (such as solid state disk (Solid
State Disk, abbreviation SSD)) etc..
The foregoing is merely illustrative of the preferred embodiments of the present invention, is not intended to limit the scope of the present invention.It is all
Any modification, equivalent replacement, improvement and so within the spirit and principles in the present invention, are all contained in protection scope of the present invention
It is interior.
Claims (20)
1. a kind of generation method of test data, which is characterized in that the method includes:
Obtain the requirement documents of test data;
Test data demand information is extracted from the requirement documents of the acquisition;
According to the test data demand information of the extraction, test data is generated.
2. according to the method described in claim 1, it is characterized in that, the extraction test number from the requirement documents of the acquisition
According to demand information, including:
According to predetermined keyword information, using presupposed information extraction algorithm, from the requirement documents of the acquisition extraction with it is described
The information that predetermined keyword information is consistent;
Using the information extracted as test data demand information.
3. according to the method described in claim 1, it is characterized in that,
The test data demand information according to the extraction, generating test data includes:
According to the test data demand information of the extraction and preset data modification scheme, the data of test data are determined
The optional character content of each field in type and the test data of each data class;
For each of test data data class, selected from the optional character content of each field in the data class
The character content of the field, and to having selected each field of the character content to be combined, generate the survey of the data class
Try data.
4. according to the method described in claim 1, it is characterized in that,
The test data demand information includes data attribute information;
The data attribute information includes:Each field in the data of at least one data class and each data class
Character types;
The test data of the generation includes legal test data, and the legal test data includes that type is described at least one
Data class, and the character types of each field are identical as the character types of each field in the data of at least one data class
Test data;
The test data demand information according to the extraction, generating test data includes:
It is generated each according to the character types of each field in the data of the data class for data class described in each
Field is corresponding, multiple characters identical with the character types of each field;
For each field in the test data of the data class, select character as this from multiple characters of the generation
The character content of field, and to having selected each field of the character content to be combined, generate the legal test data.
5. according to the method described in claim 4, it is characterized in that,
The test data of the generation further includes illegal test data, and the illegal test data includes type and described at least one
A diverse test data of data;
The test data demand information according to the extraction, generating test data includes:
According at least one data class and preset first data modification scheme, the illegal test data is determined
Data class the illegal test data is generated according to the data class of the illegal test data;
And/or
The test data of the generation further includes illegal test data, and the illegal test data includes that type is described at least one
A data class, in each field the character types of at least one field in the test data of at least one data class extremely
The different test data of the character types of a field less;
The test data demand information according to the extraction, generating test data includes:
According to the character types of each field in the data of at least one data class and preset second data modification
Scheme determines the character types at least one field in the illegal test data, according in the illegal test data extremely
Character types in a few field, generate the illegal test data.
6. method according to claim 4 or 5, which is characterized in that
The data attribute information further include at least one data class data at least one field designated character;
The legal test data includes:Type be at least one data class, the character types of each field with it is described extremely
The character types of each field are identical in the data of a few data class, and the finger of the character of at least one field and the field
Determine the identical test data of character;
It is corresponding and every to generate each field for the character types of each field in the test data according to the data class
The identical multiple characters of character types of a field include:
According at least one in the data of the character types of each field and the data class in the data of the data class
The designated character of field, generate each field it is corresponding, it is identical with the character types of each field and with the finger of the field
Determine the identical multiple characters of character.
7. according to the method described in claim 6, it is characterized in that,
The test data of the generation further includes illegal test data, and the illegal test data includes that type is described at least one
A data class, the character types phase of the character types of each field and each field in the data of at least one data class
Together, the corresponding character of at least one field test data different from the designated character of the field;
The test data demand information according to the extraction, generating test data includes:
According to the designated character of at least one field in the data of at least one data class and preset third number
According to modification, the character of at least one field in the illegal test data is determined;
According to the character of at least one field in the illegal test data, the illegal test data is generated.
8. according to the method described in claim 1, it is characterized in that,
The test data demand information includes data attribute information and the output frequency of test data;
The test data demand information according to the extraction, generating test data includes:
According to the output frequency, periodically according to the data attribute information, generates and output test data.
9. according to the method described in claim 1, it is characterized in that,
The test data of the generation includes legal test data and illegal test data;
The method further includes:
According to preset statistic frequency, the first quantity of illegal test data in the test data of each data class of generation is counted
And the second quantity of legal test data;
First quantity of statistics and second quantity are exported to user.
10. a kind of generating means of test data, which is characterized in that described device includes:
Document acquisition module, the requirement documents for obtaining test data;
Information extraction modules, for extracting test data demand information from the requirement documents of the acquisition;
Data generation module generates test data for the test data demand information according to the extraction.
11. device according to claim 10, which is characterized in that described information extraction module is specifically used for:
According to predetermined keyword information, using presupposed information extraction algorithm, from the requirement documents of the acquisition extraction with it is described
The information that predetermined keyword information is consistent;
Using the information extracted as demand data information.
12. device according to claim 10, which is characterized in that the data generation module is specifically used for:
According to the test data demand information of the extraction and preset data modification scheme, the data of test data are determined
The optional character content of each field in type and the test data of each data class;
For each of test data data class, selected from the optional character content of each field in the data class
The character content of the field, and to having selected each field of the character content to be combined, generate the survey of the data class
Try data.
13. device according to claim 10, which is characterized in that
The test data demand information includes data attribute information;
The data attribute information includes:Each field in the data of at least one data class and each data class
Character types;
The test data of the generation includes legal test data, and the legal test data includes that type is described at least one
Data class, and the character types of each field are identical as the character types of each field in the data of at least one data class
Test data;
The data generation module, is specifically used for:
It is generated each according to the character types of each field in the data of the data class for data class described in each
Field is corresponding, multiple characters identical with the character types of each field;
For each field in the test data of the data class, select character as this from multiple characters of the generation
The character content of field, and to having selected each field of the character content to be combined, generate the legal test data.
14. device according to claim 13, which is characterized in that
The test data of the generation further includes illegal test data, and the illegal test data includes type and described at least one
A diverse test data of data;
The data generation module, is used for:
According at least one data class and preset first data modification scheme, the illegal test data is determined
Data class the illegal test data is generated according to the data class of the illegal test data;
And/or
The test data of the generation further includes illegal test data, and the illegal test data includes that type is described at least one
A data class, in each field the character types of at least one field in the test data of at least one data class extremely
The different test data of the character types of a field less;
The data generation module, is used for:
According to the character types of each field in the data of at least one data class and preset second data modification
Scheme determines the character types at least one field in the illegal test data, according in the illegal test data extremely
Character types in a few field, generate the illegal test data.
15. the device according to claim 13 or 14, which is characterized in that
The data attribute information further include at least one data class data at least one field designated character;
The legal test data includes:Type be at least one data class, the character types of each field with it is described extremely
The character types of each field are identical in the data of a few data class, and the finger of the character of at least one field and the field
Determine the identical test data of character;
The data generation module, is used for:
According at least one in the data of the character types of each field and the data class in the data of the data class
The designated character of field, generate each field it is corresponding, it is identical with the character types of each field and with the finger of the field
Determine the identical multiple characters of character.
16. device according to claim 15, which is characterized in that
The test data of the generation further includes illegal test data, and the illegal test data includes that type is described at least one
A data class, the character types phase of the character types of each field and each field in the data of at least one data class
Together, the corresponding character of at least one field test data different from the designated character of the field;
The data generation module, is used for:
According to the designated character of at least one field in the data of at least one data class and preset third number
According to modification, the character of at least one field in the illegal test data is determined;
According to the character of at least one field in the illegal test data, the illegal test data is generated.
17. device according to claim 10, which is characterized in that
The test data demand information includes data attribute information and the output frequency of test data;
The data generation module, is used for:
According to the output frequency, periodically according to the data attribute information, generates and output test data.
18. device according to claim 10, which is characterized in that
The test data of the generation includes legal test data and illegal test data;
Described device further includes:
Statistical module, for according to preset statistic frequency, counting and illegally being tested in the test data of each data class of generation
First quantity of data and the second quantity of legal test data;By first quantity of statistics and second quantity
It exports to user.
19. a kind of electronic equipment, which is characterized in that including processor, communication interface, memory and communication bus, wherein processing
Device, communication interface, memory complete mutual communication by communication bus;
Memory, for storing computer program;
Processor when for executing the program stored on memory, realizes any method steps of the claims 1-9
Suddenly.
20. a kind of computer readable storage medium, which is characterized in that computer program is stored in the storage medium, it is described
The method and step as described in claim 1-9 is any is realized when computer program is executed by processor.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810470202.0A CN108763070A (en) | 2018-05-16 | 2018-05-16 | Generation method, device and the electronic equipment of test data |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201810470202.0A CN108763070A (en) | 2018-05-16 | 2018-05-16 | Generation method, device and the electronic equipment of test data |
Publications (1)
Publication Number | Publication Date |
---|---|
CN108763070A true CN108763070A (en) | 2018-11-06 |
Family
ID=64008276
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201810470202.0A Pending CN108763070A (en) | 2018-05-16 | 2018-05-16 | Generation method, device and the electronic equipment of test data |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN108763070A (en) |
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109697166A (en) * | 2018-12-26 | 2019-04-30 | 深圳市网心科技有限公司 | A kind of test data preparation method and relevant apparatus |
CN111190811A (en) * | 2019-12-05 | 2020-05-22 | 东方微银科技(北京)有限公司 | Method, device, equipment and storage medium for testing resource allocation system |
CN111459830A (en) * | 2020-04-07 | 2020-07-28 | 中国建设银行股份有限公司 | Test case generation method and device |
WO2020211391A1 (en) * | 2019-04-15 | 2020-10-22 | 深圳壹账通智能科技有限公司 | Automatic test method and apparatus, computer device and storage medium |
CN111984522A (en) * | 2019-05-23 | 2020-11-24 | 杭州海康威视系统技术有限公司 | Automatic testing method and device |
Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103186639A (en) * | 2011-12-31 | 2013-07-03 | 腾讯科技(北京)有限公司 | Data generation method and system |
CN103853652A (en) * | 2012-11-29 | 2014-06-11 | 百度在线网络技术(北京)有限公司 | Test case generation method and device |
CN104199767A (en) * | 2014-08-19 | 2014-12-10 | 北京金山安全软件有限公司 | Test method and device |
CN104407976A (en) * | 2014-11-28 | 2015-03-11 | 联动优势电子商务有限公司 | Method and device for generating interface robustness test case |
US20160239401A1 (en) * | 2015-02-16 | 2016-08-18 | Fujitsu Limited | Black-box software testing with statistical learning |
CN107239392A (en) * | 2016-03-29 | 2017-10-10 | 腾讯科技(深圳)有限公司 | A kind of method of testing, device and terminal |
-
2018
- 2018-05-16 CN CN201810470202.0A patent/CN108763070A/en active Pending
Patent Citations (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103186639A (en) * | 2011-12-31 | 2013-07-03 | 腾讯科技(北京)有限公司 | Data generation method and system |
CN103853652A (en) * | 2012-11-29 | 2014-06-11 | 百度在线网络技术(北京)有限公司 | Test case generation method and device |
CN104199767A (en) * | 2014-08-19 | 2014-12-10 | 北京金山安全软件有限公司 | Test method and device |
CN104407976A (en) * | 2014-11-28 | 2015-03-11 | 联动优势电子商务有限公司 | Method and device for generating interface robustness test case |
US20160239401A1 (en) * | 2015-02-16 | 2016-08-18 | Fujitsu Limited | Black-box software testing with statistical learning |
CN107239392A (en) * | 2016-03-29 | 2017-10-10 | 腾讯科技(深圳)有限公司 | A kind of method of testing, device and terminal |
Cited By (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN109697166A (en) * | 2018-12-26 | 2019-04-30 | 深圳市网心科技有限公司 | A kind of test data preparation method and relevant apparatus |
CN109697166B (en) * | 2018-12-26 | 2022-04-26 | 深圳市网心科技有限公司 | Test data preparation method and related device |
WO2020211391A1 (en) * | 2019-04-15 | 2020-10-22 | 深圳壹账通智能科技有限公司 | Automatic test method and apparatus, computer device and storage medium |
CN111984522A (en) * | 2019-05-23 | 2020-11-24 | 杭州海康威视系统技术有限公司 | Automatic testing method and device |
CN111984522B (en) * | 2019-05-23 | 2024-02-27 | 杭州海康威视系统技术有限公司 | Automatic test method and device |
CN111190811A (en) * | 2019-12-05 | 2020-05-22 | 东方微银科技(北京)有限公司 | Method, device, equipment and storage medium for testing resource allocation system |
CN111459830A (en) * | 2020-04-07 | 2020-07-28 | 中国建设银行股份有限公司 | Test case generation method and device |
CN111459830B (en) * | 2020-04-07 | 2024-03-08 | 建信金融科技有限责任公司 | Test case generation method and device |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN108763070A (en) | Generation method, device and the electronic equipment of test data | |
US10223550B2 (en) | Generating canonical representations of JSON documents | |
CN108664628A (en) | A kind of deriving method and equipment of data | |
JP2019091450A (en) | Method and system for providing real-time feedback information related to content of user input | |
CN109408502A (en) | A kind of data standard processing method, device and its storage medium | |
Akhavan Niaki et al. | Economic design of variable sampling interval X-bar control charts for monitoring correlated non normal samples | |
Wu et al. | An np control chart using double inspections | |
CN108021713B (en) | Document clustering method and device | |
CN110245684A (en) | Data processing method, electronic equipment and medium | |
CN109033224A (en) | A kind of Risk Text recognition methods and device | |
CN109672706A (en) | A kind of information recommendation method, device, server and storage medium | |
CN108156273A (en) | A kind of anonymous ID generation methods, device and electronic equipment | |
CN109063015B (en) | Method, device and equipment for extracting hot content | |
CN105245380B (en) | Message propagation mode identification method and device | |
CN102929778A (en) | Control method for parallel tests on multi-core array and after-silicon verification system | |
CN113946648B (en) | Structured information generation method and device, electronic equipment and medium | |
CN109522928A (en) | Theme sentiment analysis method, apparatus, electronic equipment and the storage medium of text | |
He et al. | Approximation of WKS sampling theorem on random signals | |
CN110472190A (en) | The method and apparatus for filling ordered sequence | |
CN103646060B (en) | Method and device for searching for group | |
CN107665443A (en) | Obtain the method and device of targeted customer | |
CN110580317B (en) | Social information analysis method and device, terminal equipment and storage medium | |
CN110020166A (en) | A kind of data analysing method and relevant device | |
CN114020769A (en) | Data blood margin analysis method and device and storage medium | |
CN113807926A (en) | Recommendation information generation method and device, electronic equipment and computer readable medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
RJ01 | Rejection of invention patent application after publication | ||
RJ01 | Rejection of invention patent application after publication |
Application publication date: 20181106 |