CN109726113A - Method for generating test case, unit and computer readable storage medium - Google Patents

Method for generating test case, unit and computer readable storage medium Download PDF

Info

Publication number
CN109726113A
CN109726113A CN201810951384.3A CN201810951384A CN109726113A CN 109726113 A CN109726113 A CN 109726113A CN 201810951384 A CN201810951384 A CN 201810951384A CN 109726113 A CN109726113 A CN 109726113A
Authority
CN
China
Prior art keywords
test case
test
case
measured
logic
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
Application number
CN201810951384.3A
Other languages
Chinese (zh)
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.)
Ping An Puhui Enterprise Management Co Ltd
Original Assignee
Ping An Puhui Enterprise Management 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 Ping An Puhui Enterprise Management Co Ltd filed Critical Ping An Puhui Enterprise Management Co Ltd
Priority to CN201810951384.3A priority Critical patent/CN109726113A/en
Publication of CN109726113A publication Critical patent/CN109726113A/en
Pending legal-status Critical Current

Links

Abstract

The invention discloses a kind of method for generating test case, the method for generating test case is the following steps are included: obtain the first data set, wherein first data set includes the attribute of test case, and the attribute includes location information;Logic to be measured is obtained, corresponding test case is screened from first data set according to the logic to be measured, to generate the second data set;The test case in second data set is arranged according to preset order, to generate basic test set of uses case;According to the attribute of test case in the basic test set of uses case, the complete content to be measured of corresponding test case is obtained, to generate final test set of uses case.The invention also discloses a kind of Test cases technology unit and computer readable storage mediums.The present invention realizes test data auto generation, improves testing efficiency.

Description

