CN108848000A - Network request test method, device, computer equipment and storage medium - Google Patents

Network request test method, device, computer equipment and storage medium Download PDF

Info

Publication number
CN108848000A
CN108848000A CN201810428406.8A CN201810428406A CN108848000A CN 108848000 A CN108848000 A CN 108848000A CN 201810428406 A CN201810428406 A CN 201810428406A CN 108848000 A CN108848000 A CN 108848000A
Authority
CN
China
Prior art keywords
request
response
network request
data
network
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201810428406.8A
Other languages
Chinese (zh)
Other versions
CN108848000B (en
Inventor
贺顾
贺顾一
吴培景
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
OneConnect Smart Technology Co Ltd
Original Assignee
OneConnect Smart Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by OneConnect Smart Technology Co Ltd filed Critical OneConnect Smart Technology Co Ltd
Priority to CN201810428406.8A priority Critical patent/CN108848000B/en
Publication of CN108848000A publication Critical patent/CN108848000A/en
Application granted granted Critical
Publication of CN108848000B publication Critical patent/CN108848000B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L43/00Arrangements for monitoring or testing data switching networks
    • H04L43/50Testing arrangements
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/50Network services
    • H04L67/60Scheduling or organising the servicing of application requests, e.g. requests for application data transmissions using the analysis and optimisation of the required network resources

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)
  • Debugging And Monitoring (AREA)

Abstract

This application involves a kind of network request test method, device, computer equipment and storage mediums.The method includes:The first network request that application program issues is monitored, the first request mark of first network request is obtained;Judge whether first network request is Asynchronous Request according to the first request mark;When first network request is Asynchronous Request, the associated second request mark of the first request mark is searched;Corresponding first response data is identified to the first request and the second request identifies corresponding second response data and intercepts, the corresponding default response return sequence of the first request mark is searched, the first response data and the second response data are returned into application program according to default response return sequence;First response results default response results corresponding with default response return sequence are compared to obtain test result by the first response results for obtaining application program.It being capable of test coverage using this method.

Description

