CN109815139A - Interface test method, device, computer equipment and storage medium - Google Patents

Interface test method, device, computer equipment and storage medium Download PDF

Info

Publication number
CN109815139A
CN109815139A CN201910004226.1A CN201910004226A CN109815139A CN 109815139 A CN109815139 A CN 109815139A CN 201910004226 A CN201910004226 A CN 201910004226A CN 109815139 A CN109815139 A CN 109815139A
Authority
CN
China
Prior art keywords
interface
measured
test
file
protos
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.)
Pending
Application number
CN201910004226.1A
Other languages
Chinese (zh)
Inventor
隆永玲
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
OneConnect Smart Technology Co Ltd
Original Assignee
OneConnect Smart Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by OneConnect Smart Technology Co Ltd filed Critical OneConnect Smart Technology Co Ltd
Priority to CN201910004226.1A priority Critical patent/CN109815139A/en
Publication of CN109815139A publication Critical patent/CN109815139A/en
Pending legal-status Critical Current

Links

Abstract

This application involves a kind of interface test method based on the field of test technology, device, computer equipment and storage mediums, obtain the first configuration file, have recorded multiple interfaces to be measured and corresponding protos test suite PROTOS in first configuration file;The second configuration file is obtained, the testing time of multiple interfaces to be measured is had recorded in second configuration file;When reaching the testing time of the interface to be measured, triggering test script starting calls the interface to be measured by the test script;The protos test suite PROTOS is called using the test script, the interface to be measured is tested by the protos test suite PROTOS.Fully and effectively all interfaces to be measured can be tested using this method, and effectively improve testing efficiency.

Description