Method for generating test case, unit and computer readable storage medium
Technical field
The present invention relates to the field of test technology more particularly to a kind of method for generating test case, unit and computer Readable storage medium storing program for executing.
Background technique
Test case is one group of test input, execution condition and the expected results worked out for some special objective, with Just it tests some Program path or verifies whether meet some particular demands.Test case is related to testing requirement, in existing skill In art, test case is usually write according to testing requirement manually by tester, to complete test assignment, in order to improve test effect Fruit generally requires to write a large amount of test case.However, it is very low to write efficiency by when writing test case manually, cause to survey Try efficiency decline.
Above content is only used to facilitate the understanding of the technical scheme, and is not represented and is recognized that above content is existing skill Art.
Summary of the invention
The main purpose of the present invention is to provide a kind of method for generating test case, it is intended to solve above-mentioned to write test manually The technical issues of use-case inefficiency, improves testing efficiency.
To achieve the above object, the present invention provides a kind of method for generating test case, comprising the following steps:
Obtain the first data set, wherein first data set includes the attribute of test case, and the attribute includes position Information;
Logic to be measured is obtained, corresponding test case is screened from first data set according to the logic to be measured, with Generate the second data set;
The test case in second data set is arranged according to preset order, to generate basic test set of uses case;
According to the attribute of test case in the basic test set of uses case, the complete to be measured interior of corresponding test case is obtained Hold, to generate final test set of uses case.
Preferably, the step of the first data set of acquisition includes:
Obtain driven file, wherein the content of the driven file includes the attribute of test case, the category Property includes location information;
When the format of the driven file is non-extensible markup language format, the driven file is converted Format be extensible markup language format;
The content of the driven file is extracted, data-driven data are generated, will all the data-driven data be made For the first data set.
Preferably, logic to be measured is obtained, corresponding test is screened from first data set according to the logic to be measured Use-case, with generate the second data set the step of include:
Obtain testing requirement document;
According to the testing requirement document, logic to be measured is obtained;
Obtain the test case in first data set, and judge the test case whether with the logic phase to be measured Matching;
When the test case and the logic to be measured match, the test case is filtered out, until described in traversal All test cases in first data set.
Preferably, obtain the test case in first data set, and judge the test case whether with it is described to Surveying the step of logic matches includes:
The test case in first data set is obtained, and splits the attribute of the test case to extract the test Each use-case parameter of use-case;
Judge whether the use-case parameter matches with the logic to be measured;
When at least one use-case parameter of the test case and the logic to be measured match, the test is determined Use-case matches with the logic to be measured;
When all use-case parameters of the test case and the logic to be measured mismatch, the test is determined Use-case and the logic to be measured mismatch, and generate standby signal.
Preferably, when the test case and the logic to be measured match, the step of filtering out the test case Include:
When the test case and the logic to be measured match, judge whether the test case meets preset format It is required that and preset content requirement;
When the test case meets preset format requirement and preset content requirement, the test case is added to institute It states in the second data set;
When the test case does not meet preset format requirement or preset content requirement, according in back-end data base Hold, make corrections the test case, and the test case after correction is added in second data set.
Preferably, according to the attribute of test case in the basic test set of uses case, the complete of corresponding test case is obtained Content to be measured includes: the step of final test set of uses case to generate
Obtain product data sheet to be measured;
According to the attribute of test case in the basic test set of uses case, obtains and correspond to from the product data sheet to be measured The complete content to be measured of test case;
The test case is screened according to logic of propositions;
The attribute for the test case being screened out and the complete content to be measured of corresponding test case are combined, to generate most Whole test use cases.
Preferably, in the attribute according to test case in the basic test set of uses case, from the product data sheet to be measured It is further comprising the steps of after the step of middle complete content to be measured for obtaining corresponding test case:
It is confirmed whether that there are duplicate test cases;
When there are duplicate test case, synthesizing the duplicate test case is a test case.
In addition, to achieve the above object, the present invention also proposes a kind of Test cases technology equipment, the Test cases technology Equipment includes: memory, processor and is stored in the computer program that can be run on the memory and on the processor, The step of method for generating test case is realized when the computer program is executed by the processor, the Test cases technology side Method is the following steps are included: obtain the first data set, wherein first data set includes the attribute of test case, the attribute Including location information;Logic to be measured is obtained, corresponding test is screened from first data set according to the logic to be measured and uses Example, to generate the second data set;The test case in second data set is arranged according to preset order, to generate basic test Set of uses case;According to the attribute of test case in the basic test set of uses case, the complete content to be measured of corresponding test case is obtained, To generate final test set of uses case.
In addition, to achieve the above object, present invention further propose that a kind of Test cases technology device, the test case Generating means include:
Module is obtained, to obtain the first data set, wherein first data set includes the attribute of test case, institute Stating attribute includes location information;
Screening module screens correspondence according to the logic to be measured to obtain logic to be measured from first data set Test case, to generate the second data set;
Sorting module is surveyed to arrange the test case in second data set according to preset order with generating basis Try set of uses case;
Generation module obtains corresponding test case to the attribute according to test case in the basic test set of uses case Complete content to be measured, to generate final test set of uses case.
In addition, to achieve the above object, the present invention also proposes a kind of computer readable storage medium, described computer-readable It is stored with test case generator on storage medium, realizes that test is used when the test case generator is executed by processor The step of example generation method, the method for generating test case is the following steps are included: obtain the first data set, wherein described the One data set includes the attribute of test case, and the attribute includes location information;Logic to be measured is obtained, according to the logic to be measured Corresponding test case is screened from first data set, to generate the second data set;According to preset order arrangement described the Test case in two data sets, to generate basic test set of uses case;According to test case in the basic test set of uses case Attribute obtains the complete content to be measured of corresponding test case, to generate final test set of uses case.
In the technical solution of the present invention, method for generating test case is the following steps are included: obtain the first data set, wherein First data set includes the attribute of test case, and attribute includes location information;Logic to be measured is obtained, according to logic to be measured from first Corresponding test case is screened in data set, to generate the second data set;The survey in the second data set is arranged according to preset order Example on probation, to generate basic test set of uses case;According to the attribute of test case in basic test set of uses case, obtains corresponding test and use The complete content to be measured of example, to generate final test set of uses case.The technical program is from the attribute of test case, according to be measured Logic screens test case, and according to the test case after preset order arrangement screening, generates basic test set of uses case, Obtain the attribute for all test cases for meeting testing process demand.Further, it is used according to basic test use-case integrated test The attribute of example obtains the complete content to be measured of corresponding test case, final test set of uses case is generated, to realize complete survey Automatically generating for example on probation, eliminates the process that tester writes complete test case manually, improves testing efficiency.And And the accurate screening to test case can be realized by logic to be measured, can also by defining different logic to be measured, according to Actual test demand quickly filters out required test case, is conducive to the omission for avoiding test case or repetition, so as to improve Test effect.
Detailed description of the invention
Fig. 1 is the flow diagram of method for generating test case first embodiment of the present invention;
Fig. 2 is the refinement flow diagram of step S100 in method for generating test case second embodiment of the present invention;
Fig. 3 is the refinement flow diagram of step S200 in method for generating test case 3rd embodiment of the present invention;
Fig. 4 is the refinement flow diagram of step S230 in method for generating test case fourth embodiment of the present invention;
Fig. 5 is the refinement flow diagram of step S240 in the 5th embodiment of method for generating test case of the present invention;
Fig. 6 is the refinement flow diagram of step S400 in method for generating test case sixth embodiment of the present invention;
Fig. 7 is the refinement flow diagram of step S400 in the 7th embodiment of method for generating test case of the present invention;
Fig. 8 is the structural representation of the Test cases technology equipment for the hardware running environment that the embodiment of the present invention is related to Figure.
The embodiments will be further described with reference to the accompanying drawings for the realization, the function and the advantages of the object of the present invention.
Specific embodiment
It should be appreciated that the specific embodiments described herein are merely illustrative of the present invention, it is not intended to limit the present invention.
The primary solutions of the embodiment of the present invention are: according to the attribute of test case, automatically generating in conjunction with logic to be measured Test case comprising complete content to be measured.
Test case is write manually due to relying primarily on tester in the prior art, leads to the reduction of testing efficiency.
The present invention provides a solution, according to the attribute of test case, automatically generates in conjunction with logic to be measured comprising complete The test case of whole content to be measured improves testing efficiency by test data auto generation.
First embodiment of the invention provides a kind of method for generating test case, as shown in Figure 1, method for generating test case packet Include following steps:
Step S100, the first data set is obtained, wherein the first data set includes the attribute of test case, and attribute includes position Confidence breath;
In order to save storage resource and transfer resource, in the first data set, the test that usually only including can be screened for is used The attribute of example.Attribute specifically includes the location information of test case, so as in the next steps, according to test case location information Direction, obtain the complete content to be measured of test case from other places.Certainly, the attribute of test case can also include in addition to test Other information other than the particular content of use-case itself, by taking document is tested as an example, the attribute of test case can also include document Title, document dimension data, document priority data, document template number and document version number etc..
Step S200, logic to be measured is obtained, corresponding test case is screened from the first data set according to logic to be measured, with Generate the second data set;
During the test, corresponding logic to be measured is often obtained according to specific testing requirement, and according to logic to be measured Tested tissue avoids unnecessary test to improve the specific aim of test.It, can in all test cases of the first data set There can be the test case that test cannot be realized for logic to be measured, according to logic to be measured to the test case in the first data set It is screened, to generate the second data set.During generating the second data set, test case therein can also be carried out It checks, to correct mistake, supplements necessary content etc., hereinafter also will be apparent from.Wherein, the test in the second data set is used Number of cases mesh is less with respect to the test case number in the first data set, and the test case in the second data set can with it is to be measured Logic matches, and is conducive to improve testing efficiency, improves test effect.For example, in document test, if logic to be measured is needle Document priority data is tested, then, if not there is issue of priority in the document in a certain test case, The test case can not be tested to be directed to document priority data, that is, the test case and current logic to be measured Be it is unmatched, by screening, which will not enter in the second data set, and finally, test in the second data set is used Example can match with logic to be measured.
Step S300, the test case in the second data set is arranged according to preset order, to generate basic test set of uses case;
During the test, there is certain testing process usually to simulate the program circuit in real system.Correspondingly, By being ranked up according to preset order to test case, to meet the demand of testing process.It is ranked up to test case When, it can be carried out according to time field, time field includes the entry time or system of the corresponding contextual data of test case It generates the corresponding data of test case and above-mentioned data is written to the time in table.Time field can be from test data table Obtain, have recorded in test data table system it is practical execute program as a result, so including above-mentioned time field.Base generated The basic test use-case that plinth test case is concentrated includes using according to the attribute and test of the test case after logic to be measured screening Order information between example.For example, in document test, if showing that first is single first according to the program circuit in operation system Card, then show the second document, then, when generating basic test set of uses case, corresponding first test case of the first document is arranged It is listed in front of corresponding second test case of the second document.In this way, will be surveyed according to first test first in subsequent test process Example on probation, the sequence of the second test case of re-test is tested according to actual program circuit, to make testing process more The actual program circuit of accurate simulation, improves the reliability of test.
Step S400, according to the attribute of test case in basic test set of uses case, obtain corresponding test case it is complete to Content is surveyed, to generate final test set of uses case.
In basic test set of uses case, only the partial information comprising test case still can not achieve according to this partial information Test, and the attribute according to test case is needed, obtain the complete content to be measured of corresponding test case, including complete content to be measured Test case just can be with normal use into test.In general, according to the location information in the attribute of test case, from corresponding positions Set and read complete test case, so obtain test case all information, or obtain test case in will hold The relevant whole of capable test content to be measured.It is of course also possible to according to the other information in the attribute of test case, in conjunction with correspondence Relationship reads the complete content to be measured of test case, to generate final test set of uses case.Generating final test set of uses case In the process, further the test case for having included complete content to be measured can also be checked, to ensure having for test case Effect property and correctness, hereinafter also will be apparent from.For example, in document test, with document in basic test set of uses case Location information, but according only to the location information of document, be cannot display content to document and typesetting etc. whether normally carry out Test.According to the direction of the location information of document, the content letter of specific document itself is read from corresponding storage location Breath and composition information etc., that is, obtain the complete content to be measured of document, generate final test set of uses case, with to subsequent to document Display content and typesetting etc. whether be normally carried out test.
In the present embodiment, method for generating test case is the following steps are included: obtain the first data set, wherein the first number It include the attribute of test case according to collection, attribute includes location information;Logic to be measured is obtained, according to logic to be measured from the first data set It is middle to screen corresponding test case, to generate the second data set;The test case in the second data set is arranged according to preset order, To generate basic test set of uses case;According to the attribute of test case in basic test set of uses case, the complete of corresponding test case is obtained Whole content to be measured, to generate final test set of uses case.In the technical scheme, from the attribute of test case, according to be measured Logic screens test case, and according to the test case after preset order arrangement screening, generates basic test set of uses case, Obtain the attribute for all test cases for meeting testing process demand.Further, it is used according to basic test use-case integrated test The attribute of example obtains the complete content to be measured of corresponding test case, final test set of uses case is generated, to realize complete survey Automatically generating for example on probation, eliminates the process that tester writes complete test case manually, improves testing efficiency.And And the accurate screening to test case can be realized by logic to be measured, can also by defining different logic to be measured, according to Actual test demand quickly filters out required test case, is conducive to the omission for avoiding test case or repetition, so as to improve Test effect.
Based on above-mentioned first embodiment, as shown in Fig. 2, obtaining the first data set in the second embodiment of the present invention Step includes:
Step S110, driven file is obtained, wherein the content of driven file includes the attribute of test case, Attribute includes location information;
Step S120, when the format of driven file is non-extensible markup language format, change data driving text The format of part is extensible markup language format;
Step S130, the content of driven file is extracted, data-driven data is generated, total data driving data is made For the first data set.
It, can be by the way of data-driven, that is, according to one by one in order to realize the automatic operating of Test cases technology The mode of data is handled, each step in method for generating test case is run.The content of driven file includes test The attribute of use-case, attribute include location information.In general, driven file is electrical form (excel) format, according to artificial The testing requirement file generated for writing arrangement includes the attribute of test case in testing requirement file.For the ease of program knowledge Not, when the format of driven file is non-extensible markup language format, the format of change data driving file is that can expand Open up markup language (xml) format.By extracting the content of driven file, data-driven data are generated, total data is driven Data are moved as the first data set, the first data set includes the attribute of test case, and attribute includes location information.
Based on the various embodiments described above, as shown in figure 3, in the third embodiment of the present invention, obtain logic to be measured, according to It surveys logic and screens corresponding test case from the first data set, include: the step of the second data set to generate
Step S210, testing requirement document is obtained;
Step S220, according to testing requirement document, logic to be measured is obtained;
Step S230, obtain the first data set in test case, and judge test case whether with logic phase to be measured Match;
Step S240, when test case and logic to be measured match, test case is filtered out, until the first data of traversal All test cases concentrated.
It should be noted that testing requirement document here, which is not fully equal to the test that above-mentioned manual compiling arranges, to be needed File is sought, testing requirement document can be generated according to the content of testing requirement file, include in testing requirement file except test Other particular contents of test case except use-case attribute.According to testing requirement document, logic to be measured, logic pair to be measured are obtained Should in test to be executed required test particular content.According to logic to be measured to the test case in the first data set into Row screening obtains the test case to match with logic to be measured, that is, can complete to survey for by particular content to be tested The test case of examination screens the test case for meeting condition in all first data sets, generates the second data set.
Based on above-mentioned 3rd embodiment, as shown in figure 4, in the fourth embodiment of the present invention, obtaining in the first data set Test case, and judge that the step of whether test case matches with logic to be measured includes:
Step S231, the test case in the first data set is obtained, and splits the attribute of test case and is used with extracting test Each use-case parameter of example;
Step S232, judge whether use-case parameter matches with logic to be measured;
Step S233, when an at least use-case parameter for test case and logic to be measured match, discriminating test use-case with Logic to be measured matches;
Step S234, when all use-case parameters of test case and logic to be measured mismatch, discriminating test use-case with Logic to be measured mismatches, and generates standby signal.
Specifically, the attribute of test case be it is various, for the ease of screening, the attribute of test case can be torn open Point, to extract each use-case parameter of test case, and judge in the test case with the presence or absence of the use to match in logic to be measured Example parameter.The use-case parameter to match if it exists in logic to be measured, then the test case can realize test for logic to be measured, The test case is screened in the second data set, otherwise, which cannot realize test for logic to be measured, by the survey Example on probation excludes except the second data set, and generates standby signal to prompt tester to pay attention to.For example, being tested in document In, the attribute of test case is split as document title, document synthetic state data, document dimension data, document priority number According to, document template number and document version number etc., it is assumed that logic to be measured be test whether the document needs to synthesize, then, only Include that the test case of document synthetic state data this use-case parameters can match with above-mentioned logic to be measured, is applied to In subsequent test, the test case without including this use-case parameter of document synthetic state data to be measured can not be patrolled with above-mentioned It collects and matches, can not be applied in subsequent test, also just It is not necessary to include such test case to the second data set In.
Based on above-mentioned 3rd embodiment and fourth embodiment, as shown in figure 5, working as survey in the fifth embodiment of the present invention When example on probation and logic to be measured match, the step of filtering out test case, includes:
Step S241, when test case and logic to be measured match, judge whether test case meets preset format and want Preset content of summing requires;
Step S242, when test case meets preset format requirement and preset content requirement, test case is added to In second data set;
Step S243, when test case does not meet preset format requirement or preset content requirement, according to back-end data base Content, make corrections test case, the test case after correction is added in the second data set.
Since the test case in the first data set is that the testing requirement file arranged according to manual compiling obtains, because This, it is understood that there may be the format or content of partial test use-case and the preset format requirement being unsatisfactory in system or program are default interior Hold and require, causes system or program that can not identify.In order to ensure that this programme can run well automatically, need to format or content The test case for not meeting preset format requirement or preset content requirement makes corrections, wherein method, content of correction etc. can be with It is inquired in back-end data base, so that test case be made to meet preset format requirement and preset content requirement, ensures the second number Test case according to concentration is system or program can be with the test case of automatic identification.
Based on the various embodiments described above, as shown in fig. 6, in the sixth embodiment of the present invention, according to basic test set of uses case The attribute of middle test case obtains the complete content to be measured of corresponding test case, packet the step of to generate final test set of uses case It includes:
Step S410, product data sheet to be measured is obtained;
Step S420, according to the attribute of test case in basic test set of uses case, the acquisition pair from product data sheet to be measured Answer the complete content to be measured of test case;
Step S430, according to logic of propositions screening test cases;
Step S440, the complete content to be measured of the attribute for the test case that combination is screened out and corresponding test case, with Generate final test set of uses case.
The complete information of test case is generally stored in product data sheet to be measured, by obtaining product data to be measured Table can obtain the complete content to be measured of test case in conjunction with the direction of the attribute of test case in basic test set of uses case.It is logical Often, the attribute of test case and the complete content to be measured got are combined, can be obtained and is applicable in test Complete test case.In the present embodiment, in order to ensure the accuracy and validity of final test use-case, test is being got After the complete content to be measured of use-case, test case is screened again according to logic of propositions, the logic of propositions may include to Logic is surveyed, can also include tester's other logics according to defined in actual test demand, the test case that will be filtered out Attribute and corresponding test case complete content combination to be measured, to generate final test set of uses case.
Based on above-mentioned sixth embodiment, as shown in fig. 7, being used in the seventh embodiment of the present invention according to basic test The attribute of example integrated test use-case, the step of complete content to be measured of corresponding test case is obtained from product data sheet to be measured it Afterwards, further comprising the steps of:
Step S450, it is confirmed whether that there are duplicate test cases;
Step S460, when there are duplicate test case, synthesizing duplicate test case is a test case.
In the present embodiment, in order to further increase testing efficiency, deduplication operation is carried out to test case.It is by confirmation No there are duplicate test cases, when there are duplicate test case, duplicate test case are synthesized a test and is used Example, to reduce the number of unnecessary test case.It should be noted that step S450 and step S460 can be according to default It is executed before logic screening test cases, can also be executed after screening, have no determining ordinal relation.
As shown in figure 8, Fig. 8 is the terminal for the hardware running environment that the embodiment of the present invention is related to, i.e., test case is raw The structural schematic diagram of forming apparatus.
The terminal of that embodiment of the invention can be PC, be also possible to smart phone, tablet computer, E-book reader, MP3 (Moving Picture Experts Group Audio Layer III, dynamic image expert's compression standard audio level 3) Player, MP4 (Moving Picture Experts Group Audio Layer IV, dynamic image expert's compression standard sound Frequency level 3) the packaged type terminal device having a display function such as player, portable computer.
As shown in figure 8, the terminal may include: processor 1001, such as CPU, network interface 1004, user interface 1003, memory 1005, communication bus 1002.Wherein, communication bus 1002 is for realizing the connection communication between these components. User interface 1003 may include display screen (Display), input unit such as keyboard (Keyboard), optional user interface 1003 can also include standard wireline interface and wireless interface.Network interface 1004 optionally may include that the wired of standard connects Mouth, wireless interface (such as WI-FI interface).Memory 1005 can be high speed RAM memory, be also possible to stable memory (non-volatile memory), such as magnetic disk storage.Memory 1005 optionally can also be independently of aforementioned processor 1001 storage device.
Optionally, terminal can also include camera, RF (Radio Frequency, radio frequency) circuit, sensor, audio Circuit, WiFi module etc..Wherein, sensor such as optical sensor, motion sensor and other sensors.Specifically, light Sensor may include ambient light sensor and proximity sensor, wherein ambient light sensor can according to the light and shade of ambient light come The brightness of display screen is adjusted, proximity sensor can close display screen and/or backlight when mobile terminal is moved in one's ear.As One kind of motion sensor, gravity accelerometer can detect the size of (generally three axis) acceleration in all directions, quiet Size and the direction that can detect that gravity when only, the application that can be used to identify mobile terminal posture are (such as horizontal/vertical screen switching, related Game, magnetometer pose calibrating), Vibration identification correlation function (such as pedometer, tap) etc.;Certainly, mobile terminal can also match The other sensors such as gyroscope, barometer, hygrometer, thermometer, infrared sensor are set, details are not described herein.
It will be understood by those skilled in the art that the restriction of the not structure paired terminal of terminal structure shown in Fig. 8, can wrap It includes than illustrating more or fewer components, perhaps combines certain components or different component layouts.
As shown in figure 8, as may include that operating system, network are logical in a kind of memory 1005 of computer storage medium Believe module, Subscriber Interface Module SIM and test case generator.
In terminal shown in Fig. 8, network interface 1004 is mainly used for connecting background server, carries out with background server Data communication;User interface 1003 is mainly used for connecting client (user terminal), carries out data communication with client;And processor 1001 can be used for calling the test case generator stored in memory 1005, and execute following operation:
Obtain the first data set, wherein the first data set includes the attribute of test case, and attribute includes location information;
Logic to be measured is obtained, corresponding test case is screened from the first data set according to logic to be measured, to generate second Data set;
The test case in the second data set is arranged according to preset order, to generate basic test set of uses case;
According to the attribute of test case in basic test set of uses case, the complete content to be measured of corresponding test case is obtained, with Generate final test set of uses case.
Further, processor 1001 can be used for calling the test case generator stored in memory 1005, obtain The operation for taking the first data set includes:
Obtain driven file, wherein the content of driven file includes the attribute of test case, and attribute includes position Confidence breath;
When the format of driven file is non-extensible markup language format, the format of change data driving file is Extensible markup language format;
The content of driven file is extracted, data-driven data are generated, using total data driving data as the first number According to collection.
Further, processor 1001 can be used for calling the test case generator stored in memory 1005, obtain Logic to be measured is taken, corresponding test case is screened from the first data set according to logic to be measured, to generate the behaviour of the second data set Work includes:
Obtain testing requirement document;
According to testing requirement document, logic to be measured is obtained;
The test case in the first data set is obtained, and judges whether test case matches with logic to be measured;
When test case and logic to be measured match, test case is filtered out, until the institute in the first data set of traversal There is test case.
Further, processor 1001 can be used for calling the test case generator stored in memory 1005, obtain The test case in the first data set is taken, and the operation for judging that whether test case matches with logic to be measured includes:
The test case in the first data set is obtained, and splits the attribute of test case to extract each use-case of test case Parameter;
Judge whether use-case parameter matches with logic to be measured;
When an at least use-case parameter for test case and logic to be measured match, discriminating test use-case and logic phase to be measured Matching;
When all use-case parameters of test case and logic to be measured mismatch, discriminating test use-case and logic to be measured are not Matching, and generate standby signal.
Further, processor 1001 can be used for calling the test case generator stored in memory 1005, when When test case and logic to be measured match, the operation for filtering out test case includes:
When test case and logic to be measured match, judge whether test case meets preset format requirement and preset interior Hold and requires;
When test case meets preset format requirement and preset content requirement, test case is added to the second data set In;
When test case does not meet preset format requirement or preset content requirement, according to the content of back-end data base, mend Test case after correction is added in the second data set by positive test case.
Further, processor 1001 can be used for calling the test case generator stored in memory 1005, root According to the attribute of test case in basic test set of uses case, the complete content to be measured of corresponding test case is obtained, to generate final survey Examination set of uses case operation include:
Obtain product data sheet to be measured;
According to the attribute of test case in basic test set of uses case, corresponding test case is obtained from product data sheet to be measured Complete content to be measured;
According to logic of propositions screening test cases;
The attribute for the test case being screened out and the complete content to be measured of corresponding test case are combined, to generate final survey Try set of uses case.
Further, processor 1001 can be used for calling the test case generator stored in memory 1005, According to the attribute of test case in basic test set of uses case, obtained from product data sheet to be measured corresponding test case it is complete to It surveys after the operation of content, also executes following operation:
It is confirmed whether that there are duplicate test cases;
When there are duplicate test case, synthesizing duplicate test case is a test case.
In addition, the embodiment of the present invention also proposes that a kind of Test cases technology device, Test cases technology device include:
Module is obtained, to obtain the first data set, wherein the first data set includes the attribute of test case, attribute packet Include location information;
Screening module is screened corresponding test from the first data set according to logic to be measured and is used to obtain logic to be measured Example, to generate the second data set;
Sorting module, to arrange the test case in the second data set according to preset order, to generate basic test use Example collection;
Generation module obtains the complete of corresponding test case to the attribute according to test case in basic test set of uses case Whole content to be measured, to generate final test set of uses case.
Further, obtaining module includes:
Driven file acquiring unit, to obtain driven file, wherein the content of driven file includes The attribute of test case, attribute include location information;
Converting unit, to when the format of driven file is non-extensible markup language format, change data is driven The format of dynamic file is extensible markup language format;
Extraction unit generates data-driven data, by total data driving number to extract the content of driven file According to as the first data set.
Further, screening module includes:
Testing requirement document acquiring unit, to obtain testing requirement document;
Logic unit, to obtain logic to be measured according to testing requirement document;
Judging unit, to obtain the test case in the first data set, and judge test case whether with logic to be measured Match;
First screening unit, to filter out test case when test case matches with logic to be measured, until traversal All test cases in first data set.
Further, judging unit includes:
Subelement is split, to obtain the test case in the first data set, and splits the attribute of test case to extract Each use-case parameter of test case;
First judgment sub-unit, to judge whether use-case parameter matches with logic to be measured;When test case at least When one use-case parameter and logic to be measured match, discriminating test use-case matches with logic to be measured;When the institute of test case is useful When example parameter and logic to be measured mismatch, discriminating test use-case and logic to be measured are mismatched;
Subelement is prompted, to generate prompt when all use-case parameters of test case are mismatched with logic to be measured Signal.
Further, screening unit includes:
Second judgment sub-unit, to judge whether test case meets when test case matches with logic to be measured Preset format requires and preset content requirement;
Subelement is added, to when test case meets preset format requirement and preset content requirement, by test case It is added in the second data set;
Make corrections subelement, to when test case does not meet preset format requirement or preset content requirement, according to rear end The content of database, make corrections test case;
Addition subelement is also the test case after correction to be added in the second data set.
Further, generation module includes:
Product data sheet acquiring unit to be measured, to obtain product data sheet to be measured;
Complete contents acquiring unit to be measured, to the attribute according to test case in basic test set of uses case, from production to be measured The complete content to be measured of corresponding test case is obtained in product tables of data;
Second screening unit, to according to logic of propositions screening test cases;
Assembled unit, to combine the attribute for the test case being screened out and correspond to the complete to be measured interior of test case Hold, to generate final test set of uses case.
Further, generation module further include:
Test cases confirmation unit, to be confirmed whether that there are duplicate test cases;
Synthesis unit is a test case when there are duplicate test case, to synthesize duplicate test case.
In addition, the embodiment of the present invention also proposes a kind of computer readable storage medium, deposited on computer readable storage medium Test case generator is contained, following operation is realized when test case generator is executed by processor:
Obtain the first data set, wherein the first data set includes the attribute of test case, and attribute includes location information;
Logic to be measured is obtained, corresponding test case is screened from the first data set according to logic to be measured, to generate second Data set;
The test case in the second data set is arranged according to preset order, to generate basic test set of uses case;
According to the attribute of test case in basic test set of uses case, the complete content to be measured of corresponding test case is obtained, with Generate final test set of uses case.
Further, when test case generator is executed by processor, the operation for obtaining the first data set includes:
Obtain driven file, wherein the content of driven file includes the attribute of test case, and attribute includes position Confidence breath;
When the format of driven file is non-extensible markup language format, the format of change data driving file is Extensible markup language format;
The content of driven file is extracted, data-driven data are generated, using total data driving data as the first number According to collection.
Further, when test case generator is executed by processor, logic to be measured is obtained, according to logic to be measured from Corresponding test case is screened in one data set, includes: to generate the operation of the second data set
Obtain testing requirement document;
According to testing requirement document, logic to be measured is obtained;
The test case in the first data set is obtained, and judges whether test case matches with logic to be measured;
When test case and logic to be measured match, test case is filtered out, until the institute in the first data set of traversal There is test case.
Further, when test case generator is executed by processor, the test case in the first data set is obtained, and The operation for judging that whether test case matches with logic to be measured includes:
The test case in the first data set is obtained, and splits the attribute of test case to extract each use-case of test case Parameter;
Judge whether use-case parameter matches with logic to be measured;
When an at least use-case parameter for test case and logic to be measured match, discriminating test use-case and logic phase to be measured Matching;
When all use-case parameters of test case and logic to be measured mismatch, discriminating test use-case and logic to be measured are not Matching, and generate standby signal.
Further, when test case generator is executed by processor, when test case matches with logic to be measured, The operation for filtering out test case includes:
When test case and logic to be measured match, judge whether test case meets preset format requirement and preset interior Hold and requires;
When test case meets preset format requirement and preset content requirement, test case is added to the second data set In;
When test case does not meet preset format requirement or preset content requirement, according to the content of back-end data base, mend Test case after correction is added in the second data set by positive test case.
Further, when test case generator is executed by processor, according to test case in basic test set of uses case Attribute, obtain the complete content to be measured of corresponding test case, include: to generate the operation of final test set of uses case
Obtain product data sheet to be measured;
According to the attribute of test case in basic test set of uses case, corresponding test case is obtained from product data sheet to be measured Complete content to be measured;
According to logic of propositions screening test cases;
The attribute for the test case being screened out and the complete content to be measured of corresponding test case are combined, to generate final survey Try set of uses case.
Further, it when test case generator is executed by processor, is used according to basic test use-case integrated test The attribute of example, after the operation of complete content to be measured for obtaining corresponding test case in product data sheet to be measured, also execute with Lower operation:
It is confirmed whether that there are duplicate test cases;
When there are duplicate test case, synthesizing duplicate test case is a test case.
It should be noted that, in this document, the terms "include", "comprise" or its any other variant are intended to non-row His property includes, so that the process, method, article or the system that include a series of elements not only include those elements, and And further include other elements that are not explicitly listed, or further include for this process, method, article or system institute it is intrinsic Element.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that including being somebody's turn to do There is also other identical elements in the process, method of element, article or system.
The serial number of the above embodiments of the invention is only for description, does not represent the advantages or disadvantages of the embodiments.
Through the above description of the embodiments, those skilled in the art can be understood that above-described embodiment side Method can be realized by means of software and necessary general hardware platform, naturally it is also possible to by hardware, but in many cases The former is more preferably embodiment.Based on this understanding, technical solution of the present invention substantially in other words does the prior art The part contributed out can be embodied in the form of software products, which is stored in one as described above In storage medium (such as ROM/RAM, magnetic disk, CD), including some instructions are used so that terminal device (it can be mobile phone, Computer, server, air conditioner or network equipment etc.) execute method described in each embodiment of the present invention.
The above is only a preferred embodiment of the present invention, is not intended to limit the scope of the invention, all to utilize this hair Equivalent structure or equivalent flow shift made by bright specification and accompanying drawing content is applied directly or indirectly in other relevant skills Art field, is included within the scope of the present invention.

