Summary of the invention
The main purpose of the present invention is to provide a kind of OSP system detection method and devices, it is intended to solve current OSP service
The test method operating procedure of system is more, and process is cumbersome, inefficient problem.
To achieve the above object, a kind of OSP system detection method provided by the invention, comprising steps of
Obtain data packet to be tested;
The data packet to be tested is parsed, and generates interface message corresponding with common interface in data packet to be tested;
Start corresponding Http service according to the interface message, and executes the number to be tested under Http service
According to the test of packet.
Preferably, described to include: according to the corresponding Http service of interface message starting
According to the interface message configuration surroundings variable and system parameter;
After configuration surroundings variable and system parameter, Http interface message is determined according to mapping relations;
Start corresponding Http interface service according to the Http interface message of the determination.
Preferably, described to include: according to the corresponding Http interface service of the Http interface message of determination starting
Corresponding Http service is generated according to the interface message of generation, and shows the Http service of the generation;
The enabled instruction based on display Http service is received, corresponding Http service is started.
It is preferably, described after executing the test of the data packet to be tested under the Http is serviced, further includes:
After the completion of test, stop the Http service.
Preferably, the method also includes:
One layer of application layer Http agreement is provided for OSP service, and api interface corresponding with Http agreement is provided.
In addition, to achieve the above object, the present invention also provides a kind of OSP opening machine system test devices, comprising:
Module is obtained, for obtaining data packet to be tested;
Parsing module, for parsing the data packet to be tested;
Generation module, for generating interface message corresponding with common interface in data packet to be tested;
Starting module is serviced for starting corresponding Http according to the interface message;
Test module, for executing the test of the data packet to be tested under Http service.
Preferably, the starting module includes:
Configuration unit, for according to the interface message configuration surroundings variable and system parameter;
Determination unit, for determining Http interface message according to mapping relations after configuration surroundings variable and system parameter;
Start unit, for starting corresponding Http interface service according to the Http interface message of the determination.
Preferably, the start unit, further includes: subelement is generated, it is corresponding for being generated according to the interface message of generation
Http service;
Display subelement shows the Http service of the generation;
Promoter unit for receiving the enabled instruction based on display Http service, and starts corresponding Http service.
Preferably, stopping modular, for after the completion of test, stopping the Http service.
Preferably, further includes:
Module is provided, for providing one layer of application layer Http agreement for OSP service, and is provided corresponding with Http agreement
Api interface.
The present invention calls the client approach of OSP by api interface, automatically according to the test data Packet analyzing interface of upload
Information simultaneously generates corresponding Http service, is not necessarily to tester's hand-coding code, reduces the complexity of test process, improve
Testing efficiency.
Specific embodiment
It should be appreciated that the specific embodiments described herein are merely illustrative of the present invention, it is not intended to limit the present invention.
The present invention provides a kind of OSP system detection method.
Referring to Fig.1, Fig. 1 is the flow diagram of an embodiment of OSP system detection method of the present invention.
In one embodiment, the OSP system detection method includes:
Step S10 obtains data packet to be tested;
In the present embodiment, OSP is open settlement protocol, the agreement based on client/server.The data packet to be tested
Preferably JAR (compressed file) packet.JAR management module is provided, user is uploaded by JAR management module needs JAR packet to be tested,
Upload procedure includes: that JAR packet 1) is uploaded by way of USB;2) data are first placed into cloud disk, downloads JAR packet from cloud disk, then
The JAR packet is uploaded by JAR management module;3) JAR management module provides I/O Interface, straight by I/O Interface
Connect input JAR data packet.
Step S20 parses the data packet to be tested, and generates interface corresponding with common interface in data packet to be tested
Information;
One layer of application layer Http agreement (HyperText Transfer Protocol, network association are provided for OSP service
View), and api interface corresponding with Http agreement is provided.After getting data packet to be tested, the data to be tested are parsed
Packet extracts the common interface in the data packet to be tested, that is, from data packet to be tested, parses public entrained by it
Interface.For example, the data packet of JAR format is decompressed, from decompression when the data packet to be tested is the data packet of JAR format
The relevant information of common interface is extracted in data packet.Automatically generate interface message corresponding with these common interfaces.
Step S30 starts corresponding Http according to the interface message and services, and under Http service described in execution
The test of data packet to be tested.
Start and stop relevant Http service according to the interface message, under the Http service environment described in execution
The test of data packet to be tested.
Specifically, in a preferred embodiment of the present invention, it is described to be started accordingly according to the interface message with reference to Fig. 2
Http service includes:
Step S31, according to the interface message configuration surroundings variable and system parameter;
Step S32 determines Http interface message according to mapping relations after configuration surroundings variable and system parameter;
Step S33 starts corresponding Http interface service according to the Http interface message of the determination.
After generating interface message, corresponding environmental variance and system parameter are configured according to the interface message,
After configuring good environmental variance corresponding with interface message and system parameter, Http interface message is determined according to mapping relations, according to
The Http interface message of the determination starts corresponding Http interface service.
Specifically, in a preferred embodiment of the present invention, with reference to Fig. 3, the Http interface message according to the determination
Starting corresponding Http interface service includes:
Step S34 generates corresponding Http according to the interface message of generation and services, and shows the Http clothes of the generation
Business;
Step S35 receives the enabled instruction based on display Http service, starts corresponding Http service.
According to the interface message of generation, the automatically corresponding Http service of dynamic generation shows the Http clothes of the generation
Business, tester start Http service, execute test under Http service.
After the completion of test, test result is obtained, test report is generated according to test result.And after the completion of test, stop
Only corresponding Http service.In specific application, one layer of application layer Http agreement has been packed on the basis of OSP is serviced, tested
Personnel can be by calling the api interface (Application Programming Interface, the application programming that provide
Interface), the client approach of scheduling OSP service, that is, the mechanism implementation method calling of dynamic reflective are changed into API Calls,
Tester does not need hand-coding code in this way, do not need yet modification environmental variance, in conjunction with SoapUI (open source testing tool,
Function/load/compliance test of Web Service is checked, calls, realized by soap/http) using method parameter as
Data-driven, the api interface that daily lot size scheduling provides, improves the efficiency of test job.It is based in the embodiment of the present invention
The original test job that just can be carried out by portable code is converted to and does not need portable code by the reflection mechanism of Java
Http api interface test job, greatly improves the efficiency of test.
The present embodiment calls the client approach of OSP by api interface, connects automatically according to the test data Packet analyzing of upload
Message ceases and generates corresponding Http service, is not necessarily to tester's hand-coding code, reduces the complexity of test process, improves
Testing efficiency.
The present invention further provides a kind of OSP opening machine system test devices.
It is the functional block diagram of an embodiment of OSP opening machine system test device of the present invention referring to Fig. 4, Fig. 4.
In one embodiment, the OSP opening machine system test device includes: to obtain module 10, provide module 20, parsing module
30, generation module 40, starting module 50, test module 60 and stopping modular 70.
The acquisition module 10, for obtaining data packet to be tested;
In the present embodiment, OSP is open settlement protocol, the agreement based on client/server.The data packet to be tested
Preferably JAR (compressed file) packet.JAR management module is provided, user is uploaded by JAR management module needs JAR packet to be tested,
Upload procedure includes: that JAR packet 1) is uploaded by way of USB;2) data are first placed into cloud disk, downloads JAR packet from cloud disk, then
The JAR packet is uploaded by JAR management module;3) JAR management module provides I/O Interface, straight by I/O Interface
Connect input JAR data packet.
Module 20 is provided, for providing one layer of application layer Http agreement (HyperText Transfer for OSP service
Protocol, network protocol), and api interface corresponding with Http agreement is provided.
The parsing module 30, for parsing the data packet to be tested;After getting data packet to be tested, institute is parsed
Data packet to be tested is stated, extracts the common interface in the data packet to be tested, that is, from data packet to be tested, parse it
Entrained common interface.For example, decompressing the data of JAR format when the data packet to be tested is the data packet of JAR format
Packet extracts the relevant information of common interface from the data packet of decompression.
The generation module 40, for generating interface message corresponding with common interface in data packet to be tested;It is automatic raw
At interface message corresponding with these common interfaces.
The starting module 50 is serviced for starting corresponding Http according to the interface message;Believed according to the interface
Breath starts and stops relevant Http service, and the test of the data packet to be tested is executed under the Http service environment.
Specifically, with reference to Fig. 5, the starting module 50 includes: in a preferred embodiment of the present invention
Configuration unit 51, for according to the interface message configuration surroundings variable and system parameter;
Determination unit 52, for determining that Http interface is believed according to mapping relations after configuration surroundings variable and system parameter
Breath;
Start unit 53, for starting corresponding Http interface service according to the Http interface message of the determination.
After generating interface message, corresponding environmental variance and system parameter are configured according to the interface message,
After configuring good environmental variance corresponding with interface message and system parameter, Http interface message is determined according to mapping relations, according to
The Http interface message of the determination starts corresponding Http interface service.
Specifically, with reference to Fig. 6, the start unit 53 includes: in a preferred embodiment of the present invention
Subelement 531 is generated, corresponding Http is generated according to the interface message of generation and is serviced;
It shows subelement 532, shows the Http service of the generation;
Promoter unit 533 starts corresponding Http service for receiving the enabled instruction based on display Http service.
According to the interface message of generation, the automatically corresponding Http service of dynamic generation shows the Http clothes of the generation
Business, tester start Http service;
The test module 60, for executing the test of the data packet to be tested under Http service.
After starting Http service, test is executed under the Http service environment.After the completion of test, test knot is obtained
Fruit generates test report according to test result.
The stopping modular 70, for after the completion of test, stopping corresponding Http service.In specific application, in OSP
One layer of application layer Http agreement is packed on the basis of service, tester can be by calling the api interface provided
(Application Programming Interface, application programming interface), the client approach of scheduling OSP service,
The mechanism implementation method calling of namely dynamic reflective is changed into API Calls, and such tester does not need hand-coding code,
Modification environmental variance is not needed, (open source testing tool, is checked by soap/http, calls, realizes Web in conjunction with SoapUI yet
Function/load/compliance test of Service) using method parameter as data-driven, the API that daily lot size scheduling provides connects
Mouthful, improve the efficiency of test job.Based on the reflection mechanism of Java in the embodiment of the present invention, original is passed through into portable code
The test job that just can be carried out is converted to the Http api interface test job for not needing portable code, greatly improves test
Efficiency.
The present embodiment calls the client approach of OSP by api interface, connects automatically according to the test data Packet analyzing of upload
Message ceases and generates corresponding Http service, is not necessarily to tester's hand-coding code, reduces the complexity of test process, improves
Testing efficiency.
The above is only a preferred embodiment of the present invention, is not intended to limit the scope of the invention, all to utilize this hair
Equivalent structure or equivalent flow shift made by bright specification and accompanying drawing content is applied directly or indirectly in other relevant skills
Art field, is included within the scope of the present invention.