Network request test method, device, computer equipment and storage medium
Technical field
This application involves field of computer technology, set more particularly to a kind of network request test method, device, computer Standby and storage medium.
Background technique
In actual application environment, when terminal carries out network asynchronous request, when the data back order of asynchronous response is different When, different network response results are likely to result in, such as the available normal response results of certain data back orders, and certain A little data back orders are likely to result in the exception responses results such as response collapse.And under the test environment, when test network is requested It needs requesting party and Requested Party server to carry out data interaction, and is returned since the requesting party tested is unable to control server The order of data is returned, accordingly, it is difficult to which all response conditions to network request are tested, the coverage rate of test is low.
Summary of the invention
Based on this, it is necessary in view of the above technical problems, provide a kind of network request survey that can be improved test coverage Method for testing, device, computer equipment and storage medium.
A kind of network request test method, the method includes:
The first network request that application program issues is monitored, the first request mark of the first network request is obtained;
Judge whether the first network request is Asynchronous Request according to the first request mark;
When first network request is Asynchronous Request, the associated second request mark of the first request mark is searched Know;
Corresponding first response data and corresponding second response of the second request mark are identified to first request Data are intercepted, and the corresponding default response return sequence of the first request mark is searched, by first response data with Second response data returns to the application program according to the default response return sequence;
The first response results for obtaining the application program, first response results and the default response return are suitable The corresponding default response results of sequence are compared to obtain test result.
After the first network request that the monitoring application program issues in one of the embodiments, further include:
First network request is intercepted;
After the associated second request mark of lookup the first request mark, further include:
Corresponding second network request is identified to second request to intercept;
Send the first network request intercepted and second network request.
Further include in one of the embodiments,:
Record the sending time that second request identifies corresponding second network request;
Obtained for the first estimated response time according to the sending time and default response time;
After reaching for the described first estimated response time, exists in second network request and not yet intercept response data Third network request when, search the corresponding historical responses data of the third network request, by the historical responses data make For the corresponding third response data currently intercepted of the third network request.
Further include in one of the embodiments,:
The third request mark of the third network request is recorded;
First response data that will be intercepted and second response data are returned according to the default response After sequence returns to the application program, further include:
When monitoring with the third of the record request corresponding third response data of mark, the third response is intercepted Data, and the third response data is added in the corresponding historical responses data of the third network request.
Further include in one of the embodiments,:
When searching historical responses data corresponding less than the third network request, third network request is sent simultaneously again Calculated for the second estimated response time;
The corresponding third response of the third network request is not intercepted also when reaching for the described second estimated response time When data, response abnormality prompt is generated according to the third network request.
Further include in one of the embodiments,:
After the generation response abnormality prompt according to the third network request, including:
The analog response data for receiving input are worked as using the analog response data as the third network request is corresponding Before the third response data intercepted;
It is the historical responses data of the third network request by the analog response data record
Further include in one of the embodiments,:
When searching less than the first request corresponding default response return sequence of mark, by first response data Permutation and combination, which is carried out, with the return sequence of second response data obtains built-up sequence;
First response data and second response data are returned into the application according to each built-up sequence Program, and corresponding built-up sequence is shown in the application program;
The second response results of the corresponding application program of each built-up sequence are obtained, and it is suitable to obtain each combination Second response results are compared to obtain test knot with corresponding input expected results by the corresponding input expected results of sequence Fruit.
A kind of network request test device, described device include:
First identifier obtains module, for monitoring the first network request of application program sending, obtains the first network First request mark of request;
Asynchronous judgment module, for judging whether the first network request is asynchronous ask according to the first request mark It asks;
Association identification obtains module, for searching first request when first network request is Asynchronous Request Identify associated second request mark;
First data return module is asked for identifying corresponding first response data and described second to first request It asks corresponding second response data of mark to be intercepted, searches the corresponding default response return sequence of the first request mark, First response data and second response data are returned to according to the default response return sequence described using journey Sequence;
First test module, for obtaining the first response results of the application program, by first response results with The corresponding default response results of the default response return sequence are compared to obtain test result.
A kind of computer equipment, including memory and processor, the memory are stored with computer program, the processing The step of device realizes the above method when executing the computer program.
A kind of computer readable storage medium, is stored thereon with computer program, and the computer program is held by processor The step of above method is realized when row.
Above-mentioned network request test method, device, computer equipment and storage medium, when monitor application program sending When asynchronous network request, Network Search requests corresponding related network request, asks to network request and corresponding related network The response data of return is asked to be intercepted, the response data intercepted is suitable according to the corresponding default response return of network request Sequence returns to application program, so as to which tester is thought that various responses to be tested return to situation and carry out traversal test, and The automatic test for realizing various branch's situations improves the coverage rate and testing efficiency of test.
Detailed description of the invention
Fig. 1 is the application scenario diagram of network request test method in one embodiment;
Fig. 2 is the flow diagram of network request test method in one embodiment;
Fig. 3 is the flow diagram of network request test method in another embodiment;
Fig. 4 is the structural block diagram of network request test device in one embodiment;
Fig. 5 is the internal structure chart of computer equipment in one embodiment.
Specific embodiment
It is with reference to the accompanying drawings and embodiments, right in order to which the objects, technical solutions and advantages of the application are more clearly understood The application is further elaborated.It should be appreciated that specific embodiment described herein is only used to explain the application, not For limiting the application.
Network request test method provided by the present application, can be applied in application environment as shown in Figure 1.Wherein, it surveys Examination terminal is communicated by network with server.Test terminal asks local application to the first network that server issues It asks and is monitored, obtain the first request mark of first network request, judge that first network request is according to the first request mark No is Asynchronous Request, when judging first network request is Asynchronous Request, searches associated second request of the first request mark Mark, the response data that is returned to application program of test terminal monitoring server, and intercept and request mark corresponding the with first One response data and the second response data corresponding with the second request mark, are blocked when by the first response data and the second response data After cutting, test terminal searches the corresponding default response return sequence of the first request mark, by the first response data and second Response data returns to application program according to default response return sequence, and obtains the first response results of application program, by the One response results default response results corresponding with default response return sequence are compared to obtain test result.So as to mention The test coverage of high network request test.Wherein, test terminal can be, but not limited to be various personal computers, notebook electricity The equipment such as brain, tablet computer, server can with the server cluster of independent server either multiple servers composition come It realizes.
In one embodiment, as shown in Fig. 2, providing a kind of network request test method, it is applied to Fig. 1 in this way In test terminal for be illustrated, include the following steps:
Step 210, the first network request that monitoring application program issues obtains the first request mark of first network request Know.
Application program is mounted in test terminal, and the network issued when test terminal runs application program to server is visited Ask that request is tested.The network access request that application program is sent is used to carry out data exchange with server.Test terminal prison Application program is controlled to when server sending first network request, the first request for obtaining first network request identifies.First asks Mark is asked to carry out uniquely tagged for requesting first network, the first request mark can be code, number etc., or visit Ask the address of request, key character in request address etc., request mark can be corresponding with the request function of network request.
Step 220, judge whether first network request is Asynchronous Request according to the first request mark.
It tests terminal and obtains Asynchronous Request table, store the request for belonging to the network request of Asynchronous Request in Asynchronous Request table Mark.Test terminal searches whether that there is the request consistent with the first request mark identifies, and works as lookup from Asynchronous Request table When identifying to consistent request, judge that first network request for Asynchronous Request, is identified when not finding consistent request When, judge first network request for synchronization request.
When synchronization request refers to that application program sends multiple network requests to server, server connects according to network request Receipts sequence is to application program by sequence returning response data.And Asynchronous Request refers to that application program sends multiple networks to server and asks When asking, server first receives multiple network requests, but not necessarily presses to the sequence of application program returning response data According to reception sequence, it is possible to the network that the time of return of the corresponding response data of the network request first received receives after being later than The time of return of corresponding response data is requested, i.e. the time of return of the corresponding response data of network request not can determine that, and work as Preceding Network status may also time of return to each Asynchronous Request and return sequence impact.
Wherein, when having incidence relation between the request data of multiple Asynchronous Requests, the corresponding sound of multiple Asynchronous Requests When answering the return sequence of data different, it is likely to result in the different response results of application program.For example, working as application program to service Device request " picture faceplate view ", " paintbrush ", " color panel " three data for realizing " pictures " application function when, apply Program can issue " picture faceplate view ", " paintbrush ", " color panel " to server " three Asynchronous Requests, if server receives To after three Asynchronous Requests, for three Asynchronous Request returning responses sequence be " picture faceplate view ", " color panel ", When " paintbrush " or " color panel ", " picture faceplate view ", " paintbrush ", preset function may be implemented, and if return sequence Sequentially for " paintbrush ", " picture faceplate view ", " color panel " or " paintbrush ", " color panel ", " picture faceplate view " etc., then It may cause application response failure or collapse, because application program will execute data " paintbrush " after receiving data " paintbrush " Corresponding drawing actions, but be not yet ready for " picture faceplate view ", " color panel " at this time so that the drawing actions of paintbrush without Method is normally carried out, and will lead to application response failure.It should be noted that data of application requests in practical applications It can be other kinds of data, the example above is only to facilitate be explained Asynchronous Request.
Step 230, when first network request is Asynchronous Request, the associated second request mark of the first request mark is searched Know.
When test terminal judges that first network request is Asynchronous Request, test terminal is searched and first requests mark phase Associated second request mark, the second request identifies the corresponding requested data of second network request and first network requests institute There is incidence relation, specifically, first network requests corresponding response data and the second network request pair between the data of request The response data answered can be provided commonly for realizing same application function.The quantity of second request mark may be one or more, It is Asynchronous Request that second request, which identifies corresponding second network request,.Reflecting between the first request mark and the second request mark The relationship of penetrating is previously set and is stored in test terminal, and test terminal can find the first request mark by obtaining mapping relations Know corresponding second request mark.
Step 240, corresponding first response data and corresponding second response of the second request mark are identified to the first request Data are intercepted, and search the corresponding default response return sequence of the first request mark, the first response data and second are responded Data return to application program according to default response return sequence.
The response data that terminal returns to server is monitored, and can be carried in the response data that server returns corresponding The request of network request identifies or server generates response identification corresponding with mark is requested, and whens returning response data carries Response identification.The first response data is carried out to when identifying corresponding first response data with the first request when testing terminal monitoring It intercepts, intercepts the second response data when monitoring with the second request corresponding second response data of mark.
After test terminal intercepts the first all response datas and the second response data, test terminal searches the The corresponding default response return sequence of one request mark.The first response data corresponding the is had recorded in default response return sequence What one request mark and corresponding each second request of the second response data identified puts in order, and it is preparatory to preset response return sequence It is set by tester and is stored, the quantity that same first request identifies corresponding default response return sequence can be one Or it is multiple, tester may need the sequence of the return to a variety of response datas to test, therefore can set multiple default Respond return sequence.Test terminal is by the first response data and the second response data according to respectively requesting in default response return sequence Putting in order for mark returns to application program.
Step 250, the first response results for obtaining application program are right by the first response results and default response return sequence The default response results answered are compared to obtain test result.
When test terminal returns to all first response datas and the to application program according to the default response return sequence of one kind After two response datas, obtain the corresponding default response results of default response return sequence, preset response results in advance with default sound Sequence should be returned and carry out corresponding storage.Wherein, default response results can be the relevant information such as response address, page of response page Face screenshot etc., test terminal can carry out the relevant information of the response page of application program real response and default response results It compares.First response results are compared by test terminal with default response results, when the two is consistent, determine the default response Return sequence is corresponding to be successfully tested, and otherwise determines that this presets the corresponding test crash of response return sequence.
In the present embodiment, monitoring device can be installed to realize foregoing description in test terminal or in application program Network request, response data monitoring function, the data interception of response data, data return to function etc..Monitoring device can be with But be not limited to SDK (Software Development Kit, Software Development Kit) data packet etc..
In the present embodiment, when testing the asynchronous network request that terminal monitoring is issued to application program, Network Search Corresponding related network is requested to be requested, the response data returned to network request and the request of corresponding related network is blocked It cuts, the response data intercepted is returned into application program according to the corresponding default response return sequence of network request, so as to Tester is thought that various responses to be tested return to situation and carry out traversal test, and realize the automation of various branch's situations Test, improves the coverage rate and testing efficiency of test.
In one embodiment, as shown in figure 3, monitoring application program issue first network request step 210 it Afterwards, can also include:
Step 215:First network request is intercepted.
It is intercepted when testing terminal monitoring to the first network request that application program issues, is requested when according to first network First request mark judge first network request be synchronization request when, discharge interception first network request, by the first net Network request is sent to server;When judging first network request is Asynchronous Request, first network request is continued to keep blocking The state of cutting, does not continue to be sent to server.
After the step 230 for searching the associated second request mark of the first request mark, can also include:
Step 232, corresponding second network request is identified to the second request to intercept.
After test terminal finds the second request mark, continue to monitor the network request that application program issues, and obtain The request mark for each network request that application program issues, the request mark that will acquire are compared with the second request mark, when When the request mark of acquisition is consistent with one of them second request mark, then determine that the network request monitored is the second network Request, the second network request is intercepted, does not continue to be sent to server.
Step 234, the first network request intercepted and the second network request are sent.
After all second requests are identified corresponding second network request interception by test terminal, test terminal again will First network request and the second network request are sent to server, and the sequence of transmission is not specially limited.
In the present embodiment, when testing terminal monitoring to when requesting for the first network of Asynchronous Request, first network is asked Temporary interception is asked, when testing SS later and monitoring first network and request associated second network request, then by first network Request and the second network request issue, and keep the synchronism that there is the network request of data correlation to send, and be convenient for monitoring pipe Reason.
In one embodiment, network request test method can also include:The second request of record mark corresponding second The sending time of network request;Obtained for the first estimated response time according to sending time and default response time;When arrival first It is expected that searching third when there is the third network request for not yet intercepting response data after the response time, in the second network request The corresponding historical responses data of network request, using historical responses data as corresponding currently intercepted of third network request Three response datas.
Test terminal find it is associated second request mark after, continue monitor application program issue with second request Identify corresponding second network request.Specifically, the request for each network request that the available application program of test terminal issues Mark, the request mark that will acquire are compared with the second request mark, second ask when the request of acquisition is identified with one of them When asking mark consistent, then determine that the network request monitored is the second network request.Terminal is tested by each second network request Sending time recorded, or record the sending time for the second network request that the last one sends.
It tests terminal and obtains pre-stored default response time, presetting response time is that application program is sent to server After network request, for server to the maximum time interval of application program returning response data, preset response time has test in advance Personnel rule of thumb set and store to test terminal.Test terminal is asked in the last one second network sent of record It calculated for the first estimated response time plus default response time on the basis of the sending time asked and carry out time monitoring is set.
After the estimated response time of arrival first, test terminal judges all corresponding response datas of the second network request Whether be intercepted, when judge all response datas it is intercepted then, do not do special processing;When judging the second network When there is the third network request for not intercepting respective response data in request, test terminal obtains the of third network request Three request marks, and historical responses data corresponding with third request mark are searched, historical responses data are third network request The response results that all previous server corresponding when being sent returns, test terminal identify all previous response results and third request It is associated record.Test terminal extracts a response data as third network request is corresponding from historical responses data and works as Before the third response data intercepted, do not continue to the response sequence of waiting for server return.It should be noted that the second network Include third network request in request, and includes third response data in finally obtained second response data.Specifically, it tests Terminal can randomly select out a response data when extracting response data, can also extract the number of responses of the last one record According to can also take other modes, be not specially limited herein.When test terminal is got all the of response data is not intercepted After the historical responses data of three network requests, it is suitable that the corresponding default response return of lookup the first request mark can be continued to execute Sequence, the step of the first response data and the second response data are returned into application program according to default response return sequence.
In the present embodiment, there are still do not intercept corresponding sound in the second network request after reaching the default response time When answering the third network request of data, test terminal directly asks the historical responses data of third network request as third network The response data for asking this is no longer waiting for the data actually returned, so as to save the testing time, improves testing efficiency.
In one embodiment, network request test method can also include:Mark is requested to the third of third network request Knowledge is recorded;The first response data intercepted and the second response data are returned into application according to default response return sequence After program, can also include:When monitoring with the third of the record request corresponding third response data of mark, third is intercepted Response data, and third response data is added in the corresponding historical responses data of third network request.
After the estimated response time of arrival first, there is the third net for not yet intercepting response data in the second network request When network is requested, the third that test terminal obtains third network request requests mark, and third request mark is recorded.It is surveying The first response data intercepted and the second response data are returned to application program according to default response return sequence by examination terminal Later, test terminal continue that monitoring server returns with the corresponding third response data of third request mark, when monitoring the When three response datas, test terminal intercepts third response data, does not continue to return to application program.It tests terminal and searches the Three requests identify corresponding historical responses data, and the third response data of interception is added to the historical responses data found In.
In the present embodiment, test terminal records the network request of time-out response, rings returning to application program After answering data, continue whether monitoring server returns the corresponding response data of network request that the time-out responds, when monitoring When, the response data monitored is intercepted and is added in the historical responses data for the network request that the time-out responds, is kept away Exempt to repeat to send response data and cause application response response abnormal to application program.
In one embodiment, network request test method can also include:It is corresponding less than third network request when searching Historical responses data when, send third network request again and calculated for the second estimated response time;It is rung when arrival second is estimated When not intercepting third network request corresponding third response data when between seasonable also, it is different that response is generated according to third network request Often prompt.
After the estimated response time of arrival first, there is the third network request for not yet intercepting response data, and test It may be to send for the first time due to third network request when terminal searches historical responses data corresponding less than third network request, May also third network request corresponding historical responses data the reasons such as do not save, test terminal again sends out third network request Server is given, and records the time that third network request is sent again, test terminal obtains default response time, according to third The time and default response time that network request is sent again calculated for the second estimated response time.What network request was sent again Default response time can be identical as the default response time sent for the first time, can also be different.
When not reaching for the second estimated response time, test terminal has intercepted the corresponding third sound of third network request When answering data, then the corresponding default response return sequence of lookup the first request mark can be continued to execute, by the first response data The step of returning to application program according to default response return sequence with the second response data;When in the estimated response of arrival second Between after test terminal when not intercepting the corresponding third response data of third network request also, test terminal is asked according to third network It seeks survival into response abnormality to prompt, response abnormality prompt is shown, may include third network request in response abnormality prompt Third request mark, response timeout the information such as illustrate.So that abnormal prompt carries out further tester according to response Processing guarantees going on smoothly for test.
In one embodiment, it after the step of generating response abnormality prompt according to third network request, can also wrap It includes:The analog response data for receiving input, using analog response data as corresponding the currently intercepted of third network request Three response datas;It is the historical responses data of third network request by analog response data record.
After test terminal, which generates response abnormality, to be prompted and show, data input screen, data input screen can be shown In include third network request relevant information such as request identify, when there is multiple third network requests, data input circle It carries out the third request mark of each third network request to compare setting with input entrance in face.Tester can pass through data Input interface input or analog response data, analog response data are used to simulate the corresponding server of third network request and return Real response data, with real response data data format having the same and data structure.It is defeated by data to test terminal Enter interface to receive the analog response data of tester's input and read the corresponding third request mark of each analog response data, root According to third request mark using analog response data as the third response data of corresponding third network request currently intercepted, After the corresponding analog response data acquisition of all third network requests, lookup the first request mark pair can be continued to execute First response data and the second response data are returned to according to default response return sequence and are answered by the default response return sequence answered The step of with program.And analog response data are associated storage with corresponding third request mark, as corresponding third net The historical responses data of network request, convenient for being called when test next time.
In one embodiment, network request test method can also include:It is corresponded to when searching less than the first request mark Default response return sequence when, the return of the first response data and the second response data sequence is subjected to permutation and combination and obtains group Conjunction sequence;First response data and the second response data are returned into application program according to each built-up sequence, and in application program The middle corresponding built-up sequence of display;The second response results of the corresponding application program of each built-up sequence are obtained, and obtain each combination Second response results are compared to obtain test knot with corresponding input expected results by sequentially corresponding input expected results Fruit.
When testing no the first request of setting corresponding default response return sequence of mark in advance in terminal, terminal is tested The return sequence of first response data and the second response data is subjected to permutation and combination and obtains multiple sequence combinations.For example, first Response data is identified as " 1 ", there are two the second response datas, is identified as " 2 " and " 3 ", then arranges three response datas Combination obtains 6 kinds of built-up sequences, respectively " 123 ", " 132 ", " 213 ", " 231 ", " 321 " and " 312 ".
After test terminal obtains built-up sequence, by the first response data and the second response data respectively according to each built-up sequence Application program is returned to, to carry out traversal test to various built-up sequences.Terminal is tested by the response of various built-up sequences When data return to application program, corresponding built-up sequence is shown in the application.After application program receives response data It is responded, test terminal obtains the second response results of application program under each built-up sequence.Tester is observing second While response results, it is also possible to obtain corresponding built-up sequence.Expected results input interface can be provided in display interface, surveyed Examination personnel can be inputted or be imported the corresponding expected results of built-up sequence of display by expected results input interface.Test terminal Channel expected results input interface receives the input expected results of tester's input, and will input expected results and the second response As a result it is compared, judges whether the two is consistent and obtains test result, it is suitable to judge that each response data returns according to test result Testing whether for sequence is normal.In other embodiments, tester also may not need input expected results, be answered according to what is observed Judged to test whether that exception obtains test result with the response results of program, test result is input in test terminal.
In the present embodiment, it when the return sequence for thinking response data to be tested is not previously set in tester, surveys Various possible put in order can be carried out traversal test automatically by examination terminal, and simultaneously covering for test can be improved in high degree of automation Lid rate.
It should be noted that first and second etc relational terms in the application be used merely to distinguish an entity or Movement and another entity or movement, and not necessarily require or imply any actual this pass between this entity or movement System or sequence.
It should be understood that although each step in Fig. 2-3 flow chart is successively shown according to the instruction of arrow, this A little steps are not that the inevitable sequence according to arrow instruction successively executes.Unless expressly state otherwise herein, these steps It executes there is no the limitation of stringent sequence, these steps can execute in other order.Moreover, at least one in Fig. 2-3 It step by step may include that perhaps these sub-steps of multiple stages or stage are held in synchronization to multiple sub-steps Row is completed, but can be executed at different times, the execution sequence in these sub-steps or stage be also not necessarily successively into Row, but can be held in turn or alternately at least part of the sub-step or stage of other steps or other steps Row.
In one embodiment, as shown in figure 4, providing a kind of network request test device, including:First identifier obtains Module, asynchronous judgment module 420, association identification obtain module 430, the first data return module 440 and the first test module 450, wherein:
First identifier obtains module 410, for monitoring the first network request of application program sending, obtains first network and asks The the first request mark asked.
Asynchronous judgment module 420, for judging whether first network request is Asynchronous Request according to the first request mark.
Association identification obtains module 430, closes for when first network request is Asynchronous Request, searching the first request mark Second request mark of connection.
First data return module 440, for identifying corresponding first response data and the second request mark to the first request Know corresponding second response data to be intercepted, the corresponding default response return sequence of the first request mark is searched, by the first sound Data and the second response data is answered to return to application program according to default response return sequence.
First test module 450, for obtaining the first response results of application program, by the first response results and default sound The corresponding default response results of sequence should be returned to be compared to obtain test result.
In one embodiment, device can also include:
First blocking module, for being intercepted to first network request.
Second blocking module is intercepted for identifying corresponding second network request to the second request.
First request sending module, for sending the first network intercepted request and the second network request.
In one embodiment, device can also include:
Time recording module identifies the sending time of corresponding second network request for recording the second request.
First scheduled time obtained module, when for obtaining the first estimated response according to sending time and default response time Between.
The inquiry of historical data module, for existing not yet after reaching for the first estimated response time in the second network request When intercepting the third network request of response data, the corresponding historical responses data of third network request are searched, by historical responses Data are as the corresponding third response data currently intercepted of third network request.
In one embodiment, device can also include:
Identification record module is recorded for the third request mark to the third network request.
Third data interception module monitors third number of responses corresponding with the third of record request mark for working as According to when, intercept the third response data, and the third response data is added to the third network request is corresponding to be gone through In history response data.
In one embodiment, device can also include:
Replicated blocks are requested, for being sent again when searching historical responses data corresponding less than third network request Third network request simultaneously calculated for the second estimated response time.
Abnormal prompt module, it is corresponding for not intercepting third network request also when arrival second expects the response time When third response data, response abnormality prompt is generated according to third network request.
In one embodiment, device can also include:
Analogue data receiving module, analog response data for receiving input, using analog response data as third net Network requests the corresponding third response data currently intercepted.
Analogue data logging modle, for being the historical responses data of third network request by analog response data record.
In one embodiment, device can also include:
Built-up sequence obtains module, is used for when searching less than the first request corresponding default response return sequence of mark, The return sequence of first response data and the second response data is subjected to permutation and combination and obtains built-up sequence.
Sequence display module, for the first response data and the second response data to be returned to application according to each built-up sequence Program, and corresponding built-up sequence is shown in the application.
Second test module for obtaining the second response results of the corresponding application program of each built-up sequence, and obtains each Second response results are compared with corresponding input expected results and are tested by the corresponding input expected results of built-up sequence As a result.
Specific about network request test device limits the limit that may refer to above for network request test method Fixed, details are not described herein.Modules in above-mentioned network request test device can fully or partially through software, hardware and its Combination is to realize.Above-mentioned each module can be embedded in the form of hardware or independently of in the processor in computer equipment, can also be with It is stored in the memory in computer equipment in a software form, in order to which processor calls the above modules of execution corresponding Operation.
In one embodiment, a kind of computer equipment is provided, which can be terminal, internal structure Figure can be as shown in Figure 5.The computer equipment includes processor, the memory, network interface, display connected by system bus Screen and input unit.Wherein, the processor of the computer equipment is for providing calculating and control ability.The computer equipment is deposited Reservoir includes non-volatile memory medium, built-in storage.The non-volatile memory medium is stored with operating system and computer journey Sequence.The built-in storage provides environment for the operation of operating system and computer program in non-volatile memory medium.The calculating The network interface of machine equipment is used to communicate with external terminal by network connection.When the computer program is executed by processor with Realize a kind of network request test method.The display screen of the computer equipment can be liquid crystal display or electric ink is shown Screen, the input unit of the computer equipment can be the touch layer covered on display screen, be also possible on computer equipment shell Key, trace ball or the Trackpad of setting can also be external keyboard, Trackpad or mouse etc..
It will be understood by those skilled in the art that structure shown in Fig. 5, only part relevant to application scheme is tied The block diagram of structure does not constitute the restriction for the computer equipment being applied thereon to application scheme, specific computer equipment It may include perhaps combining certain components or with different component layouts than more or fewer components as shown in the figure.
In one embodiment, a kind of computer equipment, including memory and processor are provided, which is stored with Computer program, the processor realize following steps when executing computer program:The first network that monitoring application program issues is asked It asks, obtains the first request mark of first network request;Judge whether first network request is asynchronous according to the first request mark Request;When first network request is Asynchronous Request, the associated second request mark of the first request mark is searched;It requests first It identifies corresponding first response data and the second request identifies corresponding second response data and intercepted, search the first request mark Know corresponding default response return sequence, the first response data and the second response data are returned according to default response return sequence To application program;The first response results for obtaining application program, the first response results are corresponding with default response return sequence Default response results are compared to obtain test result.It being capable of test coverage using this method.
In one embodiment, following steps are also realized when processor executes computer program:To first network request into Row intercepts;Corresponding second network request is identified to the second request to intercept;Send the first network request and the intercepted Two network requests.
In one embodiment, following steps are also realized when processor executes computer program:Record the second request mark The sending time of corresponding second network request;Obtained for the first estimated response time according to sending time and default response time; After the estimated response time of arrival first, there is the third network request for not yet intercepting response data in the second network request When, the corresponding historical responses data of third network request are searched, are worked as using historical responses data as third network request is corresponding Before the third response data intercepted.
In one embodiment, following steps are also realized when processor executes computer program:To third network request Third request mark is recorded;When monitor request mark corresponding third response data with the third of record when, interception the Three response datas, and third response data is added in the corresponding historical responses data of third network request.
In one embodiment, following steps are also realized when processor executes computer program:When lookup is less than third net When network requests corresponding historical responses data, third network request is sent again and calculated for the second estimated response time;Work as arrival When not intercepting third network request corresponding third response data when the second estimated response time also, according to third network request Generate response abnormality prompt.
In one embodiment, following steps are also realized when processor executes computer program:The simulation for receiving input is rung Data are answered, using analog response data as the corresponding third response data currently intercepted of third network request;Simulation is rung Answering data record is the historical responses data of third network request.
In one embodiment, following steps are also realized when processor executes computer program:It is asked when searching less than first When seeking the corresponding default response return sequence of mark, the return sequence of the first response data and the second response data is arranged Combination obtains built-up sequence;First response data and the second response data are returned into application program according to each built-up sequence, and Corresponding built-up sequence is shown in the application;The second response results of the corresponding application program of each built-up sequence are obtained, and The corresponding input expected results of each built-up sequence are obtained, the second response results are compared with corresponding input expected results To test result.
In one embodiment, a kind of computer readable storage medium is provided, computer program is stored thereon with, is calculated Machine program realizes following steps when being executed by processor:The first network request that application program issues is monitored, first network is obtained First request mark of request;Judge whether first network request is Asynchronous Request according to the first request mark;Work as first network When request is Asynchronous Request, the associated second request mark of the first request mark is searched;To the first request mark corresponding first Response data and the second request identify corresponding second response data and are intercepted, and search the first request and identify corresponding default sound Sequence should be returned, the first response data and the second response data are returned into application program according to default response return sequence;It obtains The first response results for taking application program, by the first response results default response results corresponding with default response return sequence into Row relatively obtains test result.It being capable of test coverage using this method.
In one embodiment, following steps are also realized when computer program is executed by processor:First network is requested It is intercepted;Corresponding second network request is identified to the second request to intercept;Send intercept first network request and Second network request.
In one embodiment, following steps are also realized when computer program is executed by processor:Record the second request mark Know the sending time of corresponding second network request;When obtaining the first estimated response according to sending time and default response time Between;After the estimated response time of arrival first, asked in the second network request in the presence of the third network for not yet intercepting response data When asking, the corresponding historical responses data of third network request are searched, historical responses data are corresponding as third network request The third response data currently intercepted.
In one embodiment, following steps are also realized when computer program is executed by processor:To third network request Third request mark recorded;When monitoring with the third of the record request corresponding third response data of mark, intercept Third response data, and third response data is added in the corresponding historical responses data of third network request.
In one embodiment, following steps are also realized when computer program is executed by processor:When lookup is less than third When the corresponding historical responses data of network request, third network request is sent again and calculated for the second estimated response time;When arriving When not intercepting third network request corresponding third response data when up to the second estimated response time also, asked according to third network Response abnormality is sought survival into prompt.
In one embodiment, following steps are also realized when computer program is executed by processor:Receive the simulation of input Response data, using analog response data as the corresponding third response data currently intercepted of third network request;It will simulation Response data is recorded as the historical responses data of third network request.
In one embodiment, following steps are also realized when computer program is executed by processor:When lookup is less than first When request identifies corresponding default response return sequence, the return sequence of the first response data and the second response data is arranged Column combination obtains built-up sequence;First response data and the second response data are returned into application program according to each built-up sequence, And corresponding built-up sequence is shown in the application;The second response results of the corresponding application program of each built-up sequence are obtained, And the corresponding input expected results of each built-up sequence are obtained, the second response results are compared with corresponding input expected results Obtain test result.
Those of ordinary skill in the art will appreciate that realizing all or part of the process in above-described embodiment method, being can be with Relevant hardware is instructed to complete by computer program, the computer program can be stored in a non-volatile computer In read/write memory medium, the computer program is when being executed, it may include such as the process of the embodiment of above-mentioned each method.Wherein, To any reference of memory, storage, database or other media used in each embodiment provided herein, Including non-volatile and/or volatile memory.Nonvolatile memory may include read-only memory (ROM), programming ROM (PROM), electrically programmable ROM (EPROM), electrically erasable ROM (EEPROM) or flash memory.Volatile memory may include Random access memory (RAM) or external cache.By way of illustration and not limitation, RAM is available in many forms, Such as static state RAM (SRAM), dynamic ram (DRAM), synchronous dram (SDRAM), double data rate sdram (DDRSDRAM), enhancing Type SDRAM (ESDRAM), synchronization link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic ram (DRDRAM) and memory bus dynamic ram (RDRAM) etc..
Each technical characteristic of above embodiments can be combined arbitrarily, for simplicity of description, not to above-described embodiment In each technical characteristic it is all possible combination be all described, as long as however, the combination of these technical characteristics be not present lance Shield all should be considered as described in this specification.
The several embodiments of the application above described embodiment only expresses, the description thereof is more specific and detailed, but simultaneously It cannot therefore be construed as limiting the scope of the patent.It should be pointed out that coming for those of ordinary skill in the art It says, without departing from the concept of this application, various modifications and improvements can be made, these belong to the protection of the application Range.Therefore, the scope of protection shall be subject to the appended claims for the application patent.

