The content of the invention
The above mentioned problem existed for test case in the prior art, now provides one kind and is intended to test comprehensively and simply surveys
The choosing method of example on probation.
Concrete technical scheme is as follows:
A kind of choosing method of test case, comprises the following steps:
Step S1, one test event of selection;
Step S2, according to the test event formed a tree structure, the node of the tree is by the test item
Purpose parameter is formed, and the node forms the tree structure according to the subordinate relation between the parameter;
Step S3, the influence according to the corresponding parameter of leaf node of the tree structure to the test event,
Obtain the Intrusion Index of every subtree using the father node of the leaf node as root node;
Step S4, every son according to Intrusion Index selection using the father node of the leaf node as root node
The leaf node on tree, forms the argument sequence of the correspondence test event.
It is preferred that, in the step S3, the acquisition of the Intrusion Index calculates method and is, the leaf node pair of the subtree
When the parameter answered influences the test event test result, the Intrusion Index of the subtree is the leaf node of the subtree
Quantity, the corresponding parameter of leaf node of the subtree do not influence the test event test result when, the son
The Intrusion Index of tree is 1.
It is preferred that, in the step S4, the method for choosing the leaf node is,
When the Intrusion Index of the subtree is 1, a leaf is chosen in the leaf node of the subtree at random
The corresponding parameter of child node;
When the Intrusion Index of the subtree is the quantity of the leaf node of the subtree, all described of the subtree is chosen
The corresponding parameter of leaf node.
It is preferred that, the method that the argument sequence is formed in the step S4 is, by the parameter of selection according to pair
The subtree answered is combined.
It is preferred that the section there is provided an electronic table unit to preserve the tree structure and the display tree structure
The corresponding parameter of point.
It is preferred that there is provided a computing unit, connect the electronic table unit, to according to the Intrusion Index choose with
The leaf node, and form the argument sequence of the correspondence test event.
It is preferred that, the electronic table unit is Excel.
It is preferred that, the computing unit is mainly formed by the macroblock in Excel.
It is preferred that, the argument sequence is shown in the way of string expression.
It is preferred that, the corresponding string expression of the test event is spliced to the ginseng formed in the step S4
The corresponding string expression of Number Sequence it is last.
Above-mentioned technical proposal has the following advantages that or beneficial effect:It is simple to operate, and to the corresponding parameter of test event
Covering is comprehensive, so as to comprehensively be tested, and overcomes that testing efficiency in the prior art is relatively low, and operates more complicated ask
Topic.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, the technical scheme in the embodiment of the present invention is carried out clear, complete
Site preparation is described, it is clear that described embodiment is only a part of embodiment of the invention, rather than whole embodiments.It is based on
Embodiment in the present invention, those of ordinary skill in the art obtained on the premise of creative work is not made it is all its
His embodiment, belongs to the scope of protection of the invention.
It should be noted that in the case where not conflicting, the embodiment in the present invention and the feature in embodiment can phases
Mutually combination.
The invention will be further described with specific embodiment below in conjunction with the accompanying drawings, 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, one test event of selection;
Step S2, a tree structure formed according to test event, the node of tree formed by the parameter of test event,
Node is according to the subordinate relation formation tree structure between parameter;
Step S3, the influence according to the corresponding parameter of leaf node of tree structure to test event, are obtained with leaf section
The father node of point is the Intrusion Index of every stalk tree of root node;
Leaf section on step S4, every stalk tree according to Intrusion Index selection by root node of the father node of leaf node
Point, forms the argument sequence of correspondence test event.
In above-mentioned technical proposal, by by the parameter of test event one tree structure of formation, its interior joint according to parameter it
Between subordinate relation formation tree structure, the influence according to the corresponding parameter of the leaf node of tree structure to test event enters
The Intrusion Index of every stalk tree of the acquisition of one step by root node of the father node of leaf node, and according to Intrusion Index choose with
The father node of leaf node is the leaf node on every stalk tree of root node, so as to form the parameter sequence of correspondence test event
Row.Which according to the argument sequence, it would know that needs test case to test the test event.
In a kind of preferably embodiment, in step s3, the acquisition of Intrusion Index calculates method and is, the leaf section of subtree
When the corresponding parameter of point influences test event test result, the Intrusion Index of subtree is the quantity of the leaf node of subtree, subtree
The corresponding parameter of leaf node do not influence test event test result when, the Intrusion Index of subtree is 1.
In a kind of preferably embodiment, in step S4, the method for choosing leaf node is,
When the Intrusion Index of subtree is 1, the corresponding parameter of a leaf node is chosen in the leaf node of subtree at random;
When the Intrusion Index of subtree is the quantity of the leaf node of subtree, the corresponding ginseng of all leaf nodes of subtree is chosen
Number.
Above-mentioned technical proposal, corresponding parameter is selected with different strategies by Intrusion Index, so as to reduce test
The quantity of use-case, improves the efficiency of test.
In a kind of preferably embodiment, the method that argument sequence is formed in step S4 is, by the parameter of selection according to
Corresponding subtree is combined.
There is provided an electronic table unit to preserve tree structure and show tree-like in a kind of preferably embodiment
The corresponding parameter of node of structure.
There is provided a computing unit in a kind of preferably embodiment, electronic table unit is connected, to refer to according to influence
Number is chosen with leaf node, and forms the argument sequence of correspondence test event.
Above-mentioned technical proposal inputs corresponding test event, and test event by the electronic table unit person of being easy to use
Corresponding parameter and corresponding Intrusion Index, and intuitively tree structure can be shown, further, by calculating
Unit can easily calculate corresponding argument sequence, both simplified operation and be improved efficiency.
In a kind of preferably embodiment, electronic table unit can be Excel.Excel is now widely used
Spreadsheet systems, it is easy to operate, and with good autgmentability.
In a kind of preferably embodiment, computing unit is mainly formed by the macroblock in Excel.It is grand in Excel
Module can be provided to be programmed to the object in Excel electrical forms, so that corresponding computing function can be realized.
In a kind of preferably embodiment, argument sequence is shown in the way of string expression.With character string mode
Display parameters sequence, makes user can get information about needs which test cases.
In a kind of preferably embodiment, the corresponding string expression of test event is spliced and formed in step S4
The corresponding string expression of argument sequence it is last.
As shown in Fig. 2 being further illustrated below with a kind of specific embodiment, MAC Address function is being learnt with interchanger
For under the embodiment of test event;
By the way that interaction machine is learnt into MAC Address one tree structure of formation,
The parameter of wherein test event is respectively, port type, VLAN patterns, physical port, aggregation port, VLAN patterns
Under the corresponding GE ports of ACCESS, TRUNK, HYBIRD and physical port and 10GE ports and aggregation port it is corresponding
Static polymerization and dynamic aggregation.
By the way that above-mentioned parameter to be formed to the node of tree structure, and form tree-like according to the subordinate relation between each parameter
Structure,
Further, leaf node is that the father node of GE ports and 10GE ports is physical port, and using physical port as
Root node, further obtains the influence of GE ports and 10GE ports to test event, draws the son using physical port as root node
It is 1 to set corresponding Intrusion Index;
Further, leaf node is that the father node of static polymerization and dynamic aggregation is aggregation port, and using aggregation port as root
Node, further obtains the influence of static polymerization and dynamic aggregation to test event, draws the subtree using aggregation port as root node
Corresponding Intrusion Index is 2;
Further, leaf node be ACCESS, TRUNK, HYBIRD, father node be poly- VLAN patterns, and with VLAN
Pattern is root node, further obtain ACCESS, TRUNK, HYBIRD, the influence to test event, draw using VLAN patterns as
The corresponding Intrusion Index of subtree of root node is 1;
It is 1 so as to obtain by the Intrusion Index of the subtree of root node of physical port, using aggregation port as the subtree of root node
Intrusion Index be 2, the Intrusion Index using VLAN patterns as the subtree of root node is 1, and is further selected according to Intrusion Index
Leaf node under taking using root node as physical port with using root node as aggregation port under leaf node and root node be
Leaf node under VLAN patterns,
It is further to be entered the corresponding parameter of node of tree structure and display tree structure by electronic table unit
Row is preserved, and is connected by computing unit with electrical form, to be chosen according to Intrusion Index with leaf node, and forms correspondence
The argument sequence of test event, such as following formula 1), 2).
1), (GE ports, 10GE ports) takes 1 value * (ACCESS, TRUNK, HYBIRD) to take 1 value at random at random.
2), (static polymerization, dynamic aggregation) 2 values traversal * (ACCESS, TRUNK, HYBIRD) takes 1 value at random.
In above-mentioned formula 1) in take wherein 1 value at random in GE ports, 10GE ports, such as take GE ports, ACCESS,
1 value is taken at random in TRUNK, HYBIRD, ACCESS is such as taken, then the argument sequence for combining formation is, GE ports ACCESS patterns.
In above-mentioned formula 2) in when taking static polymerization in static polymerization, dynamic aggregation, in ACCESS, TRUNK, HYBIRD
1 value, such as HYBIRD are taken at random, then the argument sequence for combining formation is, static polymerization HYBIRD patterns;
When value is dynamic aggregation, 1 value such as TRUNK is taken at random in ACCESS, TRUNK, HYBIRD, then combination is formed
Argument sequence be, dynamic aggregation TRUNK patterns.
The character string " MAC address learning checking " of correspondence test event on respectively splicing after above three argument sequence
Following sequence can be obtained:
The MAC address learning checking of GE ports ACCESS patterns;
The MAC address learning checking of static polymerization mouthful HYBIRD patterns;
The MAC address learning checking of dynamic aggregation mouthful TRUNK patterns.
Understand only to need 3 tests to complete the test job to test event by above-mentioned sequence, by existing test
Method needs to carry out 12 tests, it is necessary to once test the corresponding parameter of all leaf nodes.Compared to needing before
Test needs 12 times, only needed 3 times by above method test, so as to improve testing efficiency.
Above-mentioned technical proposal has the following advantages that or beneficial effect:It is not simple to operate, and to the corresponding ginseng of test event
Number covering is comprehensive, so as to comprehensively be tested, and overcomes that testing efficiency in the prior art is relatively low, and operates more complicated ask
Topic.
Preferred embodiments of the present invention are the foregoing is only, embodiments of the present invention and protection model is not thereby limited
Enclose, to those skilled in the art, should can appreciate that made by all utilization description of the invention and diagramatic content
Scheme obtained by equivalent substitution and obvious change, should be included in protection scope of the present invention.