A kind of wireless router cloud service functional interface method of testing and system
Technical field
The present invention relates to wireless router technical field, more particularly to a kind of wireless router cloud service functional interface to test
Method and system.
Background technology
Intelligent wireless router gradually increases at present, while it needs and the function of Cloud Server interaction is also more and more,
And in order to ensure the stability of final products function, it is necessary to be tested its functional interface in advance comprehensively.
, often can not integrity authentication institute in test router and Cloud Server interactive interface but Cloud Server configuration is complicated
There are interface parameters and abnormal network environment.Wireless router is tested mainly by following several with Cloud Server interactive interface at present
Mode is realized:1st, Cloud Server functional configuration item is changed;2nd, request and response report are checked in router WAN (wide area network) mouth packet capturing
Text;3rd, the increase Cloud Server response delay of Cloud Server bandwidth is reduced.
And above-mentioned method of testing is clearly present of following point:1st, each interface parameters test is required to change Cloud Server
Configuration, and easily influence the normal function of other routers;2nd, router solicitation message, efficiency can only be obtained by packet capturing mode
Lowly, while difficulty is debugged;3rd, can not accurate analog network length of delay.
And for example Application No. CN201410238125.8 patent application discloses a kind of test Cloud Server registering functional
Method, this method comprises the following steps:The module of giving out a contract for a project of first computer receives the note in the packet capturing module of second computer
Volume message, and the logon message is sent to described Cloud Server;Cloud Server checks whether the logon message meets the requirements,
When meeting, the part registration parameter in the first computer change logon message, and the logon message after change is sent to the cloud
In server;Cloud Server obtains the logon message, and checks whether the logon message meets the requirements, and when meeting, returns to first
Computer display " succeeds in registration ";When not meeting, the first Computer display " registration failure " is returned.This method can improve test
Efficiency, R&D costs are reduced, shorten the testing time, improve the reliability of server.
The above method still needs the packet capturing by Cloud Server come simulated implementation by taking specific registering functional as an example
Interaction, one side testing efficiency is low, on the other hand debugs difficult.
The content of the invention
The invention aims to solve the above-mentioned problems of the prior art, there is provided a kind of wireless router cloud service
Functional interface method of testing, it can efficiently complete the test to wireless router cloud service functional interface, while be easy to adjust
Examination.
The purpose of the present invention is achieved through the following technical solutions:
A kind of wireless router cloud service functional interface method of testing, comprises the following steps:
Step 1, wireless router is to interface test device transmission interface request message;
Step 2, interface response message corresponding to the interface test device to wireless router transmission.
Preferably, the step 2 specifically includes:
If the interface test device record has the interface response message of the corresponding interface requests message, directly to institute
State wireless router and send the interface response message;
If the interface test device does not record the interface response message of the corresponding interface requests message, connect described
Mouth request message is transmitted to Cloud Server, and the interface response message that the Cloud Server is beamed back is transmitted into the wireless routing
Device, while recorded.
If preferably, the interface requests message for encryption that the wireless router is sent, the interface testing dress
Put after the interface requests message of the encryption is received, it is decrypted;And before transmission interface response message, to described
Interface response message is encrypted.
Preferably, the step 2 also includes:The interface test device is preserved the interface requests message,
If the interface requests message is encrypted message, preserved again after it is decrypted.
The present invention also provides wireless router cloud service functional interface test system, including wireless router, interface testing
Device;The wireless router is to the interface test device transmission interface request message, and the interface test device is to described
Interface response message corresponding to wireless router transmission.
Preferably, also including Cloud Server, the interface test device connects the wireless router and Cloud Server;
When the interface test device receives new interface requests message, the new interface requests message is transmitted to the cloud
Server, and the interface response message that the Cloud Server is beamed back is sent to the wireless router.
Preferably, the interface test device includes:
Packet forwarding module, receives the interface requests message that the wireless router is sent, and to the wireless router
Interface response message corresponding to transmission;And new interface requests message is forwarded to the Cloud Server, and receive the cloud
The interface response message that server is sent;
Message accounting module, record different interface requests messages and its corresponding interface response message;
Message encryption/decryption module, the interface requests message of encryption is decrypted, while pair please with the interface of the encryption
Interface response message corresponding to message is asked to be encrypted.
Preferably, the interface test device also includes:
Message preserving module, preserve all interface requests messages.
Preferably, being provided with setting unit in the packet forwarding module, the setting unit is used to set Forwarding Delay.
Preferably, the interface test device also includes:
Domain name mapping module, by the domain name mapping of the Cloud Server to the interface test device.
It is an advantage of the invention that:
1st, Cloud Server configuration need not be changed, does not influence the test of other routers;Cloud is simulated by the interface test device
Server is responded, and Cloud Server configuration need not be changed during test, does not interfere with the cloud function test of other routers.
2nd, advance typing interface response message is not needed;The system can automatically learn and record new interface, there is new interface survey
During examination, Cloud Server is forwarded the request to automatically, and records this time interaction, and modification interface requests message parameter, which can test, newly to be connect
Mouthful.
3rd, interface requests message is automatically saved, is debugged without packet capturing;The interface test device can automatically save router hair
The interface requests message sent, Convenient interface checking and debugging.
4th, operating lag can be changed, it is convenient to simulate different network environments;The interface test device can be rung with self defined interface
Between seasonable, the accurate message interaction simulated under different network environments.
Brief description of the drawings
Fig. 1 is the flow chart of the inventive method embodiment 1;
Fig. 2 is a kind of schematic diagram of embodiment of test system of the present invention;
Fig. 3 is a kind of schematic diagram of embodiment of interface test device of the present invention.
Embodiment
Below in conjunction with the drawings and specific embodiments, the present invention is described in further detail.
Embodiment 1
A kind of wireless router cloud service functional interface method of testing, comprises the following steps:
Step 1, wireless router is to interface test device transmission interface request message;
Step 2, interface response message corresponding to the interface test device to wireless router transmission.
This method is interacted by wireless router and interface test device, comes simulation test wireless router and cloud service
The interaction of device, and specific interaction is simulated by interface requests message and interface response message.The efficiency high of test,
The participation of Cloud Server can be reduced as far as simultaneously, to avoid the influence to Cloud Server and other wireless routers are surveyed
The influence of examination.
Wherein, interface response message corresponding to the interface test device described in step 2 to wireless router transmission
Implementation can have it is a variety of, below by taking specific two kinds of implementations as an example.
A kind of relatively simple implementation is:Before testing, in the corresponding generation of setting in the interface test device
The parameter of interface response message, make it when receiving interface requests message, can be according to the parameter next life of interface requests message
Into corresponding interface response message.Also, its specific sets can be adjusted according to test needs, be taken with simulating different clouds
Business device or different network environments etc..
Intervention of the above method without Cloud Server, whole test structure are more simple, it is entirely avoided to Cloud Server
Influence.But the relative efficiency that can reduce integrated testability of the process of its arrange parameter or adjusting parameter, and set by guarantee
The difficulty of the accuracy of parameter is higher, easily occurs and the deviation of actual conditions, the i.e. accuracy of test result are relatively difficult to ensure card.
Another implementation is:Cloud Server is intervened, allows Cloud Server to participate in every kind of different types of functional interface
Test once, and makes interface test device record interaction, specifically includes interface requests message and its corresponding interface rings
Answer message.And when the functional interface test for having same type afterwards (being probably identical or different parameter information), can not
By Cloud Server, and interface response message is directly generated according to the interaction of record.
Although the above method needs the intervention of Cloud Server, but Cloud Server does not have to participate in test each time, and only
It is just to need to participate in once when there is new functional interface test, therefore excessive shadow will not be caused to Cloud Server and its function
Ring.In addition, it is more accurate by the test result of this method, because being the equal of that interface test device has learnt Cloud Server pair
In the response of difference in functionality interface requests.
Embodiment 2
Step 2 specifically includes described in embodiment 1:
If the interface test device record has the interface response message of the corresponding interface requests message, directly to institute
State wireless router and send the interface response message;
If the interface test device does not record the interface response message of the corresponding interface requests message, connect described
Mouth request message is transmitted to Cloud Server, and the interface response message that the Cloud Server is beamed back is transmitted into the wireless routing
Device, while recorded.
The above-mentioned a kind of method for generating interface response message for specific interface test device, each type functional interface
Transmitted interface requests message is tested for the first time, it is necessary to first be forwarded to Cloud Server, and then Cloud Server please according to the interface
Interface response message corresponding to message generation is sought, and sends back to interface test device, interface test device again responds the interface
Message is transmitted to wireless router.Meanwhile interface test device records the interaction, specifically ensure the interface requests report
Text message corresponding with interface.And when the functional interface test for having this type again afterwards (identical or different parameters), with regard to nothing
The interface requests message that wireless router sends over need to be transmitted to Cloud Server again, can be directly according to the interaction of record
Process is transmitted directly to wireless router come interface response message corresponding to generating.
This method generates the process of interface response message, the essence of test by interface test device learning simulation Cloud Server
Exactness is high, while participates in each test process without Cloud Server, to reduce the influence to Cloud Server normal function as far as possible.
If the interface requests message for encryption that the wireless router is sent, the interface test device are receiving
After the interface requests message of the encryption, it is decrypted;And before transmission interface response message, the interface is responded and reported
Text is encrypted.
Certainly, in test also can include encryption interface testing, therefore when receiving the interface requests message of encryption, it is necessary to
First it is decrypted, then could judge the interface with the presence or absence of record, if in the presence of, interface response message is directly generated,
And it is then forwarded to wireless router after it is encrypted;If being not present, need to forward the interface requests message after decryption
To Cloud Server, the interface response message then beamed back to Cloud Server is encrypted, is then forwarded to wireless router, remembers simultaneously
Interface requests message and interface response message under the lower decrypted state of record.
The step 2 also includes:The interface test device is preserved the interface requests message, if the interface
Request message is encrypted message, then is preserved again after it being decrypted.
Interface checking and debugging of the aforesaid operations in order to facilitate after, are debugged with avoiding passing through packet capturing, Gu will be all
Decrypted state under interface requests message preserved.
The present invention also provides a kind of wireless router cloud service functional interface test system, including wireless router, interface
Test device;The wireless router to the interface test device transmission interface request message, the interface test device to
Interface response message corresponding to the wireless router transmission.
The system is interacted by wireless router and interface test device, comes simulation test wireless router and cloud service
The interaction of device, and specific interaction is simulated by interface requests message and interface response message.The efficiency high of test,
The participation of Cloud Server can be reduced as far as simultaneously, to avoid the influence to Cloud Server and other wireless routers are surveyed
The influence of examination.
Certainly, the reality of interface response message corresponding to the specific interface test device to wireless router transmission
Existing mode can have a variety of.For example before testing, interface response message is generated accordingly in being set in the interface test device
Parameter, it is generated corresponding interface according to the parameter of interface requests message when receiving interface requests message
Response message.Also, its specific sets can be adjusted according to test needs, to simulate different Cloud Servers or difference
Network environment etc..Intervention of this method without Cloud Server, whole test structure are more simple, it is entirely avoided to cloud service
The influence of device.But the relative efficiency that can reduce integrated testability of the process of its arrange parameter or adjusting parameter, and set by guarantee
Put that the difficulty of the accuracy of parameter is higher, easily occur and the deviation of actual conditions, the i.e. accuracy of test result are relatively difficult to ensure card.
Cloud Server and for example is intervened, allows Cloud Server to participate in every kind of different types of functional interface test once, and make
Interface test device records interaction, specifically includes interface requests message and its corresponding interface response message.And work as it
Have afterwards same type functional interface test when (being probably identical or different parameter information), can not by Cloud Server,
And interface response message is directly generated according to the interaction of record.Although this method needs the intervention of Cloud Server, still
Cloud Server does not have to participate in test each time, and simply just needs to participate in once when there is new functional interface test, therefore not
Excessive influence can be caused to Cloud Server and its function.In addition, it is more accurate by the test result of this method, because quite
Then interface test device has learnt response of the Cloud Server for difference in functionality interface requests.
The test system also includes Cloud Server, and the interface test device connects the wireless router and cloud service
Device;When the interface test device receives new interface requests message, the new interface requests message is transmitted to institute
Cloud Server is stated, and the interface response message that the Cloud Server is beamed back is sent to the wireless router.
Cloud Server is introduced, to improve the test mode, and improves the accuracy of test.In practice, each type
The first time of functional interface tests transmitted interface requests message, it is necessary to first be forwarded to Cloud Server, then Cloud Server root
According to interface response message corresponding to interface requests message generation, and interface test device is sent back to, interface test device again will
The interface response message is transmitted to wireless router.Meanwhile interface test device records the interaction, described in specific guarantee
Interface requests message and the corresponding message of interface.It is and (identical or different when the functional interface test for having this type again afterwards
Parameter), can direct basis just without the interface requests message that wireless router sends over is transmitted into Cloud Server again
The interaction of record is transmitted directly to wireless router come interface response message corresponding to generating.
The interface test device includes:
Packet forwarding module, receives the interface requests message that the wireless router is sent, and to the wireless router
Interface response message corresponding to transmission;And new interface requests message is forwarded to the Cloud Server, and receive the cloud
The interface response message that server is sent;
Message accounting module, record different interface requests messages and its corresponding interface response message;
Message encryption/decryption module, the interface requests message of encryption is decrypted, while pair please with the interface of the encryption
Interface response message corresponding to message is asked to be encrypted.
In practice, wireless router sends interface requests message to packet forwarding module, if encrypted message, then
Message encryption/decryption module is first passed through to be decrypted.Then message accounting module is searched for, judges whether that the interface of the type please
Seek the intersection record of message:
If there is record, directly according to intersection record, interface response message corresponding to generation, and pass through packet forwarding module
The interface response message is sent to wireless router;If the interface requests message for encryption received, needs to pass through
Message encryption/decryption module docking port response message is then forwarded to wireless router after being encrypted.
If not recording, need that the interface requests message is transmitted into Cloud Server by packet forwarding module, so
Corresponding interface response message is sent back to packet forwarding module by Cloud Server afterwards, and then packet forwarding module rings the interface
Answer message to be transmitted to wireless router, while this interactive interface requests message and interface is recorded by message accounting module
Response message.Likewise, if the interface requests message for encryption received, needs by message encryption/decryption module docking port
Response message is then forwarded to wireless router after being encrypted.
The interface test device also includes:
Message preserving module, preserve all interface requests messages.
The message preserving module is preserved all interface requests messages, in order to interface checking afterwards and is adjusted
Examination, avoid carrying out packet capturing operation, so as to be greatly enhanced testing efficiency.
Setting unit is provided with the packet forwarding module, the setting unit is used to set Forwarding Delay.
The setting unit can customize the interface corresponding time, accurately to simulate the friendship of the message of different network environments
Mutually.
The interface test device also includes:
Domain name mapping module, by the domain name mapping of the Cloud Server to the interface test device.
Domain name parsing module is used for the domain name request for receiving wireless router, and replys the domain name request, by cloud
Server domain name resolves to the address of interface test device.
To sum up, flow of this test system in practice is as follows:
A. wireless router sends domain name request, finds the domain name mapping of Cloud Server;
B. domain name mapping module replys the domain name request, and is interface test device address by Cloud Server domain name mapping;
C. wireless router transmission interface request message is to packet forwarding module, and packet forwarding module is by this interface requests report
Text is sent to message accounting module;If encrypted message, then need first after the decryption of message encryption/decryption module, then by this interface
Request message is sent to message accounting module;
D. message accounting module searches whether the interface has corresponding intersection record, if so, then directly according to the record
Interface response message corresponding to generation, the interface response message is then sent to forwarding module, is sent to by forwarding module
Wireless router;If encrypted message, then need after being encrypted by message encryption/decryption module to the interface response message, then send
To wireless router;
E. as in the case of d, this request is forwarded to by the interface without corresponding intersection record, then notice message forwarding module
Cloud Server;
F. in the case of e, after packet forwarding module receives the interface response message of Cloud Server, the interface is responded and reported
Text is transmitted to wireless router, and is reported the interface requests message in this interaction and interface response by message accounting module
Text record;If encrypted message, then need after being encrypted by message encryption/decryption module to the interface response message, then give nothing
Line router;
G. during d-f, total interface request message is stored in message preserving module, such as interface requests during being somebody's turn to do
Message is encrypted message, then needs to preserve after decrypting by message encryption/decryption module.
Specific embodiment described herein is only to spirit explanation for example of the invention.Technology belonging to the present invention is led
The technical staff in domain can be made various modifications or supplement to described specific embodiment or be replaced using similar mode
Generation, but without departing from the spiritual of the present invention or surmount scope defined in appended claims.