A kind of router switch machine automated testing method and system
Technical field
The present invention relates to the technical field of router test more particularly to a kind of router switch machine automated testing methods
And system.
Background technique
Router (Router) is also known as gateway (Gateway), for connecting multiple logically separate networks.It is so-called
Logical network is to represent an individual network or a subnet.When data is transferred from one subnet to another subnet,
It can be completed by the routing function of router.Therefore, router has the function of judging network address and the selection path IP, it
Can flexible connection be established, can be connected with entirely different data grouping with media access method in a multi-network interconnection environment
Various subnets, router only receive source station or the information of other routers, belong to a kind of InterWorking Equipment of network layer.
With the fast development of wireless communication technique, wireless router has been widely used for each occasion, such as family, public affairs
The occasions such as department, market, every household has the demand to WIFI and wireless router at present, and router has become one must
Palpus product, the test of router switch machine is one of the important indicator of router reliability performance, essential during the test
Link, generally all can be at thousands of times or more to the switching on and shutting down test of router, and existing router switch machine test method is
By simulating the power on/off of router to relay on-off electricity, router is then led to by Ethernet interface Ping to judge to route
Whether device is successfully opened, however relay has electric residual during power on/off, may influence test result and relay
Capacitor can rectify, bring surge current big situation when can not simulate for plugging router plug, and this is logical
Crossing the logical router of Ethernet interface Ping can not prove that router is successfully opened.
The patent of Publication No. CN 104901848A discloses a kind of router switch machine automatization test system and side
Method, including setting power-on time lower limit, the power-on time upper limit, cycle-index, waiting time and interval time;Control router into
After row circulation powers on repeatedly, then controls router and power on simultaneously certain time;It is unimpeded whether the gateway of detection router connects;
If it is not, test crash is judged, if so, setting power-on time is to work as when whether current power-on time is less than the power-on time upper limit
Preceding power-on time and interval time and, repeat aforementioned testing procedure;Whether it is greater than the power-on time upper limit in current power-on time
When, judgement is successfully tested.Router switch machine automatization test system of the invention and method are suitable for all SOHO without route
By device product;It can be realized full-automatic switching on and shutting down test, reduce the workload of tester, improve the operation effect of test macro
Rate;Substantially increase testing efficiency and accurate testing degree.This method still using relay come relay on-off electricity come simulation road
By the power on/off of device, router is then led to judge whether router is successfully opened by Ethernet interface Ping, or exists and surveys
Test result inaccuracy, can not analog subscriber plug plug when bring surge current big situation the problems such as.
Summary of the invention
The purpose of the present invention is in view of the drawbacks of the prior art, provide a kind of router switch machine automated testing method
And system is simulated the switching on and shutting down situation that actual user plugs power supply, is able to verify that big surge current using the mode of mechanical plug
Influence to router, and in the verifying successful link of router startup, increase the process of wireless network card connection, it is ensured that routing
Device module does not go wrong in switching on and shutting down test.
In order to achieve the goal above, the present invention uses following technical scheme:
A kind of router switch machine automated testing method, including step:
S1. connection is established with router to be measured;
S2. the DHCP function of the router to be measured is opened, and configures the wireless messages of the router to be measured;
S3. control stepper motor retreats so that socket is separated with the attaching plug of the router to be measured;
S4. wait preset time period then control stepper motor advance so that the router to be measured attaching plug
It is inserted into socket;
S5. wired network adapter is enabled, wireless network card is disabled, Ping behaviour is carried out to the router to be measured by wired network adapter
Make;
S6. wired network adapter is disabled, wireless network card is enabled, is separately connected all of the router to be measured using wireless network card
Frequency range it is wireless, Ping operation is carried out to the router to be measured by wireless network card;
S7. judge whether testing time reaches default testing time, if so, step S8 is jumped to, if it is not, then jumping to step
S3;
S8. it is disconnected with the router to be measured.
Further, in the wireless messages for configuring the router to be measured if the router to be measured is double frequency router
When two frequency ranges be both needed to configure.
Further, the stepper motor is pivotally connected to fixture by machinery.
Further, the socket is fixed on the fixture.
Further, the attaching plug of the router to be measured is fixed on the front of the socket.
Correspondingly, a kind of router switch machine automatization test system is also provided, including:
Link block, for establishing connection with router to be measured;
Configuration module for opening the DHCP function of the router to be measured, and configures the wireless of the router to be measured
Information;
First control module is retreated for controlling stepper motor so that the attaching plug of socket and the router to be measured point
From;
Second control module, for controlling stepper motor after waiting a preset time period after stepper motor retrogressing
Advance so that the attaching plug of the router to be measured is inserted into socket;
First Ping operation module disables wireless network card, by wired network adapter to described to be measured for enabling wired network adapter
Router carries out Ping operation;
2nd Ping operation module enables wireless network card, is separately connected institute using wireless network card for disabling wired network adapter
The wireless of all frequency ranges of router to be measured is stated, Ping operation is carried out to the router to be measured by wireless network card;
Judgment module, for judging whether testing time reaches default testing time;
Module is disconnected, is connected for being disconnected when testing time reaches default testing time with the router to be measured
It connects.
Further, in the wireless messages for configuring the router to be measured if the router to be measured is double frequency router
When two frequency ranges be both needed to configure.
Further, the stepper motor is pivotally connected to fixture by machinery.
Further, the socket is fixed on the fixture.
Further, the attaching plug of the router to be measured is fixed on the front of the socket.
Compared with prior art, the present invention has the following advantages that:
(1) present invention using stepper motor realize in the way of mechanical plug replace relay on-off electricity in the way of come pair
Router carries out switching on and shutting down test, can simulate the switching on and shutting down situation that actual user plugs router power supply, constantly can be avoided
Relay electricity, which remains bring, to be influenced, and can verify influence of the big surge current to router, it is easier to be found the problem.
(2) when carrying out switching on and shutting down test to router, not only Ping leads to router to the present invention, also to the nothing of router
Wire module carries out Ping operation, it is ensured that router is in state good for use, and test result is more acurrate.
Detailed description of the invention
Fig. 1 is a kind of router switch machine automated testing method flow chart that embodiment one provides;
Fig. 2 is each component connection signal in testing in the router switch machine automated testing method of the offer of embodiment one
Figure;
Fig. 3 is a kind of router switch machine automatization test system structure chart that embodiment two provides.
Specific embodiment
Illustrate embodiments of the present invention below by way of specific specific example, those skilled in the art can be by this specification
Other advantages and efficacy of the present invention can be easily understood for disclosed content.The present invention can also pass through in addition different specific realities
The mode of applying is embodied or practiced, the various details in this specification can also based on different viewpoints and application, without departing from
Various modifications or alterations are carried out under spirit of the invention.It should be noted that in the absence of conflict, following embodiment and implementation
Feature in example can be combined with each other.
It should be noted that illustrating the basic structure that only the invention is illustrated in a schematic way provided in following embodiment
Think, only shown in schema then with related component in the present invention rather than component count, shape and size when according to actual implementation
Draw, when actual implementation kenel, quantity and the ratio of each component can arbitrarily change for one kind, and its assembly layout kenel
It is likely more complexity.
With the development of internet technology, the terminal device for needing to network is more and more, wireless network due to its have it is larger
Flexibility, also increasingly become the object that people are favored, the purpose of the present invention is for existing to router switching on and shutting down
The technological deficiency of test provides a kind of router switch machine automated testing method and system, using the mode of mechanical plug,
The switching on and shutting down situation that actual user plugs power supply is simulated, is able to verify that influence of the big surge current to router, and verifying
The successful link of router startup increases the process of wireless network card connection, it is ensured that router-module does not have in switching on and shutting down test
It goes wrong.
Embodiment one
The present embodiment provides a kind of router switch machine automated testing methods, as shown in Figure 1, including step:
S11. connection is established with router to be measured;
S12. the DHCP function of the router to be measured is opened, and configures the wireless messages of the router to be measured;
S13. control stepper motor retreats so that socket is separated with the attaching plug of the router to be measured;
S14. it waits a preset time period then to control stepper motor to advance so that the power supply of the router to be measured is inserted
Head insertion socket;
S15. wired network adapter is enabled, wireless network card is disabled, Ping behaviour is carried out to the router to be measured by wired network adapter
Make;
S16. wired network adapter is disabled, wireless network card is enabled, the institute of the router to be measured is separately connected using wireless network card
There is the wireless of frequency range, Ping operation is carried out to the router to be measured by wireless network card;
S17. judge whether testing time reaches default testing time, if so, step S18 is jumped to, if it is not, then jumping to step
Rapid S13;
S18. it is disconnected with the router to be measured.
The router switch machine automated testing method executing subject of the present embodiment is computer.
It should be noted that the computer to router carry out switching on and shutting down test before, be equipped with Gigabit Ethernet and
Double-frequency wireless network interface card.
When router to be measured is tested, the computer described first will establish connection with the router to be measured, tool
The router to be measured is connected to by wired network adapter when the computer of body, when the computer and the router to be measured
After establishing connection, the computer can open the DHCP function of router to be measured, and wired network adapter is allowed successfully to get IP
Address, and the wireless messages of the router to be measured are configured, so that subsequent computer carries out switching on and shutting down test to it.
Further, in the wireless messages for configuring the router to be measured if the router to be measured is double frequency router
When two frequency ranges be both needed to configure.So that the subsequent radio function to two frequency ranges of router to be measured detects.
It should be noted that the router to be measured is energized state, i.e. institute before establishing connection with the computer
The attaching plug for stating router to be measured is inserted in socket.
After computer is the configuration of routers to be measured complete wireless messages, computer can control stepper motor retrogressing, make
It obtains socket to separate with the attaching plug of router to be measured, the router power-off to be measured.Then wait a preset time period right
Computer controls the stepper motor and advances afterwards, so that the attaching plug of the router to be measured is inserted into socket, router to be measured
It is powered.The preset time period is 2 seconds.
Further, the stepper motor is pivotally connected to fixture by machinery.
Further, the socket is fixed on the fixture.
Further, the attaching plug of the router to be measured is fixed on the front of the socket.
Specifically, upper fixture is fixed on the mechanical axis of stepper motor, then by the fixed socket of fixture, then in socket
The fixed router to be measured in front attaching plug, as shown in Fig. 2, for router switch machine provided in this embodiment from
Each component connection schematic diagram in test in dynamicization test method, wherein stepper motor is connect by Serial Port Line with computer, stepping
Motor is used to fix socket by being fixed with fixture, fixture on own mechanical axis, and the socket connects alternating current, before socket just
The attaching plug of the fixed router to be measured in side, can use stepper motor thus to control the forward-reverse of socket, when
Stepper motor will make the attaching plug of router to be measured plug socket (at router i.e. to be measured after proceeding to a certain distance
In open state), socket will be made far from the attaching plug of the router to be measured after stepper motor retreats certain distance
(router i.e. to be measured is in off-mode) so recycles, and can simulate the switching on and shutting down feelings that actual user plugs router power supply
Condition, constantly can be avoided relay electricity residual bring influences, and can verify influence of the big surge current to router,
The problem of more easily finding router to be measured.
It should be noted that the distance that the stepper motor moves forward and backward is by the socket and the routing to be measured
Device attaching plug is arranged apart from size, and is controlled by computer programming the stepper motor.
After computer-controlled stepper motor advances so that the attaching plug of the router to be measured is inserted into socket, institute at this time
Stating router to be measured is open state, and computer can enable wired network adapter first, disables wireless network card, then passes through wired network adapter
Ping operation is carried out to the router to be measured, Ping operation is carried out to router to be measured by wired network adapter, if being capable of Ping
It is logical, then show that the wired connection of router to be measured is unimpeded, the LAN mouth mold block of router to be measured has restarted success;If cannot
Ping is logical, then shows that the wired connection of router to be measured is not smooth, then router wired module to be measured may power at this time
It goes wrong in the process, but occurs the case where losing wired configuration or image file damage, routing to be measured in power up
The LAN mouth mold block of device does not restart success.
After the wired module for having detected router to be measured, computer will disable wired network adapter, enable wireless network card, use
Wireless network card is separately connected the wireless of all frequency ranges of router to be measured, is then carried out by wireless network card to router to be measured
Ping operation, if all frequency ranges can Ping it is logical, show that the wireless connection of all frequency ranges of router to be measured is unimpeded, it is to be measured
The wireless module of router has restarted success;If not all frequency range can Ping it is logical, show that router to be measured has
The wireless connection of a little frequency ranges is not smooth, then the wireless module of router to be measured may go wrong in power up at this time,
May occur the case where losing radio configuration in power up, the wireless module of router to be measured does not restart success.
In the present invention, the LAN mouth mold block of router only to be measured and wireless module all restart success, just guarantee road to be measured
It is successful when restarting by device, it is ensured that router is in state good for use, test result is more acurrate.
After the wireless module for having detected router to be measured, computer just judges time treated and survey the test of router switch machine
Whether number reaches default test test, specifically, computer can by the number that the calculating stepper motor moves forward and backward
Know that, if not reaching preset testing time, computer is just to the testing time of the router switch machine to be measured
Step S13 to step S16 can be repeated, until reaching default testing time to router switch machine testing time to be measured, when
Reach default testing time, computer will be disconnected with the router to be measured, test result.
It should be noted that the default testing time is wanted according to the number of the switching on and shutting down of the router to be measured test
It asks to set.
The present embodiment uses the mode of mechanical plug, and simulation actual user plugs the switching on and shutting down situation of power supply, is able to verify that
Big influence of the surge current to router, and in the verifying successful link of router startup, increase the mistake of wireless network card connection
Journey, it is ensured that router-module does not go wrong in switching on and shutting down test.
Embodiment two
The present embodiment provides a kind of router switch machine automatization test systems, as shown in figure 3, including:
Link block 11, for establishing connection with router to be measured;
Configuration module 12 for opening the DHCP function of the router to be measured, and configures the nothing of the router to be measured
Line information;
First control module 13 retreats the attaching plug so that socket and the router to be measured for controlling stepper motor
Separation;
Second control module 14, for waiting control stepping after a preset time period electric after stepper motor retrogressing
Machine advances so that the attaching plug of the router to be measured is inserted into socket;
First Ping operation module 15 disables wireless network card for enabling wired network adapter, by wired network adapter to it is described to
It surveys router and carries out Ping operation;
2nd Ping operation module 16 is enabled wireless network card, is separately connected using wireless network card for disabling wired network adapter
All frequency ranges of the router to be measured it is wireless, Ping operation is carried out to the router to be measured by wireless network card;
Judgment module 17, for judging whether testing time reaches default testing time;
Module 18 is disconnected, is connected for being disconnected when testing time reaches default testing time with the router to be measured
It connects.
The function of the modules of the router switch machine automatization test system of the present embodiment is all integrated in computer,
The achievable fast shutdown to router to be measured of the computer is tested.
It should be noted that the computer to router carry out switching on and shutting down test before, be equipped with Gigabit Ethernet and
Double-frequency wireless network interface card.
When router to be measured is tested, the computer described first will establish connection with the router to be measured, tool
The router to be measured is connected to by wired network adapter when the computer of body, when the computer and the router to be measured
After establishing connection, the computer can open the DHCP function of router to be measured, and wired network adapter is allowed successfully to get IP
Address, and the wireless messages of the router to be measured are configured, so that subsequent computer carries out switching on and shutting down test to it.
Further, in the wireless messages for configuring the router to be measured if the router to be measured is double frequency router
When two frequency ranges be both needed to configure.So that the subsequent radio function to two frequency ranges of router to be measured detects.
It should be noted that the router to be measured is energized state, i.e. institute before establishing connection with the computer
The attaching plug for stating router to be measured is inserted in socket.
After computer is the configuration of routers to be measured complete wireless messages, computer can control stepper motor retrogressing, make
It obtains socket to separate with the attaching plug of router to be measured, the router power-off to be measured.Then wait a preset time period right
Computer controls the stepper motor and advances afterwards, so that the attaching plug of the router to be measured is inserted into socket, router to be measured
It is powered.The preset time period is 2 seconds.
Further, the stepper motor is pivotally connected to fixture by machinery.
Further, the socket is fixed on the fixture.
Further, the attaching plug of the router to be measured is fixed on the front of the socket.
Specifically, upper fixture is fixed on the mechanical axis of stepper motor, then by the fixed socket of fixture, then in socket
The fixed router to be measured in front attaching plug, after thus can use advance of the stepper motor to control socket
It moves back, the attaching plug of router to be measured will be made to plug socket (road i.e. to be measured after stepper motor proceeds to a certain distance
Open state is in by device), socket will be made far from the electricity of the router to be measured after stepper motor retreats certain distance
Source plug (router i.e. to be measured is in off-mode) so recycles, and can simulate actual user and plug opening for router power supply
Power down condition, constantly can be avoided relay electricity residual bring influences, and can verify big surge current to router
Influence, it is easier to the problem of finding router to be measured.
It should be noted that the distance that the stepper motor moves forward and backward is by the socket and the routing to be measured
Device attaching plug is arranged apart from size, and is controlled by computer programming the stepper motor.
After computer-controlled stepper motor advances so that the attaching plug of the router to be measured is inserted into socket, institute at this time
Stating router to be measured is open state, and computer can enable wired network adapter first, disables wireless network card, then passes through wired network adapter
Ping operation is carried out to the router to be measured, Ping operation is carried out to router to be measured by wired network adapter, if being capable of Ping
It is logical, then show that the wired connection of router to be measured is unimpeded, the LAN mouth mold block of router to be measured has restarted success;If cannot
Ping is logical, then shows that the wired connection of router to be measured is not smooth, then router wired module to be measured may power at this time
It goes wrong in the process, but occurs the case where losing wired configuration or image file damage, routing to be measured in power up
The LAN mouth mold block of device does not restart success.
After the wired module for having detected router to be measured, computer will disable wired network adapter, enable wireless network card, use
Wireless network card is separately connected the wireless of all frequency ranges of router to be measured, is then carried out by wireless network card to router to be measured
Ping operation, if all frequency ranges can Ping it is logical, show that the wireless connection of all frequency ranges of router to be measured is unimpeded, it is to be measured
The wireless module of router has restarted success;If not all frequency range can Ping it is logical, show that router to be measured has
The wireless connection of a little frequency ranges is not smooth, then the wireless module of router to be measured may go wrong in power up at this time,
May occur the case where losing radio configuration in power up, the wireless module of router to be measured does not restart success.
In the present invention, the LAN mouth mold block of router only to be measured and wireless module all restart success, just guarantee road to be measured
It is successful when restarting by device, it is ensured that router is in state good for use, test result is more acurrate.
After the wireless module for having detected router to be measured, computer just judges time treated and survey the test of router switch machine
Whether number reaches default test test, specifically, computer can by the number that the calculating stepper motor moves forward and backward
Know that, if not reaching preset testing time, computer is just to the testing time of the router switch machine to be measured
Step S13 to step S16 can be repeated, until reaching default testing time to router switch machine testing time to be measured, when
Reach default testing time, computer will be disconnected with the router to be measured, test result.
It should be noted that the default testing time is wanted according to the number of the switching on and shutting down of the router to be measured test
It asks to set.
The present embodiment using stepper motor realize in the way of mechanical plug replace relay on-off electricity in the way of come pair
Router carries out switching on and shutting down test, can simulate the switching on and shutting down situation that actual user plugs router power supply, constantly can be avoided
Relay electricity, which remains bring, to be influenced, and can verify influence of the big surge current to router, it is easier to it finds the problem,
And not only Ping leads to router when carrying out switching on and shutting down test to router, also carries out Ping behaviour to the wireless module of router
Make, it is ensured that router is in state good for use, and test result is more acurrate.
Note that the above is only a better embodiment of the present invention and the applied technical principle.It will be appreciated by those skilled in the art that
The invention is not limited to the specific embodiments described herein, be able to carry out for a person skilled in the art it is various it is apparent variation,
It readjusts and substitutes without departing from protection scope of the present invention.Therefore, although being carried out by above embodiments to the present invention
It is described in further detail, but the present invention is not limited to the above embodiments only, without departing from the inventive concept, also
It may include more other equivalent embodiments, and the scope of the invention is determined by the scope of the appended claims.