A kind of maintaining method of test macro and device
Technical field
The invention belongs to Test Application field, particularly relate to a kind of maintaining method and device of test macro.
Background technology
Due to the development of technology, the transition of cybertimes are more and more faster, and renewal, the test of software also become more and more frequent thereupon.Method for test examples design in existing system, is all on the basis of upper-layer functionality module or functional requirement, directly carries out testing example design and write.But it is too wide that the demand on upper strata and functional module relate to face, and the test case of lower floor is but too carefully fallen apart, and makes in follow-up maintenance, is difficult to the test case accurately finding needs to upgrade or revise in huge test case library.
Summary of the invention
The object of the embodiment of the present invention is the maintaining method and the device that provide a kind of test macro, the write method being intended to solve existing test case, in follow-up maintenance, is difficult in huge test case library, accurately find needs to upgrade or the problem of test case of amendment.
The embodiment of the present invention is achieved in that a kind of maintaining method of test macro, and described method comprises the steps:
Each functional module of test macro is divided into one or more universal test point according to function point respectively, again described universal test point is split as one or more general refinement item respectively, and sets up the mapping relations between described functional module, universal test point and general refinement item;
Write test case according to described general refinement item, and in every bar test case, mark out the general refinement item of this test case of composition;
When test macro receives Data Update bag, when determining the universal test point that need upgrade or general refinement item, upgrade to corresponding functional module according to the mapping relationship searching between described functional module, universal test point and general refinement item, or find corresponding test case according to the general refinement item that described each test case marks and upgrade.
Further, described each functional module of test macro is divided into multiple universal test point according to function point before, also comprise step:
Test macro is divided into multiple functional module.
Further, mapping relations between described functional module, universal test point and general refinement item comprise: a corresponding one or more universal test point of functional module, a corresponding one or more functional module of universal test point, a corresponding universal test point of general refinement item.
Further, described functional module, universal test point and general refinement item are named according to default naming method.
Another object of the embodiment of the present invention is the attending device providing a kind of test macro, and described device comprises:
Function refinement module, for each functional module of test macro is divided into one or more universal test point according to function point respectively, then is split as one or more general refinement item respectively by described universal test point;
Module is set up in mapping, for setting up the mapping relations between described functional module, universal test point and general refinement item;
Test case writes module, for writing test case according to described general refinement item, and in every bar test case, marks out the general refinement item of this test case of composition;
Demand update module, for receiving Data Update bag when test macro, when determining the universal test point that need upgrade or general refinement item, upgrade to corresponding functional module according to the mapping relationship searching between described functional module, universal test point and general refinement item, or find corresponding test case according to the general refinement item that described each test case marks and upgrade.
Further, the attending device of described test macro also comprises:
Function divides module, for test macro is divided into multiple functional module.
Further, mapping relations between described functional module, universal test point and general refinement item comprise: a corresponding one or more universal test point of functional module, a corresponding one or more functional module of universal test point, a corresponding universal test point of general refinement item.
Further, described functional module, universal test point and general refinement item are named according to default naming method.
In embodiments of the present invention, due to functional module is made an explanation alternative by definition universal test point, universal test point inside obtains general refinement item by fractionation again, and the composite design to general refinement item, to get back complete test case, make the functional module on upper strata, and the test case of lower floor all contains the information of universal test point and general refinement item, therefore by the retrieval to universal test point and general refinement item, just indirect control can be carried out to functional module and test case.In addition, in the renewal of follow-up test system version with in safeguarding, just can directly find test case to be updated by general refinement item, make refresh test use-case storehouse become simpler, more efficiently.
Accompanying drawing explanation
Fig. 1 is the maintaining method process flow diagram of the test macro that the embodiment of the present invention provides;
Fig. 2 is the structural representation of the attending device of the test macro that the embodiment of the present invention provides.
Embodiment
In order to make object of the present invention, technical scheme and advantage clearly understand, below in conjunction with drawings and Examples, the present invention is further elaborated.Should be appreciated that specific embodiment described herein only in order to explain the present invention, be not intended to limit the present invention.
In order to technical solutions according to the invention are described, be described below by specific embodiment.
Embodiment one:
Be illustrated in figure 1 the process flow diagram of the maintaining method of the test macro that first embodiment of the invention provides, for convenience of explanation, illustrate only the part relevant to the embodiment of the present invention.
In step S101, test macro is divided into multiple functional module.
In embodiments of the present invention, first by needing the test macro of test rationally to carry out function division, multiple functional module is divided into.For the ease of differentiate and locating function module, after division completes according to default naming method be each functional module name.Wherein, the default naming method of functional module comprises multiple, as: can according to functional module title describe and numbering name, can describe according to the title of functional module, marker character and numbering name etc.As following two template name: module_0013_net and module_0024_playback be then describe according to the title of functional module, marker character and numbering name, wherein " module " is the marker character of functional module, 4-digit number after following first underscore is the numbering of this functional module, and the title after second underscore is then that the title of this functional module describes.
In step s 102, each functional module of test macro is divided into one or more universal test point according to function point respectively, more described universal test point is split as one or more general refinement item respectively.
In embodiments of the present invention, by analyzing each functional module, determining the inner every function point with relatively independent function of functional module, each functional module is divided into one or more universal test point according to function point.Wherein, universal test point be there is in test macro relatively independent function simplify module most.Same, after the complete universal test point of division, for each universal test point is named according to default naming method, the universal test point at this place is preset naming method and is also comprised multiple, but in order to keep the consistance of test macro, universal test point and functional module adopt same default naming method to name, in step S101, illustrate that functional module describes according to the title of functional module, marker character and numbering name, then universal test point also describes according to the title of universal test point herein, marker character and numbering name.As: point_0166_ip, point_0263_sata, point_0296_vga etc., wherein " point " is the marker character of universal test point, 4-digit number after following first underscore is the numbering of this universal test point, and the title after second underscore is then that the title of this universal test point describes.
In embodiments of the present invention, divide and after having named universal test point, each universal test point carried out internal detachment, is divided into one or more general refinement item respectively.Wherein, the component parts of the universal test point belonging to general refinement Xiang Weiqi, but it is from the aspect that function divides, and cannot segment again, be equal to every attribute of class in Object-Oriented Programming Language.Subsequently, again each general refinement item is named according to default naming method, general refinement item is preset naming method and is also comprised multiple, in order to keep the consistance of test macro, general refinement item and universal test point and functional module all adopt same default naming method to name, still for the naming method in step S101, then herein general refinement item also describe according to the title of general refinement item, marker character and numbering name.As: item_0011_ip, item_0033_ip, item_0026_sata etc., wherein " item " is the marker character of general refinement item, 4-digit number after following first underscore is the numbering of this general refinement item in affiliated universal test point inside, and the title after second underscore is then that the title of this universal test point belonging to general refinement item describes.
In embodiments of the present invention, the naming method of functional module, universal test point and general refinement item is multiple in addition, is not limited with above-mentioned example.
In step s 103, the mapping relations between functional module, universal test point and general refinement item are set up.
In embodiments of the present invention, after functional module, universal test point and general refinement item divide, according to the fractionation situation of universal test point and general refinement item in each functional module, set up the mapping relations between functional module, universal test point and general refinement item, and set up mapping table according to the mapping relations between functional module, universal test point and general refinement item.
In embodiments of the present invention, because a functional module is divided into one or more universal test point according to function point, a therefore corresponding one or more universal test point of functional module; And universal test point is the module of simplifying most in test macro with relatively independent function, thus a universal test point may belong to different functional modules, a corresponding one or more functional module of universal test point; General refinement item again each universal test point internal detachment goes out, and thus a general refinement item only can belong to a universal test point, then a corresponding universal test point of general refinement item.
In step S104, write test case according to general refinement item, and in every bar test case, mark out the general refinement item of this test case of composition.
In embodiments of the present invention, all general refinement items are carried out composite design according to use-case general design method, writes test case.Wherein, use-case general design method comprises multiple, as case designing methods such as equivalence class classifying method, boundary values, cause effect graph, error guessings, according to general refinement item writes test case after any means can be adopted to carry out composite design general refinement item herein.And according to the combined situation of general refinement item, for every bar test case item writes test case, and in every bar test case, mark out the general refinement item of this test case of composition.
In embodiments of the present invention, the execution sequence of step S103 and step S104 is not limit, and both can first perform step S103 and perform step S104 again, also can first perform step S104 and perform step S103 again.
In step S105, when test macro receives Data Update bag, determine the universal test point that need upgrade or general refinement item, upgrade to corresponding functional module according to the mapping relationship searching between functional module, universal test point and general refinement item, or find corresponding test case according to the general refinement item that each test case marks and upgrade.
In embodiments of the present invention, when test macro needs to upgrade, test macro receives Data Update bag, just can determine to need the universal test point of renewal or general refinement item according to the content (code as Data Update bag) of this Data Update bag.Now, then upgrade to corresponding functional module according to the mapping relationship searching between functional module, universal test point and general refinement item set up, or find the test case of correspondence according to the general refinement item that each test case marks and upgrade.
Be specially, when the Data Update bag that test macro receives is when needing renewal or newly-increased universal test point, according to the mapping relationship searching between functional module, universal test point and general refinement item to corresponding functional module, upgrade or newly-increased universal test point in the functional module of correspondence; When the Data Update bag that test macro receives is that when needing renewal or newly-increased general refinement item, the general refinement item marked by each test case finds corresponding test case, upgrade in the test case of correspondence or newly-increased general refinement item.
Such as, when the Data Update bag that test macro receives is newly-increased universal test point, according to the mapping relationship searching between functional module, universal test point and general refinement item to corresponding functional module, newly-increased universal test point in the functional module of correspondence, and after naming according to default naming method for this universal test point, this universal test point is carried out internal detachment, is divided into one or more general refinement item respectively, and more each general refinement item is processed according to described in step S104; When the Data Update bag that test macro receives is newly-increased general refinement item in universal test point, then according to the naming method of universal test point, the title that need increase the universal test point of general refinement item newly describes as all universal test points in keyword search test case library, find corresponding universal test point and increase general refinement item newly wherein, and find corresponding test case according to the general refinement item that each test case marks, carry out the increase of test case; When the Data Update bag that test macro receives is when revising general refinement item in universal test point, then according to the naming method of universal test point, the title of the general refinement item that need revise describes as all general refinement item in keyword search test case library, find out corresponding general refinement item to modify, the general refinement item marked according to each test case again finds corresponding test case, revises this test case.
In embodiments of the present invention, the test case of writing according to general refinement item both can carry out according to the method described in step S105 the test case that upgrades or revise, also can carry out testing authentication to these test cases.
In embodiments of the present invention, due to functional module is made an explanation alternative by definition universal test point, universal test point inside obtains general refinement item by fractionation again, and the composite design to general refinement item, to get back complete test case, make the functional module on upper strata, and the test case of lower floor all contains the information of universal test point and general refinement item, therefore by the retrieval to universal test point and general refinement item, just indirect control can be carried out to functional module and test case.In addition, in the renewal of follow-up test system version with in safeguarding, just can directly find test case to be updated by general refinement item, make refresh test use-case storehouse become simpler, more efficiently.
Embodiment two:
The attending device structural representation of the test macro that Fig. 2 provides for the embodiment of the present invention, for convenience of explanation, illustrate only the part relevant to the embodiment of the present invention.This device can be the unit that software unit, hardware cell or the software and hardware be built in the equipment such as mobile phone, televisor combines, or is integrated in the application system of these equipment or equipment as independently suspension member.Wherein:
Function divides module 21, for test macro is divided into multiple functional module.
Function refinement module 22, for each functional module of test macro is divided into one or more universal test point according to function point respectively, then is split as one or more general refinement item respectively by described universal test point.
In embodiments of the present invention, functional module, universal test point and general refinement item are named according to default naming method, and concrete naming method describes at above-mentioned instructions, repeats no more.
Module 23 is set up in mapping, for setting up the mapping relations between functional module, universal test point and general refinement item.
In embodiments of the present invention, because a functional module is divided into one or more universal test point according to function point, a therefore corresponding one or more universal test point of functional module; And universal test point is the module of simplifying most in test macro with relatively independent function, thus a universal test point may belong to different functional modules, a corresponding one or more functional module of universal test point; General refinement item again each universal test point internal detachment goes out, and thus a general refinement item only can belong to a universal test point, then a corresponding universal test point of general refinement item.
Test case writes module 24, for writing test case according to general refinement item, and in every bar test case, marks out the general refinement item of this test case of composition.
Demand update module 25, for receiving Data Update bag when test macro, when determining the universal test point that need upgrade or general refinement item, upgrade to corresponding functional module according to the mapping relationship searching between functional module, universal test point and general refinement item, or find corresponding test case according to the general refinement item that each test case marks and upgrade.
In embodiments of the present invention, due to functional module is made an explanation alternative by definition universal test point, universal test point inside obtains general refinement item by fractionation again, and the composite design to general refinement item, to get back complete test case, make the functional module on upper strata, and the test case of lower floor all contains the information of universal test point and general refinement item, therefore by the retrieval to universal test point and general refinement item, just indirect control can be carried out to functional module and test case.In addition, in the renewal of follow-up test system version with in safeguarding, just can directly find test case to be updated by general refinement item, make refresh test use-case storehouse become simpler, more efficiently.
One of ordinary skill in the art will appreciate that, the all or part of step realized in above-described embodiment method is that the hardware that can carry out instruction relevant by program has come, described program can be stored in a computer read/write memory medium, and described storage medium can be ROM/RAM, disk, CD etc.
The foregoing is only preferred embodiment of the present invention, not in order to limit the present invention, all any amendments done within the spirit and principles in the present invention, equivalent replacement and improvement etc., all should be included within protection scope of the present invention.