Interface test method, device, computer equipment and storage medium
Technical field
This application involves field of computer technology, more particularly to a kind of interface test method, device, computer equipment and Storage medium.
Background technique
Existing payment system only has back end interface, and payment transaction is more complicated, and accuracy requirement is high, in payment process It cannot malfunction when middle calling interface.Therefore, payment system requires to do a large amount of recurrence survey before publication new version every time Examination.In traditional mode, regression test is to be completed by manually, but manually easy omission is to be measured for a large amount of regression test Interface, and testing efficiency is lower.How fully and effectively all interfaces to be measured to be tested, and effectively improves test effect Rate becomes a technical problem for needing to solve at present.
Summary of the invention
Based on this, it is necessary in view of the above technical problems, provide one kind can fully and effectively to all interfaces to be measured into Row test, and effectively improve interface test method, device, computer equipment and the storage medium of testing efficiency.
A kind of interface test method, which comprises
The first configuration file is obtained, multiple interfaces to be measured and corresponding test suite are had recorded in first configuration file Part;
The second configuration file is obtained, the testing time of multiple interfaces to be measured is had recorded in second configuration file;
When reaching the testing time of the interface to be measured, triggering test script starting is called by the test script The interface to be measured;
The protos test suite PROTOS is called using the test script, the interface to be measured is surveyed by the protos test suite PROTOS Examination.
It is described in one of the embodiments, to include: by the test script calling interface to be measured
Enter ginseng using the request that the test script obtains the interface to be measured;
It requests to carry out abstract processing into ginseng to described, generates the file of preset format;
The file for parsing the preset format obtains requesting with described into the corresponding json character string of ginseng;
The interface to be measured is called according to the json character string.
In one of the embodiments, in the file of the parsing preset format, obtain requesting with described into ginseng pair After the json character string answered, the method also includes:
Key file is obtained, the key file is parsed, obtains the key being hidden in the key file;
It is encrypted according to json character string described in the key pair.
In one of the embodiments, the method also includes:
Corresponding respond out of interface to be measured is obtained using the test script to join;
It requests to execute context into the corresponding json character string write-in of ginseng by described;
After being tested by the protos test suite PROTOS the interface to be measured, resolution response result set is obtained and institute It states to respond out and joins corresponding json character string;
Described respond out is joined into corresponding json character string write-in execution context;
It requests into ginseng to described by the execution context and responds out and join corresponding field and assert.
It is described in one of the embodiments, that according to interface, ginseng return test result includes: out
The test script is obtained to the access authority of interface IP address and multiple tables of data;
The corresponding interface to be measured of the interface IP address is inquired according to the access authority, and corresponding with the interface to be measured Tables of data;
Using the multiple tables of data inquired as table result set;
The field in the table result set is asserted by the test script.
A kind of interface test device, described device include:
File acquisition module has recorded multiple to be measured connect for obtaining the first configuration file, in first configuration file Mouth and corresponding protos test suite PROTOS;The second configuration file is obtained, multiple interfaces to be measured are had recorded in second configuration file Testing time;
Interface calling module, for when reaching the testing time of the interface to be measured, triggering test script starting to pass through The test script calls the interface to be measured;
Interface testing module passes through the protos test suite PROTOS pair for calling the protos test suite PROTOS using the test script The interface to be measured is tested.
The interface testing module is also used to obtain using the test script described to be measured in one of the embodiments, The request of interface enters ginseng;It requests to carry out abstract processing into ginseng to described, generates the file of preset format;Parse the preset format File, obtain requesting with described into the corresponding json character string of ginseng;The interface to be measured is called according to the json character string.
The interface testing module is also used to obtain key file in one of the embodiments, parses the key text Part obtains the key being hidden in the key file;It is encrypted according to json character string described in the key pair.
A kind of computer equipment, including memory and processor, the memory are stored with and can run on a processor Computer program, the processor realize the step in above-mentioned each embodiment of the method when executing the computer program.
A kind of computer readable storage medium, is stored thereon with computer program, and the computer program is held by processor The step in above-mentioned each embodiment of the method is realized when row.
Above-mentioned interface test method, device, computer equipment and storage medium, before being tested, if there is more A interface to be measured only need to be pre-configured with all interfaces to be measured and corresponding protos test suite PROTOS in the first configuration file, and second matches Set the testing time that all interfaces to be measured are pre-configured in file.It, can be to all when reaching the testing time of interface to be measured Interface to be measured is tested automatically.It does not need manually to participate in during the test, can not only effectively cover comprehensively all to be measured Interface, and testing efficiency can be effectively improved.
Detailed description of the invention
Fig. 1 is the applied environment figure of interface test method in one embodiment;
Fig. 2 is the flow diagram of interface test method in one embodiment;
Fig. 3 is the flow diagram for calling interface step to be measured in one embodiment by test script;
Fig. 4 is the structural block diagram of interface test device in one embodiment;
Fig. 5 is the internal structure chart of computer equipment in one embodiment.
Specific embodiment
It is with reference to the accompanying drawings and embodiments, right in order to which the objects, technical solutions and advantages of the application are more clearly understood The application is further elaborated.It should be appreciated that specific embodiment described herein is only used to explain the application, not For limiting the application.
Interface test method provided by the present application can be applied in application environment as shown in Figure 1.Terminal 102 passes through Network is communicatively coupled with server 104.Terminal 102 can upload multiple configuration files, configuration file packet to server 104 Include the first configuration file and the second configuration file.Server 104 obtains the first configuration file that terminal 102 uploads, and first matches It sets and has recorded multiple interfaces to be measured and corresponding protos test suite PROTOS in file.Server 104 obtains terminal 102 uploads second and matches File is set, the testing time of multiple interfaces to be measured is had recorded in the second configuration file.When reaching the testing time of interface to be measured, Server 104 triggers test script starting, and server 104 enters ginseng using the request that test script obtains interface to be measured, to request Enter ginseng and carry out abstract processing, generate the file of preset format, server parses the file of preset format, obtains and request into ginseng pair The json character string answered, server 104 call interface to be measured according to json character string.Server 104 is called using test script Protos test suite PROTOS tests interface to be measured by protos test suite PROTOS.Wherein, terminal 102 can be, but not limited to be various personal meters Calculation machine, laptop, tablet computer.Server 104 can use the clothes of the either multiple server compositions of independent server Device cluster be engaged in realize.
In one embodiment, as shown in Fig. 2, providing a kind of interface test method, it is applied in Fig. 1 in this way It is illustrated for server, comprising the following steps:
Step 202, the first configuration file is obtained, has recorded multiple interfaces to be measured and corresponding survey in the first configuration file Try external member.
The corresponding relationship being pre-configured in server between test script, source code address and trigger.Wherein, exist The first configuration file is stored in source code address.First configuration file can be terminal and be uploaded to server in advance.First Record has multiple interfaces to be measured and corresponding protos test suite PROTOS in configuration file.Wherein, each interface to be measured can correspond to one Protos test suite PROTOS can also correspond to multiple protos test suite PROTOSs.Interface to be measured can have multiple, and corresponding external member to be measured also correspondingly has more It is a.
Step 204, the second configuration file is obtained, the testing time of multiple interfaces to be measured is had recorded in the second configuration file.
Terminal can also upload the second configuration file to server in advance.It is had recorded in second configuration file and trigger pair The testing time for the multiple interfaces to be measured answered.Wherein, without limitation to the form of testing time.For example, the testing time can be Specific time, such as 10:00, it is also possible to time interval, such as 10 minutes.If there is multiple interfaces to be measured, then configuration file In just pre-configured all interfaces to be measured testing time.The second configuration file that server is uploaded by obtaining terminal, can With the testing time according to all interfaces to be measured come clocked flip test script, according to test script to all interfaces to be measured Automatically it is tested.
Step 206, when reaching the testing time of interface to be measured, triggering test script starting is called by test script Interface to be measured.
Server is obtaining the second configuration file, and the testing time of multiple interfaces to be measured is had recorded in the second configuration file Afterwards, when reaching the testing time of interface to be measured, it can trigger test script starting, test script is according to source code call by location phase The interface to be measured answered.If the testing time of multiple interfaces to be measured is identical, test script starting can be triggered according to trigger, Multiple interfaces to be measured are called simultaneously by test script, multiple interfaces to be measured are tested simultaneously.
Step 208, protos test suite PROTOS is called using test script, interface to be measured is tested by protos test suite PROTOS.
Server calls protos test suite PROTOS after calling interface to be measured by test script, using test script, passes through survey Examination external member tests interface to be measured.Specifically, server by utilizing test script calls the test suite of test interface corresponding points Part.Wherein, protos test suite PROTOS can be the test file of preset format, and preset format can be xml (extensible markup Language) format.A protos test suite PROTOS is configured in the test file of one preset format.If server passes through foot to be measured One interface to be measured of this calling, then call the corresponding protos test suite PROTOS of the interface to be measured using test script, and server passes through the survey Examination external member tests the interface to be measured.If server calls multiple interfaces to be measured by script to be measured, test is utilized Script calls the corresponding protos test suite PROTOS of multiple interfaces to be measured, server by multiple protos test suite PROTOSs to multiple interfaces to be measured simultaneously into Row test.
In conventional manner, regression test is carried out to all interfaces to be measured by manually, in a large amount of regression test In be easy to omit interface to be measured, it is difficult to all interfaces to be measured are fully and effectively tested.In the present embodiment, it is being surveyed Before examination, if there is multiple interfaces to be measured, all interfaces to be measured and correspondence need to be only pre-configured in the first configuration file Protos test suite PROTOS, the testing time of all interfaces to be measured is pre-configured in the second configuration file.When the test for reaching interface to be measured When the time, all interfaces to be measured can be tested automatically.It does not need manually to participate in during the test, it can not only be comprehensive All interfaces to be measured are effectively covered, and testing efficiency can be effectively improved.
In one embodiment, as shown in figure 3, the step of calling interface to be measured by test script specifically includes:
Step 302, enter ginseng using the request that test script obtains interface to be measured.
Step 304, to requesting to carry out abstract processing into ginseng, the file of preset format is generated.
Step 306, the file for parsing preset format is obtained and is requested into the corresponding json character string of ginseng.
Step 308, interface to be measured is called according to json character string.
When server calls interface to be measured by test script, the request for needing to obtain interface to be measured enters ginseng.It is each to be measured Interface all has corresponding request into ginseng.Interface to be measured can be it is multiple, it is corresponding request also to have into ginseng it is multiple.Different is to be measured The request of interface enters ginseng can be identical, can also part it is identical, for example, it includes complete that account, which opens interface and payment interface, It is identical to request into ginseng: version number, transaction number, transaction journal number, transaction date of shipping time, initiator's channel number, sub- canal Taoist monastic name, trade company number, business datum and signature field.Short message transmission interface includes that part is identical with obtain reconciliation file interface Request enter ginseng: version number, transaction number, transaction journal number, transaction the date of shipping time, initiator's channel number, sub- channel number, Trade company number, business datum and signature field.
Server requests one or more to carry out abstract processing into ginseng, generates the file of one or more preset formats. Wherein, the file of preset format can be xml document.Server generates preset format to requesting to carry out abstract processing into ginseng File after, the file of the preset format can be parsed, obtain and request into corresponding json (the java script object of ginseng Notation) character string.For example, server can use the corresponding version number of interface to be measured, transaction number, transaction journal number, Trade date, transaction date of shipping time, initiator's channel number, sub- channel number, trade company number, business datum and signature field are raw At corresponding json character string.Wherein, json character string can be air control extended field, air control extended field include device number, Language message, IP address, MAC (Media Access Control or Medium Access Control, media interviews) Location, GPS (Global Positioning System, global positioning system) information, SIM (Subscriber Identification Module, user identity identification) card number code, SIM card quantity, account ID (IDentity, identity knowledge Not), receive province, harvest city, type of merchandise etc..
Server can basis after obtaining json character string corresponding with ginseng is requested in the file of parsing preset format Json character string calls interface to be measured.Json character string is generated interface according to interface method of calling by server by utilizing test script Call request.Wherein, interface method of calling can be POST.Server by parsing interface call request, obtain accordingly to Interface message is surveyed, server calls corresponding interface to be measured according to interface message to be measured, and server by utilizing test script, which calls, to be surveyed External member is tried, interface to be measured is tested by protos test suite PROTOS.
In the present embodiment, ginseng is entered by the request that test script obtains interface to be measured, to requesting to carry out abstract place into ginseng Reason, it is available to request into the corresponding json character string of ginseng, according to json character string call interface to be measured come to interface to be measured into Row test, can use the flexibility that interface enters ginseng, is flexibly called to interface to be measured, and realization is more convenient, quickly adjusts With interface to be measured, so save it is online before testing time.
In one embodiment, in the file of parsing preset format, obtain with request into the corresponding json character string of ginseng it Afterwards, further includes: obtain key file, parse key file, obtain being hidden in the key in key file;According to key pair json Character string is encrypted.
Server obtains being hidden in the key in key file by parsing key file.For example, server can pass through Key file is decoded, corresponding decoding character string is obtained.Server is extracted since the first position of decoding character string The character extracted is formed character string by respective symbols, is corresponding key by string token.Server can also be in key The predeterminated position of file extracts corresponding key figure.Specifically, it is corresponding more to obtain the second position in key file for server Multiple coordinates are connected to form graph outline by a coordinate, extract corresponding figure, the figure mark that will be extracted according to image outline It is denoted as key figure.
Server by parsing key file can be according to key pair after obtaining being hidden in the key in key file Json character string is encrypted.Key can be fixed, and be also possible to dynamic change.For example, key can be with the time Variation carry out dynamic update.Server can choose according to the variation of time and key, and generation is hidden in key file Key.After key file updates, server can be parsed to obtain according to more new information to updated key file Updated key.Wherein, key can be preset characters string or preset pattern etc..
In the present embodiment, server obtains key file, parses the key file, obtains being hidden in key file Key.Server is encrypted according to the key pair json character string in key file, can be improved the safety of interface to be measured, The interference of other factors is prevented, and then improves the accuracy of test.
In one embodiment, the above method further include: obtain corresponding respond out of interface to be measured using test script and join; It will request to execute context into the corresponding json character string write-in of ginseng;Interface to be measured is being carried out by protos test suite PROTOS to test it Afterwards, resolution response result set obtains joining corresponding json character string with responding out;It will respond out and join corresponding json character string and write Enter to execute context;By executing context to requesting into ginseng and respond out and join corresponding field and assert.
In the present embodiment, server can be initialized to context is executed, and it may include to be measured for executing context Interface is corresponding multiple to request to join into ginseng and multiple respond out.For example, responding out ginseng can be version number, transaction number, friendship Easy serial number, transaction date of shipping time, initiator's channel number, sub- channel number, system return serial number, system time of return, System returns to state, system return code, system returned specification, business datum and signature etc..
Server will request to execute context into the corresponding json character string write-in of ginseng.Server will respond out join it is corresponding The write-in of json character string executes context.Server is by executing context to requesting into ginseng and respond out and join corresponding field It is asserted.Specifically, server can be in the database to requesting into ginseng and respond out and join corresponding field and field Value configured.If requesting the value for joining corresponding field into ginseng and responding out correct, continue to carry out interface to be measured Test.If requesting ginseng and responding out to join either field in corresponding field and mistake occur, then it represents that request into ginseng and It responds out and joins corresponding interface exception to be measured, test application stops test.
In the present embodiment, join by executing context and the field joined is requested out to be asserted to responding out, thus Whether the response results that interface to be measured can be verified are accurate, quickly identify whether interface to be measured is abnormal, effectively increases survey Try efficiency.
Further, interface to be measured further includes interface logic, can control holding between interface to be measured according to interface logic Row sequence.Server enters ginseng according to the request of interface to be measured, responds out ginseng and interface logic calling interface to be measured.It is different to be measured The request of interface, which enters ginseng and responds out ginseng, can be different.Can be interrelated between multiple interfaces to be measured, upper one to be measured connects Mouthful respond out ginseng can be used as next interface to be measured request enter ginseng.For example, account open interface, short message transmission interface and Verification short message interface between request mouth enter ginseng and respond out ginseng can be interrelated.Terminate it in the test of short message transmission interface Afterwards, the response of the interface to be measured can be gone out join, the request as verification short message interface enters ginseng.The short message transmission interface and verification There is association in the parameter between short message interface.
In one embodiment, this method further include: obtain visit of the test script to interface IP address and multiple tables of data Ask permission;According to the corresponding interface to be measured in access authority query interface address, and tables of data corresponding with interface to be measured;It will look into The multiple tables of data ask are as table result set;The field in table result set is asserted by test script.
In the present embodiment, server to be measured connects according to access authority and service logic query interface address are corresponding Mouthful, and tables of data corresponding with interface to be measured.Wherein, tables of data may include in relevant to each field of interface to be measured Hold.For example, business datum etc..Business datum can be transaction the target date, business return serial number, card signing protocol number and Signing state.Server is using the multiple tables of data inquired as table result set, by test script to the word in table result set Duan Jinhang is asserted.If the value of all fields in table result set is all correct, continue to test.If in table result set Either field mistake in field, then test application stops test.
Server can also may be used by executing context to requesting into ginseng and respond out and join corresponding field and assert To be asserted by test script to the field in table result set.Wherein, the independent service that can be is asserted, it is independent Service refers to independently of a service except test application.Server, can be to prevent by will assert that this service separates It only repeats to write code, can also be improved the maintainability of code.For example, can be added or deleted according to business needs when asserting Certain field, server can be configured directly by database, be modified without the code to test application.
In the present embodiment, server is according to the corresponding interface to be measured in access authority query interface address, and with it is to be measured The corresponding tables of data of interface, using the multiple tables of data inquired as table result set, by test script in table result set Field is asserted, if the value of all fields in table result set is all correct, then it represents that test logic is accurate.If table result Either field mistake in the field of concentration, then it represents that test logic inaccuracy it is possible thereby to which whether check test logic is accurate, mentions The accuracy of height test.
It further, can be by the configuration item in database when server needs to carry out interface testing to other systems It is replaced, the field configuration asserted will be needed into database.Do not need to rewrite the code of test application, it is possible thereby to Support the interface testing of cross-system.
It should be understood that although each step in the flow chart of Fig. 2-3 is successively shown according to the instruction of arrow, These steps are not that the inevitable sequence according to arrow instruction successively executes.Unless expressly stating otherwise herein, these steps Execution there is no stringent sequences to limit, these steps can execute in other order.Moreover, at least one in Fig. 2-3 Part steps may include that perhaps these sub-steps of multiple stages or stage are not necessarily in synchronization to multiple sub-steps Completion is executed, but can be executed at different times, the execution sequence in these sub-steps or stage is also not necessarily successively It carries out, but can be at least part of the sub-step or stage of other steps or other steps in turn or alternately It executes.
In one embodiment, as shown in figure 4, providing a kind of interface test device, comprising: file acquisition module 402, Interface calling module 404, interface testing module 406, in which:
File acquisition module 402 has recorded multiple interfaces to be measured in the first configuration file for obtaining the first configuration file And corresponding protos test suite PROTOS;The second configuration file is obtained, when having recorded the test of multiple interfaces to be measured in the second configuration file Between.
Interface calling module 404, for when reaching the testing time of interface to be measured, triggering test script starting to pass through Test script calls interface to be measured.
Interface testing module 406, for using test script call protos test suite PROTOS, by protos test suite PROTOS to interface to be measured into Row test.
In one embodiment, the request that interface testing module 406 is also used to obtain interface to be measured using test script enters Ginseng;To requesting to carry out abstract processing into ginseng, the file of preset format is generated;Parse preset format file, obtain and request into Join corresponding json character string;Interface to be measured is called according to json character string.
In one embodiment, interface testing module 406 is also used to obtain key file, parses key file, obtains hidden Ensconce the key in key file;It is encrypted according to key pair json character string.
In one embodiment, above-mentioned apparatus further includes asserting module, this assert module for using test script acquisition Corresponding respond out of interface to be measured is joined;It will request to execute context into the corresponding json character string write-in of ginseng;Passing through test suite After part tests interface to be measured, resolution response result set obtains joining corresponding json character string with responding out;It will response Join corresponding json character string write-in out and executes context;It is corresponding to requesting to join into ginseng and responding out by executing context Field is asserted.
In one embodiment, above-mentioned apparatus further includes asserting module, this asserts that module is also used to obtain test script pair The access authority of interface IP address and multiple tables of data;According to the corresponding interface to be measured in access authority query interface address, and Tables of data corresponding with interface to be measured;Using the multiple tables of data inquired as table result set;By test script to table result Collection is asserted.
Specific about interface test device limits the restriction that may refer to above for interface test method, herein not It repeats again.Modules in above-mentioned interface test device can be realized fully or partially through software, hardware and combinations thereof.On Stating each module can be embedded in the form of hardware or independently of in the processor in computer equipment, can also store in a software form In memory in computer equipment, the corresponding operation of the above modules is executed in order to which processor calls.
In one embodiment, a kind of computer equipment is provided, which can be server, internal junction Composition can be as shown in Figure 5.The computer equipment include by system bus connect processor, memory, network interface and Database.Wherein, the processor of the computer equipment is for providing calculating and control ability.The memory packet of the computer equipment Include non-volatile memory medium, built-in storage.The non-volatile memory medium is stored with operating system, computer program and data Library.The built-in storage provides environment for the operation of operating system and computer program in non-volatile memory medium.The calculating The database of machine equipment is for storing the first configuration file, second configuration file etc..The network interface of the computer equipment is used for It is communicated with external terminal by network connection.To realize a kind of interface testing side when the computer program is executed by processor Method.
It will be understood by those skilled in the art that structure shown in Fig. 5, only part relevant to application scheme is tied The block diagram of structure does not constitute the restriction for the computer equipment being applied thereon to application scheme, specific computer equipment It may include perhaps combining certain components or with different component layouts than more or fewer components as shown in the figure.
In one embodiment, a kind of computer equipment, including memory and processor are provided, which is stored with Computer program, the processor perform the steps of when executing computer program
The first configuration file is obtained, multiple interfaces to be measured and corresponding protos test suite PROTOS are had recorded in the first configuration file;
The second configuration file is obtained, the testing time of multiple interfaces to be measured is had recorded in the second configuration file;
When reaching the testing time of interface to be measured, triggering test script starting calls interface to be measured by test script;
Protos test suite PROTOS is called using test script, interface to be measured is tested by protos test suite PROTOS.
In one embodiment, it also performs the steps of when processor executes computer program and is obtained using test script The request of interface to be measured enters ginseng;To requesting to carry out abstract processing into ginseng, the file of preset format is generated;Parse the text of preset format Part is obtained and is requested into the corresponding json character string of ginseng;Interface to be measured is called according to json character string.
In one embodiment, acquisition key file is also performed the steps of when processor executes computer program, is parsed Key file obtains being hidden in the key in key file;It is encrypted according to key pair json character string.
In one embodiment, it also performs the steps of when processor executes computer program and is obtained using test script Corresponding respond out of interface to be measured is joined;It will request to execute context into the corresponding json character string write-in of ginseng;Passing through test suite After part tests interface to be measured, resolution response result set obtains joining corresponding json character string with responding out;It will response Join corresponding json character string write-in out and executes context;It is corresponding to requesting to join into ginseng and responding out by executing context Field is asserted.
In one embodiment, it is also performed the steps of when processor executes computer program and obtains test script docking The access authority of port address and multiple tables of data;According to the corresponding interface to be measured in access authority query interface address, Yi Jiyu The corresponding tables of data of interface to be measured;Using the multiple tables of data inquired as table result set;By test script to table result set In field asserted.
In one embodiment, a kind of computer readable storage medium is provided, computer program is stored thereon with, is calculated The step in the method for the various embodiments described above is realized when machine program is executed by processor:
The first configuration file is obtained, multiple interfaces to be measured and corresponding protos test suite PROTOS are had recorded in the first configuration file;
The second configuration file is obtained, the testing time of multiple interfaces to be measured is had recorded in the second configuration file;
When reaching the testing time of interface to be measured, triggering test script starting calls interface to be measured by test script;
Protos test suite PROTOS is called using test script, interface to be measured is tested by protos test suite PROTOS.
In one embodiment, it also performs the steps of when processor executes computer program and is obtained using test script The request of interface to be measured enters ginseng;To requesting to carry out abstract processing into ginseng, the file of preset format is generated;Parse the text of preset format Part is obtained and is requested into the corresponding json character string of ginseng;Interface to be measured is called according to json character string.
In one embodiment, acquisition key file is also performed the steps of when processor executes computer program, is parsed Key file obtains being hidden in the key in key file;It is encrypted according to key pair json character string.
In one embodiment, it also performs the steps of when processor executes computer program and is obtained using test script Corresponding respond out of interface to be measured is joined;It will request to execute context into the corresponding json character string write-in of ginseng;Passing through test suite After part tests interface to be measured, resolution response result set obtains joining corresponding json character string with responding out;It will response Join corresponding json character string write-in out and executes context;It is corresponding to requesting to join into ginseng and responding out by executing context Field is asserted.
In one embodiment, it is also performed the steps of when processor executes computer program and obtains test script docking The access authority of port address and multiple tables of data;According to the corresponding interface to be measured in access authority query interface address, Yi Jiyu The corresponding tables of data of interface to be measured;Using the multiple tables of data inquired as table result set;By test script to table result set In field asserted.
Those of ordinary skill in the art will appreciate that realizing all or part of the process in above-described embodiment method, being can be with Relevant hardware is instructed to complete by computer program, the computer program can be stored in a non-volatile computer In read/write memory medium, the computer program is when being executed, it may include such as the process of the embodiment of above-mentioned each method.Wherein, To any reference of memory, storage, database or other media used in each embodiment provided herein, Including non-volatile and/or volatile memory.Nonvolatile memory may include read-only memory (ROM), programming ROM (PROM), electrically programmable ROM (EPROM), electrically erasable ROM (EEPROM) or flash memory.Volatile memory may include Random access memory (RAM) or external cache.By way of illustration and not limitation, RAM is available in many forms, Such as static state RAM (SRAM), dynamic ram (DRAM), synchronous dram (SDRAM), double data rate sdram (DDRSDRAM), enhancing Type SDRAM (ESDRAM), synchronization link (Synchlink) DRAM (SLDRAM), memory bus (Rambus) direct RAM (RDRAM), direct memory bus dynamic ram (DRDRAM) and memory bus dynamic ram (RDRAM) etc..
Each technical characteristic of above embodiments can be combined arbitrarily, for simplicity of description, not to above-described embodiment In each technical characteristic it is all possible combination be all described, as long as however, the combination of these technical characteristics be not present lance Shield all should be considered as described in this specification.
The several embodiments of the application above described embodiment only expresses, the description thereof is more specific and detailed, but simultaneously It cannot therefore be construed as limiting the scope of the patent.It should be pointed out that coming for those of ordinary skill in the art It says, without departing from the concept of this application, various modifications and improvements can be made, these belong to the protection of the application Range.Therefore, the scope of protection shall be subject to the appended claims for the application patent.

