a kind of automatic interface testing method based on simulation http request and system
Technical field
The invention belongs to mobile technology field, be specifically related to a kind of automatic interface testing method based on simulation http request and system.
Background technology
Testing process is generally divided into 5 steps: formulate test plan, test case preparation, test execution, submission defect, testing evaluation report.
Wherein, test case the behavioral activity of software test is done a scientific tissue to conclude, and object the behavior of software test can be changed into manageable pattern; Test case is also that different classes of software, test case is different by one of concrete for test method quantized simultaneously.
In the test execution stage, the object in this stage is perfectly clear, and finds defect exactly, supervises everybody to find out defect exactly.The execution of test case should be help us to find defect quickly.In theory, if defect has all been found out, quality is also just guaranteed.So at this one-phase, at all hazards, defect to be found exactly, so not only also highly beneficial to development teams, most of defect can be revised as soon as possible; Favourable to test, testing efficiency is high, and regression test below also can be stablized, and confidence is more abundant.
The test case of existing test prepares, measuring executing process, need the ability of tester high, the ability of the ability of building of the ability of being familiar with of code, the use ability of interface testing framework, interface testing environment, interface testing design, the ability of writing of foundation code, basis look for defect ability etc., thus exist to tester require high, take time and effort, the problem such as testing efficiency is low, test code coverage rate is low.
Summary of the invention
Write to overcome the robotization of test case in interface testing, robotization request server, and reduce the technical matters such as workload of result verification, the object of the present invention is to provide a kind of automatic interface testing method based on simulation http request and system.
The technical solution used in the present invention is:
Based on an automatic interface testing method for simulation http request, comprise the following steps:
A) the user's input rule needed for setting test;
B) user's input is for the test data of target interface;
C) test request of target interface is submitted to;
D) according to parameter definition and the response data format of configuration file reflectance target interface;
E) utilize user's input rule by described test data, parameter definition and the automatic generating test use case of response data format;
F) concurrent of described Test cases technology is utilized to simulate http request;
G) verification test cases feedback test result.
Further, in described step e, test case builds test case dictionary after repeatedly testing, and directly searches test case after submitting the test request of target interface to for step C when testing next time.
Further, described step G verifies for the content of test case and form respectively, and content and form meet the requirements simultaneously, return the test result that interface is correct.
Wherein, contrast answer when verifying in described step G presets.
The present invention also comprises the technical scheme with the same design of above-mentioned reading method, i.e. a kind of interface automatization test system based on simulation http request, comprising:
Please centering, for receiving the test data for target interface of user's input, submit to the test request of target interface to interface proxy center, and utilize user's input rule by the definition of the parameter of described test data, interface proxy foveal reflex and the automatic generating test use case of response data format, utilize concurrent of described Test cases technology to simulate http request to verification center;
Interface proxy center, defines and response data format for the parameter according to configuration file reflectance target interface;
Verification center, for verification test cases and feedback test result.
Further, the test case at described request center builds test case dictionary after repeatedly testing, for test next time submit to target interface test request after directly search test case.
Further, described verification center is verified for the content of test case and form respectively, and content and form meet the requirements simultaneously, return the test result that interface is correct.
Wherein, contrast answer during described verification central authentication presets.
The invention has the beneficial effects as follows:
The present invention's robotization of test case in interface testing is write, and robotization request server reduces the test job amount of tester 80%, and realize high coverage rate, high-level efficiency completes test job.
Accompanying drawing explanation
Below in conjunction with accompanying drawing, the specific embodiment of the present invention is described further.
Fig. 1 is the process flow diagram of the automatic interface testing method that the present invention is based on simulation http request;
Fig. 2 is the theory diagram of the interface automatization test system that the present invention is based on simulation http request.
Embodiment
Shown in figure 1, be a kind of automatic interface testing method based on simulation http request of the present invention, comprise the following steps:
A) the user's input rule needed for setting test;
B) user's input is for the test data of target interface;
C) test request of target interface is submitted to;
D) according to parameter definition and the response data format of configuration file reflectance target interface;
E) utilize user's input rule by described test data, parameter definition and the automatic generating test use case of response data format;
F) concurrent of described Test cases technology is utilized to simulate http request;
G) verification test cases feedback test result; This step is verified for the content of test case and form respectively, and contrast answer during checking presets, and content and form meet the requirements simultaneously, returns the test result that interface is correct.
As the optimization of this programme, in described step e, test case builds test case dictionary after repeatedly testing, and directly searches test case after submitting the test request of target interface to for step C when testing next time.
As shown in Figure 2, the present invention also comprises the technical scheme with the same design of above-mentioned reading method, i.e. a kind of interface automatization test system based on simulation http request, comprising:
Request center 10, for receiving the test data for target interface of user's input, submit to the test request of target interface to interface proxy center 20, and the parameter utilizing user's input rule to be reflected in described test data, interface proxy center 20 defines and the automatic generating test use case of response data format, concurrent of described Test cases technology is utilized to simulate http request to verification center 30;
Interface proxy center 20, defines and response data format for the parameter according to configuration file reflectance target interface;
Verification center 30, for verification test cases and feedback test result; Concrete, verification center 30 is verified with form for the content of test case respectively, and contrast answer and preset, content and form meet the requirements simultaneously, return the test result that interface is correct.。
In addition, the test case at request center 10 builds test case dictionary after repeatedly testing, for test next time submit to target interface test request after directly search test case.
The foregoing is only preferred embodiments of the present invention, the present invention is not limited to above-mentioned embodiment, as long as the technical scheme realizing the object of the invention with basic same approach all belongs within protection scope of the present invention.