Method and device for testing based on RMI protocol
The invention provides a method and device for testing based on the remote method invocation (RMI) protocol. The method comprises the following steps: S1, recording stage: intercepting a request sent by a service system to be tested to an RMI Server, extracting and recording invocation parameter information in the request, sending the request to the RMI Server, intercepting response data returned by the RMI Server, establishing corresponding relations between the response data and the invocation parameter information, and storing; S2, replaying stage: intercepting the request sent by the service system to be tested to the RMI Server, extracting the invocation parameter information in the request, searching the response data corresponding to the invocation parameter information in the response data stored in S1, and returning the response data to the service system to be tested. According to the invention, recording and replaying of systemic interaction data based on the RMI protocol can be achieved, so that cost required in service system testing is saved. 1. Based on a remote method invocation RMI protocol test method, to the service system through the RMI protocol Server RMI call related to the background module for testing interaction process, characterized in that the method comprises: S1, the recording stage, to intercept service system to be tested is sent to the request of the RMI Server, extracting and record the call parameter information in the request, to send this request after Server RMI, RMI Server to intercept the response data, the response data with the call parameter information store a corresponding relation is formed; S2, playback stage, to intercept service system to be tested is sent to the request of the RMI Server, extracting the request call parameter information, in said step S1 of the response data is stored in the searching for the call corresponding to the information of the response data, the response data to the service system to be tested. 2. Method according to Claim 1, characterized in that the stated step S1 to intercept in sent to the service system to be tested before a request Server RMI, also includes: a service system to be tested the playback of pre-recorded user sends the request of the service to be tested, or, record the user is sent to the request of the service system to be measured; The steps S2 to intercept in sent to the service system to be tested before a request Server RMI, also includes: playback service system to be tested has been recorded user sends the request of the service to be tested. 3. Method according to Claim 1, characterized in that the stated step S1 the response data in the calling parameter information store a corresponding relation is formed, specifically comprising: according to the call parameter information generating key value, the key value with the response data store a corresponding relation is formed; The step S2 for searching with the calling parameter corresponding to the information of the response data, specifically comprising: parameter information generated according to the call key value, in said step S1 the corresponding relationship stored in the searching for the response data corresponding to the key value. 4. Method according to Claim 1, characterized in that the method also includes: In the step S1 and the step S2 extracts the request parameter information in the call, the call parameter information is difficult to reproduce in the filter the parameter information, the parameter of the difficult to reproduce information includes: the current system time or random number. 5. Method according to Claim 1, characterized in that the stated step S2 with the calling parameters found in the response after the data corresponding to information, reaches a preset delay time and then return the response data service system to be tested. 6. Method according to Claim 5, characterized in that the pre-set delay time in particular to: Fixed value; or, The step S1 in, from the intercept service system to be measured is sent to the request to the intercept of the RMI Server to the RMI Server return of the response data extend or shorten the time between the value of the number of times; or, The random value of the fluctuation in section. 7. Based on a remote method invocation RMI protocol testing device, to the service system through the RMI protocol Server RMI call related to the background module for testing interaction process, characterized in that the device comprises: Recording unit, is used to intercept the measured service system is sent to the request of the RMI Server, extracting and record the call parameter information in the request, to send this request after Server RMI, RMI Server to intercept the response data, the response data with the call parameter information store a corresponding relation is formed; A playback unit, is used to intercept the measured service system is sent to the request of the RMI Server, extracting the request call parameter information, in the recording unit stores the response data in the searching for the call corresponding to the information of the response data, the response data to the service system to be tested. 8. Device according to Claim 7, characterized in that said recording unit to intercept sent to the service system to be tested before a request Server RMI, also performs: service system to be tested the playback of pre-recorded user sends the request of the service to be tested, or, record the user is sent to the request of the service system to be measured; The playback unit to intercept sent to the service system to be tested before a request Server RMI, also performs: playback service system to be tested has been recorded user sends the request of the service to be tested. 9. Device according to Claim 7, characterized in that the stated recording the response data unit with the calling parameter information store a corresponding relation is formed, specific implementation: call information generated according to the value of key, the key value with the response data store a corresponding relation is formed; The playback unit searching the call corresponding to the information of the response data, specific implementation: according to the call parameter information generating key value, in the recording unit stores the corresponding relationship of the searching for the response data corresponding to the key value. 10. Device according to Claim 7, characterized in that the device also comprises: The filtering unit, used in the recording unit and the playback unit extracting the parameter information in the request after the call, the call parameter information is difficult to reproduce in the filter the parameter information, the parameter of the difficult to reproduce information includes: the current system time or random number. 11. Device according to Claim 7, characterized in that the playback unit with the calling parameter is found corresponding to the information of the response data, reaches a preset delay time and then return the response data service system to be tested. 12. Device according to Claim 11, characterized in that the pre-set delay time in particular to: Is a fixed value; or, For the recording unit, from the intercept service system to be measured is sent to the request to the intercept of the RMI Server to the RMI Server return of the response data extend or shorten the time between the value of the number of times; or, The preset interval for the random value of fluctuation.