Disclosure of Invention
Aiming at the problem that the value of an IP list variable in a circulating script cannot be acquired and input by a test case when a robotframe platform executes the automatic test of communication equipment in batch, the method and the system for automatically storing the variable and acquiring the variable based on the identification of the type of a local general database and finally completing the batch automatic test of the communication equipment are provided.
The technical scheme adopted by the invention is as follows: a method for testing communication equipment in batches is characterized in that a robotframe platform is built at a PC end, and the PC is communicated with a plurality of detected communication equipment through a router; and executing a circulating script in the robotframe platform to circularly execute an automatic test case according to the IP list variable for the tested communication equipment, simultaneously storing the address of the IP of the current tested equipment into a local database table through a database operation library, calling the database operation library through an imported variable file to acquire the IP of the tested equipment when the automatic test case is called and executed, and finally generating an html (hypertext markup language) test report according to the test result and the IP address of the equipment.
Further, the concrete working process of the robotframe platform is as follows: creating a robot case, traversing the input list variables of the equipment IP for circulation, calling a database operation library to identify the type of a local general database, and storing the IP address taken out for circulation into the local database by calling a corresponding interface according to the type of the database; calling cmd through a python subpacess module, and calling an existing test case library of the running equipment to execute the automatic test case.
Furthermore, the data operation library is a library based on a robotframe framework, the database operation library is connected with the local through socket communication, identifies and logs in the local database, and stores the equipment IP address into a table of the local database or takes out the stored equipment IP address from the table of the local database by calling a corresponding interface according to the type of the database.
Further, the existing test case library is a developed device test case library, acquires the IP address of the tested communication device from the variable file, and is in communication connection with the tested device according to the IP address of the tested device to run the automated test case.
Further, the variable file is a python file for importing variables, and the IP address of the current device to be tested is acquired by calling the encapsulation keywords of the database operation library.
Further, the method for generating the html test report includes: before an automatic test case is operated, a robotframe opens a socket communication binding local port; during test operation, the robotframe monitors real-time operation data through socket communication; after the automatic test case is operated, the robotframe closes socket communication; robotframe generates log logs from the data and generates html reports.
The invention also provides a system for testing the communication equipment in batches, which comprises a robotframe platform set up at the PC end, the PC is communicated with a plurality of communication equipment to be tested through a router, and the robotframe platform is used for executing the method for testing the communication equipment in batches.
Compared with the prior art, the beneficial effects of adopting the technical scheme are as follows: the method and the device solve the problem that when the robotframe platform executes the automatic test of the communication equipment in batch, the value of the IP list variable in the circulating script cannot be acquired and input by the test case. The robotframe platform can be used by testers to test the communication equipment in batches, and the efficiency of the testers in batch testing of the communication equipment is improved.
Detailed Description
The invention is further described below with reference to the accompanying drawings.
Example 1
The invention provides a method for storing variables and acquiring variables based on a universal database and finally completing batch automatic testing of communication equipment, aiming at the problem that when a robotframe platform executes the batch automatic testing of the communication equipment, the values of IP list variables in a circulating script cannot be acquired and input by a test case.
The method is based on a robotframwork framework, and communication equipment testing is completed by socket communication identification, connection with a local general database and data acquisition. The tester can perform the batch test of the communication equipment only by deploying the test environment at the beginning of the test, as shown in fig. 1. The specific scheme is as follows:
as shown in fig. 2, in the method for testing communication devices in batches, a robotframe platform is built at a PC end, and the PC communicates with a plurality of detected communication devices through a router; and executing a circulating script in a robotframe platform to circularly execute an automatic test case according to the IP list variable for the tested communication equipment, simultaneously identifying the type of a local general database by a database operation library, storing the IP address of the tested equipment into a local database table by calling a corresponding interface according to the type of the database, calling the database operation library by an imported variable file to obtain the IP of the tested equipment when the automatic test case is called and executed, and finally generating an html (hypertext markup language) test report according to the test result and the IP address of the equipment.
Example 2
On the basis of the embodiment 1, the specific working process of the robotframe platform is as follows: creating a robot case, circularly traversing the input list variables of the equipment IP, calling a database operation library to identify the type of a local database, and storing the IP address taken out circularly for in the local database through a corresponding interface according to the type of the database; calling cmd through a python subpacess module, and calling an existing test case library of the running equipment to execute the automatic test case.
Example 3
On the basis of the embodiment 2, the data operation library is a library based on a robotframe framework, the database operation library communicates locally through a socket, identifies and logs in a local database, and stores the device IP address into a table of the local database or takes out the stored device IP address from the table of the local database by calling a corresponding interface according to the type of the database.
Example 4
On the basis of the embodiment 3, the existing test case library is a developed device test case library, the IP address of the tested communication device is obtained from the variable file, and the test case library is in communication connection with the tested device according to the IP address of the tested device to run an automatic test case.
Example 5
On the basis of embodiment 4, the variable file is a python file for importing variables, and the IP address of the current device under test is acquired by calling the encapsulation key of the database operation library.
Example 6
On the basis of the embodiment 5, the method for generating the html test report comprises the following steps: before an automatic test case is operated, a robotframe opens a socket communication binding local port; during test operation, the robotframe monitors real-time operation data through socket communication; after the automatic test case is operated, the robotframe closes socket communication; robotframe generates log logs from the data and generates html reports.
By adopting the scheme provided by the invention, the problem that the value of the IP list variable in the circulating script cannot be acquired and input by the test case when the robotframe platform executes the automatic test of the communication equipment in batches can be effectively solved. The robotframe platform can be used by testers to test the communication equipment in batches, and the efficiency of the testers in the batch test of the communication equipment is improved
Example 6
The invention also provides a system for testing the communication equipment in batches, which comprises a robotframe platform set up at a PC end, wherein the PC is communicated with a plurality of communication equipment to be tested through a router, and the robotframe platform is used for executing the method for testing the communication equipment in batches as in any one of embodiments 1-5.
The invention is not limited to the foregoing embodiments. The invention extends to any novel feature or any novel combination of features disclosed in this specification and any novel method or process steps or any novel combination of features disclosed. Those skilled in the art to which the invention pertains will appreciate that insubstantial changes or modifications can be made without departing from the spirit of the invention as defined by the appended claims.
All of the features disclosed in this specification, or all of the steps in any method or process so disclosed, may be combined in any combination, except combinations of features and/or steps that are mutually exclusive.
Any feature disclosed in this specification may be replaced by alternative features serving equivalent or similar purposes, unless expressly stated otherwise. That is, unless expressly stated otherwise, each feature is only an example of a generic series of equivalent or similar features.