Claims (10)

1. a kind of network request test method, the method includes:
The first network request that application program issues is monitored, the first request mark of the first network request is obtained;
Judge whether the first network request is Asynchronous Request according to the first request mark;
When first network request is Asynchronous Request, the associated second request mark of the first request mark is searched;
Corresponding first response data is identified to first request and second request identifies corresponding second response data It is intercepted, searches the corresponding default response return of the first request mark sequentially, by first response data and described Second response data returns to the application program according to the default response return sequence;
The first response results for obtaining the application program are right by first response results and the default response return sequence The default response results answered are compared to obtain test result.
2. the method according to claim 1, wherein the first network that the monitoring application program issues requests it Afterwards, further include:
First network request is intercepted;
After the associated second request mark of lookup the first request mark, further include:
Corresponding second network request is identified to second request to intercept;
Send the first network request intercepted and second network request.
3. the method according to claim 1, wherein the method also includes:
Record the sending time that second request identifies corresponding second network request;
Obtained for the first estimated response time according to the sending time and default response time;
There is not yet intercept response data the after reaching for the described first estimated response time, in second network request When three network requests, the corresponding historical responses data of the third network request are searched, using the historical responses data as institute State the corresponding third response data currently intercepted of third network request.
4. according to the method described in claim 3, it is characterized in that, the method also includes:
The third request mark of the third network request is recorded;
First response data that will be intercepted and second response data are according to the default response return sequence After returning to the application program, further include:
When monitoring with the third of the record request corresponding third response data of mark, the third number of responses is intercepted According to, and the third response data is added in the corresponding historical responses data of the third network request.
5. according to the method described in claim 3, it is characterized in that, the method also includes:
When searching historical responses data corresponding less than the third network request, third network request is sent again and is calculated Second estimated response time;
The corresponding third response data of the third network request is not intercepted also when reaching for the described second estimated response time When, response abnormality prompt is generated according to the third network request.
6. according to the method described in claim 5, it is characterized in that, described generate response abnormality according to the third network request After prompt, including:
The analog response data for receiving input are currently blocked using the analog response data as the third network request is corresponding The third response data being truncated to;
It is the historical responses data of the third network request by the analog response data record.
7. the method according to claim 1, wherein the method also includes:
When searching less than the first request corresponding default response return sequence of mark, by first response data and institute The return sequence for stating the second response data carries out permutation and combination and obtains built-up sequence;
First response data and second response data are returned into the application program according to each built-up sequence, And corresponding built-up sequence is shown in the application program;
The second response results of the corresponding application program of each built-up sequence are obtained, and obtain each built-up sequence pair Second response results are compared to obtain test result by the input expected results answered with corresponding input expected results.
8. a kind of network request test device, which is characterized in that described device includes:
First identifier obtains module, for monitoring the first network request of application program sending, obtains the first network request First request mark;
Asynchronous judgment module, for judging whether the first network request is Asynchronous Request according to the first request mark;
Association identification obtains module, for searching the first request mark when first network request is Asynchronous Request Associated second request mark;
First data return module, for identifying corresponding first response data and the second request mark to first request Know corresponding second response data to be intercepted, the corresponding default response return sequence of the first request mark is searched, by institute It states the first response data and second response data and returns to the application program according to the default response return sequence;
First test module, for obtaining the first response results of the application program, by first response results with it is described The default corresponding default response results of return sequence that respond are compared to obtain test result.
9. a kind of computer equipment, including memory and processor, the memory are stored with computer program, feature exists In the step of processor realizes any one of claims 1 to 7 the method when executing the computer program.
10. a kind of computer readable storage medium, is stored thereon with computer program, which is characterized in that the computer program The step of method described in any one of claims 1 to 7 is realized when being executed by processor.
CN201810428406.8A 2018-05-07 2018-05-07 Network request testing method and device, computer equipment and storage medium Active CN108848000B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810428406.8A CN108848000B (en) 2018-05-07 2018-05-07 Network request testing method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810428406.8A CN108848000B (en) 2018-05-07 2018-05-07 Network request testing method and device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN108848000A true CN108848000A (en) 2018-11-20
CN108848000B CN108848000B (en) 2021-05-11