Claims (10)

1. a kind of interface test method, which comprises
The first configuration file is obtained, multiple interfaces to be measured and corresponding protos test suite PROTOS are had recorded in first configuration file;
The second configuration file is obtained, the testing time of multiple interfaces to be measured is had recorded in second configuration file;
When reaching the testing time of the interface to be measured, triggering test script starting, by described in test script calling Interface to be measured;
The protos test suite PROTOS is called using the test script, the interface to be measured is tested by the protos test suite PROTOS.
2. the method according to claim 1, wherein described call the interface to be measured by the test script Include:
Enter ginseng using the request that the test script obtains the interface to be measured;
It requests to carry out abstract processing into ginseng to described, generates the file of preset format;
The file for parsing the preset format obtains requesting with described into the corresponding json character string of ginseng;
The interface to be measured is called according to the json character string.
3. according to the method described in claim 2, it is characterized in that, the parsing preset format file, obtain with It is described request the corresponding json character string of ginseng after, the method also includes:
Key file is obtained, the key file is parsed, obtains the key being hidden in the key file;
It is encrypted according to json character string described in the key pair.
4. according to the method described in claim 2, it is characterized in that, the method also includes:
Corresponding respond out of interface to be measured is obtained using the test script to join;
It requests to execute context into the corresponding json character string write-in of ginseng by described;
After being tested by the protos test suite PROTOS the interface to be measured, resolution response result set is obtained and the sound It should go out and join corresponding json character string;
Described respond out is joined into corresponding json character string write-in execution context;
It requests into ginseng to described by the execution context and responds out and join corresponding field and assert.
5. the method according to claim 1, wherein the method also includes:
The test script is obtained to the access authority of interface IP address and multiple tables of data;
The corresponding interface to be measured of the interface IP address is inquired according to the access authority, and number corresponding with the interface to be measured According to table;
Using the multiple tables of data inquired as table result set;
The field in the table result set is asserted by the test script.
6. a kind of interface test device, which is characterized in that described device includes:
File acquisition module, had recorded for obtaining the first configuration file, in first configuration file multiple interfaces to be measured with And corresponding protos test suite PROTOS;The second configuration file is obtained, the test of multiple interfaces to be measured is had recorded in second configuration file Time;
Interface calling module, for when reaching the testing time of the interface to be measured, triggering test script to start, by described Test script calls the interface to be measured;
Interface testing module, for calling the protos test suite PROTOS using the test script, by the protos test suite PROTOS to described Interface to be measured is tested.
7. device according to claim 6, which is characterized in that the interface testing module is also used to utilize the test foot This request for obtaining the interface to be measured enters ginseng;It requests to carry out abstract processing into ginseng to described, generates the file of preset format;Solution The file for analysing the preset format obtains requesting with described into the corresponding json character string of ginseng;According to the json character string tune With the interface to be measured.
8. device according to claim 6, which is characterized in that the interface testing module is also used to obtain key file, The key file is parsed, the key being hidden in the key file is obtained;According to json character string described in the key pair It is encrypted.
9. a kind of computer equipment, including memory and processor, the memory are stored with the meter that can be run on a processor Calculation machine program, which is characterized in that the processor realizes any one of claims 1 to 5 institute when executing the computer program The step of stating method.
10. a kind of computer readable storage medium, is stored thereon with computer program, which is characterized in that the computer program The step of any one of claims 1 to 5 the method is realized when being executed by processor.
CN201910004226.1A 2019-01-03 2019-01-03 Interface test method, device, computer equipment and storage medium Pending CN109815139A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910004226.1A CN109815139A (en) 2019-01-03 2019-01-03 Interface test method, device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910004226.1A CN109815139A (en) 2019-01-03 2019-01-03 Interface test method, device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN109815139A true CN109815139A (en) 2019-05-28

