Summary of the invention
The shortcoming of prior art in view of the above, the object of the present invention is to provide a kind of method of testing and system of integration testing instrument, too low for solving existing many test platforms degree of coupling in prior art, cannot realize the problem of test automatically.
For achieving the above object and other relevant objects, the invention provides a kind of method of testing of integration testing instrument, comprising: in the process of test equipment under test, pre-configured start corresponding test module to the interface of test module each in test instrumentation by calling; When determining that started test module has run, obtain the test log comprising test process and/or test result that described test module records; Continue to perform the test to described equipment under test based on obtained test log.
Preferably, described default comprising with the interface of each test module in test instrumentation: the keyword configuring the start-up code corresponding to each described test module.
Preferably, default comprising with the mode of the interface of each test module in test instrumentation is called described in: adopt SSH technology that the start-up code of called test module is passed to described test instrumentation, so that described test instrumentation starts corresponding test module.
Preferably, determine that the mode that started test module has run comprises: monitor the process of test module in described test instrumentation started, when described process disappears, then determine that started test module has run.
Preferably, described test instrumentation comprises: based on the automatic test instrument of CDRouter, IXIA or SmartBits.
Based on above-mentioned purpose, the present invention also provides a kind of test macro of integration testing instrument, comprising: the first module, for pre-configured starting corresponding test module to the interface of test module each in test instrumentation by calling in the process of test equipment under test; Second module, for when determining that started test module has run, obtains the test log comprising test process and/or test result that described test module records; 3rd module, for continuing to perform the test to described equipment under test based on obtained test log.
Preferably, that presets in described first module comprises with the interface of each test module in test instrumentation: the keyword configuring the start-up code corresponding to each described test module.
Preferably, the start-up code of called test module is passed to described test instrumentation for adopting SSH technology by described first module, so that described test instrumentation starts corresponding test module.
Preferably, tell the second module also for monitoring the process of started test module in described test instrumentation, when described process disappears, then determine that started test module has run.
Preferably, described test instrumentation comprises: based on the automatic test instrument of CDRouter, IXIA or SmartBits.
As mentioned above, the method of testing of integration testing instrument of the present invention and system, there is following beneficial effect: two diverse testing equipments of execution environment combined with the interface of test module each in test instrumentation by configuration, effectively prevent the inharmonious of two testing equipments, effectively improve the testing efficiency to equipment under test; Meanwhile, described test macro utilizes the test log in described test instrumentation, and the test record needed for automatically extracting also proceeds test, achieves full automatic test between two diverse test environments; In addition, determine that started test module completes test by the process in monitoring and test instrument, obtain test log again, test log can not only be obtained in time to carry out follow-up test, effectively can also prevent from blindly obtaining because test instrumentation cannot be learnt whether to complete test the not congruent defect of data that test log brings; Further, adopt SSH technology, can safety carry out Long-distance Control test instrumentation, decrease the troubles such as the place that test macro and test instrumentation bring by signal wiring.
Embodiment
Below by way of specific instantiation, embodiments of the present invention are described, those skilled in the art the content disclosed by this specification can understand other advantages of the present invention and effect easily.The present invention can also be implemented or be applied by embodiments different in addition, and the every details in this specification also can based on different viewpoints and application, carries out various modification or change not deviating under spirit of the present invention.It should be noted that, when not conflicting, the feature in following examples and embodiment can combine mutually.
Refer to Fig. 1, the invention provides a kind of method of testing of integration testing instrument.Described method of testing performs primarily of the test macro be arranged in test platform.Wherein, described test platform can be the test frame etc. based on the test platform of RobotFramework (auto-testing-framework), QTP (Quick Test Professional tests professional version fast) or the stratification of independent research.Described test instrumentation includes but not limited to: based on the automatic test instrument of CDRouter, IXIA or SmartBits
Wherein, described test instrumentation is mainly used to carry out described test macro to equipment under test and cannot carries out or utilize described test macro to be not easy to the test carried out.Such as, described test macro is used for testing the function of equipment under test, and integrated test instrumentation is the protocol conformance for testing equipment under test, when described test macro needs the packet capturing data in the test result of described test instrumentation or test process in test process, which employs following method will give integrated with the diverse test instrumentation of selftest environment, to realize automatic test.Wherein, described equipment under test can be the electronic equipment of any communication class, and it includes but not limited to: router, switch etc.
In step sl, described test macro pre-configured starts corresponding test module to the interface of test module each in test instrumentation by calling in the process of test equipment under test.
Wherein, described interface can be the hardware interface between described test macro and test instrumentation.Here preferred, described interface is that tester is pre-configured in described test macro according to the corresponding relation in each test module in test instrumentation and each test module in described test macro in advance.Such as, described tester utilizes configuration file the start-up code of the call instruction of each test module in described test macro with the corresponding test module in described test instrumentation to be matched.More preferably, described interface is the keyword that configuration corresponds to the start-up code of each described test module.Such as, tester is configured with the keyword of the start-up code corresponding to each described test module in described test macro, then described test macro starts the operation of corresponding test module in described test instrumentation in running by calling corresponding keyword.
At this, the instruction between described test macro and test instrumentation can be passed through hardware interface (as serial bus interfaces such as USB) and transmit.Preferably, described test macro adopts SSH (safety shell protocol) technology the start-up code of called test module to be passed to described test instrumentation, so that described test instrumentation starts corresponding test module.Such as, described test macro is connected with test instrumentation network, then described test macro adopts SSH framework, and the start-up code of encryption is passed to described test instrumentation.
Therefore, described test macro is when performing test script, be arranged through according to script and call configured keyword, adopt SSH technology that the start-up code corresponding to described keyword is passed to test instrumentation, then described test instrumentation starts and runs corresponding test module, meanwhile, described test macro suspends current test, and waits for that the test of corresponding test module completes.
In step s 2, described test macro, when determining that started test module has run, obtains the test log comprising test process and/or test result that described test module records.
Particularly, when the test module in described test instrumentation is activated operation, test process and test result are kept in default file with the form of daily record by described test instrumentation, when described test instrumentation executes corresponding test module, initiatively described test log can be supplied to described test macro, so that described test macro again recovers and continues to perform follow-up test.Its presentation mode also can adopt SSH technology, to guarantee safety.
In fact, most of test instrumentation does not have the function initiatively exporting test log.Described test macro, while time-out test, is monitored the process of started test module in described test instrumentation by the mode such as telnet or interface accessing, when described process disappears, is then determined that started test module has run.
In the present embodiment, described test macro utilizes the technology such as telnet to enter in the operating system of described test instrumentation, and the process title of monitoring in described test instrumentation, when the process title of started test module disappears, determine that it has run, now, from the file preset, corresponding test log is extracted.
Such as, described test macro is long-range after startup test module A enters described test instrumentation, and the executive process of buddy is monitored in the instruction of circulation execution ps-auwx|grep buddy, and read the result of PS instruction, coupling tclsh process is gone by return value regular expression, corresponding test module A is described also in operation if the match is successful, otherwise then from the file preset, provides the test log corresponding to described test module A, and perform step S3.
In step s3, described test macro continues to perform the test to described equipment under test based on obtained test log.
Particularly, described test macro is after obtaining test log, by the analysis to test log, therefrom extract the detecting information such as test result or described packet capturing data, and extracted detecting information is substituted in the test script suspended as parameter, to continue to perform described test script.
Such as, described test macro extracts data retransmission that address ip 1 sends by equipment under test to all forwarding datas in address ip 2 process in obtained test log, and extracted forwarding data is sent in the test script suspended, and continue to perform this test script, whether consistent with the expectation preset to detect the forwarding data extracted, and obtain corresponding test result.
Refer to Fig. 2, the invention provides a kind of test macro of integration testing instrument.Described test macro 1 comprises by the software and hardware be arranged in test platform.Wherein, described test platform can be the test frame etc. based on the test platform of RobotFramework (auto-testing-framework), QTP (Quick Test Professional tests professional version fast) or the stratification of independent research.Described test instrumentation 2 includes but not limited to: based on the automatic test instrument 2 of CDRouter, IXIA or SmartBits
Wherein, described test instrumentation 2 is mainly used to carry out described test macro 1 to equipment under test 3 and cannot carries out or utilize described test macro 1 to be not easy to the test carried out.Such as, described test macro 1 is used for testing the function of equipment under test 3, and integrated test instrumentation 2 is the protocol conformance for testing equipment under test 3, when described test macro 1 needs the packet capturing data in the test result of described test instrumentation 2 or test process in test process, it have invoked as lower module will give integrated with the diverse test instrumentation of selftest environment 2, to realize automatic test.Wherein, described equipment under test 3 can be the electronic equipment of any communication class, and it includes but not limited to: router, switch etc.
Described test macro 1 comprises: the first module 11, second module 12 and the 3rd module 13.
Described first module 11 for pre-configured starting corresponding test module to the interface of each test module in test instrumentation 2 by calling in the process of test equipment under test 3.
Wherein, described interface can be the hardware interface between described test macro 1 and test instrumentation 2.Here preferred, described interface is that tester is pre-configured in described first module 11 according to the corresponding relation in each test module in each test module in test instrumentation 2 and described first module 11 in advance.Such as, described tester utilizes configuration file to be matched with the start-up code of the corresponding test module in described test instrumentation 2 by the call instruction of each test module in described first module 11.More preferably, described interface is the keyword that configuration corresponds to the start-up code of each described test module.Such as, tester is configured with the keyword of the start-up code corresponding to each described test module in described first module 11, then described first module 11 starts the operation of corresponding test module in described test instrumentation 2 in running by calling corresponding keyword.
At this, the instruction between described first module 11 and test instrumentation 2 can be passed through hardware interface (as serial bus interfaces such as USB) and transmit.Preferably, described first module 11 adopts SSH (safety shell protocol) technology that the start-up code of called test module is passed to described test instrumentation 2, so that described test instrumentation 2 starts corresponding test module.Such as, described first module 11 is connected with test instrumentation 2 network, then described first module 11 adopts SSH framework, and the start-up code of encryption is passed to described test instrumentation 2.
Therefore, described first module 11 is when performing test script, be arranged through according to script and call configured keyword, adopt SSH technology that the start-up code corresponding to described keyword is passed to test instrumentation 2, then described test instrumentation 2 starts and runs corresponding test module, meanwhile, described first module 11 suspends current test, and waits for that the test of corresponding test module completes.
Described second module 12, for when determining that started test module has run, obtains the test log comprising test process and/or test result that described test module records.
Particularly, when the test module in described test instrumentation 2 is activated operation, test process and test result are kept in default file with the form of daily record by described test instrumentation 2, when described test instrumentation 2 executes corresponding test module, initiatively described test log can be supplied to described second module 12, so that described second module 12 is again recovered and continued to perform follow-up test.Its presentation mode also can adopt SSH technology, to guarantee safety.
In fact, most of test instrumentation 2 does not have the function initiatively exporting test log.Described second module 12, while time-out test, is monitored the process of started test module in described test instrumentation 2 by the mode such as telnet or interface accessing, when described process disappears, is then determined that started test module has run.
In the present embodiment, described second module 12 utilizes the technology such as telnet to enter in the operating system of described test instrumentation 2, and the process title of monitoring in described test instrumentation 2, when the process title of started test module disappears, determine that it has run, now, from the file preset, corresponding test log is extracted.
Such as, described second module 12 is long-range after startup test module A enters described test instrumentation 2, and the executive process of buddy is monitored in the instruction of circulation execution ps-auwx|grep buddy, and read the result of PS instruction, coupling tclsh process is gone by return value regular expression, corresponding test module A is described also in operation if the match is successful, otherwise then from the file preset, provides the test log corresponding to described test module A, and start described 3rd module 13.
Described 3rd module 13 is for continuing to perform the test to described equipment under test 3 based on obtained test log.
Particularly, described 3rd module 13 is after obtaining test log, by the analysis to test log, therefrom extract the detecting information such as test result or described packet capturing data, and extracted detecting information is substituted in the test script suspended as parameter, to continue to perform described test script.
Such as, described 3rd module 13 extracts data retransmission that address ip 1 sends by equipment under test 3 to all forwarding datas in address ip 2 process in obtained test log, and extracted forwarding data is sent in the test script suspended, and continue to perform this test script, whether consistent with the expectation preset to detect the forwarding data extracted, and obtain corresponding test result.
In sum, the method of testing of integration testing instrument of the present invention and system, two diverse testing equipments of execution environment are combined with the interface of test module each in test instrumentation by configuration, effectively prevent the inharmonious of two testing equipments, effectively improve the testing efficiency to equipment under test; Meanwhile, described test macro utilizes the test log in described test instrumentation, and the test record needed for automatically extracting also proceeds test, achieves full automatic test between two diverse test environments; In addition, determine that started test module completes test by the process in monitoring and test instrument, obtain test log again, test log can not only be obtained in time to carry out follow-up test, effectively can also prevent from blindly obtaining because test instrumentation cannot be learnt whether to complete test the not congruent defect of data that test log brings; Further, adopt SSH technology, can safety carry out Long-distance Control test instrumentation, decrease the troubles such as the place that test macro and test instrumentation bring by signal wiring.So the present invention effectively overcomes various shortcoming of the prior art and tool high industrial utilization.
Above-described embodiment is illustrative principle of the present invention and effect thereof only, but not for limiting the present invention.Any person skilled in the art scholar all without prejudice under spirit of the present invention and category, can modify above-described embodiment or changes.Therefore, such as have in art usually know the knowledgeable do not depart from complete under disclosed spirit and technological thought all equivalence modify or change, must be contained by claim of the present invention.