Summary of the invention
For the problems referred to above that test case in prior art exists, now provide a kind of and be intended to test comprehensively and the choosing method of simple test case.
Concrete technical scheme is as follows:
A choosing method for test case, comprises the following steps:
Step S1, select a test event;
Step S2, form a tree structure according to described test event, the node of described tree is formed by the parameter of described test event, and described node forms described tree structure according to the subordinate relation between described parameter;
Step S3, according to described parameter corresponding to the leaf node of described tree structure on the impact of described test event, obtain with the father node of described leaf node the Intrusion Index of every the described subtree being root node;
Step S4, according to described Intrusion Index choose with the father node of described leaf node be root node every described subtree on described leaf node, form the argument sequence of corresponding described test event.
Preferably, in described step S3, the acquisition calculation method of described Intrusion Index is, described in the described parameter influence that the leaf node of described subtree is corresponding during test event test result, the Intrusion Index of described subtree is the quantity of the leaf node of described subtree, the described parameter that the leaf node of described subtree is corresponding do not affect described test event test result time, the Intrusion Index of described subtree is 1.
Preferably, in described step S4, the method choosing described leaf node is,
When the Intrusion Index of described subtree is 1, in the described leaf node of described subtree, choose described parameter corresponding to a described leaf node at random;
When the Intrusion Index of described subtree is the quantity of the leaf node of described subtree, choose the described parameter that all described leaf node of described subtree is corresponding.
Preferably, the method forming described argument sequence in described step S4 is, the described parameter chosen is combined according to corresponding described subtree.
Preferably, provide an electronic table unit in order to preserve described tree structure and to show described parameter corresponding to the node of described tree structure.
Preferably, provide a computing unit, connect described electronic table unit, in order to choose with described leaf node according to described Intrusion Index, and form the argument sequence of corresponding described test event.
Preferably, described electronic table unit is Excel.
Preferably, described computing unit is formed primarily of the macroblock in Excel.
Preferably, described argument sequence shows in the mode of string expression.
Preferably, string expression corresponding for described test event is spliced the last of described string expression corresponding to the described argument sequence that formed in described step S4.
Technique scheme tool has the following advantages or beneficial effect: simple to operate, and comprehensive to the parameters distribution that test event is corresponding, thus can comprehensively test, and overcomes testing efficiency in prior art lower, and the problem that operation is more complicated.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, be clearly and completely described the technical scheme in the embodiment of the present invention, obviously, described embodiment is only the present invention's part embodiment, instead of whole embodiments.Based on the embodiment in the present invention, the every other embodiment that those of ordinary skill in the art obtain under the prerequisite of not making creative work, all belongs to the scope of protection of the invention.
It should be noted that, when not conflicting, the embodiment in the present invention and the feature in embodiment can combine mutually.
Below in conjunction with the drawings and specific embodiments, the invention will be further described, but not as limiting to the invention.
The present invention includes a kind of choosing method of test case.
As shown in Figure 1, a kind of choosing method of test case, comprises the following steps:
Step S1, select a test event;
Step S2, form a tree structure according to test event, the node of tree is formed by the parameter of test event, and node forms tree structure according to the subordinate relation between parameter;
Step S3, according to parameter corresponding to the leaf node of tree structure on the impact of test event, obtain with the Intrusion Index of the father node of leaf node every stalk tree that is root node;
Step S4, to choose with the leaf node on the father node of leaf node every stalk tree that is root node according to Intrusion Index, form the argument sequence of corresponding test event.
In technique scheme, by the parameter of test event is formed a tree structure, its interior joint forms tree structure according to the subordinate relation between parameter, according to parameter corresponding to the leaf node of tree structure on the impact of test event, the Intrusion Index of every stalk tree that further acquisition is root node with the father node of leaf node, and choose according to Intrusion Index with the leaf node on the father node of leaf node every stalk tree that is root node, thus form the argument sequence of corresponding test event.According to this argument sequence, can know and need which test case to test this test event.
In one preferably embodiment, in step s3, the acquisition calculation method of Intrusion Index is, during parameter influence test event test result corresponding to the leaf node of subtree, the Intrusion Index of subtree is the quantity of the leaf node of subtree, the parameter that the leaf node of subtree is corresponding do not affect test event test result time, the Intrusion Index of subtree is 1.
In one preferably embodiment, in step S4, the method choosing leaf node is,
When the Intrusion Index of subtree is 1, in the leaf node of subtree, choose a parameter that leaf node is corresponding at random;
When the Intrusion Index of subtree is the quantity of the leaf node of subtree, choose the parameter that all leaf nodes of subtree are corresponding.
Technique scheme, selects corresponding parameter by Intrusion Index with different strategies, thus can reduce the quantity of test case, improves the efficiency of test.
In one preferably embodiment, the method forming argument sequence in step S4 is the parameter chosen combined according to corresponding subtree.
In one preferably embodiment, provide an electronic table unit in order to preserve the parameter corresponding to node of tree structure and display tree structure.
In one preferably embodiment, provide a computing unit, connect electronic table unit, in order to choose with leaf node according to Intrusion Index, and form the argument sequence of corresponding test event.
Technique scheme inputs corresponding test event by the electronic table unit person of being easy to use, and parameter corresponding to test event and corresponding Intrusion Index, and can show tree structure intuitively, further, corresponding argument sequence can be calculated easily by computing unit, both simplify operation and be improved efficiency.
In one preferably embodiment, electronic table unit can be Excel.Excel is now widely used spreadsheet systems, easy and simple to handle, and has good extendability.
In one preferably embodiment, computing unit is formed primarily of the macroblock in Excel.Macroblock in Excel can provide programmes to the object in excel spreadsheet lattice, thus can realize corresponding computing function.
In one preferably embodiment, argument sequence shows in the mode of string expression.With character string mode display parameter sequence, user can be got information about needs for which test case.
In one preferably embodiment, string expression corresponding for test event is spliced the last of string expression corresponding to the argument sequence that formed in step S4.
As shown in Figure 2, further illustrate with a kind of specific embodiment below, under the embodiment being test event with switch learning MAC address function;
By mutual machine learning MAC address is formed a tree structure,
Wherein the parameter of test event is respectively, ACCESS, TRUNK, HYBIRD under port type, VLAN pattern, physical port, aggregation port, VLAN pattern and GE port corresponding to physical port and 10GE port and static polymerization corresponding to aggregation port and dynamic aggregation.
By above-mentioned parameter being formed the node of tree structure, and form tree structure according to the subordinate relation between each parameter,
Further, leaf node is the father node of GE port and 10GE port is physical port, and be root node with physical port, obtain further GE port and 10GE port to the impact of test event, draw with physical port be Intrusion Index corresponding to the subtree of root node to be 1;
Further, leaf node is the father node of static polymerization and dynamic aggregation is aggregation port, and be root node with aggregation port, obtain further static polymerization and dynamic aggregation to the impact of test event, draw with aggregation port be Intrusion Index corresponding to the subtree of root node to be 2;
Further, leaf node is ACCESS, TRUNK, HYBIRD, father node be poly-VLAN pattern, and with VLAN pattern for root node, obtain ACCESS, TRUNK, HYBIRD, impact on test event further, draw with Intrusion Index corresponding to the VLAN pattern subtree that is root node as 1;
Thus the Intrusion Index obtaining with physical port the subtree being root node is 1, take aggregation port as the Intrusion Index of the subtree of root node be 2, the Intrusion Index of the subtree being root node with VLAN pattern is 1, and further to choose according to Intrusion Index with root node be leaf node under physical port with taking root node as leaf node under aggregation port and root node be the leaf node under VLAN pattern
Further by electronic table unit, parameter corresponding for the node of tree structure and display tree structure is preserved, and be connected with electrical form by computing unit, in order to choose with leaf node according to Intrusion Index, and form the argument sequence of corresponding test event, as shown in the formula 1), 2).
1), (GE port, 10GE port) is got 1 value * (ACCESS, TRUNK, HYBIRD) at random and is got 1 value at random.
2), (static polymerization, dynamic aggregation) 2 value traversal * (ACCESS, TRUNK, HYBIRD) get 1 value at random.
In above-mentioned formula 1) in GE port, getting wherein 1 value in 10GE port at random, as got GE port, in ACCESS, TRUNK, HYBIRD, getting 1 value at random, as got ACCESS, then the argument sequence be combined to form is, GE port ACCESS pattern.
In above-mentioned formula 2) in static polymerization, when getting static polymerization in dynamic aggregation, in ACCESS, TRUNK, HYBIRD, get 1 value at random, as HYBIRD, then the argument sequence be combined to form is, static polymerization HYBIRD pattern;
When value is dynamic aggregation, in ACCESS, TRUNK, HYBIRD, get 1 value at random as TRUNK, then the argument sequence be combined to form is, dynamic aggregation TRUNK pattern.
The character string " MAC address learning checking " of splicing upper corresponding test event after above-mentioned three argument sequences respectively can be obtained following sequence:
The MAC address learning checking of GE port ACCESS pattern;
The MAC address learning checking of static polymerization mouth HYBIRD pattern;
The MAC address learning checking of dynamic aggregation mouth TRUNK pattern.
Test the test job that can complete test event 3 times by known only need of above-mentioned sequence, by existing method of testing, need the parameter corresponding to all leaf nodes all once to test, namely need to carry out 12 tests.Need test needs 12 times before comparing, tested by said method and only need 3 times, thus improve testing efficiency.
Technique scheme tool has the following advantages or beneficial effect: inoperation is simple, and comprehensive to the parameters distribution that test event is corresponding, thus can comprehensively test, and overcomes testing efficiency in prior art lower, and the problem that operation is more complicated.
The foregoing is only preferred embodiment of the present invention; not thereby embodiments of the present invention and protection domain is limited; to those skilled in the art; should recognize and all should be included in the scheme that equivalent replacement done by all utilizations instructions of the present invention and diagramatic content and apparent change obtain in protection scope of the present invention.