The content of the invention
The invention aims to overcome the shortcomings of above-mentioned background technology there is provided a kind of automated testing method and be
System, can solve Dependence Problem of the test script to test environment, can not only improve the portability of test script, reduce test group
Net is built puts into human cost with script modification, and testing efficiency is high.
To achieve the above objectives, the present invention provides a kind of automated testing method, and the method for testing comprises the following steps:A、
Parse test envelope file and the test topology file of all test cases;The parsed test topology file of B, comparison, by phase
Same test topology file is merged and sorted;C, according to the order after rearrangement, by a test topology file
All logical device with the physical equipment in test envelope file map and match and occupy;If all in D, test envelope file
Physical equipment is matched and is mapped to, then is performed all related in the test topology file that mapping matching is completed in step C
Test case.
On the basis of above-mentioned technical proposal, the test envelope file includes physical equipment description information, equipment connection and retouched
State information and equipment matching precedence information;The test topology file includes forcing match information and logical device description letter
Breath.
On the basis of above-mentioned technical proposal, step C idiographic flow is:
C1:According to the order after rearrangement, check whether is some logical device defined in current test topology file
There is pressure to map with the physical equipment in test envelope file, if so, being then transferred to step C2, be otherwise transferred to step C3;
C2:Directly perform and force mapping, be transferred to step C7;
C3:Multi-component system mapping is carried out, step C4 is transferred to;
C4:Success is carried out after multi-component system mapping, judges whether have multiple physical equipments to meet the test in test envelope file
To the description of the logical device in topological file, if so, being transferred to step C5, step C6 is otherwise transferred to.
C5:Priority mapping is carried out, the high physical equipment of priority will be marked in test envelope file and is matched to current test
The logical device in topological file, is transferred to step C7;
C6:The physical equipment that first matches in test envelope file is mapped to the logic in current test topology file
Equipment, is transferred to step C7.
C7:Detect whether all logical device match mapping completion in current test topology file, if so, being transferred to step
S5, otherwise, repeat step C1~C7 complete the matching mapping of other logical device in current test topology file.
On the basis of above-mentioned technical proposal, in step D, if also having physical equipment to need matching to reflect in test envelope file
Penetrate, rejected in test envelope file after the physical equipment for being matched and having occupied, by surplus equipment and next survey according to sequence
The topological file of examination carries out mapping matching, if there is all phases just performed parallel in former and later two test topology files that can be matched
The test case of pass.
The present invention also provides a kind of automatization test system based on the above method, and the system includes parsing module, test
Topological file combination module, mapping matching module and performing module.The parsing module is used for:Parse test envelope file and institute
There is the test topology file of test case, and merging signal is sent to test topology file combination module;The test topology text
Part merging module is used for:Receive after merging signal, relatively parsed test topology file, identical test topology file is entered
Row merges and sorted, and sends mapping matched signal to mapping matching module;The mapping matching module is used for:Receive mapping
After signal, according to the order after rearrangement, by all logical device in a test topology file and test envelope file
In physical equipment carry out mapping and matching and occupy, and sent to performing module and perform signal;The performing module is used for:Receive
Perform after signal, be mapped to if all physical equipments in test envelope file are matched, performing mapping matching module is used for
Complete all related test cases in the test topology file of mapping matching.
On the basis of above-mentioned technical proposal, the test envelope file includes:Physical equipment description information, equipment connection are retouched
State information and equipment matching precedence information;The test topology file includes:Force match information and logical device description letter
Breath.
On the basis of above-mentioned technical proposal, the mapping matching module includes forcing mapping matched sub-block, multi-component system
Map matched sub-block, priority mapping matched sub-block and mapping matching detection submodule:
It is described to force mapping matched sub-block to be used for:Receive after mapping matched signal, according to the order after rearrangement, inspection
Look into whether some logical device defined in current test topology file has pressure to map with the physical equipment in test envelope file,
Mapping is forced if so, then performing, and detection signal is sent to mapping matching detection submodule, otherwise, maps and matches to multi-component system
Submodule sends multi-component system mapping signal;
The multi-component system mapping matched sub-block is used for:Receive after multi-component system mapping signal, progress multi-component system mapping, and
Success is carried out after multi-component system mapping to priority mapping matched sub-block transmission priority mapping signal;
The priority mapping matched sub-block is used for:Receive after priority mapping signal, judge be in test envelope file
It is no to there are multiple physical equipments to meet the description in the test topology file to the logical device, if so, priority mapping is carried out, will
The high physical equipment of priority is marked in test envelope file to match to the logical device in current test topology file, and to reflecting
Penetrate matching detection submodule and send detection signal;Otherwise, the physical equipment mapping that first matches in test envelope file is worked as
The logical device in preceding test topology file, and send detection signal to mapping matching detection submodule;
The mapping matching detection submodule is used for:Receive after detection signal, detect in current test topology file and own
Whether logical device, which matches mapping, is completed, and signal is performed if so, being sent to performing module, otherwise, to pressure mapping matching submodule
Block sends mapping matched signal.
On the basis of above-mentioned technical proposal, the performing module also includes surplus resources and maps implementation sub-module, and this is remained
Remaining resource impact implementation sub-module is used for:If also having physical equipment to need to match mapping in test envelope file, in test envelope file
Middle rejecting has been matched after the physical equipment occupied, by surplus equipment with being reflected according to next test topology file of sequence
Matching is penetrated, if there are all related test cases just performed parallel in former and later two test topology files that can be matched.
On the basis of above-mentioned technical proposal, the parsing module includes test envelope document analysis submodule and test topology
Document analysis submodule;The test envelope document analysis submodule is used for:Test envelope file is parsed, and is closed to test topology file
And module sends and merges signal;The test topology document analysis submodule is used for:Parse the test topology of all test cases
File, and send merging signal to test topology file combination module.
The beneficial effects of the present invention are:
(1) present invention is by by patrolling in the test topology file in the physical equipment and test script in test envelope file
Volume equipment carries out mapping matching (i.e. by the way that topologic network logic is described into equipment under test), thus reach isolation test script with
The purpose of the dependence of physical equipment, makes test case possess the feasibility of smooth transplanting, greatly improves automatic test collection
Maintainability, portable, reduce Test Networking and build the human cost that input is changed with script.Also, the present invention will be surveyed
Identical test topology file is merged in training sheet so that identical test topology file is matched once with test envelope file
Related all test cases can just be run through, the problem of not only avoiding repetition running test case, and saved
The time spent with mapping, testing efficiency is high.
(2) present invention additionally use the test thinking that a kind of surplus resources are matched again, when a upper test topology file from
After equipment is matched in test envelope file and is occupied, if there is non-mapped of surplus resources (surplus equipment) in test envelope file
It is fitted on, then test topology file below can be selected to be matched in the remaining resource of test envelope file, if matching
On all related test cases just performed parallel in former and later two test topology files, what this surplus resources were matched again
Parallel action method, reduces the time of test script execution, further increases the execution efficiency of test.
Embodiment
Below in conjunction with the accompanying drawings and specific embodiment the present invention is described in further detail.
Shown in Figure 1, the embodiment of the present invention provides a kind of automated testing method, comprises the following steps:
Step S1:Test envelope file is parsed, step S2 is transferred to.
It is understood that test envelope file, abbreviation TBD (TestBed) file, to describe in actual test environment
All physical equipments and its association attributes, different test environments can be described with different TBD files.TBD files can
To be described by multiple format, in embodiments of the present invention, described using .txt suffix names file, and the TBD files including
General physical equipment description and equipment are connected outside the attribute of description, are also had additional equipment matching precedence information, are set when two
For when can match, it can determine how specific this matches by checking priority parameters.Specifically, TBD files include
Physical equipment description information, equipment connection description information and equipment matching precedence information particular content be:
(1) device descriptive information
Device type (type):The concrete model of equipment;
Implementor name (name):Device name, is forced mapping to be quoted in equipment connection and topology;
Equipment interface (interface):The port of equipment;
Equipment access path (access):Logging device used interface;
(2) equipment connection description information
Link connection (link):The link of equipment room, form is as follows:
Link name, 1 equipment interface of implementor name/IP, mask --- 2 equipment interfaces of implementor name/IP, mask;
(3) equipment matching precedence information
Priority (priority):0~7 grade, 7 grades of highest priority is defaulted as 0 grade.
Step S2:The test topology file of all test cases is parsed, step S3 is transferred to.
It is understood that test topology file (referred to as, TOPO files) is contained in test script and (is used to complete to tested
The order of examination equipment is issued, result inspection operation) in, and tested setting of having required for test script operation in TOPO files
Standby logical description.In the embodiment of the present invention, TOPO files include the essential logical device description informations such as device type, connection,
Also include the description information for forcing mapping, and these equipment need to match and occupy into TBD files.Specifically, TOPO
The content that file includes is following two parts:
(1) match information part is forced
Force mapping (force):For the name of equipment in TBD files, acquiescence does not force mapping;
(2) logical device description information part
Logical device name:Directly invoked in logical device title, script;
Logical device types:The type of equipment, for being matched with equipment in TBD files;
Logical device is connected:Description logic equipment is connected, and the link connection in TBD files is matched;
Logic interfacing:Interface name, interface type, directly by script applications.
TOPO files are described in strict accordance with certain format, keep a good resolvability.Logical device in TOPO
Mix after the equipment in TBD files, all properties of the equipment in TBD files will be inherited.TBD files, TOPO files, test pin
This matching mapping relations are as shown in Figure 2.And need to call device name, equipment interface etc. all to apply TOPO in test script
Defined in file, so script and physical equipment are isolated entirely from, the portability of script is greatly enhanced, can be safeguarded
Property.TBD files, TOPO files, test script relation it is as shown in Figure 3.
Step S3:Compare parsed TOPO files, by identical TOPO Piece file mergences and to sort (be exactly to make all to have
The public TOPO file of test case of phase homeomorphism, it is only necessary to which mapping is once), it is transferred to step S4.
It is understood that identical TOPO Piece file mergences, refer to that systems inspection finds that the TOPO files in test set have
After identical, internal sort only needs to identical some TOPO texts these identicals TOPO Piece file mergences together, so
Part once can just run through related all test cases to TBD matchings, not only avoid the operation of retest, and
The time that matching mapping is spent is saved.
Step S4:According to the order after rearrangement, by all logical device in a TOPO file and TBD files
Physical equipment carry out mapping and matching and occupy, be transferred to step S5.
Participate in shown in Fig. 1, during practical operation, step S4 specifically includes below scheme:
Step S401:According to the order after rearrangement, check that some logical device defined in current TOPO files is
The no physical equipment with TBD has pressure to map, if so, being then transferred to step S402;Otherwise, it is transferred to step S403.
Step S402:Directly perform and force mapping, be transferred to step S407.
Step S403:Multi-component system mapping is carried out, step S404 is transferred to.
Step S404:Success is carried out after multi-component system mapping, judges whether have multiple equipment to meet in the TOPO files in TBD
Description (judging whether to need to carry out priority mapping) to the logical device, if so, being transferred to step S405;Otherwise it is transferred to step
Rapid S406.
Step S405:Priority mapping is carried out, the high equipment of priority will be marked in TBD and is matched in current TOPO files
The logical device, be transferred to step S407.
Step S406:By the logical device in the current TOPO files of first device map matched in TBD, it is transferred to
Step S407.
Step S407:Detect whether all devices match mapping completion in current TOPO files, if so, step S5 is transferred to,
Otherwise, repeat step S301~S307, completes the matching mapping of other equipment in current TOPO files.
Step S5:Judge in TBD whether all physical equipments are matched to be mapped to, if so, step S6 is then transferred to, it is no
Then, represent also have surplus resources (surplus equipment) to need matching in TBD, be then transferred to step S7.
Step S6:Current test set is performed (after that merging of current test set to complete mapping matching in step S4
TOPO files) in all related test cases, terminate.
Step S7:Rejected in TBD after the equipment that the matching of TOPO files has occupied described in step S4, by TBD
Surplus equipment carries out mapping with next TOPO files according to sequence and matched, if having two before and after the just parallel execution that can be matched
(the TOPO files that mapping matching is completed before i.e. complete mapping to all related test cases in individual TOPO files with current
All related test cases for the TOPO files matched somebody with somebody), terminate.
The test thinking that the embodiment of the present invention uses a kind of surplus resources to match again is can be seen that from step S5~S7, when
After a upper TOPO file matches equipment and occupied in TBD files, if in TBD also have surplus resources (surplus equipment) not by
Mapping is matched, then TOPO files below can be selected to be matched in the remaining resources of TBD, if matching just
All related test cases in former and later two TOPO files, the parallel execution side that this surplus resources are matched again are performed parallel
Formula, further increases the execution efficiency of test.
Shown in Figure 4, the embodiment of the present invention also provides a kind of automatization test system based on the above method, the test
System includes parsing module, test topology file combination module, mapping matching module and performing module.Wherein:
Parsing module is used for:Test envelope file and the test topology file of all test cases are parsed, and is opened up to test
Flutter file combination module and send and merge signal.Specifically, the parsing module includes test envelope document analysis submodule and survey
The topological document analysis submodule of examination.Test envelope document analysis submodule, for parsing test envelope file, and to test topology file
Merging module, which is sent, merges signal.Test topology document analysis submodule, the test topology text for parsing all test cases
Part, and send merging signal to test topology file combination module.
Test topology file combination module is used for:Receive after merging signal, relatively parsed test topology file, by phase
Same test topology file is merged and sorted, and sends mapping matched signal to mapping matching module.
Mapping matching module is used for:Receive after mapping matched signal, according to the order after rearrangement, a test is opened up
All logical device flutterred in file carry out mapping with the physical equipment in test envelope file and match and occupy, and to performing module
Send and perform signal.
Further, participate in shown in Fig. 4, the mapping matching module includes forcing mapping matched sub-block, multi-component system to be reflected
Penetrate matched sub-block, priority mapping matched sub-block and mapping matching detection submodule.It is described to force mapping matched sub-block
For:Receive after mapping matched signal, according to the order after rearrangement, check some defined in current test topology file
Logical device whether with the physical equipment in test envelope file have pressure map, if so, then perform force mapping, and to mapping
Detection signal is sent with detection sub-module, otherwise, multi-component system mapping signal is sent to multi-component system mapping matched sub-block.It is described many
Tuple mapping matched sub-block is used for:Receive after multi-component system mapping signal, carry out multi-component system mapping, and successfully carrying out multi-component system
After mapping priority mapping signal is sent to priority mapping matched sub-block.The priority mapping matched sub-block is used for:
Receive after priority mapping signal, judge whether there are multiple physical equipments to meet in test envelope file right in the test topology file
The description of the logical device, if so, carrying out priority mapping, will mark the high physical equipment of priority and matches in test envelope file
Detection signal is sent to the logical device in current test topology file, and to mapping matching detection submodule;Otherwise, it will survey
First physical equipment for matching maps the logical device in current test topology file in examination bed file, and to mapping
Detection signal is sent with detection sub-module.The mapping matching detection submodule is used for:Receive after detection signal, detection is current to survey
Whether all logical device match mapping and complete in the topological file of examination, and signal is performed if so, being sent to performing module, otherwise, to
Mapping matched sub-block is forced to send mapping matched signal.
Performing module is used for:Receive after execution signal, be mapped to if all physical equipments in test envelope file are matched
, then performing mapping matching module is used to complete all related test cases in the test topology file of mapping matching.
Further, participate in shown in Fig. 4, the performing module also includes surplus resources and maps implementation sub-module, and this is remained
Remaining resource impact implementation sub-module is used for:If also having physical equipment to need to match mapping in test envelope file, in test envelope file
Middle rejecting has been matched after the physical equipment occupied, by surplus equipment with being reflected according to next test topology file of sequence
Matching is penetrated, if there are all related test cases just performed parallel in former and later two test topology files that can be matched.
It should be noted that:The system that above-described embodiment is provided is when carrying out automatic test, only with above-mentioned each function mould
The division progress of block for example, in practical application, above-mentioned functions can be distributed as needed and be completed by different functional modules,
The internal structure of system is divided into different functional modules, to complete all or part of function described above.
The present invention is not limited to the above-described embodiments, for those skilled in the art, is not departing from
On the premise of the principle of the invention, some improvements and modifications can also be made, these improvements and modifications are also considered as the protection of the present invention
Within the scope of.
The content not being described in detail in this specification belongs to prior art known to professional and technical personnel in the field.