CN103853652B - A kind of test cases generation method and device - Google Patents

A kind of test cases generation method and device Download PDF

Info

Publication number
CN103853652B
CN103853652B CN201210500437.2A CN201210500437A CN103853652B CN 103853652 B CN103853652 B CN 103853652B CN 201210500437 A CN201210500437 A CN 201210500437A CN 103853652 B CN103853652 B CN 103853652B
Authority
CN
China
Prior art keywords
test
test data
data
description information
combined
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201210500437.2A
Other languages
Chinese (zh)
Other versions
CN103853652A (en
Inventor
石宏杨
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Baidu Netcom Science and Technology Co Ltd
Original Assignee
Beijing Baidu Netcom Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Baidu Netcom Science and Technology Co Ltd filed Critical Beijing Baidu Netcom Science and Technology Co Ltd
Priority to CN201210500437.2A priority Critical patent/CN103853652B/en
Publication of CN103853652A publication Critical patent/CN103853652A/en
Application granted granted Critical
Publication of CN103853652B publication Critical patent/CN103853652B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The invention discloses a kind of test cases generation method and device, a kind of test cases generation method includes: to obtain preset test data description information, generates test data set according to test data description information;Preset test logical description information is obtained, determining needs sequence of operation set to be tested;Element in test data set and operation logic set is combined, a plurality of sequences of operation comprising given test data are obtained;Using the present invention program, tester can safeguard the test cases of ten million magnitude with very low cost.It avoids and significantly changes test cases code when system changes or upgrades.

Description

A kind of test cases generation method and device
Technical field
The present invention relates to the field of test technology, more particularly to a kind of test cases generation method and device.
Background technique
System testing is the important component of systems life cycle, has weight to the correctness and integrality for ensuring system Want meaning.With the development of measuring technology, automatization testing technique is used more and more widely, relates generally to test Data prepare automatically, the automatic of test cases executes and verification, the automatic deployment of test environment etc..
The generation of test cases, and an important link of test, quickly, comprehensively get out test cases, can be with Testing efficiency is significantly improved, test period is shortened.It, can be according to the data characteristic of examining system automatically structure using the prior art Test data is made, still, for the test data automatically generated, it is still desirable to which manual compiling needs the sequence of operation (example to be tested Such as insertion, deletion, modification, inquiry), and then obtain test cases.
In the above scheme, although test data can automatically generate, due to needing the manual compiling sequence of operation, because In this test cases ultimately generated, the operation logic that can actually cover is still very limited, it is difficult to which simulation is true Test condition.Moreover, the test cases that this method generates, is coupled in one for the data characteristic of system under test (SUT) and logic behaviour It rises, once testing requirement is changed, original test cases can not reuse substantially, need to regenerate test cases, cause Maintenance cost is higher.
Summary of the invention
In order to solve the above technical problems, the embodiment of the present invention provides a kind of test cases generation method and device, technical side Case is as follows:
The embodiment of the present invention provides a kind of test cases generation method, this method comprises:
Preset test data description information is obtained, test data set is generated according to test data description information;
Preset test logical description information is obtained, determining needs sequence of operation set to be tested;
Element in test data set and operation logic set is combined, is obtained a plurality of comprising given test number According to the sequence of operation;
Using the obtained sequence of operation comprising given test data, test cases is generated.
A kind of specific embodiment according to the present invention, this method further include:
Preset test object description information is obtained, the execution according to test object description information, to the test cases Environment is configured.
A kind of specific embodiment according to the present invention, the test data are made of several fields, described according to test Data specifying-information generates test data set, comprising:
According in test data description information, the feature of multiple fields is described, generates the standby of each field at random respectively Select data;
The alternate data of each field is combined, test data set is generated according to combined result.
A kind of specific embodiment according to the present invention, the alternate data to each field is combined, according to group It closes result and generates test data set, comprising:
According to the combination specified in test data description information, the alternate data of each field is combined;
And/or
According to the test data quantity specified in test data description information, the test data for meeting desired amt is generated;
And/or
According to the filter condition specified in test data description information, corresponding test data is filtered out.
A kind of specific embodiment according to the present invention, it is described to obtain preset test logical description information, it determines and needs The sequence of operation set of test, comprising:
Test logical description information is parsed, determine the execution number of operation to be measured and every kind of operation to be measured and is held Row sequence;
According to parsing result, determining needs sequence of operation set to be tested.
A kind of specific embodiment according to the present invention, the element in test data set and operation logic set It is combined, obtains a plurality of sequences of operation comprising given test data, comprising:
According to preset combination and/or preset sequence of operation desired amt, test data set and operation are patrolled The element compiled in closing is combined, and obtains a plurality of sequences of operation comprising given test data.
The embodiment of the present invention also provides a kind of test cases generating means, which includes:
Data characteristics processing unit, for obtaining preset test data description information, according to test data description information Generate test data set;
Logical implication processing unit, for obtaining preset test logical description information, determining needs operation sequence to be tested Column set;
Cycle tests generation unit is obtained for being combined to the element in test data set and operation logic set To a plurality of sequences of operation comprising given test data;
Test cases generation unit, for generating test using the obtained sequence of operation comprising given test data Case.
A kind of specific embodiment according to the present invention, the device further include:
System features processing unit, for obtaining preset test object description information, according to test object description information, The performing environment of the test cases is configured.
A kind of specific embodiment according to the present invention, the test data are made of several fields, the data characteristics Processing unit includes:
Field data generates subelement, for being described to the feature of multiple fields according in test data description information, point The alternate data of each field is not generated at random;
Field data combines subelement, is combined for the alternate data to each field, is generated according to combined result Test data set.
A kind of specific embodiment according to the present invention, the field data combine subelement, are specifically used for:
According to the combination specified in test data description information, the alternate data of each field is combined;
And/or
According to the test data quantity specified in test data description information, the test data for meeting desired amt is generated;
And/or
According to the filter condition specified in test data description information, corresponding test data is filtered out.
A kind of specific embodiment according to the present invention, the logical implication processing unit, is specifically used for:
Test logical description information is parsed, determine the execution number of operation to be measured and every kind of operation to be measured and is held Row sequence;
According to parsing result, determining needs sequence of operation set to be tested.
A kind of specific embodiment according to the present invention, the cycle tests generation unit, is specifically used for:
According to preset combination and/or preset sequence of operation desired amt, test data set and operation are patrolled The element compiled in closing is combined, and obtains a plurality of sequences of operation comprising given test data.
Technical solution provided by the embodiment of the present invention in advance needs the test data demand of system under test (SUT) and test logic Ask independent and be stored as description information, during generating test cases, by respectively read test data requirements and Logic requirement is tested, different test datas and test logic are combined, construct multifarious cycle tests automatically, is tested Personnel only need respectively to be defined test data and test logic, it will be able to effectively be covered a variety of test datas and a variety of Test the test cases of logic.On the other hand, once testing requirement changes, for tester, it is only necessary to directly repair Change test data description information or test logical description information, so that it may new test is generated using the present invention program rapid batch Case, for the application scenarios that testing requirement often changes, can obvious maintenance cost, improve testing efficiency.
Detailed description of the invention
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 technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this The some embodiments recorded in invention can also be obtained according to these attached drawings other for those of ordinary skill in the art Attached drawing.
Fig. 1 is a kind of flow chart of test cases of embodiment of the present invention generation method;
Fig. 2 is second of flow chart of test cases of embodiment of the present invention generation method;
Fig. 3 is a kind of structural schematic diagram of test cases of embodiment of the present invention generating means;
Fig. 4 is second of structural schematic diagram of test cases of embodiment of the present invention generating means.
Specific embodiment
It is provided for the embodiments of the invention a kind of test cases generation method first to be illustrated, this method may include Following steps:
Preset test data description information is obtained, test data set is generated according to test data description information;
Preset test logical description information is obtained, determining needs sequence of operation set to be tested;
Element in test data set and operation logic set is combined, is obtained a plurality of comprising given test number According to the sequence of operation;
Using the obtained sequence of operation comprising given test data, test cases is generated.
Technical solution provided by the embodiment of the present invention in advance needs the test data demand of system under test (SUT) and test logic Ask independent and be stored as description information, during generating test cases, by respectively read test data requirements and Logic requirement is tested, different test datas and test logic are combined, construct multifarious cycle tests automatically, is tested Personnel only need respectively to be defined test data and test logic, it will be able to effectively be covered a variety of test datas and a variety of Test the test cases of logic.On the other hand, once testing requirement changes, for tester, it is only necessary to directly repair Change test data description information or test logical description information, so that it may new test is generated using the present invention program rapid batch Case, for the application scenarios that testing requirement often changes, can obvious maintenance cost, improve testing efficiency.
According to the solution of the present invention, tester previously according to test need, to test needed for data primary demand with And logic to be tested is needed to be defined, test data description information and test logical description information are generated, separately below to this Two kinds of description informations are illustrated:
The basic demand of test data is defined in test data description information, in the information, may include The essential informations such as the test data quantity that test data title, type, value range, needs generate.
In actual application, it may be a tables of data that required data are corresponding, that is to say, that needs to generate and contain The test data of multiple data fields in one embodiment of the invention can be in test data description information, respectively The data requirements of each field is described, it is raw according to the demand of each field respectively during generating test data At data, finally the data of each field are combined, to generate test data.
The essential attribute that is related to of each data field includes field name, field type etc..In addition, for different words Section, it may be necessary to define value range, the value that must include, do not allow the value for including etc..In order to sufficiently to test pair As being tested, also need specially to generate some illegal values or abnormal data sometimes, while providing in test cases for this The expection processing method of " mistake " data a bit, to judge it is expected whether test object can provide for these " mistake " data Processing.
In an embodiment of the present invention, demand of the customized syntax format to test data can be used to retouch It states, for example, currently need to generate tetra- different types of fields of weight, reason, layer, name, test data description letter Breath can be according to following formal definition:
In above-mentioned data specifying-information, the data of four fields pass through tag1 ~ tag4 respectively and are described, in each word In the description information of section, title (name), type (type), qualifications (such as the maximum/minimum of the field are respectively defined Value mode limits, specified value mode limits etc.) and to mistake/abnormal data processing mode etc..
Such as the requirement of tag1 is: field name name, field type be i nt, legal value range be [1, 15], if the data generated are not belonging to this range, (drop) processing is abandoned to the data, i.e., invalid data is pressed It is handled according to " null value " NULL.
In addition, also defining the data bulk that each field needs to generate on the head of above-mentioned data specifying-information Datanum=10, test data quantity allnum=100 for needing to generate in total.
Further, in above-mentioned data specifying-information, also define respectively generate four fields data after, to four The combination of field data: combinetype=random, the mode combined here using random (random), in conjunction with The quantity of front defines known to information: four fields, and each field generates 10 data, is then likely to form 410 kinds of combinations in total, 100 kinds are chosen in this 410 kinds combinations at random, as the test data finally used.It certainly, in practical applications, can be with It can during generating test data if do not defined to combination using modes such as sequence combination, given combinations Using the combination of certain default.
Further, it in above-mentioned data specifying-information, is also described in rule field to the data after combination Whole qualifications.It for the present embodiment, is meant that: if 1 numerical value of field of certain data is equal to 3 and the number of field 2 Value is then abandoned (drop) processing to the data less than 20.
Test logical description information is to needing operation logic to be tested to be defined, and in the information, may include is needed Operation to be performed executes the essential informations such as number, execution sequence.Shown below it is a kind of test logical description information it is specific Example:
Above-mentioned test logical description information is the form using regular expression, can according to above-mentioned test logical description information Know, need operation to be tested as follows: carrying out 10 Add operations first, then carries out 15 Mod operations, next concurrently execute Tetra- kinds of Scan, Query, Add and Del operations, wherein Scan is executed 1 to 5 times, and Query is at least executed 1 time, and Add executes 1 time, 6 Secondary or 9 times, Del can be executed or not executed, and finally execute 1 Check.
In addition, be above according to test logical description information in code content directly determine various operations execution it is suitable Sequence, it is to be understood that in practical applications, " arrangement " operation can also be executed to all given operations, to obtain not Same executes sequence.
The test data description information and test logical description information in the embodiment of the present invention are described respectively above, at this In a kind of preferred embodiment of invention, in order to meet multiplexing demand of the test cases between not homologous ray, tester may be used also Further some normal attributes of test object to be described, test object description information is generated.In this way, being subsequently generated When test cases, so that it may according to test object description information, further be automatically configured to the performing environment of test cases.
Test object description information describes some normal attributes of system under test (SUT), such as port numbers, the journey of system under test (SUT) The features such as sequence title, Starting mode, operation interface, buffer size.It shown below a kind of tool of test object description information Body example:
According to above-mentioned test object description information: the port numbers of system under test (SUT) are 10000, program name is ServerA, data path be /home/work/disk/, starting path is, buffer size is, start command format be /$ SERVERNAME -p$PORT–d$RUNDIR。
It is understood that above test data description information, test logical description information, test object description information It is to schematically illustrate, should not be construed as the limitation to the present invention program, those skilled in the art can be right according to actual needs Actual content defined in various description informations is increased and decreased, modifies, or uses other description information expression formats, this The implementation of overall plan of the present invention is had no effect on a bit.
Below with reference to a specific example, the solution of the present invention is illustrated, it is assumed that pre-generated test data is retouched It is as in the previous examples to state information, test logical description information difference, then generating the side of test cases according to above- mentioned information Method is as shown in Figure 1, may comprise steps of:
S101 obtains preset test data description information, generates test data set according to test data description information;
Read test data specifying-information first determines the test data requirement for needing to generate.For the present embodiment, need Generate tetra- different types of fields of weight, reason, layer, name.The data number generated is needed according to each field Datanum=10 are measured, generate the alternate data of 4 fields at random respectively, such as:
Tag1:[-5,0,1,15,10,3,11, abc ... ...]
Tag2:[-10,0,1,65535,6553500,40, x ... ...]
Tag3:[" 0 ", " 11 ", " aaaa ", " a ", " 123 " ...]
Tag4:[1,2,3,4,5 ... ...]
Wherein each field should have 10 numerical value, be not entirely shown in the above example.
It (is described in the test data of the present embodiment according to the overall situation or to the generting machanism for defining random data of each field It is not shown in information), it can permit and generate various types of random numbers, such as numerical value, text, null character string, contain other Character string of additional character etc..According to specific testing requirement, many numerical value are disabled for test object, but It is the processing capacity to abnormal data for test program, the numerical value of these " illegal " is actually needed in test cases 's.Further, according to the dealing of abnormal data mode provided in data specifying-information, desired input number can also be obtained According to.By the way that the data being originally generated and expected data are inputted system under test (SUT) respectively, whether the output for comparing the two is consistent, so that it may To test out whether system under test (SUT) has desired exception handling ability.
By taking tag1 as an example: according to qualifications max:15, min:1 it is found that it is generated 0, -5,30, abc etc. be illegal Numerical value, according to specified processing mode drop, it should these data be handled in a manner of " NULL ", i.e. expected data Tag1 ' are as follows: [NULL, NULL, 1,15,10, NULL, 11, NULL ... ...], that is to say, that for the abnormal data of input Tag1, it is desirable to which system under test (SUT) can be handled actually according to the numerical value of tag1 '.It, can be with during executing test cases The practical tag1 generated at random and tag1 ' is inputted into system under test (SUT), if the finally obtained result of the two is identical, specifier respectively Close test oracle.
Certainly, the generation of abnormality test data and the processing for abnormal conditions are only a kind of specific embodiments, It should not be construed the limitation to technical solution of the present invention.
After the alternate data for generating each field respectively, further the alternate data of each field is combined, In the data specifying-information of the present embodiment, define combination combinetype=random of interfield, thus using with The mode of machine gets up the combinations of values in each tag, requires allnum=100, total symbiosis according further to test data total amount At 100 groups of data, example is as follows:
[tag1:15, tag2:1, tag3: " 11 ", tag4:2]
[tag1:10, tag2:65535, tag3: " 0 ", tag4:3]
[tag1:3, tag2:0, tag3: " 123 ", tag4:5]
... (totally 100 groups)
It is understood that also need if the data of only field have desired value according to combination above mode, The corresponding expected data generated after combination.
According to the condition limited in rule field, it is also necessary to further verification is done to the data after combination, in the present embodiment In if, it is specified that 1 numerical value of field of certain data be equal to 3 and field 2 numerical value less than 20, which is lost Abandon (drop) processing.As it can be seen that [tag1:3, tag2:0, tag3: " 123 ", tag4:5] this data is eligible, it should carry out Discard processing.New data can be regenerated to supply quantity for the data abandoned according to specific testing requirement; Desired value can also be provided as the embodiment of front;It can certainly be not processed, no longer be described in detail here.
S102 obtains preset test logical description information, and determining needs sequence of operation set to be tested;
Read test logical description information first determines the operation needed to be implemented, executes the information such as number, execution sequence, It for the present embodiment, needs operation to be tested as follows: carrying out 10 Add operations first, then carry out 15 Mod operations, connect Get off concurrently to execute tetra- kinds of Scan, Query, Add and Del operations, wherein Scan is executed 1 to 5 times, and Query is at least executed 1 time, Add is executed 1 time, 6 times or 9 times, and Del can be executed or not executed, and finally executes 1 Check.
In the present embodiment test logical description information, directly defined every kind of operation executes sequence, therefore When generating the sequence of operation, it is only necessary to carry out " combination " without " arrangement ".Combine the sequence of operation generated later schematically as follows:
The similar combination to test data can also preassign arrangement/combination side in test logical description information Formula, it is specified need the sequence of operation quantity generated or provide some qualifications etc., be not detailed herein.
S103 is combined the element in test data set and operation logic set, obtains a plurality of comprising given The sequence of operation of test data;
It is combined, can be obtained using S101 test data generated and the S102 sequence of operation generated, the two To several sequences of operation comprising test data.With the sequence of operation
For, after test data is added, it is as follows to generate result:
According to other test datas generated and the sequence of operation, by combining the operation that can produce largely containing data Sequence, these combined results can cover various fields, various values, a variety of situations of various operations, and effective simulation is true Usage scenario.
Certainly, during generating containing data manipulation sequence, combination, specified needs can equally be preassigned It the sequence of operation quantity of generation or provides some qualifications etc., is not detailed herein.
S104 generates test cases using the obtained sequence of operation comprising given test data.
Include the sequence of operation of given test data using the one or more that front generates, test case can be directly generated Example.
It, in one embodiment of the invention, can also be according to test pair shown in shown in step S104a referring to fig. 2 As description information, the performing environment of test cases is configured.
For example, according to test object description information
The order line of available starting system under test (SUT):
./dataserver–p 9990–d /home/data/
The order line is written in test cases, so that it may when executing test cases, start system under test (SUT) automatically.It utilizes Similar method can also configure the other parameters of system under test (SUT), such as cache size, data source path etc., this In no longer illustrate one by one.
It can be seen that the present invention program for the test data demand and survey in integrated testability demand by above embodiment Logic requirement decoupling is tried, tester respectively can individually define two kinds of demands.According to Fig.2, tester goes back Further the parameter of test object can be independently defined.
Provided embodiment according to the present invention, test data description information, test logical description information, test object Description information three be it is independent of each other, when testing requirement changes, such as data characteristics increases or decreases several fields, It so only needs to modify test data description information, the information of corresponding tag is added or deleted;If it is need operation to be tested Logic changes, then only needs to modify test logical description information, increase, modify or delete corresponding operation;System under test (SUT) It is also as a same reason when characteristic changes.In short, tester only needs to modify on a small quantity using the present invention program, so that it may fast Speed regenerates test cases, and the test cases of ten million magnitude can be safeguarded with very low cost.It avoids when system becomes When changing or upgrading, test cases code is significantly changed.
It is shown in Figure 3 the present invention also provides a kind of test cases generating means corresponding to above method embodiment, The apparatus may include: data characteristics processing unit 210, logical implication processing unit 220,230 He of cycle tests generation unit Test cases generation unit 240.The function of each unit and cooperation relation are illustrated individually below.
Data characteristics processing unit 210 describes to believe for obtaining preset test data description information according to test data Breath generates test data set;
In a kind of specific embodiment of the invention, data characteristics processing unit 210 be can specifically include:
Field data generates subelement, for being described to the feature of multiple fields according in test data description information, point The alternate data of each field is not generated at random;
Field data combines subelement, is combined for the alternate data to each field, is generated according to combined result Test data set.
Field data generates subelement read test data specifying-information first, determines and the test data generated is needed to want It asks.For the present embodiment, need to generate tetra- different types of fields of weight, reason, layer, name.According to each Field needs data bulk datanum=10 generated, generates the alternate data of 4 fields at random respectively, such as:
Tag1:[-5,0,1,15,10,3,11, abc ... ...]
Tag2:[-10,0,1,65535,6553500,40, x ... ...]
Tag3:[" 0 ", " 11 ", " aaaa ", " a ", " 123 " ...]
Tag4:[1,2,3,4,5 ... ...]
Wherein each field should have 10 numerical value, be not entirely shown in the above example.
It (is described in the test data of the present embodiment according to the overall situation or to the generting machanism for defining random data of each field It is not shown in information), it can permit and generate various types of random numbers, such as numerical value, text, null character string, contain other Character string of additional character etc..According to specific testing requirement, many numerical value are disabled for test object, but It is the processing capacity to abnormal data for test program, the numerical value of these " illegal " is actually needed in test cases 's.Further, according to the dealing of abnormal data mode provided in data specifying-information, desired input number can also be obtained According to.By the way that the data being originally generated and expected data are inputted system under test (SUT) respectively, whether the output for comparing the two is consistent, so that it may To test out whether system under test (SUT) has desired exception handling ability.
By taking tag1 as an example: according to qualifications max:15, min:1 it is found that it is generated 0, -5,30, abc etc. be illegal Numerical value, according to specified processing mode drop, it should these data be handled in a manner of " NULL ", i.e. expected data Tag1 ' are as follows: [NULL, NULL, 1,15,10, NULL, 11, NULL ... ...], that is to say, that for the abnormal data of input Tag1, it is desirable to which system under test (SUT) can be handled actually according to the numerical value of tag1 '.It, can be with during executing test cases The practical tag1 generated at random and tag1 ' is inputted into system under test (SUT), if the finally obtained result of the two is identical, specifier respectively Close test oracle.
Certainly, the generation of abnormality test data and the processing for abnormal conditions are only a kind of specific embodiments, It should not be construed the limitation to technical solution of the present invention.
Field data generates after subelement generates the alternate data of each field respectively, field data combine subelement into One step is combined the alternate data of each field, in the data specifying-information of the present embodiment, defines the group of interfield Conjunction mode combinetype=random, therefore random manner is used, the combinations of values in each tag is got up, in addition root Allnum=100 are required according to test data total amount, collectively generate 100 groups of data, example is as follows:
[tag1:15, tag2:1, tag3: " 11 ", tag4:2]
[tag1:10, tag2:65535, tag3: " 0 ", tag4:3]
[tag1:3, tag2:0, tag3: " 123 ", tag4:5]
... (totally 100 groups)
It is understood that also need if the data of only field have desired value according to combination above mode, The corresponding expected data generated after combination.
According to the condition limited in rule field, it is also necessary to further verification is done to the data after combination, in the present embodiment In if, it is specified that 1 numerical value of field of certain data be equal to 3 and field 2 numerical value less than 20, which is lost Abandon (drop) processing.As it can be seen that [tag1:3, tag2:0, tag3: " 123 ", tag4:5] this data is eligible, it should carry out Discard processing.New data can be regenerated to supply quantity for the data abandoned according to specific testing requirement; Desired value can also be provided as the embodiment of front;It can certainly be not processed, no longer be described in detail here.
Logical implication processing unit 220, for obtaining preset test logical description information, determining needs operation to be tested Arrangement set;
Read test logical description information first determines the operation needed to be implemented, executes the information such as number, execution sequence, It for the present embodiment, needs operation to be tested as follows: carrying out 10 Add operations first, then carry out 15 Mod operations, connect Get off concurrently to execute tetra- kinds of Scan, Query, Add and Del operations, wherein Scan is executed 1 to 5 times, and Query is at least executed 1 time, Add is executed 1 time, 6 times or 9 times, and Del can be executed or not executed, and finally executes 1 Check.
In the present embodiment test logical description information, directly defined every kind of operation executes sequence, therefore When generating the sequence of operation, it is only necessary to carry out " combination " without " arrangement ".Combine the sequence of operation generated later schematically as follows:
The similar combination to test data can also preassign arrangement/combination side in test logical description information Formula, it is specified need the sequence of operation quantity generated or provide some qualifications etc., be not detailed herein.
Cycle tests generation unit 230, for being combined to the element in test data set and operation logic set, Obtain a plurality of sequences of operation comprising given test data;
It is generated using the test data generated of data characteristics processing unit 210 and logical implication processing unit 220 The sequence of operation, the two is combined, available several sequences of operation comprising test data.With the sequence of operation
For, after test data is added, it is as follows to generate result:
According to other test datas generated and the sequence of operation, by combining the operation that can produce largely containing data Sequence, these combined results can cover various fields, various values, a variety of situations of various operations, and effective simulation is true Usage scenario.
Certainly, during generating containing data manipulation sequence, combination, specified needs can equally be preassigned It the sequence of operation quantity of generation or provides some qualifications etc., is not detailed herein.
Test cases generation unit 240, for generating and surveying using the obtained sequence of operation comprising given test data Try case.
Shown in Figure 4, test cases generating means provided by the embodiment of the present invention can further include system Characteristic processing unit 250, for obtaining preset test object description information, according to test object description information, to the survey The performing environment of examination case is configured.
For example, according to test object description information
The order line of available starting system under test (SUT):
./dataserver–p9990–d /home/data/
The order line is written in test cases, so that it may when executing test cases, start system under test (SUT) automatically.It utilizes Similar method can also configure the other parameters of system under test (SUT), such as cache size, data source path etc., this In no longer illustrate one by one.
For convenience of description, it is divided into various units when description apparatus above with function to describe respectively.Certainly, implementing this The function of each unit can be realized in the same or multiple software and or hardware when invention.
As seen through the above description of the embodiments, those skilled in the art can be understood that the present invention can It realizes by means of software and necessary general hardware platform.Based on this understanding, technical solution of the present invention essence On in other words the part that contributes to existing technology can be embodied in the form of software products, the computer software product It can store in storage medium, such as ROM/RAM, magnetic disk, CD, including some instructions are used so that a computer equipment (can be personal computer, server or the network equipment etc.) executes the certain of each embodiment or embodiment of the invention Method described in part.
All the embodiments in this specification are described in a progressive manner, same and similar portion between each embodiment Dividing may refer to each other, and each embodiment focuses on the differences from other embodiments.Especially for device reality For applying example, since it is substantially similar to the method embodiment, so describing fairly simple, related place is referring to embodiment of the method Part explanation.The apparatus embodiments described above are merely exemplary, wherein described be used as separate part description Unit may or may not be physically separated, component shown as a unit may or may not be Physical unit, it can it is in one place, or may be distributed over multiple network units.It can be according to the actual needs Some or all of the modules therein is selected to achieve the purpose of the solution of this embodiment.Those of ordinary skill in the art are not paying In the case where creative work, it can understand and implement.
The above is only a specific embodiment of the invention, it is noted that for the ordinary skill people of the art For member, various improvements and modifications may be made without departing from the principle of the present invention, these improvements and modifications are also answered It is considered as protection scope of the present invention.

Claims (8)

1. a kind of test cases generation method, which is characterized in that this method comprises:
Preset test data description information is obtained, according in test data description information, the feature of multiple fields is described, point The alternate data for not generating each field at random, is combined the alternate data of each field, is generated and is surveyed according to combined result Data acquisition system is tried, wherein the test data is made of several fields;
Preset test logical description information is obtained, test logical description information is parsed, determines operation to be measured and every It plants the execution number of operation to be measured and executes sequence, according to parsing result, determining needs sequence of operation set to be tested;
Element in test data set and operation logic set is combined, is obtained a plurality of comprising giving test data The sequence of operation;
Using the obtained sequence of operation comprising given test data, test cases is generated.
2. the method according to claim 1, wherein this method further include:
Preset test object description information is obtained, according to test object description information, to the performing environment of the test cases It is configured.
3. the method according to claim 1, wherein the alternate data to each field is combined, root Test data set is generated according to combined result, comprising:
According to the combination specified in test data description information, the alternate data of each field is combined;
And/or
According to the test data quantity specified in test data description information, the test data for meeting desired amt is generated;
And/or
According to the filter condition specified in test data description information, corresponding test data is filtered out.
4. the method according to claim 1, wherein described in test data set and operation logic set Element is combined, and obtains a plurality of sequences of operation comprising given test data, comprising:
According to preset combination and/or preset sequence of operation desired amt, to test data set and operation logic collection Element in conjunction is combined, and obtains a plurality of sequences of operation comprising given test data.
5. a kind of test cases generating means, which is characterized in that the device includes:
Data characteristics processing unit, it is right according in test data description information for obtaining preset test data description information The feature of multiple fields describes, and generates the alternate data of each field at random respectively, carries out group to the alternate data of each field It closes, test data set is generated according to combined result, wherein the test data is made of several fields;
Logical implication processing unit solves test logical description information for obtaining preset test logical description information Analysis determines the execution number of operation to be measured and every kind of operation to be measured and executes sequence, according to parsing result, determines and needs to test Sequence of operation set;
Cycle tests generation unit is answered for being combined to the element in test data set and operation logic set Several sequences of operation comprising given test data;
Test cases generation unit, for generating test cases using the obtained sequence of operation comprising given test data.
6. device according to claim 5, which is characterized in that the device further include:
System features processing unit, for obtaining preset test object description information, according to test object description information, to institute The performing environment for stating test cases is configured.
7. device according to claim 5, which is characterized in that the data characteristics processing unit is specifically used for:
According to the combination specified in test data description information, the alternate data of each field is combined;
And/or
According to the test data quantity specified in test data description information, the test data for meeting desired amt is generated;
And/or
According to the filter condition specified in test data description information, corresponding test data is filtered out.
8. device according to claim 5, which is characterized in that the cycle tests generation unit is specifically used for:
According to preset combination and/or preset sequence of operation desired amt, to test data set and operation logic collection Element in conjunction is combined, and obtains a plurality of sequences of operation comprising given test data.
CN201210500437.2A 2012-11-29 2012-11-29 A kind of test cases generation method and device Active CN103853652B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210500437.2A CN103853652B (en) 2012-11-29 2012-11-29 A kind of test cases generation method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210500437.2A CN103853652B (en) 2012-11-29 2012-11-29 A kind of test cases generation method and device

Publications (2)

Publication Number Publication Date
CN103853652A CN103853652A (en) 2014-06-11
CN103853652B true CN103853652B (en) 2019-02-12

Family

ID=50861331

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210500437.2A Active CN103853652B (en) 2012-11-29 2012-11-29 A kind of test cases generation method and device

Country Status (1)

Country Link
CN (1) CN103853652B (en)

Families Citing this family (20)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104850494B (en) * 2015-04-29 2018-05-25 百度在线网络技术(北京)有限公司 A kind of method and apparatus for memory system testing
CN108427632B (en) * 2017-02-14 2021-12-31 腾讯科技(深圳)有限公司 Automatic test method and device
CN107741905B (en) * 2017-09-11 2020-01-03 珠海格力电器股份有限公司 Test case, analytic model thereof, execution method, storage medium and processor
CN107908559B (en) * 2017-11-15 2021-05-07 中国农业银行股份有限公司 Test case design method and device
CN108062276A (en) * 2017-12-19 2018-05-22 北京小度信息科技有限公司 The generation method and device of test case and the generation method and device of test report
CN110209566B (en) * 2018-04-08 2021-09-28 腾讯科技(深圳)有限公司 Method and device for testing software
CN108710569A (en) * 2018-05-09 2018-10-26 深圳壹账通智能科技有限公司 Test cases generation method, data creation method, device, equipment and medium
CN108763070A (en) * 2018-05-16 2018-11-06 北京金山云网络技术有限公司 Generation method, device and the electronic equipment of test data
CN108763083A (en) * 2018-05-30 2018-11-06 平安普惠企业管理有限公司 Automated testing method, device, computer equipment and storage medium
CN110825610A (en) * 2018-08-14 2020-02-21 北京京东尚科信息技术有限公司 Method and device for providing test data
CN109684205B (en) * 2018-12-12 2022-02-08 恒生电子股份有限公司 System testing method, device, electronic equipment and storage medium
CN111984522B (en) * 2019-05-23 2024-02-27 杭州海康威视系统技术有限公司 Automatic test method and device
CN110287118B (en) * 2019-06-28 2022-09-16 四川长虹电器股份有限公司 Test data generation method and software test method of test case
CN111143221B (en) * 2019-12-28 2024-01-30 中国银行股份有限公司 Test method and device
CN113360364B (en) * 2020-03-04 2024-04-19 腾讯科技(深圳)有限公司 Target object testing method and device
CN111459830B (en) * 2020-04-07 2024-03-08 建信金融科技有限责任公司 Test case generation method and device
CN113821481A (en) * 2020-06-19 2021-12-21 北京金山云网络技术有限公司 Test data source generation method and device and server
CN111949552A (en) * 2020-09-03 2020-11-17 Oppo广东移动通信有限公司 Test case set generation method and device, computer equipment and storage medium
CN112100084B (en) * 2020-11-17 2021-02-26 支付宝(杭州)信息技术有限公司 Method and device for generating intelligent contract test case
CN115543775B (en) * 2022-08-17 2023-06-23 睿智合创(北京)科技有限公司 Automatic test case generation method

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1873625A (en) * 2005-08-19 2006-12-06 华为技术有限公司 Method for automatic generating random excitation based on percentage of function coverage
CN101187894A (en) * 2006-11-15 2008-05-28 中兴通讯股份有限公司 Automatic test method based on key word drive and its test system
CN101645012A (en) * 2009-09-11 2010-02-10 兰雨晴 Combinational selection method of foundational software platform integrated test
CN101984416A (en) * 2010-11-02 2011-03-09 中兴通讯股份有限公司 Method and device for generating test case
CN102541735A (en) * 2011-12-28 2012-07-04 云海创想信息技术(天津)有限公司 Automatic software test method
CN102622294A (en) * 2011-01-28 2012-08-01 国际商业机器公司 Method and method for generating test cases for different test types

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN100349135C (en) * 2005-04-07 2007-11-14 华为技术有限公司 Test vector generation method
CN101221502A (en) * 2008-02-01 2008-07-16 中国建设银行股份有限公司 Case design method and device for software test
CN101908015B (en) * 2009-06-04 2013-04-17 中国工商银行股份有限公司 Device and method for creating test case based on components
CN102054078B (en) * 2009-10-30 2014-11-26 新思科技(上海)有限公司 Bidirectional priority selection based scanning chain reconstructing method and device in physical design

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1873625A (en) * 2005-08-19 2006-12-06 华为技术有限公司 Method for automatic generating random excitation based on percentage of function coverage
CN101187894A (en) * 2006-11-15 2008-05-28 中兴通讯股份有限公司 Automatic test method based on key word drive and its test system
CN101645012A (en) * 2009-09-11 2010-02-10 兰雨晴 Combinational selection method of foundational software platform integrated test
CN101984416A (en) * 2010-11-02 2011-03-09 中兴通讯股份有限公司 Method and device for generating test case
CN102622294A (en) * 2011-01-28 2012-08-01 国际商业机器公司 Method and method for generating test cases for different test types
CN102541735A (en) * 2011-12-28 2012-07-04 云海创想信息技术(天津)有限公司 Automatic software test method

Also Published As

Publication number Publication date
CN103853652A (en) 2014-06-11

Similar Documents

Publication Publication Date Title
CN103853652B (en) A kind of test cases generation method and device
US9141521B2 (en) Method and apparatus for automatically generating a test script for a graphical user interface
CN107665171B (en) Automatic regression testing method and device
US8954931B2 (en) System test scope and plan optimization
US20120042302A1 (en) Selective regression testing
CN103345442B (en) Equipment automatization test service integrated system
CN105138685B (en) A kind of Performance Test System towards HBase
CN103838672A (en) Automated testing method and device for all-purpose financial statements
CN105824713B (en) A kind of data verification method and device
CN105824746A (en) Method and device for automatically generating test scheduling based on use case dependencies
CN103605606B (en) A kind of embedded software test use-case batch execution method that can automatically change
CN104899141B (en) A kind of test cases selection and extending method of network-oriented application system
US9098634B2 (en) Creating test templates based on steps in existing tests
CN102306122A (en) Automated testing method and equipment
CN111158656B (en) Test code generation method and device based on fruit tree method
CN106502720B (en) A kind of data processing method and device
CN109446257A (en) Method and device for importing excel file data into database
CN103823145A (en) Automation test platform for hardware
US8875074B1 (en) Formal fault detection
CN109783565A (en) A kind of method and system that excel data quickly introduce
US8949793B1 (en) Test bed design from customer system configurations using machine learning techniques
US20120259611A1 (en) System and method for generation of cim-based power system circuit models
CN103942140A (en) Automatic testing program conversion method
CN103473178A (en) Method and system for optimizing testing process execution
EP3547143B1 (en) System and method for model-based and behaviour-driven testing

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
EXSB Decision made by sipo to initiate substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant