CN109446075A - Interface testing method and device - Google Patents
Interface testing method and device Download PDFInfo
- Publication number
- CN109446075A CN109446075A CN201811158041.8A CN201811158041A CN109446075A CN 109446075 A CN109446075 A CN 109446075A CN 201811158041 A CN201811158041 A CN 201811158041A CN 109446075 A CN109446075 A CN 109446075A
- Authority
- CN
- China
- Prior art keywords
- test
- interface
- environment
- interface testing
- default
- 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
Links
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F11/00—Error detection; Error correction; Monitoring
- G06F11/36—Preventing errors by testing or debugging software
- G06F11/3668—Software testing
- G06F11/3672—Test management
- G06F11/3688—Test management for test execution, e.g. scheduling of test suites
Abstract
The embodiment of the invention provides an interface testing method and device, and the scheme is as follows: configuration information required by the interface test can be determined, the preset test environment is initialized according to the configuration information, the test environment for the interface test is obtained, and the interface test is executed according to the preset test request data in the test environment. By the scheme provided by the embodiment of the invention, the testing environment required by the test can be automatically configured in the interface testing process, the interface test is completed, the human resources are greatly saved, and the interface testing efficiency is improved.
Description
Technical field
The present invention relates to computer application technologies, more particularly to a kind of interface test method and device.
Background technique
Current many online service systems can be related to API, and (Application Programming Interface, is answered
With Program Interfaces) with the interworking of third party system, it is under normal circumstances, more mature for technology, support to generally acknowledge
The online service system of standard agreement can be directly to online service system and third party system after introducing third party system
Carry out interface testing.If test passes through, the interaction of online service system and third party system can be directly realized by.
However, testing the configuration of environment, the simulation requested in true line, interface response parameter in interface test process
The verification of correctness is all especially to need to manually check in interface response parameter checking procedure each by being accomplished manually
The validity of field.Therefore, in interface test process, need to expend a large amount of human resources.
In addition, it is directed to each interface testing project, since the needs such as the configuration of the project testing environment are accomplished manually, because
This may cause this to estimate in interface test process due to the project waiting of tester and resource allocation etc.
The examination period is elongated, influences the efficiency of interface testing.
Summary of the invention
The embodiment of the present invention is designed to provide a kind of interface test method and device, to realize in interface test process
In, human resources are saved, testing efficiency is improved.Specific technical solution is as follows:
The embodiment of the invention provides a kind of interface test methods, which comprises
It determines for configuration information needed for interface testing;
According to the configuration information, initialization process is carried out to default test environment, is obtained for the interface testing
Test environment;
In the test environment, according to default test request data, the interface testing is executed.
Further, the interface testing is true request test;
It is described that initialization process is carried out to default test environment according to the configuration information, it obtains surveying for the interface
The test environment of examination, comprising:
Based on default test environment, the configuration information is loaded into the default test environment, to the default survey
Test ring border carries out initialization process, test environment needed for obtaining the true request test.
Further, the interface testing is response sample test;
Configuration information needed for the determination is directed to interface testing, comprising:
It determines for environment configuration information and emulating server configuration information needed for interface testing.
Further, described according to the configuration information, initialization process is carried out to default test environment, is obtained for institute
State the test environment of interface testing, comprising:
The environment configuration information is loaded into default test environment, the default test environment is carried out at initialization
Reason, and the emulating server configuration information is loaded into predetermined analog service mock sever, to the default mock
Sever carries out initialization process, test environment needed for obtaining the response sample test.
It is further, described, according to default test request data, to execute the interface testing in the test environment,
Include:
In the test environment, default test request data are sent to the default mock sever after initialization;
After the default mock sever after initialization receives the default test request data, respond described pre-
If test request data.
Further, according to default test request data, the interface testing is executed in the test environment described
Later, further includes:
Obtain the test response results of the interface testing and the test log (log) of the interface testing;
According to the test response results and the test log, the test result of the interface testing is determined.
Further, the survey of the interface testing is determined according to the test response results and the test log described
After test result, further includes:
By the test request data, the test response results and the test result, it is stored in presetting database
In, as test data;
According to the test result, judge whether the interface testing passes through;
If the interface testing is to pass through, the test result is shown in test interface, wherein the test interface
The program application interface of the interface testing is carried out for tester;
If the interface testing is not pass through, the data in the test data are carried out according to the test response results
It extracts, determines that the interface testing does not pass through reason, and the test response results and described do not pass through in reason are shown
In the test interface.
The embodiment of the invention also provides a kind of interface test device, described device includes:
Configuration information determining module, for determining for configuration information needed for interface testing;
Environment configuration module is tested, for initialization process being carried out to default test environment, being obtained according to the configuration information
To the test environment for the interface testing;
Interface testing execution module, for according to default test request data, being connect described in execution in the test environment
Mouth test.
Further, the interface testing is true request test;
The test environment configuration module is specifically used for that the configuration information is loaded into institute based on default test environment
It states in default test environment, initialization process is carried out to the default test environment, obtain needed for the true request test
Test environment.
Further, the interface testing is response sample test;
The configuration information determining module, specifically for determining for environment configuration information and simulation needed for interface testing
Server configuration information.
Further, the test environment configuration module, specifically for the environment configuration information is loaded into default survey
In test ring border, initialization process is carried out to the default test environment, and the emulating server configuration information is loaded into pre-
If in analog service mock sever, carrying out initialization process to the default mock sever, obtaining the response sample and survey
Test environment needed for examination.
Further, the interface testing execution module is specifically used in the test environment, to the institute after initialization
It states default mock sever and sends default test request data;The default mock sever after initialization receives described
After default test request data, the default test request data are responded.
Further, described device further include:
Test result determining module, for obtain the interface testing test response results and the interface testing
Test log (log);According to the test response results and the test log, the test result of the interface testing is determined.
Further, described device further include:
Test data memory module is used for the test request data, the test response results and the test
As a result, storage is in the preset database, as test data;
Judgment module, for judging whether the interface testing passes through according to the test result;If the interface testing
To pass through, the test result is shown in test interface, wherein the test interface is that tester carries out the interface
The program application interface of test;If the interface testing is not pass through, according to the test response results to the test data
In data extract, determine that the interface testing does not pass through reason, and described do not lead to the test response results and
It crosses in reason and is shown in the test interface.
The embodiment of the invention also provides a kind of electronic equipment, the electronic equipment includes processor, communication interface, storage
Device and communication bus, wherein processor, communication interface, memory complete mutual communication by communication bus;
Memory, for storing computer program;
Processor when for executing the program stored on memory, realizes any interface test method step.
The embodiment of the invention also provides a kind of computer program products comprising instruction, when it runs on computers
When, so that computer executes any of the above-described interface test method.
A kind of interface test method and device provided in an embodiment of the present invention can be determined for matching needed for interface testing
Confidence breath carries out initialization process to default test environment, obtains the test wrapper for interface testing according to the configuration information
Border, according to default test request data, executes interface testing in the test environment.The side provided through the embodiment of the present invention
Case, can be in interface test process, and test environment needed for automatically configuring test completes interface testing, people is greatly saved
Power resource improves interface testing efficiency.
Certainly, implement any of the products of the present invention or method it is not absolutely required at the same reach all the above excellent
Point.
Detailed description of the invention
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below
There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this
Some embodiments of invention for those of ordinary skill in the art without creative efforts, can be with
It obtains other drawings based on these drawings.
Fig. 1 is a kind of flow diagram of interface test method provided in an embodiment of the present invention;
Fig. 2 is a kind of structural schematic diagram of interface test device provided in an embodiment of the present invention;
Fig. 3 is the structural schematic diagram of a kind of electronic equipment provided in an embodiment of the present invention.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete
Site preparation description, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.It is based on
Embodiment in the present invention, it is obtained by those of ordinary skill in the art without making creative efforts every other
Embodiment shall fall within the protection scope of the present invention.
A kind of interface test method and device provided in an embodiment of the present invention can be determined for matching needed for interface testing
Confidence breath carries out initialization process to default test environment, obtains the test wrapper for interface testing according to the configuration information
Border, according to default test request data, executes interface testing in the test environment.The side provided through the embodiment of the present invention
Case, can be in interface test process, and test environment needed for automatically configuring test completes interface testing, people is greatly saved
Power resource improves interface testing efficiency.
The embodiment of the invention provides a kind of interface test methods, as shown in Figure 1, at least may comprise steps of:
Step S101 is determined for configuration information needed for interface testing.
In this step, it before carrying out interface testing, can first determine for configuration information needed for interface testing,
Such as, it is preset needed for mock sever configuration in environment configuration information needed for testing environment configurations or response sample test
Emulating server configuration information etc..Wherein, above-mentioned configuration information includes at least interface type, trade mode and URL
(Uniform Resource Locator, uniform resource locator) address.
In embodiments of the present invention, the determination of above-mentioned configuration information can be acquired by test platform.For example, working as
When user selects true request test, interface suitable class can be selected in the front-end interface of test platform according to configuration information
Type, trade mode, address URL of typing examining system etc..When user's Response to selection test sample, the front end circle of test platform
Test sample text box is had on face, user, which can choose, to be imported configuration information or copy in test sample text box.
When the rear end of test platform, which listens to front end, test event, for example, user selects " starting to test " in test platform front end
Button, rear end and front end carry out information exchange, acquire above-mentioned configuration information from front end by the rear end of test platform.
It can be seen from the above, in embodiments of the present invention, can at least support true request test and response sample test two
Kind test method.The selection of true request test and response sample test is illustrated, if system A is company A
One research and development product, the research and development product that system B is company B, now needs to carry out interface testing between system a and systemb.Assuming that
Interface test process be from true system A to system B send data requesting instructions, system B according to the data requesting instructions to
System A feeds back corresponding response results.If the system B that company B is provided to company A is the system of a necessary being, at this point, using
True system A and true system B carries out interface testing, which belongs to true request test.If company B to
Company A provides only some parameters about system B, at this point, using true system A and the parameter according to company B offer
It simulates obtained system B and carries out interface testing, which belongs to response sample test.In addition to this, when using true
When real system A and true system B carries out true request test, system B may be due to factors such as system itself or environment
Can not 100% response system A send data requesting instructions when, at this point it is possible to using simulation system B and true system A
Carry out response sample test.It therefore, can basis when determining interface testing is true request test or response sample test
Actual conditions carry out selecting specific interface test method.
It is understood that above system B may due to the factors such as system itself or environment can not 100% response system
When the data requesting instructions that the A that unites is sent, true request test is changed into response sample test process, the transformation of test method
It can be after the completion of true request has been tested, determine there is non-response condition, Response to selection sample according to test result
This test re-starts interface test process.For example, the api interface of above system B refers in the request of data for receiving system A transmission
It breaks down when enabling, directly results in test crash, when analyzing test result, there are test request instructions not to ring for discovery
When the case where answering, the interface testing between the system B completion system A and system B of response sample test simulation can choose.Together
When, the transformation of test method is also possible in true request test process, when there are data requesting instructions and not responding, according to
True request test is directly changed into response sample test by the parameter of real system B, for example, test request instruction is to obtain certain
The age information of one user, but there is no any age informations about user in above-mentioned real system B, therefore, really
System B cannot respond to request for test instruction, at this point it is possible to directly according to the parameter of real system B and default test request
Data, the step of testing according to response sample, execute interface testing.At this point, response sample test can not rung from real system B
At the test request instruction answered, the interface testing between system A and simulation system B is carried out, system A and mould can also be restarted
Interface testing between quasi- system B.
In embodiments of the present invention, before the above system A and system B or system B of simulation carries out interface testing, may be used also
First to determine whether to be able to carry out interface testing.For example, whether identical interface protocol can be supported by system A and system B,
Such as, Open RTB (Open Real-Time Bidding, open real time bid) 2.0 agreement of 1.0 agreements or Open RTB etc.
Interface protocol, then system A and system B can carry out interface testing.
Further, it when above-mentioned interface testing is that true request is tested, determines for ring needed for true request test
Border configuration information, as configuration information.
When above-mentioned interface testing is that response sample is tested, determine for environment configuration information needed for response sample test
With emulating server configuration information.
Specifically, obtaining when interface testing is that true request is tested for test macro needed for true request test
State or test needed for the information such as network state, as configuration information.It is asked for example, sending data to system B with system A
Ask instruction for be illustrated, since system A and system B there may be corresponding api interface, it is assumed that now from system A to
System B sends test request instruction, when user selects true response test, if system A current working condition is system A
Receive other systems or the data requesting instructions of user, and the data requesting instructions in response to receiving.At this time, it may be necessary to according to
The configuration information of acquisition adjusts the working condition of system A.
When interface testing is that response sample is tested, obtains and match confidence for test environment needed for response sample test
Breath, as environment configuration information, and the configuration information for receiving the simultaneously emulating server of response data request instruction, as
Emulating server configuration information.It is tested compared to true request, in response sample test process, above system B is by simulation
System replaces, and therefore, when user's Response to selection test sample, environment configuration information can be expressed as testing for response sample,
Environment configuration informations and the corresponding simulation system institutes of system B such as network state needed for the state or test of test macro
The emulating server configuration information needed.
It can be seen from the above, when interface testing be different test methods when, corresponding test environment be it is different, it is required
Configuration information be also different.Therefore, in embodiments of the present invention, it needs to be determined that above-mentioned connect before determining configuration information
Test method used by mouth is tested, according to test method, executes above-mentioned steps S101 and determines needle after determining test method
To configuration information needed for interface testing.
Step S102 carries out initialization process to default test environment, obtains for interface testing according to configuration information
Test environment.
In this step, which is loaded into default test environment by the configuration information determined according to step S101
In, it realizes to the initialization process of default test environment, obtains the test environment for interface testing.
In embodiments of the present invention, for above-mentioned configuration information, which can be stored in the preset database,
Generate configuration file.
Specifically, carrying out initialization process to default test environment according to above-mentioned configuration information, obtain surveying for interface
Before the test environment of examination, can the configuration information, storage in the preset database, generate configuration file.
In embodiments of the present invention, it is above-mentioned configuration information is loaded into default environment after, can be generated in default environment
The corresponding data file of configuration information.But in interface test process, system may can be completed not by primary test
The interface test process of system.Therefore, the data file preset in environment can be with the progress of interface testing each time, data file
In configuration information will be thus continually updated, the corresponding configuration information of interface testing will be also capped before.For convenience of later period user
It can accurately track and test corresponding configuration information each time, the above method can be used, for interface testing each time, on
Corresponding configuration file can all be generated by stating in presetting database, be not in the capped phenomenon of configuration file, can be in order to
After the completion of interface testing, user searches or calls configuration file.
Further, when above-mentioned interface testing is that true request is tested, based on default test environment, by configuration information plus
It is downloaded in default test environment, initialization process is carried out to default test environment, test wrapper needed for obtaining true request test
Border.
Optionally, when interface testing is that true request is tested, based on default test environment, configuration information is loaded into pre-
If testing in environment, the parameter in default test environment is adjusted according to configuration information, is completed to default test environment
Initialization procedure is obtained for test environment needed for interface testing.Data requesting instructions are sent to system B with above system A
For be illustrated, system A current working status is to provide response data from system A to other systems or user, now by being
When the A that unites sends test request instruction to system B, above-mentioned configuration information can be loaded into system A by above-mentioned test platform, system
A can be adjusted current working status according to configuration information, obtain for test environment needed for interface testing.
Further, when interface testing is that response sample is tested, environment configuration information is loaded into default test environment
In, initialization process is carried out to default test environment, and emulating server configuration information is loaded into default mock sever (mould
Quasi- service) in, initialization process is carried out to default mock sever, test environment needed for obtaining response sample test.
Optionally, when interface testing is that response sample is tested, the environment configurations that can will include in above-mentioned configuration information
Information is loaded into default test environment, is adjusted, is completed to the parameter in default test environment according to environment configuration information
Default test environment is surveyed and is initialized;Meanwhile the emulating server configuration information for including in above-mentioned configuration information can be loaded
Into default mock sever, the parameter in default mock sever is adjusted according to emulating server configuration information, it is complete
The initialization of default mock sever in pairs;By the default test environment and default mock sever after initialization, as with
The test environment needed for response sample test.For example, being surveyed when interface testing is that response sample is tested compared to true request
Examination can simulate above system B with default mock sever, at this point, still sending using above system A to default mock sever
Test request instruction can be with other than the working condition that can then adjust system A according to the environment configuration information in configuration information
The parameter in default mock sever is adjusted according to the simulator configuration information in configuration information, is completed to default mock
The initialization process of sever is simulated above system B with the default mock sever after initialization, is then tested for response sample
Test environment be initialization after default test environment and initialization after default mock sever collectively constitute.
In embodiments of the present invention, the configuration of above-mentioned test environment is only illustrated from the transmitting terminal of test request data
, during actual disposition, the responder of test request data can also be configured, that is, above-mentioned true request is surveyed
The default mock sever in system B and response sample test in examination.For example, it is assumed that above-mentioned test request instruction is acquisition
The user login information of system B can then simulate a logging in system by user B in systemb accordingly, generate the login of the user
Information.
It can be seen from the above, can be initialized to default mock sever according to configuration information, after being initialized
Default mock sever, tests for response sample, allows the embodiment of the present invention that response sample is supported to test.
Step S103, according to default test request data, executes interface testing in test environment.
In this step, in the configured test environment of step S102, according to default test request data to system to be measured
System sends test request instruction, and examining system receives and identifies the default test request data in test request instruction, response
The default test request data, complete interface testing.
Specifically, if interface testing is true request test, it is assumed that send above-mentioned test request to system B from system A and refer to
It enables, in above-mentioned test environment, is instructed when system B receives the test request, identify the default survey in test request instruction
Request data is tried, and test request data are preset according to this, it is corresponding as a result, conduct to feed back test request instruction to system A
Response results are tested, true request test is completed.For example, default test request data are the ID that user logs in acquisition system B
Title, carry out true request test when, system A by include the test request data test request instruction be sent to system B,
System B identifies test request instruction, is stepped on user according to the result of identification when receiving test request instruction
The ID title of record feeds back to system A, e.g., Zhang San is fed back to system A, completes interface testing.
Further, when interface testing is that response sample is tested, in above-mentioned test environment, to presetting after initialization
Mock sever sends default test request data;Default mock sever after initialization receives default test request number
According to rear, the default test request data of response.
Specifically, if interface testing is response sample test, it is assumed that instructed by the above-mentioned test request of system A, work as initialization
When default mock sever afterwards receives test request instruction, the default test request number in test request instruction is identified
According to, and test request data are preset according to this, it is corresponding as a result, responding as test to feed back test request instruction to system A
As a result, completing response sample test.It is tested compared to above-mentioned true request, response sample test is with default after initialization
Mock sever simulates above system B, that is, sends request of data to the default mock sever after initialization from system A and refer to
It enables, by the default mock sever after initializing in response to the data requesting instructions.
In embodiments of the present invention, a part of data of data in above-mentioned default test request data, which can be, presets
, a part of data can be according to the setting of above-mentioned configuration information.For example, the data interaction between above system A and system B
Mode can be set according to configuration information.And the expected test response results in default request data are then that can preset
, for example, the ID title that user logs in above-mentioned default test request data-acquisition system B, the ID title which logs in can
To be set as Zhang San.
Further, it in test environment, can also be obtained after executing interface testing according to default test request data
Take the test response results of interface testing and the test log (log) of interface testing;According to test response results and test
Log determines the test result of interface testing.
Specifically, needing to analyze test result, available interface testing after completing above-mentioned interface testing
Obtained response test is as a result, and the test log that generates in interface test process;Will test response results and test log into
Row compare, determine test response results in each field whether there is problem, obtain test result.
Further, according to test response results and test log, after the test result for determining interface testing, may be used also
To store test request data, test response results and test result in the preset database, as test data;Root
According to test result, judge whether interface testing passes through;If interface testing is to pass through, test result is shown in test interface,
Wherein, test interface is the program application interface that tester carries out interface testing;If interface testing is not pass through, according to test
Response results extract the data in test data, determine that interface testing does not pass through reason, and will test response results with
And not by being shown in test interface in reason.
Specifically, after determining the test result of interface testing, by the test request data in interface test process, survey
Response results and test result are tried, is stored in the presetting database in above-mentioned steps S102, as test data.
According to above-mentioned test result, judge whether interface testing passes through, there are when problem field in test result, interface is surveyed
Examination does not pass through.For example, being illustrated by taking the ID title that user in above-mentioned acquisition system B logs in as an example, test response results are
Three, but testing expected accordingly result in log is Li Si, at this point, there are problem fields in the test response results, is then connect
There are problem fields in the test result of mouth test, then interface testing does not pass through.
If according to test result determine interface testing be by when, will test response results show in test page.If
Determine that interface testing is when not passing through, according to the problems in test response results field, in test data according to test result
Data extract, obtain the unsanctioned reason of interface testing, and test response results and test are not shown by reason
Show in test interface.
In embodiments of the present invention, it may include test request data, test response results that above-mentioned test, which does not pass through reason,
And the key message in test result, user can determine that test does not pass through reason according to these key messages.For example, these
Key message at least may include time key (key) corresponding with interface testing, test request data, response results and survey
It pinged or did not passed through.Wherein, the key of time and interface testing can be indicated are as follows: 2018_09_01_10_30_20_
The meaning that native (primary test), the key of the time and interface testing are indicated is that the field is at 10 points of September in 2018 1 day
At 30 points and 20 seconds, carry out interface type be native interface testing, certainly, the key of time and interface testing may include but
The information such as time, interface type are not limited to, can also include the trade mode etc. of interface.
In embodiments of the present invention, in actual interface test process, test request instruction is sent to system B with system A,
System B is illustrated for responding test request instruction.Can use html, (HyperText Markup Language surpasses
Grade text mark up language) or the computer languages such as css (Cascading Style Sheets, cascading style sheets) construct one
Web (WWW) interface, the front end as test platform.User can in the web interface, select interface test method and
Corresponding configuration information is set.It can be in the rear end of the test platform using one service of Open-Source Tools node.js building, when the clothes
Business listen to front end web interface there are when interface testing event, back-end services will be interacted with front end web interface, be obtained
To the configuration information in the web interface of front end, and in the preset database by the data information memory, configuration file is generated.
If what user selected in the web interface of front end is true request test, test platform is according to test request data institute
What is obtained from system B is program or data, by calling python (python) script, the configuration information that rear end is obtained
It is loaded into the corresponding .cnf of system A (config, configuration) file or .data (data) file, and generates corresponding data
File.According to the configuration information in data file, the initialization procedure of system A is completed, is obtained for needed for true request test
Test environment, for example, when interface type is video (video) video class can be set for the interface type of system A
Type.Later in the test environment, system A sends test request to system B according to the address URL in configuration information and instructs, and is
System B in response to receive test request instruction in include test request data, and by test response results feed back to system
A completes true request test process.
If what user selected in the web interface of front end is in response to test sample, test platform is according to test request data institute
What is obtained from system B is program or data, by calling python script, the ring in configuration information that rear end is obtained
Border configuration information is loaded into the corresponding .cnf file of system A or .data file, and generates corresponding data file;And it will
Emulating server configuration information in configuration information is loaded into default mock sever, is carried out to default mock sever initial
Change processing, with the mock sever simulation system B after initialization, for example, mock can be preset when interface type is native
The interface type of sever is set as native.Default mock sever according to the system A after initialization and after initializing,
Obtain the test environment tested for response sample.In the test environment, test request is sent from system A to mock sever
Instruction, mock sever is in response to the test request data in the test request instruction that receives, and it is anti-to test response results
Feeding system A completes response sample test.
After completing interface response test, system A will test response results and test log feeds back to test platform.
Test platform compares test log and test response results according to the test response results and test log that receive,
It determines the problems in test response results field, obtains test result, and will test response results, test request data and survey
Test result stores in the preset database.When system B passes through the interface testing, test response results are shown in front end
In web interface, when system B does not pass through the interface testing, according to test response results, test request data, test result etc.
It determines that test does not pass through reason, and test is not shown in the web interface of front end by reason and test response results.
In embodiments of the present invention, what above system A was used is all real system, e.g., online service system or third
Method, system etc..But during actual test, equally a simulation system can be configured according to configuration information, realized and above-mentioned system
Unite B or initialization after mock sever between interface testing.
It can be seen from the above, being at least stored with configuration information in embodiments of the present invention, in above-mentioned presetting database, test is asked
Data, test response results and test result are asked, so the embodiment of the present invention can support multiple users while carry out interface
Test, further, since the configuration for testing environment in embodiments of the present invention automatically configures completion, therefore, the present invention is implemented
Example can improve the efficiency of interface testing with the project waiting and resource allocation problem of effective solution user.
In conclusion can at least support true request test and response sample to survey using embodiment provided by the invention
Examination;And in interface test process, the configuration for testing environment is system according to completion is configured in configuration information, does not depend on people
Work configuration;Meanwhile after completing interface testing, arrangement, the analysis of data, and be automatically performed by system, it is greatly saved
Human resources improve interface testing efficiency.In addition to this, since test data and configuration information etc. can store default
In database, therefore, it is possible to prevente effectively from interference phenomenon when more people test simultaneously between data, can be further improved and connect
Mouth testing efficiency.
Based on same inventive concept, according to a kind of interface test method that the embodiments of the present invention provide, the present invention
Embodiment additionally provides a kind of interface test device, as shown in Fig. 2, at least may include with lower module:
Configuration information determining module 201, for determining for configuration information needed for interface testing;
Environment configuration module 202 is tested, for initialization process being carried out to default test environment, being obtained according to configuration information
To the test environment for interface testing;
Interface testing execution module 203, for according to default test request data, executing interface and surveying in test environment
Examination.
Further, interface testing is true request test;
Environment configuration module 202 is tested, is specifically used for that configuration information is loaded into default test based on default test environment
In environment, initialization process is carried out to default test environment, test environment needed for obtaining true request test.
Further, interface testing is response sample test;
Configuration information determining module 201, specifically for determining for environment configuration information and simulation needed for interface testing
Server configuration information.
Further, environment configuration module 202 is tested, specifically for environment configuration information is loaded into default test environment
In, initialization process is carried out to default test environment, and emulating server configuration information is loaded into predetermined analog service mock
In sever, initialization process is carried out to default mock sever, test environment needed for obtaining response sample test.
Further, interface testing execution module 203 is specifically used in test environment, to presetting after initialization
Mock sever sends default test request data;Default mock sever after initialization receives default test request number
According to rear, the default test request data of response.
Further, above-mentioned apparatus further include:
Test result determining module, for obtaining the test response results of interface testing and the test log of interface testing
(log);According to test response results and test log, the test result of interface testing is determined.
Further, above-mentioned apparatus further include:
Test data memory module, for being stored in test request data, test response results and test result pre-
If in database, as test data;
Judgment module, for judging whether interface testing passes through according to test result;If interface testing is to pass through, will survey
Test result is shown in test interface, wherein test interface is the program application interface that tester carries out interface testing;If connecing
Mouth test extracts the data in test data according to test response results, determines that interface testing does not pass through not pass through
Reason, and response results will be tested and not by display in reason in test interface.
The embodiment of the invention also provides a kind of electronic equipment, as shown in figure 3, include processor 301, communication interface 302,
Memory 303 and communication bus 304, wherein processor 301, communication interface 302, memory 303 are complete by communication bus 304
At mutual communication,
Memory 303, for storing computer program;
Processor 301 when for executing the program stored on memory 303, realizes following steps:
It determines for configuration information needed for interface testing;
According to configuration information, initialization process is carried out to default test environment, obtains the test environment for interface testing;
In test environment, according to default test request data, interface testing is executed.
The communication bus that above-mentioned electronic equipment is mentioned can be Peripheral Component Interconnect standard (Peripheral Component
Interconnect, PCI) bus or expanding the industrial standard structure (Extended Industry Standard
Architecture, EISA) bus etc..The communication bus can be divided into address bus, data/address bus, control bus etc..For just
It is only indicated with a thick line in expression, figure, it is not intended that an only bus or a type of bus.
Communication interface is for the communication between above-mentioned electronic equipment and other equipment.
Memory may include random access memory (Random Access Memory, RAM), also may include non-easy
The property lost memory (Non-Volatile Memory, NVM), for example, at least a magnetic disk storage.Optionally, memory may be used also
To be storage device that at least one is located remotely from aforementioned processor.
Above-mentioned processor can be general processor, including central processing unit (Central Processing Unit,
CPU), network processing unit (Network Processor, NP) etc.;It can also be digital signal processor (Digital Signal
Processing, DSP), it is specific integrated circuit (Application Specific Integrated Circuit, ASIC), existing
It is field programmable gate array (Field-Programmable Gate Array, FPGA) or other programmable logic device, discrete
Door or transistor logic, discrete hardware components.
In another embodiment provided by the invention, a kind of computer readable storage medium is additionally provided, which can
It reads to be stored with computer program in storage medium, the computer program realizes any of the above-described interface testing when being executed by processor
The step of method.
In another embodiment provided by the invention, a kind of computer program product comprising instruction is additionally provided, when it
When running on computers, so that computer executes either interface test method in above-described embodiment.
In the above-described embodiments, can come wholly or partly by software, hardware, firmware or any combination thereof real
It is existing.When implemented in software, it can entirely or partly realize in the form of a computer program product.The computer program
Product includes one or more computer instructions.When loading on computers and executing the computer program instructions, all or
It partly generates according to process or function described in the embodiment of the present invention.The computer can be general purpose computer, dedicated meter
Calculation machine, computer network or other programmable devices.The computer instruction can store in computer readable storage medium
In, or from a computer readable storage medium to the transmission of another computer readable storage medium, for example, the computer
Instruction can pass through wired (such as coaxial cable, optical fiber, number from a web-site, computer, server or data center
User's line (DSL)) or wireless (such as infrared, wireless, microwave etc.) mode to another web-site, computer, server or
Data center is transmitted.The computer readable storage medium can be any usable medium that computer can access or
It is comprising data storage devices such as one or more usable mediums integrated server, data centers.The usable medium can be with
It is magnetic medium, (for example, floppy disk, hard disk, tape), optical medium (for example, DVD) or semiconductor medium (such as solid state hard disk
Solid State Disk (SSD)) etc..
It should be noted that, in this document, relational terms such as first and second and the like are used merely to a reality
Body or operation are distinguished with another entity or operation, are deposited without necessarily requiring or implying between these entities or operation
In any actual relationship or order or sequence.Moreover, the terms "include", "comprise" or its any other variant are intended to
Non-exclusive inclusion, so that the process, method, article or equipment including a series of elements is not only wanted including those
Element, but also including other elements that are not explicitly listed, or further include for this process, method, article or equipment
Intrinsic element.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that
There is also other identical elements in process, method, article or equipment including the element.
Each embodiment in this specification is all made of relevant mode and describes, same and similar portion between each embodiment
Dividing may refer to each other, and each embodiment focuses on the differences from other embodiments.Especially for device,
For the embodiments such as electronic equipment, since it is substantially similar to the method embodiment, so being described relatively simple, related place ginseng
See the part explanation of embodiment of the method.
The foregoing is merely illustrative of the preferred embodiments of the present invention, is not intended to limit the scope of the present invention.It is all
Any modification, equivalent replacement, improvement and so within the spirit and principles in the present invention, are all contained in protection scope of the present invention
It is interior.
Claims (10)
1. a kind of interface test method characterized by comprising
It determines for configuration information needed for interface testing;
According to the configuration information, initialization process is carried out to default test environment, obtains the test for the interface testing
Environment;
In the test environment, according to default test request data, the interface testing is executed.
2. the method according to claim 1, wherein the interface testing is true request test;
It is described that default test environment progress initialization process is obtained for the interface testing according to the configuration information
Test environment, comprising:
Based on default test environment, the configuration information is loaded into the default test environment, to the default test wrapper
Border carries out initialization process, test environment needed for obtaining the true request test.
3. the method according to claim 1, wherein the interface testing is response sample test;
Configuration information needed for the determination is directed to interface testing, comprising:
It determines for environment configuration information and emulating server configuration information needed for interface testing.
4. according to the method described in claim 3, it is characterized in that, described according to the configuration information, to default test environment
Initialization process is carried out, the test environment for the interface testing is obtained, comprising:
The environment configuration information is loaded into default test environment, initialization process is carried out to the default test environment,
And the emulating server configuration information is loaded into predetermined analog service mock sever, to the default mock sever
Initialization process is carried out, test environment needed for obtaining the response sample test.
5. according to the method described in claim 4, being asked according to default test it is characterized in that, described in the test environment
Data are sought, the interface testing is executed, comprising:
In the test environment, default test request data are sent to the default mock sever after initialization;
After the default mock sever after initialization receives the default test request data, the default survey is responded
Try request data.
6. the method according to claim 1, wherein described in the test environment, according to default test
Request data, after executing the interface testing, further includes:
Obtain the test response results of the interface testing and the test log (log) of the interface testing;
According to the test response results and the test log, the test result of the interface testing is determined.
7. according to the method described in claim 6, it is characterized in that, described according to the test response results and the test
Log, after the test result for determining the interface testing, further includes:
By the test request data, the test response results and the test result, storage in the preset database, is made
For test data;
According to the test result, judge whether the interface testing passes through;
If the interface testing is to pass through, the test result is shown in test interface, wherein the test interface is to survey
Examination personnel carry out the program application interface of the interface testing;
If the interface testing is not pass through, the data in the test data are mentioned according to the test response results
It takes, determines that the interface testing does not pass through reason, and described do not existed the test response results and by display in reason
In the test interface.
8. a kind of interface test device characterized by comprising
Configuration information determining module, for determining for configuration information needed for interface testing;
Environment configuration module is tested, for initialization process being carried out to default test environment, being used according to the configuration information
In the test environment of the interface testing;
Interface testing execution module, for according to default test request data, executing the interface and surveying in the test environment
Examination.
9. device according to claim 8, which is characterized in that the interface testing is true request test;
The test environment configuration module is specifically used for being loaded into the configuration information described pre- based on default test environment
If testing in environment, initialization process is carried out to the default test environment, test needed for obtaining the true request test
Environment.
10. device according to claim 8, which is characterized in that the interface testing is response sample test;
The configuration information determining module, specifically for determining for environment configuration information and analog service needed for interface testing
Device configuration information.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811158041.8A CN109446075B (en) | 2018-09-30 | 2018-09-30 | Interface testing method and device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201811158041.8A CN109446075B (en) | 2018-09-30 | 2018-09-30 | Interface testing method and device |
Publications (2)
Publication Number | Publication Date |
---|---|
CN109446075A true CN109446075A (en) | 2019-03-08 |
CN109446075B CN109446075B (en) | 2022-02-25 |
Family
ID=65544892
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201811158041.8A Active CN109446075B (en) | 2018-09-30 | 2018-09-30 | Interface testing method and device |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN109446075B (en) |
Cited By (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110096395A (en) * | 2019-03-12 | 2019-08-06 | 深圳壹账通智能科技有限公司 | Interface joint debugging test method, device, computer equipment and storage medium |
CN110191013A (en) * | 2019-04-19 | 2019-08-30 | 深圳壹账通智能科技有限公司 | Electronic device, the Mock test method of more capital's interfaces and storage medium |
CN111190811A (en) * | 2019-12-05 | 2020-05-22 | 东方微银科技(北京)有限公司 | Method, device, equipment and storage medium for testing resource allocation system |
CN111198821A (en) * | 2020-01-06 | 2020-05-26 | 瑞庭网络技术(上海)有限公司 | Interface abnormity judgment method and device and readable storage medium |
CN112699027A (en) * | 2020-12-29 | 2021-04-23 | 平安银行股份有限公司 | Interface testing method, device, equipment and readable storage medium |
CN113392026A (en) * | 2021-07-07 | 2021-09-14 | 北京智慧星光信息技术有限公司 | Interface automation test method, system, electronic equipment and storage medium |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107748717A (en) * | 2017-09-26 | 2018-03-02 | 深圳市牛鼎丰科技有限公司 | Automatic interface testing method, device, storage medium and computer equipment |
CN107797919A (en) * | 2017-07-24 | 2018-03-13 | 平安普惠企业管理有限公司 | The method and computing device of a kind of automatic test |
CN108415847A (en) * | 2018-05-08 | 2018-08-17 | 平安普惠企业管理有限公司 | Performance test methods, device, computer equipment and storage medium |
-
2018
- 2018-09-30 CN CN201811158041.8A patent/CN109446075B/en active Active
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN107797919A (en) * | 2017-07-24 | 2018-03-13 | 平安普惠企业管理有限公司 | The method and computing device of a kind of automatic test |
CN107748717A (en) * | 2017-09-26 | 2018-03-02 | 深圳市牛鼎丰科技有限公司 | Automatic interface testing method, device, storage medium and computer equipment |
CN108415847A (en) * | 2018-05-08 | 2018-08-17 | 平安普惠企业管理有限公司 | Performance test methods, device, computer equipment and storage medium |
Cited By (7)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN110096395A (en) * | 2019-03-12 | 2019-08-06 | 深圳壹账通智能科技有限公司 | Interface joint debugging test method, device, computer equipment and storage medium |
CN110191013A (en) * | 2019-04-19 | 2019-08-30 | 深圳壹账通智能科技有限公司 | Electronic device, the Mock test method of more capital's interfaces and storage medium |
CN111190811A (en) * | 2019-12-05 | 2020-05-22 | 东方微银科技(北京)有限公司 | Method, device, equipment and storage medium for testing resource allocation system |
CN111198821A (en) * | 2020-01-06 | 2020-05-26 | 瑞庭网络技术(上海)有限公司 | Interface abnormity judgment method and device and readable storage medium |
CN112699027A (en) * | 2020-12-29 | 2021-04-23 | 平安银行股份有限公司 | Interface testing method, device, equipment and readable storage medium |
CN113392026A (en) * | 2021-07-07 | 2021-09-14 | 北京智慧星光信息技术有限公司 | Interface automation test method, system, electronic equipment and storage medium |
CN113392026B (en) * | 2021-07-07 | 2023-12-19 | 北京智慧星光信息技术有限公司 | Interface automatic test method, system, electronic equipment and storage medium |
Also Published As
Publication number | Publication date |
---|---|
CN109446075B (en) | 2022-02-25 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109446075A (en) | Interface testing method and device | |
CN104065528B (en) | For analyzing and examining functional method and apparatus of multiple network equipments | |
CN105099811B (en) | Interface testing method and device | |
CN108199921A (en) | The method, apparatus and storage medium of a kind of simulation test | |
CN107341098A (en) | Software performance testing method, platform, equipment and storage medium | |
CN104579822A (en) | Automatic performance test system and method of mobile application based on Http protocol | |
CN106569951B (en) | A kind of Web test method being detached from the page | |
CN110798380B (en) | Data acquisition method, system, device, test equipment and test server | |
CN110275822A (en) | Performance test methods, device, equipment and the storage medium of application programming interfaces | |
CN107239271A (en) | Develop document structure tree method and device | |
CN107562637B (en) | Method, device, system and storage medium for software testing | |
CN112187558B (en) | Data verification method and device and electronic equipment | |
CN105117340B (en) | URL detection methods and device for iOS browser application quality evaluations | |
CN111522738A (en) | Test method and device of micro-service system, storage medium and electronic equipment | |
CN105607994A (en) | Mobile terminal software testing method and system | |
CN109840192B (en) | Method and device for automatic testing | |
CN107832221A (en) | Platform semi-automation function test method, apparatus and system based on Burpsuit plug-in units | |
CN102684925B (en) | Method and device for acquiring internet access source information | |
CN107360036A (en) | A kind of network failure locating method, terminal and server | |
CN113360376A (en) | Buried point testing method and device | |
CN106972983A (en) | The automatic test device and method of network interface | |
WO2016188101A1 (en) | Service system test method and device | |
CN109902777A (en) | Method based on handheld terminal real time inspection intelligent apparatus on-line testing result | |
CN113127356A (en) | Pressure measurement method and device, electronic equipment and storage medium | |
CN104678292B (en) | A kind of complex programmable logic device (CPLD) test method and device |
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 |