Summary of the invention
The technical matters that the embodiment of the invention will solve provides a kind of generation method and apparatus of test case, improves the formation efficiency and the maintenance efficiency of test case.
For solving the problems of the technologies described above, the generation method embodiment of test case provided by the present invention can realize through following technical scheme:
The acceptance test use-case generates order, and said test case generates the message file that the tested main body of test case to be generated has been specified in order;
Resolve said test case and generate the message file of the said tested main body in the order, obtain the information of the component units that said tested main body comprises;
According to the information of said component units, obtain the expected execution result of said component units;
According to the information of said component units, obtain the corresponding test order of said component units;
The test case of the test order of obtaining and expected execution result being formed tested main body.
A kind of generating apparatus of test case comprises:
The order receiving element is used for the acceptance test use-case and generates order, and said test case generates the message file that the tested main body of test case to be generated has been specified in order;
Resolution unit is used for resolving the message file that said test case generates the said tested main body of order, obtains the information of the component units that said tested main body comprises;
Acquiring unit is used for the information according to said component units, obtains the expected execution result of said component units; According to the information of said component units, obtain the corresponding test order of said component units;
Generation unit is used for the test order of obtaining and expected execution result are formed the test case of tested main body.
In scheme of the present invention; Test case is made up of the test order of the component units of forming tested main body; The tester is through carrying out the exploitation of test order to component units; As long as have identical component units for different test subjects, just can multiplexing test order and do not need to develop again, thus improve the formation efficiency of test case; And then tester's maintenance that test order is carried out also can be applied in the generation of later test case, improved maintenance efficiency.
Embodiment
To combine the accompanying drawing in the embodiment of the invention below, the technical scheme in the embodiment of the invention is carried out clear, intactly description, obviously, described embodiment only is the present invention's part embodiment, rather than whole embodiment.Based on the embodiment among the present invention, those of ordinary skills are not making the every other embodiment that is obtained under the creative work prerequisite, all belong to the scope of the present invention's protection.A kind of generation method of test case, as shown in Figure 1, comprising:
Test case is directed to tested main body and writes in the prior art, and for different tested main bodys, the test case of writing originally can not be re-used like this, and the test case formation efficiency is low; The maintenance of test case need be analyzed the test case of whole tested main body, and maintenance time is long and maintenance efficiency is low.
101: the acceptance test use-case generates order, and above-mentioned test case generates the message file that the tested main body of test case to be generated has been specified in order;
102: resolve the message file that above-mentioned test case generates the above-mentioned tested main body in the order, obtain the information of the component units that above-mentioned tested main body comprises;
Above-mentioned test command can be the message file that comprises main body to be tested in 101; Message file can be stored with arbitrary format; For example net is shown (Net List) form; The net table is a kind of document with fixed format of describing information such as device and device annexation in the printed circuit board (PCB); Like electronic product development platform (e_product developer, the * .tel file in EPD); If adopt the net sheet format; Each data item of net table can be stored the information of the component units of forming this tested main body so, and these information can comprise: in the type of component units, the quantity of component units, interface, the annexation is perhaps multinomial.It is understandable that above about storage format for example, and the information of component units is not exhaustive for example, should not be construed as the qualification to the embodiment of the invention.
103:, obtain the expected execution result of above-mentioned component units according to the information of above-mentioned component units; According to the information of above-mentioned component units, obtain the corresponding test order of above-mentioned component units;
Particularly, above-mentioned expected result can comprise: the electrical specification of component units, signal quality, sequential etc.Above-mentioned test order comprises: method of testing, testing procedure, test purpose, test grades etc.
Alternatively, above-mentioned message file is with the storage of net tableau format; Resolve the message file of the above-mentioned tested main body in the above-mentioned test case generation order; The information that obtains the component units that above-mentioned tested main body comprises comprises: resolve the data item (can adopt the mode of poll to carry out) of the net meter file of above-mentioned tested main body, obtain the network that tested main body comprises and the information of device.
Alternatively; Above-mentioned message file is with the storage of net tableau format; Expected execution result will not limit this embodiment of the invention beyond can being stored in and also can being stored in the net table in the data item; According to the information of above-mentioned component units, the expected execution result of obtaining above-mentioned component units comprises so: resolve the data item of the net meter file of above-mentioned tested main body, obtain the network that tested main body comprises and the expected execution result of device; Or, search preset expected execution result database and obtain the network expected execution result corresponding that comprise with above-mentioned tested main body with device.
104: the test case that the examination rule that will obtain and expected execution result are formed tested main body.
Further, the embodiment of the invention also provided manual amendment's function before the test case of forming tested main body, and above embodiment also comprises: show above-mentioned test order, and receive modify instruction; Revise test order according to above-mentioned modify instruction;
104 realization comprises so: form the test case of tested main body with amended test order and with the corresponding expected execution result of above-mentioned amended test order.
Further, the generation of test report for ease, the solution that the embodiment of the invention also provides test report to generate, above method also comprises: the test case of above-mentioned tested main body is sent to above-mentioned tested main body execution; The execution result of the above-mentioned tested main body that receives is exported by predetermined form.It is understandable that above-mentioned output can be to be output as electronics retaining file also can printout will not limit this embodiment of the invention.The position of the electronics files of output storage can be in the device of test case generation in addition, also can be test case generating apparatus external unit, and the embodiment of the invention will not limit this.
Further, to the maintenance of test order, the embodiment of the invention also provides the implementation that instructs test order to safeguard through statistics for ease, and above method also comprises:
The applying frequency and the execution result of statistical test rule; Preserve the applying frequency and the execution result of the test order of above-mentioned statistics.
More than the executive agent of each step can will not limit this embodiment of the invention for generating any device of test case; In the above embodiment; Test case is made up of the test order of the component units of forming tested main body; The tester is directed to the exploitation that component units carries out test order; As long as have identical component units for different test subjects, just can multiplexing test order and do not need to develop again, improve the formation efficiency of test case like this; The tester safeguards the generation that can be applied in later test case to test order, has improved maintenance efficiency.
In order to introduce the generation method of the test case that the embodiment of the invention provides in more detail, it is example with the veneer that present embodiment provides tested main body, and component units is for forming the device of veneer; The device information of veneer is stored in net table (Net List) file through the schematic diagram of standard, and is as shown in Figure 2, comprising:
201: the user imports the net meter file (Net List) of veneer, comprises the device information in this testing single-board in this net meter file; Above device information can comprise: device category information and annexation, for example: the type of device, the quantity of device, interface, annexation etc.
202, resolve net meter file, extraction device information; For example extract interface type, electrical specification and information such as signal quality and sequential.The expected execution result of acquisition device (being the result that device is carried out under the normal condition); This expected execution result can be stored in the data item of net meter file; Also can be stored in the expected execution result storehouse, adopt the storage of device information and expected execution result corresponding mode;
203, search test order according to device information; Test order is stored in the test case library, and the mode of storage can be that device information is corresponding with test order (for example: method of testing, testing procedure etc.), is associated with method of testing and step through interface type.For identical device, so the method for test is identical can pre-designedly being stored in the test case library with step;
It is understandable that, comprise more than one device in the veneer, so above 202 and 203 can repeatedly carry out; The combination of the execution result of the expection that the test order that device is corresponding is corresponding with it is the test case of this device.
204: the test case that the test case combination of all devices of veneer is obtained veneer.
More than the executive agent of each step can will not limit this embodiment of the invention for generating any device of test case; In the above embodiment; Test case is made up of the test order of the device of forming veneer; The tester is directed to the exploitation that device carries out test order; As long as have identical device for different single boards, just can multiplexing test order and do not need to develop again, improve the formation efficiency of test case like this; The tester safeguards the generation that can be applied in later test case to test order, has improved maintenance efficiency.
A kind of generating apparatus of test case, as shown in Figure 3, comprising:
Order receiving element 301 is used for the acceptance test use-case and generates order, and above-mentioned test case generates the message file that the tested main body of test case to be generated has been specified in order;
Resolution unit 302 is used for resolving the message file that above-mentioned test case generates the above-mentioned tested main body of order, obtains the information of the component units that above-mentioned tested main body comprises;
Acquiring unit 303 is used for the information according to above-mentioned component units, obtains the expected execution result of above-mentioned component units; According to the information of above-mentioned component units, obtain the corresponding test order of above-mentioned component units;
Generation unit 304 is used for the test order of obtaining and expected execution result are formed the test case of tested main body.
The described device of present embodiment is used to realize Fig. 1 and method embodiment illustrated in fig. 2.
Alternatively, above-mentioned message file is with the storage of net tableau format; Above-mentioned resolution unit 302 is used to resolve the data item of the net meter file of above-mentioned tested main body, obtains the network that tested main body comprises and the information of device.
Above-mentioned acquiring unit 303; Be used for information according to above-mentioned component units; The expected execution result of obtaining above-mentioned component units comprises: be used to resolve the data item of the net meter file of above-mentioned tested main body, obtain the network that tested main body comprises and the expected execution result of device; Or, search preset expected execution result database and obtain the network expected execution result corresponding that comprise with above-mentioned tested main body with device.
Further, the present invention implements also to provide manual amendment's function, and as shown in Figure 4, said apparatus also comprises:
Display unit 401 is used to show above-mentioned test order;
Revise unit 402, be used for revising test order according to the modify instruction that receives;
Above-mentioned generation unit 304 is used for forming the test case of tested main body with amended test order and with the corresponding expected execution result of above-mentioned amended test order.
Further, the generation of test report for ease, the solution that the embodiment of the invention also provides test report to generate, as shown in Figure 5, said apparatus also comprises:
Transmitting element 501 is used for the test case of above-mentioned tested main body is sent to above-mentioned tested main body execution;
Output unit 502 is used for the execution result of the above-mentioned tested main body that receives is exported by predetermined form.
Further, to the maintenance of test order, the embodiment of the invention also provides the implementation that instructs test order to safeguard through statistics for ease, and as shown in Figure 6, said apparatus also comprises:
Statistic unit 601 is used to add up the applying frequency and the execution result of above-mentioned test order;
Storage unit 602 is used to preserve the applying frequency and the execution result of the test order of above-mentioned statistics.
In the above embodiment; Test case is made up of the test order of the component units of forming tested main body; The tester is directed to the exploitation that component units carries out test order; As long as have identical component units for different test subjects, just can multiplexing test order and do not need to develop again, improve the formation efficiency of test case like this; The tester safeguards the generation that can be applied in later test case to test order, has improved maintenance efficiency.
One of ordinary skill in the art will appreciate that all or part of step that realizes in the foregoing description method is to instruct relevant hardware to accomplish through program; Program can be stored in a kind of computer-readable recording medium; The above-mentioned storage medium of mentioning can be a ROM (read-only memory), disk or CD etc.
More than the generation method and apparatus of a kind of test case that the embodiment of the invention provided has been carried out detailed introduction; Used concrete example among this paper principle of the present invention and embodiment are set forth, the explanation of above embodiment just is used for helping to understand method of the present invention and core concept thereof; Simultaneously, for one of ordinary skill in the art, according to thought of the present invention, the part that on embodiment and range of application, all can change, to sum up, this description should not be construed as limitation of the present invention.