Claims (10)

1. a kind of method for generating test case, which is characterized in that the method for generating test case the following steps are included:
Obtain the first data set, wherein first data set includes the attribute of test case, and the attribute includes position letter Breath;
Logic to be measured is obtained, corresponding test case is screened from first data set according to the logic to be measured, to generate Second data set;
The test case in second data set is arranged according to preset order, to generate basic test set of uses case;
According to the attribute of test case in the basic test set of uses case, the complete content to be measured of corresponding test case is obtained, with Generate final test set of uses case.
2. method for generating test case as described in claim 1, which is characterized in that obtain the first data set the step of include:
Obtain driven file, wherein the content of the driven file includes the attribute of test case, the attribute packet Include location information;
When the format of the driven file is non-extensible markup language format, the lattice of the driven file are converted Formula is extensible markup language format;
Extract the content of the driven file, generate data-driven data, will all the data-driven data as the One data set.
3. method for generating test case as described in claim 1, which is characterized in that logic to be measured is obtained, according to described to be measured Logic screens corresponding test case from first data set, includes: the step of the second data set to generate
Obtain testing requirement document;
According to the testing requirement document, logic to be measured is obtained;
Obtain the test case in first data set, and judge the test case whether with the logic phase to be measured Match;
When the test case and the logic to be measured match, the test case is filtered out, until traversal described first All test cases in data set.
4. method for generating test case as claimed in claim 3, which is characterized in that obtain the test in first data set Use-case, and judge that the step of whether test case matches with the logic to be measured includes:
The test case in first data set is obtained, and splits the attribute of the test case to extract the test case Each use-case parameter;
Judge whether the use-case parameter matches with the logic to be measured;
When at least one use-case parameter of the test case and the logic to be measured match, the test case is determined Match with the logic to be measured;
When all use-case parameters of the test case and the logic to be measured mismatch, the test case is determined It is mismatched with the logic to be measured, and generates standby signal.
5. method for generating test case as claimed in claim 3, which is characterized in that when the test case to be measured is patrolled with described When volume matching, the step of filtering out the test case, includes:
When the test case and the logic to be measured match, judge whether the test case meets preset format requirement With preset content requirement;
When the test case meets preset format requirement and preset content requirement, the test case is added to described In two data sets;
When the test case does not meet preset format requirement or preset content requirement, according to the content of back-end data base, mend The test case after correction is added in second data set by the just described test case.
6. method for generating test case as described in claim 1, which is characterized in that surveyed according in the basic test set of uses case The attribute of example on probation obtains the complete content to be measured of corresponding test case, includes: the step of final test set of uses case to generate
Obtain product data sheet to be measured;
According to the attribute of test case in the basic test set of uses case, corresponding test is obtained from the product data sheet to be measured The complete content to be measured of use-case;
The test case is screened according to logic of propositions;
The attribute for the test case being screened out and the complete content to be measured of corresponding test case are combined, to generate final survey Try set of uses case.
7. method for generating test case as claimed in claim 6, which is characterized in that according in the basic test set of uses case The attribute of test case, the step of complete content to be measured of corresponding test case is obtained from the product data sheet to be measured it Afterwards, further comprising the steps of:
It is confirmed whether that there are duplicate test cases;
When there are duplicate test case, synthesizing the duplicate test case is a test case.
8. a kind of Test cases technology equipment, which is characterized in that the Test cases technology equipment includes: memory, processor And it is stored in the computer program that can be run on the memory and on the processor, the computer program is by the place Manage the step of realizing the method for generating test case as described in any one of claims 1 to 7 when device executes.
9. a kind of Test cases technology device, which is characterized in that the Test cases technology device includes:
Module is obtained, to obtain the first data set, wherein first data set includes the attribute of test case, the category Property includes location information;
Screening module screens corresponding survey from first data set according to the logic to be measured to obtain logic to be measured Example on probation, to generate the second data set;
Sorting module, to arrange the test case in second data set according to preset order, to generate basic test use Example collection;
Generation module obtains the complete of corresponding test case to the attribute according to test case in the basic test set of uses case Whole content to be measured, to generate final test set of uses case.
10. a kind of computer readable storage medium, which is characterized in that be stored with test on the computer readable storage medium and use Example generates program, realizes as described in any one of claims 1 to 7 when the test case generator is executed by processor The step of method for generating test case.
CN201810951384.3A 2018-08-17 2018-08-17 Method for generating test case, unit and computer readable storage medium Pending CN109726113A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810951384.3A CN109726113A (en) 2018-08-17 2018-08-17 Method for generating test case, unit and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810951384.3A CN109726113A (en) 2018-08-17 2018-08-17 Method for generating test case, unit and computer readable storage medium

Publications (1)

Publication Number Publication Date
CN109726113A true CN109726113A (en) 2019-05-07

Family

ID=66295404

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810951384.3A Pending CN109726113A (en) 2018-08-17 2018-08-17 Method for generating test case, unit and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN109726113A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110334024A (en) * 2019-06-28 2019-10-15 浙江吉利控股集团有限公司 A kind of testing case management based on tree, device and terminal
CN110363646A (en) * 2019-06-19 2019-10-22 平安普惠企业管理有限公司 Document investigation method, apparatus, equipment and storage medium extremely
CN111367791A (en) * 2020-02-19 2020-07-03 北京字节跳动网络技术有限公司 Method, device, medium and electronic equipment for generating test case

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107301127A (en) * 2017-06-22 2017-10-27 郑州云海信息技术有限公司 A kind of method and apparatus of the automatic test based on Robot Framework
WO2018036531A1 (en) * 2016-08-26 2018-03-01 上海合福信息科技有限公司 Test case generation method
CN107832229A (en) * 2017-12-03 2018-03-23 中国直升机设计研究所 A kind of system testing case automatic generating method based on NLP
CN108268377A (en) * 2018-01-23 2018-07-10 郑州云海信息技术有限公司 A kind of service test method of server, device and medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2018036531A1 (en) * 2016-08-26 2018-03-01 上海合福信息科技有限公司 Test case generation method
CN107301127A (en) * 2017-06-22 2017-10-27 郑州云海信息技术有限公司 A kind of method and apparatus of the automatic test based on Robot Framework
CN107832229A (en) * 2017-12-03 2018-03-23 中国直升机设计研究所 A kind of system testing case automatic generating method based on NLP
CN108268377A (en) * 2018-01-23 2018-07-10 郑州云海信息技术有限公司 A kind of service test method of server, device and medium

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110363646A (en) * 2019-06-19 2019-10-22 平安普惠企业管理有限公司 Document investigation method, apparatus, equipment and storage medium extremely
CN110334024A (en) * 2019-06-28 2019-10-15 浙江吉利控股集团有限公司 A kind of testing case management based on tree, device and terminal
CN110334024B (en) * 2019-06-28 2023-08-08 浙江吉利控股集团有限公司 Test case management method, device and terminal based on tree structure
CN111367791A (en) * 2020-02-19 2020-07-03 北京字节跳动网络技术有限公司 Method, device, medium and electronic equipment for generating test case

Similar Documents

Publication Publication Date Title
CN108292317B (en) Question and answer processing method and electronic device supporting the same
CN104407980B (en) Mobile solution automatic test device and method
CN109726113A (en) Method for generating test case, unit and computer readable storage medium
CN104461894B (en) The operation record device and method of Android software
CN107832226A (en) Report-generating method, device, equipment and computer media based on performance test
CN108132887B (en) User interface method of calibration, device, software testing system, terminal and medium
CN109063583A (en) A kind of learning method and electronic equipment based on read operation
CN105843734A (en) Automatic test method and device and computing device
CN104407779B (en) The arrangement display methods and device of graphical interfaces
CN105874448A (en) Method and apparatus for outputting digital content
US20200134135A1 (en) Vehicle simulation device and method
CN106611058A (en) Method and device for searching test questions
CN111125220A (en) Information user-defined export method and device
CN106462191A (en) Electronic device and method of content display
CN109726110A (en) Document test method, unit and computer readable storage medium
CN106649111A (en) Method and device for running test cases
CN110334013A (en) Test method, device and the electronic equipment of decision engine
CN109271313A (en) Code test method, device and computer readable storage medium
CN106471493A (en) Method and apparatus for managing data
CN108776632B (en) Signal-oriented self-checking flow automatic generation method, device, equipment and readable storage medium
CN113076717A (en) Data automatic association method and device and electronic equipment
CN105676024B (en) Iris aging of product test method and device
CN111508562A (en) Visual display method, device, equipment and medium of flow descriptive language
CN109726112A (en) Traverse test method, unit and computer readable storage medium
CN111767214B (en) Automatic testing method and device for software UI

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
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20190507

WD01 Invention patent application deemed withdrawn after publication