Family

ID=66604007

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910004226.1A Pending CN109815139A (en) 2019-01-03 2019-01-03 Interface test method, device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN109815139A (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111897721A (en) * 2020-07-14 2020-11-06 重庆长安汽车股份有限公司 Automatic test method of API interface and storage medium
CN113392026A (en) * 2021-07-07 2021-09-14 北京智慧星光信息技术有限公司 Interface automation test method, system, electronic equipment and storage medium
CN114090454A (en) * 2021-11-29 2022-02-25 苏州万店掌网络科技有限公司 Interface automatic testing method, device, equipment and storage medium

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111897721A (en) * 2020-07-14 2020-11-06 重庆长安汽车股份有限公司 Automatic test method of API interface and storage medium
CN111897721B (en) * 2020-07-14 2024-04-30 重庆长安汽车股份有限公司 Automatic testing method of API (application program interface) and 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
CN114090454A (en) * 2021-11-29 2022-02-25 苏州万店掌网络科技有限公司 Interface automatic testing method, device, equipment and storage medium

Similar Documents

Publication Publication Date Title
CN109522218A (en) Interface test method, device, computer equipment and storage medium
CN110751550B (en) Account checking method and device, computer equipment and storage medium
CN109474578A (en) Message method of calibration, device, computer equipment and storage medium
CN108268375A (en) Applied program testing method, device, computer equipment and storage medium
CN108038053A (en) A kind of dynamic configuration buries method and apparatus a little
CN109815139A (en) Interface test method, device, computer equipment and storage medium
CN109788032A (en) Acquisition methods, device, computer equipment and the storage medium of image file
CN110209652A (en) Tables of data moving method, device, computer equipment and storage medium
CN109710677A (en) Processing for Data Analysis in Physics, device, computer equipment and storage medium
CN109656778A (en) Data capture method, device, computer equipment and storage medium
CN109726134B (en) Interface test method and system
CN109165266A (en) List generation method, device, computer equipment and storage medium
CN110221967A (en) Test data building method, device, computer equipment and storage medium
CN109446065A (en) User tag test method, device, computer equipment and storage medium
CN109669859A (en) Service test method, device, computer equipment and storage medium
CN112905459B (en) Service interface testing method and device, electronic equipment and storage medium
CN109144799A (en) Integrated testing method, apparatus, computer equipment and storage medium
CN109816364A (en) Transaction data processing method, device, computer equipment and storage medium
CN110502428A (en) Code test method, device, computer equipment and storage medium
CN113448862A (en) Software version testing method and device and computer equipment
CN114168190A (en) Interface document generation method and device, computer equipment and storage medium
CN106990974B (en) APP updating method and device and electronic equipment
CN110502242A (en) Code automatic generation method, device, computer equipment and storage medium
CN113778878A (en) Interface testing method and device, electronic equipment and storage medium
CN111274120A (en) Interface document verification 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