Family

ID=64212729

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810428406.8A Active CN108848000B (en) 2018-05-07 2018-05-07 Network request testing method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN108848000B (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109587013A (en) * 2019-01-18 2019-04-05 深圳壹账通智能科技有限公司 APP network compatibility test method, device, computer equipment and storage medium
CN109871251A (en) * 2019-01-17 2019-06-11 平安科技(深圳)有限公司 A kind of processing method of response data, device, storage medium and terminal device
CN110008118A (en) * 2019-03-13 2019-07-12 深圳壹账通智能科技有限公司 Page data test method, device, computer equipment and storage medium
CN110069395A (en) * 2019-03-12 2019-07-30 平安科技(深圳)有限公司 A kind of method, apparatus, storage medium and computer equipment for simulating asynchronous interface
CN113726770A (en) * 2021-08-30 2021-11-30 平安国际融资租赁有限公司 Data interception method and device, computer equipment and storage medium
CN113835912A (en) * 2020-06-24 2021-12-24 北京新氧科技有限公司 Application crash information processing method and device
CN113992543A (en) * 2021-10-29 2022-01-28 建信金融科技有限责任公司 Response message sending method, device, equipment and readable storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102833125A (en) * 2011-06-17 2012-12-19 腾讯科技(深圳)有限公司 Test server, test system adopting test server, and test method
US20150317193A1 (en) * 2014-04-30 2015-11-05 Fujitsu Limited Distributed processing apparatus, distributed processing system, and storage medium
CN107070735A (en) * 2016-12-30 2017-08-18 上海亿账通互联网科技有限公司 Method, test terminal and the system of asynchronous interface test
CN107294803A (en) * 2017-06-15 2017-10-24 北京小度信息科技有限公司 Response message conformance test method and device

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102833125A (en) * 2011-06-17 2012-12-19 腾讯科技(深圳)有限公司 Test server, test system adopting test server, and test method
US20150317193A1 (en) * 2014-04-30 2015-11-05 Fujitsu Limited Distributed processing apparatus, distributed processing system, and storage medium
CN107070735A (en) * 2016-12-30 2017-08-18 上海亿账通互联网科技有限公司 Method, test terminal and the system of asynchronous interface test
CN107294803A (en) * 2017-06-15 2017-10-24 北京小度信息科技有限公司 Response message conformance test method and device

Cited By (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109871251A (en) * 2019-01-17 2019-06-11 平安科技(深圳)有限公司 A kind of processing method of response data, device, storage medium and terminal device
CN109587013A (en) * 2019-01-18 2019-04-05 深圳壹账通智能科技有限公司 APP network compatibility test method, device, computer equipment and storage medium
CN109587013B (en) * 2019-01-18 2022-08-19 深圳壹账通智能科技有限公司 APP network compatibility testing method and device, computer equipment and storage medium
CN110069395A (en) * 2019-03-12 2019-07-30 平安科技(深圳)有限公司 A kind of method, apparatus, storage medium and computer equipment for simulating asynchronous interface
CN110069395B (en) * 2019-03-12 2023-07-25 平安科技(深圳)有限公司 Method and device for simulating asynchronous interface, storage medium and computer equipment
CN110008118A (en) * 2019-03-13 2019-07-12 深圳壹账通智能科技有限公司 Page data test method, device, computer equipment and storage medium
CN110008118B (en) * 2019-03-13 2023-03-10 深圳壹账通智能科技有限公司 Page data testing method and device, computer equipment and storage medium
CN113835912A (en) * 2020-06-24 2021-12-24 北京新氧科技有限公司 Application crash information processing method and device
CN113835912B (en) * 2020-06-24 2024-02-09 北京新氧科技有限公司 Crash information processing method and device for application program
CN113726770A (en) * 2021-08-30 2021-11-30 平安国际融资租赁有限公司 Data interception method and device, computer equipment and storage medium
CN113726770B (en) * 2021-08-30 2023-06-30 平安国际融资租赁有限公司 Data interception method, device, computer equipment and storage medium
CN113992543A (en) * 2021-10-29 2022-01-28 建信金融科技有限责任公司 Response message sending method, device, equipment and readable storage medium

Also Published As

Publication number Publication date
CN108848000B (en) 2021-05-11

Similar Documents

Publication Publication Date Title
CN108848000A (en) Network request test method, device, computer equipment and storage medium
CN110399293B (en) System test method, device, computer equipment and storage medium
CN108804644B (en) Interface log storage method, device, computer equipment and storage medium
CN110008118A (en) Page data test method, device, computer equipment and storage medium
CN109032824A (en) Database method of calibration, device, computer equipment and storage medium
CN112910945A (en) Request link tracking method and service request processing method
CN108427613B (en) Abnormal interface positioning method and device, computer equipment and storage medium
CN108920354A (en) Bury a management method, device, computer equipment and storage medium
CN110008117A (en) Page test method, device, computer equipment and storage medium
CN110287101A (en) User interface automated testing method, device, computer equipment and storage medium
CN109542712A (en) Server stress test method, device, computer equipment and storage medium
CN111475376A (en) Method and device for processing test data, computer equipment and storage medium
CN112115005B (en) Test data acquisition method and device, computer equipment and storage medium
CN112738230B (en) Automatic network gate testing system and working method thereof
CN109040039A (en) A kind of leak detection method, apparatus and system
CN109033139A (en) Client information inquiry method, device, computer equipment and storage medium
CN109491885A (en) Test problem localization method, device, computer equipment and storage medium
CN109491889A (en) The method and apparatus of automatic test in NFV
CN109325010A (en) Log inspection method, device, computer equipment and storage medium
CN110149421A (en) Method for monitoring abnormality, system, device and the computer equipment of domain name system
CN110493064A (en) Firewall management method, apparatus, computer equipment and storage medium
CN109299009A (en) Data test method, apparatus, computer equipment and storage medium
US11269997B2 (en) Automated dynamic security testing
CN111414614A (en) Unauthorized detection method and auxiliary device
CN109831521A (en) Cache instance management method, apparatus, computer equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant