Summary of the invention
Embodiments of the invention provide a kind of method and device that generates automatic test cases of mobile phone, to improve the establishment efficient of automatic test cases of mobile phone.
The method that embodiments of the invention are a kind of to generate automatic test cases of mobile phone is by the following technical solutions:
A kind of method that generates automatic test cases of mobile phone, described method comprises the steps:
Set up the cascade connection between each father's menu and its submenu;
By described cascade connection, obtain to find the path of target menu;
As record storage, and the record that utilizes described storage is as test case with the described path of searching.
The embodiment of the invention generates the method for automatic test cases of mobile phone, by each father's menu of foundation and the cascade connection between its submenu, can obtain to find the path of searching of target menu, and the described path of searching is stored as record.Like this, when mobile phone is tested, just can utilize the record of storage as test case.
Generate automatic test cases in a manner mentioned above, avoided in the prior art owing to need the implementation of test cases of tester's manual operations mobile phone, then manual operations is formed automatic test cases and the not high problem of testing efficiency brought.Therefore, utilize the test case of the described method generation of the embodiment of the invention, can improve the establishment efficient of automatic test cases of mobile phone.
The device that embodiments of the invention are a kind of to generate automatic test cases of mobile phone is by the following technical solutions:
A kind of device that generates automatic test cases of mobile phone, described device comprises:
Associative cell is used to set up the cascade connection between each father's menu and its submenu;
Acquiring unit is used for by described cascade connection, obtains to find the path of target menu;
Memory cell is used to store the record that the path forms of searching by described target menu, and the record that utilizes described storage is as test case.
The embodiment of the invention generates the device of automatic test cases of mobile phone, by each father's menu of associative cell foundation and the cascade connection between its submenu, can obtain to find the path of searching of target menu by acquiring unit, and the described path of searching be stored as record by memory cell.Like this, when mobile phone is tested, just can utilize the record of storage as test case.
Generate automatic test cases in a manner mentioned above, avoided in the prior art owing to need the implementation of test cases of tester's manual operations mobile phone, then manual operations is formed automatic test cases and the not high problem of testing efficiency brought.Therefore, utilize the test case of the described method generation of the embodiment of the invention, can improve the establishment efficient of automatic test cases of mobile phone.
Embodiment
In order to be illustrated more clearly in the technical scheme of the embodiment of the invention, the accompanying drawing of required use is done an introduction simply in will describing embodiment below, apparently, accompanying drawing in describing below only is some embodiments of the present invention, for those of ordinary skills, under the prerequisite of not paying creative work, can also obtain other accompanying drawing according to these accompanying drawings.
For solving the lower problem of mobile phone test efficient in the prior art, embodiments of the invention provide a kind of method that generates automatic test cases of mobile phone.As shown in Figure 1, described method comprises the steps:
101, set up cascade connection between each father's menu and its submenu;
102,, obtain to find the path of target menu by described cascade connection;
103, the path of searching of described target menu is stored as record.
As can be seen from the above step, the embodiment of the invention generates the method for automatic test cases of mobile phone, by each father's menu of foundation and the cascade connection between its submenu, can obtain to find the path of searching of target menu, and the described path of searching is stored as record.Like this, the record of storage just can be used as test case and comes mobile phone is tested.
Generate automatic test cases in a manner mentioned above, avoided in the prior art owing to need the implementation of test cases of tester's manual operations mobile phone, then manual operations is formed automatic test cases and the not high problem of testing efficiency brought.Therefore, utilize the test case of the described method generation of the embodiment of the invention, can improve the establishment efficient of automatic test cases of mobile phone.
For raising finds the speed of target menu, in an embodiment of the present invention, described cascade connection is a tree.In described tree, described father's menu is as root node, and described submenu is as leaf node.By the path between described father's menu and its submenu, just can find target menu by father's menu.
Certainly, described cascade connection also can be other forms, as long as can embody the relation of getting in touch between father's menu and the submenu, is not limited to cited in an embodiment of the present invention.
In order to improve the test case that generates, as shown in Figure 2, the method that embodiments of the invention generate automatic test cases of mobile phone also comprises the steps:
101a, the property parameters of described each father's menu and submenu is set.
Described property parameters comprises: the test zone in the target menu, test-types, the test result of expectation, and button attribute information at least a that enters into target menu, or its combination in any.
After being provided with above-mentioned property parameters, the described method of the embodiment of the invention also comprises:
104, with described property parameters as record storage, and described property parameters is kept in the described record, under described each father's menu and the corresponding leaf node of submenu.
So like this, when mobile phone is tested, after the automatic test cases that utilization generates according to the described mode of the embodiment of the invention is tested, not only can find target menu faster by described cascade connection, can also be when finding target menu, obtain its corresponding property parameters, described target menu is tested with convenient.
In concrete the application, can utilize multiple programming language to describe automatic test cases in the embodiment of the invention.In an embodiment of the present invention, being that example describes with XML language (extend markup language).
Figure 3 shows that the automatic test cases that utilizes the XML language description.For ease of test, the order of the submenu under same father's menu is with the sequence consensus of the menu item of reality in the mobile phone.And as seen from Figure 3, each father's menu, or under the pairing node of submenu (root node or leaf node), all be provided with the property parameters of this menu, as the test zone in the target menu (checkArea), test-types (checkType), the test result of expectation (expectResult), and enter into button attribute information (key) of target menu etc.
In order to reduce the maintenance cost to test case, the described representation that enters into the button attribute information of target menu is: the location index of the leaf node of described target menu under the root node of its corresponding father's menu.
With test case shown in Figure 3 is example, and the key in each father's menu/submenu attribute information is to utilize the mode of upper and lower key to represent, also, calculates the location index of each submenu under its corresponding father's menu.If need utilize a plurality of buttons to represent the location index of described submenu, the form of then available CSV (CommaSeparated Values) is represented described location index.
As the position of submenu speedDail under the root node of his father's menu phonebook is 4, so press 3 down Arrows under father's menu phonebook, one time left Arrow can enter into submenu speedDail.Therefore, the key attribute of submenu speedDail correspondence is: key=" down-times 3, lsk ", its implication for uncle's menu phonebook enters submenu speedDail need be by down (down Arrow) 3 times, lsk (left Arrow) is once.Wherein, times represents touch potential; Delay represents the dead time behind the button.
In addition, also available digital is represented the key attribute.Be example with the speedDail submenu equally, calculate its location index under the root node of phonebook under father's menu of correspondence, index increases 1 successively from 1 open numbering.As the position of speedDail submenu under phonebook father's menu root node is 4, so digital shortcut keys is exactly 4, therefore, the key attribute of submenu speedDail correspondence is: key=" 4 ".Certainly, also can obtain the key attribute of father's menu or submenu with other modes.
In test case shown in Figure 3, the mode of the upper and lower key of employing is represented the key in each father's menu/submenu attribute information in the menu menu, and the message menu then is to utilize the form of numerical key to represent.By the described test case of Fig. 3 as can be seen, wherein also the physical button of mobile phone is defined.
It should be noted that in test case shown in Figure 3, just listed the relevant information of wherein a part of father's menu and submenu.The describing mode of other menus does not repeat them here with shown in Figure 3 identical.
After utilizing the described method of the embodiment of the invention to generate automatic test cases of mobile phone, when certain target menu of mobile phone is tested, can be by the above-mentioned automatic test cases that generates based on the menu path mode, directly find described target menu, and obtain property parameters under the pairing node of described target menu, described target menu is tested.
AddNew is an example with the test submenu, can pass through the test of following procedure section realization to submenu addNew:
GotoMenu/menu/phonebook/addNew; // entering the addNew menu, parameter is a menu path
GrabScreen; // extracting mobile phone current screen
CheckScreen; // according to the property parameters of definition, check picture.
By carrying out top program, can be among the submenu addNew, the character of test zone in " 00 100 100 " scope tested.If test result is " addNew ", then the test to submenu addNew is correct, otherwise test errors.
Fig. 4 and Fig. 5 shown respectively when the test case of utilizing the described method of embodiments of the invention to generate is tested, and the operation chart during with method generation test case of the prior art.As shown in Figure 4, when the test case of utilizing the described method of the embodiment of the invention to generate is tested, can can enter into corresponding target menu, so that described target menu is tested by the path of searching of the target menu preserved in GotoMenu statement and the described test case.And as seen in Figure 5,, then need constantly to repeat to enter into the manual operations of target menu if will certain target menu be tested.
Therefore, by above-mentioned description as can be seen, when the test case of utilizing the described method of the embodiment of the invention to generate is carried out mobile phone test, can improve the testing efficiency of mobile phone.Simultaneously, the test case of utilizing the described method of the embodiment of the invention to generate is based on that the mode of searching the path creates, so its maintainability is good, can reuse when the mobile phone of same type is tested.
The method that generates automatic test cases of mobile phone with the embodiment of the invention is corresponding, and embodiments of the invention also provide a kind of device that generates automatic test cases of mobile phone.
As shown in Figure 6, the embodiment of the invention generates the device of automatic test cases of mobile phone, comprising: associative cell, acquiring unit, and memory cell.
Associative cell is used to set up the cascade connection between each father's menu and its submenu;
Acquiring unit is used for by described cascade connection, obtains to find the path of target menu;
Memory cell is used to store by described and searches the record that the path forms.
The embodiment of the invention generates the device of automatic test cases of mobile phone, by each father's menu of associative cell foundation and the cascade connection between its submenu, can obtain to find the path of searching of target menu by acquiring unit, and the described path of searching be stored as record by memory cell.Like this, the record of storage just can be used as test case and comes mobile phone is tested.
Generate automatic test cases in a manner mentioned above, avoided in the prior art owing to need the implementation of test cases of tester's manual operations mobile phone, then manual operations is formed automatic test cases and the not high problem of testing efficiency brought.Therefore, utilize the test case of the described method generation of the embodiment of the invention, can improve the establishment efficient of automatic test cases of mobile phone.
In order to improve the test case that generates, as shown in Figure 7, the described device of embodiments of the invention also comprises: the unit is set, is used to be provided with the property parameters of described each father's menu and submenu.
Equally, in this embodiment, described property parameters comprises: the test zone in the target menu, test-types, the test result of expectation, and button attribute information at least a that enters into target menu, or its combination in any.
Therefore, described memory cell also needs described property parameters as the record storage, and described property parameters is kept in the record, under described each father's menu and the corresponding node of submenu.
Like this, when certain target menu is tested, this target menu that can be by obtaining cell stores search the path, and the property parameters that is provided with down of the pairing node of this target menu is tested described target menu.
Therefore, utilize the test case of the described method generation of the embodiment of the invention, can improve the establishment efficient of automatic test cases of mobile phone.And the test case of utilizing the described method of the embodiment of the invention to generate is based on that the mode of searching the path creates, so its maintainability is good, can reuse when the mobile phone of same type is tested.
It should be noted that and one of ordinary skill in the art will appreciate that all or part of step that realizes in the foregoing description is to instruct relevant hardware to finish by program.Described program can be stored in the computer-readable recording medium.Described storage medium can comprise ROM/RAM, magnetic disc, CD etc.
Certainly; embodiments of the invention also can have a variety of; under the situation that does not deviate from embodiments of the invention spirit and essence thereof; those skilled in the art work as can make various corresponding changes and distortion according to embodiments of the invention, but these corresponding changes and distortion all should belong to the protection range of the appended claim of embodiments of the invention.