The content of the invention
It is an object of the invention to provide a kind of method of asynchronous interface test, test terminal and system, it is intended to realization pair
The test of asynchronous HTTP callback interfaces, improves the security for the personal information that unified utilization and management are carried out based on crawler technology.
To achieve the above object, the present invention provides a kind of method of asynchronous interface test, the side of the asynchronous interface test
Method includes:
S1, test terminal sends predetermined HTTP request one by one to asynchronous HTTP callback interfaces equipment to be measured;
S2, each HTTP request of the service terminal reception asynchronous HTTP callback interfaces equipment transmission is corresponding to be returned
HTTP data, and the return HTTP data are sent to the test terminal;
S3, the test terminal obtains the standard HTTP data corresponding with the HTTP request prestored, according to what is received
Return to HTTP data and the standard HTTP data are tested the asynchronous HTTP callback interfaces.
Preferably, the step S1 includes:
S11, the test terminal sends first predetermined HTTP request to asynchronous HTTP callback interfaces equipment to be measured
Afterwards, the corresponding response message of first predetermined HTTP request that the asynchronous HTTP callback interfaces equipment is returned is received;
S12, if the response message is asks successful information, sends to asynchronous HTTP callback interfaces equipment to be measured
Next predetermined HTTP request.
Preferably, the step S12 further comprises:
If the response message analyzes in the successful information of request whether include keyword to ask successful information
Segment information;
Whether if including critical field information in the successful information of request, it is pre- to analyze the critical field information
Fixed field information, if predetermined field information, then sends next predetermined to asynchronous HTTP callback interfaces equipment to be measured
HTTP request.
Preferably, the step S3 includes:
The return HTTP data received are compared S31, the test terminal with corresponding standard HTTP data;
S32, if having the return HTTP data and corresponding standard HTTP data inconsistent, generates the survey of test crash
Test result information;
S33, if all return HTTP data are consistent with corresponding standard HTTP data, generation is successfully tested
Test result information.
Preferably, also include after the step S2:
S4, the service terminal enters line discipline computing to the return HTTP data based on predetermined data rule, and will
Return HTTP data storages after regular computing are into predetermined third party's safety database.
To achieve the above object, the present invention also provides a kind of method testing end tested based on above-mentioned asynchronous interface
End, the test terminal includes:
Sending module, for sending predetermined HTTP request one by one to asynchronous HTTP callback interfaces equipment to be measured;
Test module, each HTTP for receiving the asynchronous HTTP callback interfaces equipment transmission in service terminal please
Seek corresponding return HTTP data, and the return HTTP data be sent to after the test terminal, obtain prestore with this
The corresponding standard HTTP data of HTTP request, according to the return HTTP data and the standard HTTP data received to described different
Step HTTP callback interfaces are tested.
Preferably, the sending module makes a reservation for specifically for sending first to asynchronous HTTP callback interfaces equipment to be measured
HTTP request after, receive first predetermined HTTP request that the asynchronous HTTP callback interfaces equipment returns corresponding
Response message;If the response message is asks successful information, under being sent to asynchronous HTTP callback interfaces equipment to be measured
One predetermined HTTP request.
Preferably, if the sending module is further used for the response message to ask successful information, analysis is described
Ask whether include critical field information in successful information;If including critical field information in the successful information of request,
Whether be predetermined field information, if predetermined field information if then analyzing the critical field information, then to be measured asynchronous
HTTP callback interfaces equipment sends next predetermined HTTP request.
Preferably, the test module is specifically for the return HTTP data and corresponding standard HTTP data that will be received
It is compared;If having the return HTTP data and corresponding standard HTTP data inconsistent, the test of test crash is generated
Object information;If all return HTTP data are consistent with corresponding standard HTTP data, what generation was successfully tested
Test result information.
To achieve the above object, the present invention also provides a kind of system of asynchronous interface test, the asynchronous interface test
System includes service terminal and above-mentioned test terminal, and the service terminal is used to receive the asynchronous HTTP callback interfaces equipment
Corresponding the returns HTTP data of each HTTP request sent, and the returns HTTP data are sent to described test end
End.
The beneficial effects of the invention are as follows:The present invention sends HTTP from test terminal to asynchronous HTTP callback interfaces equipment please
Ask, asynchronous HTTP callback interfaces send it to service terminal after the corresponding return HTTP data of the HTTP request are got,
So that return HTTP data can be sent to test terminal by service terminal, test terminal is based on return HTTP data and mark
Quasi- HTTP data are tested asynchronous HTTP callback interfaces, realize the test to asynchronous HTTP callback interfaces, are improved and are based on climbing
Worm technology carries out the security of the personal information of unified utilization and management.
Embodiment
The principle and feature of the present invention are described below in conjunction with accompanying drawing, the given examples are served only to explain the present invention, and
It is non-to be used to limit the scope of the present invention.
As shown in figure 1, Fig. 1 is the schematic flow sheet of the embodiment of method one of asynchronous interface of the present invention test, this is asynchronous to connect
The method of mouth test comprises the following steps:
Step S1, test terminal sends predetermined HTTP request one by one to asynchronous HTTP callback interfaces equipment to be measured;
In the present embodiment, test terminal can be that mobile phone, computer, tablet personal computer, personal digital assistant etc. are any suitable
Electronic equipment.For asynchronous HTTP callback interfaces to be tested, test terminal sends predetermined HTTP request to it one by one, should
Predetermined HTTP request be prestore in HTTP request for test, test terminal this be used for test HTTP request it is corresponding
Standard HTTP data, or can be got by other approach this be used for test the corresponding standard HTTP numbers of HTTP request
According to.Such as HTTP request for being used to test is the request of a certain webpage of acquisition request or picture resource, then corresponding standard
HTTP data are the data of the webpage or picture resource.
Wherein, sent in test terminal to asynchronous HTTP callback interfaces equipment to be measured after predetermined HTTP request, this is different
Step HTTP callback interfaces can make an immediate response, and return to request success or failure information and give test terminal, at this moment the HTTP request and
Corresponding response process terminates, but really the effective corresponding data of the HTTP request, it is necessary to a period of time predetermined processing
The Http interface IP addresses specified can be just returned to afterwards, that is, are tested terminal and received the response message of request success or failure information
Afterwards, it is necessary to which a period of time can just receive the corresponding data of the HTTP request.
Step S2, each HTTP request that service terminal receives the asynchronous HTTP callback interfaces equipment transmission is corresponding
HTTP data are returned, and the return HTTP data are sent to the test terminal;
In the present embodiment, asynchronous HTTP callback interfaces equipment is obtained after the HTTP request that test terminal is sent is received
Then return HTTP data are sent to service terminal by the corresponding return HTTP data of the HTTP request, specifically, asynchronous
Return HTTP data are sent to the predetermined corresponding service terminal in Http addresss of service, the service by HTTP callback interfaces equipment
Terminal for example can be HTTP server.
In order that the corresponding return of HTTP request that terminal can obtain obtaining through asynchronous HTTP callback interfaces must be tested
Return HTTP data are sent to test terminal by HTTP data, the service terminal, so that test terminal is based on return HTTP
Data are tested.
Step S3, the test terminal obtains the standard HTTP data corresponding with the HTTP request prestored, according to being connect
The return HTTP data of receipts and the standard HTTP data are tested the asynchronous HTTP callback interfaces.
In the present embodiment, the corresponding standard HTTP data of above-mentioned HTTP request are previously stored with test terminal, or
The corresponding standard HTTP data of the HTTP request are obtained from other equipment by way of network service.Receiving service eventually
Hold after the return HTTP data sent, asynchronous HTTP is adjusted back based on the return HTTP data and standard HTTP data received
Interface is tested.
Specific test process can judge whether return HTTP data and standard HTTP data are identical, if both phases
It is same then be successfully tested, the corresponding information that is successfully tested is generated so that tester checks, if test crash, similarly generates correspondence
Test crash information, to remind tester.
Compared with prior art, the present embodiment sends HTTP request from test terminal to asynchronous HTTP callback interfaces equipment,
Asynchronous HTTP callback interfaces send it to service terminal after the corresponding return HTTP data of the HTTP request are got, with
Just return HTTP data can be sent to test terminal by service terminal, and test terminal is based on return HTTP data and standard
HTTP data are tested asynchronous HTTP callback interfaces, realize the test to asynchronous HTTP callback interfaces, are improved and are based on reptile
Technology carries out the security of the personal information of unified utilization and management.
In a preferred embodiment, as shown in Fig. 2 on the basis of above-mentioned Fig. 1 embodiment, the step S1 bags
Include:
S11, the test terminal sends first predetermined HTTP request to asynchronous HTTP callback interfaces equipment to be measured
Afterwards, the corresponding response message of first predetermined HTTP request that the asynchronous HTTP callback interfaces equipment is returned is received;
S12, if the response message is asks successful information, sends to asynchronous HTTP callback interfaces equipment to be measured
Next predetermined HTTP request.
In the present embodiment, test terminal sends first predetermined HTTP to asynchronous HTTP callback interfaces equipment to be measured please
After asking, asynchronous HTTP callback interfaces return to corresponding response message to it, if the response message is asks successful information,
Then test terminal can continue to send next HTTP request to asynchronous HTTP callback interfaces equipment, then receive asynchronous HTTP and return
The corresponding response message of the next HTTP request that interface equipment is returned is adjusted, by that analogy, HTTP request is sent one by one, until
All predetermined HTTP requests have been sent to asynchronous HTTP callback interfaces equipment.
If the response message is the information of request failure, the prompting message of test terminal generation HTTP request failure,
So that tester makes the processing of correlation in time.
Preferably, if whether above-mentioned response message is analyzed and wrapped in the successful information of the request to ask successful information
Information containing critical field, the critical field information for example can be to characterize asynchronous HTTP callback interfaces equipment to only exist in test mode
Rather than in running order information, to prevent asynchronous HTTP callback interfaces equipment due to being produced easily in different states
The information obscured;If asking to include critical field information in successful information, whether analysis of key field information is predetermined
Field information, for example, analyze the information that the critical field information only exists in test mode for asynchronous HTTP callback interfaces equipment, if
For predetermined field information, then next predetermined HTTP request is sent to asynchronous HTTP callback interfaces equipment to be measured, then
The corresponding response message of the next HTTP request for receiving that asynchronous HTTP callback interfaces equipment returns, by that analogy, one by one
HTTP request is sent, until all predetermined HTTP requests have been sent to asynchronous HTTP callback interfaces equipment;If above-mentioned
Ask not including critical field information in successful information, then generate prompting message, so that tester makes correlation in time
Processing, and no longer send HTTP request to asynchronous HTTP callback interfaces equipment to be measured.
In a preferred embodiment, as shown in figure 3, on the basis of above-mentioned Fig. 1 embodiment, the step S3 bags
Include:
The return HTTP data received are compared S31, the test terminal with corresponding standard HTTP data;
S32, if having the return HTTP data and corresponding standard HTTP data inconsistent, generates the survey of test crash
Test result information;
S33, if all return HTTP data are consistent with corresponding standard HTTP data, generation is successfully tested
Test result information.
In the present embodiment, in test terminal according to the return HTTP data and the standard HTTP data received to described
When asynchronous HTTP callback interfaces are tested, each return HTTP data are compared with corresponding standard HTTP data, for example,
X1 asks corresponding return HTTP data to be Y1, and X2 asks corresponding return HTTP data to be Y2;X1 asks corresponding standard
HTTP data are Z1, and X2 asks corresponding standard HTTP data to be Z2;Then Y1 is compared with Z1, Y2 and Z2 is compared
Right, if Y1 is consistent with Z1, and Y2 is consistent with Z2, then is successfully tested, and generates the test result being successfully tested, if returning
HTTP data and corresponding standard HTTP data are inconsistent, then test crash, generate the test result of test crash.
In a preferred embodiment, as shown in figure 4, on the basis of above-mentioned Fig. 1 embodiment, after the step S2
Also include:
S4, the service terminal enters line discipline computing to the return HTTP data based on predetermined data rule, and will
Return HTTP data storages after regular computing are into predetermined third party's safety database.
In the present embodiment, line discipline computing can be entered to returning to HTTP data based on predetermined data rule, for example, to returning
Return HTTP data and computing is encrypted, or computing etc. is encrypted again to returning after HTTP data are compressed, wherein, encryption
Algorithm such as can be using symmetric encipherment algorithm or other AESs.Then by the return HTTP after regular computing
Data storage is for example preserved into independent third party's safety database into predetermined third party's safety database.
As shown in figure 5, the embodiment of method testing terminal one that Fig. 5 is tested for the present invention based on above-mentioned asynchronous interface
Structural representation, the test terminal includes:
Sending module 101, for sending predetermined HTTP request one by one to asynchronous HTTP callback interfaces equipment to be measured;
In the present embodiment, test terminal can be that mobile phone, computer, tablet personal computer, personal digital assistant etc. are any suitable
Electronic equipment.For asynchronous HTTP callback interfaces to be tested, test terminal sends predetermined HTTP request to it one by one, should
Predetermined HTTP request be prestore in HTTP request for test, test terminal this be used for test HTTP request it is corresponding
Standard HTTP data, or can be got by other approach this be used for test the corresponding standard HTTP numbers of HTTP request
According to.Such as HTTP request for being used to test is the request of a certain webpage of acquisition request or picture resource, then corresponding standard
HTTP data are the data of the webpage or picture resource.
Wherein, sent in test terminal to asynchronous HTTP callback interfaces equipment to be measured after predetermined HTTP request, this is different
Step HTTP callback interfaces can make an immediate response, and return to request success or failure information and give test terminal, at this moment the HTTP request and
Corresponding response process terminates, but really the effective corresponding data of the HTTP request, it is necessary to a period of time predetermined processing
The Http interface IP addresses specified can be just returned to afterwards, that is, are tested terminal and received the response message of request success or failure information
Afterwards, it is necessary to which a period of time can just receive the corresponding data of the HTTP request.
Test module 102, for receiving each described of the asynchronous HTTP callback interfaces equipment transmission in service terminal
The corresponding return HTTP data of HTTP request, and the return HTTP data are sent to after the test terminal, acquisition prestores
Standard HTTP data corresponding with the HTTP request, according to the return HTTP data and the standard HTTP data pair received
The asynchronous HTTP callback interfaces are tested.
In the present embodiment, asynchronous HTTP callback interfaces equipment is obtained after the HTTP request that test terminal is sent is received
Then return HTTP data are sent to service terminal by the corresponding return HTTP data of the HTTP request, specifically, asynchronous
Return HTTP data are sent to the predetermined corresponding service terminal in Http addresss of service, the service by HTTP callback interfaces equipment
Terminal for example can be HTTP server.
In order that the corresponding return of HTTP request that terminal can obtain obtaining through asynchronous HTTP callback interfaces must be tested
Return HTTP data are sent to test terminal by HTTP data, the service terminal, so that test terminal is based on return HTTP
Data are tested.
In the present embodiment, the corresponding standard HTTP data of above-mentioned HTTP request are previously stored with test terminal, or
The corresponding standard HTTP data of the HTTP request are obtained from other equipment by way of network service.Receiving service eventually
Hold after the return HTTP data sent, asynchronous HTTP is adjusted back based on the return HTTP data and standard HTTP data received
Interface is tested.
Specific test process can judge whether return HTTP data and standard HTTP data are identical, if both phases
It is same then be successfully tested, the corresponding information that is successfully tested is generated so that tester checks, if test crash, similarly generates correspondence
Test crash information, to remind tester.
In a preferred embodiment, above-mentioned sending module 101 to asynchronous HTTP callback interfaces to be measured specifically for setting
Preparation is sent after first predetermined HTTP request, and receive the asynchronous HTTP callback interfaces equipment return described first makes a reservation for
The corresponding response message of HTTP request;If the response message is asks successful information, returned to asynchronous HTTP to be measured
Interface equipment is adjusted to send next predetermined HTTP request.
In the present embodiment, test terminal sends first predetermined HTTP to asynchronous HTTP callback interfaces equipment to be measured please
After asking, asynchronous HTTP callback interfaces return to corresponding response message to it, if the response message is asks successful information,
Then test terminal can continue to send next HTTP request to asynchronous HTTP callback interfaces equipment, then receive asynchronous HTTP and return
The corresponding response message of the next HTTP request that interface equipment is returned is adjusted, by that analogy, HTTP request is sent one by one, until
All predetermined HTTP requests have been sent to asynchronous HTTP callback interfaces equipment.
If the response message is the information of request failure, the prompting message of test terminal generation HTTP request failure,
So that tester makes the processing of correlation in time.
Preferably, if whether above-mentioned response message is analyzed and wrapped in the successful information of the request to ask successful information
Information containing critical field, the critical field information for example can be to characterize asynchronous HTTP callback interfaces equipment to only exist in test mode
Rather than in running order information, to prevent asynchronous HTTP callback interfaces equipment due to being produced easily in different states
The information obscured;If asking to include critical field information in successful information, whether analysis of key field information is predetermined
Field information, for example, analyze the information that the critical field information only exists in test mode for asynchronous HTTP callback interfaces equipment, if
For predetermined field information, then next predetermined HTTP request is sent to asynchronous HTTP callback interfaces equipment to be measured, then
The corresponding response message of the next HTTP request for receiving that asynchronous HTTP callback interfaces equipment returns, by that analogy, one by one
HTTP request is sent, until all predetermined HTTP requests have been sent to asynchronous HTTP callback interfaces equipment;If above-mentioned
Ask not including critical field information in successful information, then generate prompting message, so that tester makes correlation in time
Processing, and no longer send HTTP request to asynchronous HTTP callback interfaces equipment to be measured.
In a preferred embodiment, above-mentioned test module 102 specifically for the return HTTP data that will be received with it is right
The standard HTTP data answered are compared;If having the return HTTP data and corresponding standard HTTP data inconsistent, give birth to
Into the test result information of test crash;If all return HTTP data are consistent with corresponding standard HTTP data,
Then generate the test result information being successfully tested.
In the present embodiment, in test terminal according to the return HTTP data and the standard HTTP data received to described
When asynchronous HTTP callback interfaces are tested, each return HTTP data are compared with corresponding standard HTTP data, for example,
X1 asks corresponding return HTTP data to be Y1, and X2 asks corresponding return HTTP data to be Y2;X1 asks corresponding standard
HTTP data are Z1, and X2 asks corresponding standard HTTP data to be Z2;Then Y1 is compared with Z1, Y2 and Z2 is compared
Right, if Y1 is consistent with Z1, and Y2 is consistent with Z2, then is successfully tested, and generates the test result being successfully tested, if returning
HTTP data and corresponding standard HTTP data are inconsistent, then test crash, generate the test result of test crash.
The system that the present invention provides a kind of test of asynchronous interface, the system of the asynchronous interface test include service terminal and
Above-mentioned test terminal, each HTTP that the service terminal is used to receive the asynchronous HTTP callback interfaces equipment transmission please
Corresponding return HTTP data are sought, and the return HTTP data are sent to the test terminal.
The foregoing is only presently preferred embodiments of the present invention, be not intended to limit the invention, it is all the present invention spirit and
Within principle, any modification, equivalent substitution and improvements made etc. should be included in the scope of the protection.