CN106201865A - A kind of application programming interface API method of testing, device and terminal unit - Google Patents

A kind of application programming interface API method of testing, device and terminal unit Download PDF

Info

Publication number
CN106201865A
CN106201865A CN201610482242.8A CN201610482242A CN106201865A CN 106201865 A CN106201865 A CN 106201865A CN 201610482242 A CN201610482242 A CN 201610482242A CN 106201865 A CN106201865 A CN 106201865A
Authority
CN
China
Prior art keywords
api
document
measured
test
server
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
CN201610482242.8A
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.)
Leshi Zhixin Electronic Technology Tianjin Co Ltd
LeTV Holding Beijing Co Ltd
Original Assignee
Leshi Zhixin Electronic Technology Tianjin Co Ltd
LeTV Holding Beijing 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 Leshi Zhixin Electronic Technology Tianjin Co Ltd, LeTV Holding Beijing Co Ltd filed Critical Leshi Zhixin Electronic Technology Tianjin Co Ltd
Priority to CN201610482242.8A priority Critical patent/CN106201865A/en
Publication of CN106201865A publication Critical patent/CN106201865A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3604Software analysis for verifying properties of programs
    • G06F11/3616Software analysis for verifying properties of programs using software metrics

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The open a kind of application programming interface API method of testing of the embodiment of the present invention, device and terminal unit, in this API method of testing, after the API standard document obtaining API to be measured, according to preset format, read the test parameter of the API described to be measured comprised in described API standard document, wherein, described API standard document is the API document write according to preset format;According to the test parameter of described API to be measured, generate the test request of API to be measured;By described test request by described API to be measured transmission to server, and the response message receiving described server feedback by described API to be measured, the performance of described API to be measured is determined according to described response message.Pass through this programme, it is capable of the test to API, and, in test process, obtained the test parameter of API to be measured by the API standard document write according to preset format, thus decrease the communication of Test Engineer and backstage research and development engineer, reduce the consuming of manpower, and reduce time for communication, improve the testing efficiency of API.

Description

A kind of application programming interface API method of testing, device and terminal unit
Technical field
The present embodiments relate to software testing technology field, particularly relate to a kind of application programming interface API test Method, device and terminal unit.
Background technology
Along with the development of scientific and technological level, the application of various terminal units (such as smart mobile phone etc.) is increasingly extensive.The biggest portion Point terminal unit is CS (Client/Server Structs, client-server structure), by with the holding alternately of server Row operations.In this case, terminal unit is provided with API (Application Programming Interface, Application programming interface), when user needs terminal unit to perform a certain operation, terminal unit produces and asks letter accordingly Breath, and pass through API by described request message transmission to server, in order to server produces corresponding sound according to described solicited message Answer data.Then, described terminal unit receives the response data of described server feedback by API, and according to described number of responses According to performing corresponding operating.Therefore, the performance of API influences whether the use of terminal unit, in order to determine the performance of API, often needs API is tested.
In prior art, backstage research and development engineer develop API, and write corresponding document according to API, the document wraps Relevant information containing API, such as the interactive mode etc. of API Yu server.Test Engineer is after getting the document, according to rear The communication of platform research and development engineer, determines the relevant information of the described API comprised in the document, in order to being correlated with according to described API The corresponding test request of information editing, and by the transmission of described test request to the test terminal of API, realize described test terminal Test to API.
But, inventor finds in the research process of the application, when API is tested by prior art, needs test Engineer links up with backstage research and development engineer, expends a large amount of manpower, and, communication process often takes considerable time, Affect the testing efficiency of API.
Summary of the invention
For overcoming problem present in correlation technique, the embodiment of the present invention provides a kind of application programming interface API to survey Method for testing, device and terminal unit.
In order to solve above-mentioned technical problem, the embodiment of the invention discloses following technical scheme:
First aspect according to embodiments of the present invention, it is provided that a kind of application programming interface API method of testing, including:
After the API standard document obtaining API to be measured, according to preset format, read and described API standard document comprises The test parameter of described API to be measured, wherein, described API standard document is the API document write according to preset format;
According to the test parameter of described API to be measured, generate the test request of described API to be measured;
Described test request is transmitted to server by described API to be measured, and receives described clothes by described API to be measured The response message of business device feedback, determines the performance of described API to be measured according to described response message.
Optionally, also include:
After obtaining API document, it is judged that whether described API document is API standard document, if it is not, delete described API literary composition Shelves.
Optionally, described judge whether described API document is that API standard document includes:
After obtaining described API document, it is judged that whether described API document comprises standard logo, if so, determine described API document is described API standard document.
Optionally, described judge whether described API document is that API standard document includes:
Described API document is contrasted line by line with the API destination document prestored, if the form of described API document Match with the form of described API destination document, determine that described API document is API standard document, wherein, described API target literary composition Shelves are the API document write according to described preset format.
Optionally, the test parameter of described API to be measured includes:
Between interactive mode between described API to be measured and server, and described API to be measured and server mutual each The type of item data and the span of described each item data.
Second aspect according to embodiments of the present invention, it is provided that a kind of application programming interface API test device, including:
Test parameter read module, for after the API standard document obtaining API to be measured, according to preset format, reads institute Stating the test parameter of the API described to be measured comprised in API standard document, wherein, described API standard document is according to preset format The API document write;
Test request generation module, for the test parameter according to described API to be measured, generates the test of described API to be measured Request;
Performance determines module, for described test request being transmitted to server by described API to be measured, and by described API to be measured receives the response message of described server feedback, determines the performance of described API to be measured according to described response message.
Optionally, also include:
Document judge module, for after obtaining API document, it is judged that whether described API document is API standard document, if No, delete described API document.
Optionally, described document judge module includes:
First judging unit, for after obtaining described API document, it is judged that whether comprise standard mark in described API document Know, if so, determine that described API document is described API standard document.
Optionally, described document judge module includes:
Second judging unit, for described API document is contrasted line by line with the API destination document prestored, if The form of described API document matches with the form of described API destination document, determines that described API document is API standard document, Wherein, described API destination document is the API document write according to described preset format.
Optionally, the test parameter of described API to be measured includes:
Between interactive mode between described API to be measured and server, and described API to be measured and server mutual each The type of item data and the span of described each item data.
The third aspect according to embodiments of the present invention, it is provided that a kind of terminal unit, including:
Processor;
For storing the memorizer of processor executable;
Wherein, described processor is configured to:
After the API standard document obtaining API to be measured, according to preset format, read and described API standard document comprises The test parameter of described API to be measured, wherein, described API standard document is the API document write according to preset format;
According to the test parameter of described API to be measured, generate the test request of described API to be measured;
Described test request is transmitted to server by described API to be measured, and receives described clothes by described API to be measured The response message of business device feedback, determines the performance of described API to be measured according to described response message.
The technical scheme that the embodiment of the present invention provides can include following beneficial effect:
By API method of testing, device and terminal unit disclosed in the embodiment of the present invention, it is possible to realize the test to API, Further, in test process, the test parameter of API to be measured is obtained by the API standard document write according to preset format, thus Decrease the communication of Test Engineer and backstage research and development engineer, reduce the consuming of manpower, and reduce time for communication, improve The testing efficiency of API.
It should be appreciated that it is only exemplary and explanatory, not that above general description and details hereinafter describe The present invention can be limited.
Accompanying drawing explanation
Accompanying drawing herein is merged in description and constitutes the part of this specification, it is shown that meet the enforcement of the present invention Example, and for explaining the principle of the present invention together with description.
Fig. 1 is according to a kind of application programming interface API method of testing shown in the present invention one exemplary embodiment Configuration diagram;
Fig. 2 is according to a kind of application programming interface API method of testing shown in the present invention one exemplary embodiment Workflow schematic diagram;
Fig. 3 is according to another the application programming interface API method of testing shown in the present invention one exemplary embodiment Workflow schematic diagram;
Fig. 4 is to test device according to a kind of application programming interface API shown in the present invention one exemplary embodiment Structural representation;
Fig. 5 is to test device according to another application programming interface API shown in the present invention one exemplary embodiment Structural representation.
Detailed description of the invention
Here will illustrate exemplary embodiment in detail, its example represents in the accompanying drawings.Explained below relates to During accompanying drawing, unless otherwise indicated, the same numbers in different accompanying drawings represents same or analogous key element.Following exemplary embodiment Described in embodiment do not represent all embodiments consistent with the present invention.On the contrary, they are only with the most appended The example of the apparatus and method that some aspects that described in detail in claims, the present invention are consistent.
The open a kind of application programming interface API method of testing of the embodiment of the present invention, device and terminal unit, to solve When utilizing prior art that API is tested, the problem that a large amount of manpower and time can be expended.
Configuration diagram shown in Figure 1, this schematic diagram includes terminal unit 100 and server 200.Wherein, institute State in terminal unit 100 and be built-in with application programming interface API, it is possible to by API test side disclosed in the embodiment of the present invention Method and device realize the test to API.Wherein, described terminal unit 100 disclosed scheme according to embodiments of the present invention produces and treats Survey the test request of API, and by API to be measured by test request transmission extremely described server 200, then by described to be measured API receives the response message of described server 200 feedback, according to described response message, determines the performance of described API to be measured.
The open a kind of application programming interface API method of testing of the embodiment of the present invention one.Workflow shown in Figure 2 Journey schematic diagram, described API method of testing comprises the following steps:
Step S11, obtain API to be measured API standard document after, according to preset format, read described API standard document In the test parameter of API described to be measured that comprises, wherein, described API standard document is the API literary composition write according to preset format Shelves.
In API document, include the various test parameters of API.In scheme disclosed in the embodiment of the present invention, set The various test parameters of API are API standard document according to the API document that preset format is write.
Wherein, the test parameter of described API to be measured generally includes: the interactive mode between described API to be measured and server, And the type of mutual each item data and the span of described each item data between described API to be measured and server.
Multiple interactive mode is there is between API and server.Wherein, at HTTP (HyperText Transfer Protocol, HTML (Hypertext Markup Language)) in, the interactive mode of definition includes searching type (i.e. GET type) and revising type (i.e. POST type) etc. type.
Further, the mutual of many item data, wherein, the API of difference in functionality and clothes can be carried out between each API and server The business mutual data of device are the most different.Described test parameter includes the type of each item data, as set the class of certain item data Type is integer, and the type of another data is character string type.It addition, described test parameter also includes the value model of each item data Enclosing, described span generally includes the default value of data, the maximum of permission and minima etc..
Owing to described API standard document is write according to preset format, therefore, according to described preset format, i.e. can read institute State the described test parameter comprised in API standard document.
Such as, if in described preset format, it is stipulated that this test parameter of the interactive mode between API to be measured and server With "<method></method>" form fill in, and described API standard document comprises "<method>gET</method>" Description, then may determine that interactive mode between described API to be measured and server is for searching type (i.e. GET type), the most just Being to say, described API to be measured is generally used for obtaining or query resource information.
Step S12, test parameter according to described API to be measured, generate the test request of described API to be measured.
Wherein, in HTTP (HyperText Transfer Protocol, HTML (Hypertext Markup Language)), described API to be measured Test request be usually HTTP request.
Step S13, described test request is transmitted to server by described API to be measured, and connect by described API to be measured Receive the response message of described server feedback, determine the performance of described API to be measured according to described response message.
Described server, after the test request receiving described API to be measured transmission, can produce according to described test request Corresponding response message is also fed back, and terminal unit can receive described response message by described API to be measured.
It addition, when determining the performance of described API to be measured according to the response message of server feedback, can set in terminal in advance The response message that standby middle storage API to be measured should get in the case of functional, and by itself and this test process The response message received compares, and determines the performance of described API to be measured according to the matching degree of the two.Wherein, the two coupling Degree is the highest, illustrates that the performance of described API to be measured is the best.
The open a kind of application programming interface API method of testing of the embodiment of the present invention one, with it, be capable of Test to API, and, in test process, obtain API's to be measured by the API standard document write according to preset format Test parameter, thus decrease the communication of Test Engineer and backstage research and development engineer, reduce the consuming of manpower, and reduce ditch The logical time, improve the testing efficiency of API.
In application programming interface API method of testing disclosed in the embodiment of the present invention, terminal unit generally receives use The API document of family input, wherein, frequently includes API standard document and the API not write according to preset format in this API document Document.In this case, workflow schematic diagram shown in Figure 3, the open a kind of application program of the embodiment of the present invention two is compiled Journey interface API method of testing, described application programming interface API method of testing comprises the following steps:
Step S21, obtaining after API document, it is judged that whether described API document is API standard document, if it is not, perform step The operation of rapid S22, if so, performs the operation of step S23.
If step S22 described API document is not API standard document, delete described API document.
If described API document is not API standard document, the survey of described API to be measured often cannot be read according to preset format Examination parameter, but need the communication repeatedly of Test Engineer and backstage research and development engineer, could obtain and comprise in this API document Test parameter.In this case, described API document can be deleted, thus reduce and memory space in terminal unit is taken.
If step S23 described API document is API standard document, after the API standard document obtaining API to be measured, according to Preset format, reads the test parameter of the API described to be measured comprised in described API standard document, wherein, described API standard literary composition Shelves are the API document write according to preset format.
Wherein, the test parameter of described API to be measured generally includes: the interactive mode between described API to be measured and server, And the type of mutual each item data and the span of described each item data between described API to be measured and server.
Multiple interactive mode is there is between API and server.Wherein, at HTTP (HyperText Transfer Protocol, HTML (Hypertext Markup Language)) in, the interactive mode of definition includes searching type (i.e. GET type) and revising type (i.e. POST type) etc. type.
Further, the mutual of many item data, wherein, the API of difference in functionality and clothes can be carried out between each API and server The business mutual data of device are the most different.Described test parameter includes the type of each item data, as set the class of certain item data Type is integer, and the type of another data is character string type.It addition, described test parameter also includes the value model of each item data Enclose.Described span includes the default value of data, the maximum of permission and minima etc..
Owing to described API standard document is write according to preset format, therefore, according to described preset format, i.e. can read institute State the described test parameter comprised in API standard document.
Step S24, test parameter according to described API to be measured, generate the test request of described API to be measured.
Step S25, described test request is transmitted to server by described API to be measured, and connect by described API to be measured Receive the response message of described server feedback, determine the performance of described API to be measured according to described response message.
Wherein, the operating process of step S23 to step S25 is identical with the operating process of step S11 to step S13, can phase Reference mutually, here is omitted.
The open a kind of API method of testing of the embodiment of the present invention two, with it, be capable of the test to API, and And, in test process, obtained the test parameter of API to be measured by the API standard document write according to preset format, thus subtract Lack the communication of Test Engineer and backstage research and development engineer, reduced the consuming of manpower, and reduce time for communication, improve The testing efficiency of API.
Further, in API method of testing disclosed in the embodiment of the present invention two, survey at the API receiving user's input Examination document after, it is judged that described in state whether API document is API standard document, if it is not, delete this API document such that it is able to it is right to reduce Taking of the memory space of terminal unit.
Further, in API method of testing disclosed in the embodiment of the present invention, described API can be judged in several ways Whether document is API standard document.
In in one way in which, described judge whether described API document is that API standard document includes:
After obtaining described API document, it is judged that whether described API document comprises standard logo, if so, determine described API document is described API standard document.
In which, backstage research and development engineer, when writing API standard document, can add in described API standard document Standard logo.In this case, terminal unit is after receiving described API document, by whether comprising standard in this API document Mark, determines whether described API is API standard document.
Wherein, described standard logo is usually a specific character set in advance or character string, and is arranged on API literary composition The original position of shelves.
In another mode, described judge whether described API document is that API standard document includes:
Described API document is contrasted line by line with the API destination document prestored, if the form of described API document Match with the form of described API destination document, determine that described API document is API standard document, wherein, described API target literary composition Shelves are the API document write according to described preset format.
In which, needing to prestore API destination document, described API destination document is write according to described preset format. After receiving API document, it is contrasted line by line with API destination document, and determine according to the matching degree of the two described Whether API document is API standard document.
Wherein, if the form of the described each row of API document is the most identical with the form of the described each row of API destination document, or, if The form of the length occupying more than n% in described API document is identical with the form of described API destination document, then it is assumed that described API The form of document matches with the form of described API destination document, and described API document is API standard document, and wherein n is default The numerical value more than o.
Such as, if in described API destination document, set the type of each item data mutual between API and server Preset format be "<type></type>", if in the API document received, for a certain item data comprise described below "< Type>long</type>", this description is long (integer) for representing the type of this item data, in this case, it is believed that The form of this row is identical with the form of this row in described API destination document.
Accordingly, the open a kind of application programming interface API test device of the embodiment of the present invention three, shown in Figure 4 Structural representation, described application programming interface API test device include: test parameter read module 110, test request Generation module 120 and performance determine module 130.
Wherein, described test parameter read module 110, for after the API standard document obtaining API to be measured, according in advance If form, read the test parameter of the API described to be measured comprised in described API standard document, wherein, described API standard document For the API document write according to preset format.
In API document, include the various test parameters of API.In scheme disclosed in the embodiment of the present invention, set The various test parameters of API are API standard document according to the API document that preset format is write.
Wherein, the test parameter of described API to be measured generally includes: the interactive mode between described API to be measured and server, And the type of mutual each item data and the span of described each item data between described API to be measured and server.
Multiple interactive mode is there is between API and server.Wherein, at HTTP (HyperText Transfer Protocol, HTML (Hypertext Markup Language)) in, the interactive mode of definition includes searching type (i.e. GET type) and revising type (i.e. POST type) etc. type.
Further, the mutual of many item data, wherein, the API of difference in functionality and clothes can be carried out between each API and server The business mutual data of device are the most different.Described test parameter includes the type of each item data, as set the class of certain item data Type is integer, and the type of another data is character string type.It addition, described test parameter also includes the value model of each item data Enclose.Described span includes the default value of data, the maximum of permission and minima etc..
Owing to described API standard document is write according to preset format, therefore, according to described preset format, i.e. can read institute State the described test parameter comprised in API standard document.
Such as, if in described preset format, it is stipulated that this test parameter of the interactive mode between API to be measured and server With "<method></method>" form fill in, and described API standard document comprises "<method>gET</method>" Description, then may determine that interactive mode between described API to be measured and server is for searching type (i.e. GET type), the most just Being to say, described API to be measured is generally used for obtaining or query resource information.
Described test request generation module 120, for the test parameter according to described API to be measured, generates described API to be measured Test request.
Wherein, in HTTP (HyperText Transfer Protocol, HTML (Hypertext Markup Language)), described API to be measured Test request be usually HTTP request.
Described performance determines module 130, for described test request is transmitted to server by described API to be measured, and Received the response message of described server feedback by described API to be measured, determine described API's to be measured according to described response message Performance.
Described server, after the test request receiving described API to be measured transmission, can produce according to described test request Corresponding response message is also fed back, and terminal unit can receive described response message by described API to be measured.
It addition, described performance determines that module 130 is in the property determining described API to be measured according to the response message of server feedback During energy, the response message that API to be measured should get in the case of functional can be stored in advance in terminal unit, and will Its with this test process in the response message that receives compare, determine described API's to be measured according to the matching degree of the two Performance.Wherein, the two matching degree is the highest, illustrates that the performance of described API to be measured is the best.
The open a kind of API of the embodiment of the present invention three tests device, by this device, it is possible to realize the test to API, and And, in test process, obtained the test parameter of API to be measured by the API standard document write according to preset format, thus subtract Lack the communication of Test Engineer and backstage research and development engineer, reduced the consuming of manpower, and reduce time for communication, improve The testing efficiency of API.
It addition, the API document that receives of terminal unit frequently includes API standard document and does not writes according to preset format API document.In this case, the open a kind of application programming interface API test device of the embodiment of the present invention four, see figure Structural representation shown in 5, described application programming interface API test device includes: test parameter read module 110, survey Examination request generation module 120 and performance determine module 130, and, described API test device also includes: document judge module 140。
Wherein, described document judge module 140 is for after obtaining API document, it is judged that whether described API document is API Standard document, if it is not, delete described API document.
It addition, described test parameter read module 110, for after the API standard document obtaining API to be measured, according in advance If form, read the test parameter of the API described to be measured comprised in described API standard document, wherein, described API standard document For the API document write according to preset format.
Described test request generation module 120, for the test parameter according to described API to be measured, generates described API to be measured Test request.
Described performance determines module 130, for described test request is transmitted to server by described API to be measured, and Received the response message of described server feedback by described API to be measured, determine described API's to be measured according to described response message Performance.
Device is tested, it is possible to realize the test to API by API disclosed in the embodiment of the present invention four, and, testing Cheng Zhong, is obtained the test parameter of API to be measured, thus decreases test work by the API standard document write according to preset format Cheng Shi and the communication of backstage research and development engineer, decrease the consuming of manpower, and decrease time for communication, improve the survey of API Examination efficiency.
Further, described API test device can be after the API test document receiving user's input, it is judged that described State whether API document is API standard document, if it is not, delete this API document such that it is able to reduce the storage to terminal unit empty Between take.
Further, in API test device disclosed in the embodiment of the present invention, described document judge module 140 includes: the One judging unit 141 and/or the second judging unit 142.
Wherein, described first judging unit 141, for after obtaining described API document, it is judged that in described API document be No comprise standard logo, if so, determine that described API document is described API standard document.
If described document judge module 140 includes the first judging unit 141, research and development engineer in backstage is writing API mark During quasi-document, standard logo can be added in described API standard document.In this case, terminal unit is receiving described API After document, by whether this API document comprises standard logo, determine whether described API is API standard document.Wherein, described Standard logo is usually a specific character set in advance or character string, and is arranged on the original position of API document.
Described second judging unit 140, for carrying out described API document line by line with the API destination document prestored Contrast, if the form of the form of described API document and described API destination document matches, determines that described API document is that API marks Quasi-document, wherein, described API destination document is the API document write according to described preset format.
If described document judge module 140 includes the second judging unit 142, need to prestore API destination document, institute State API destination document to write according to described preset format.After receiving API document, itself and API destination document are carried out line by line Contrast, and determine whether described API document is API standard document according to the matching degree of the two.
Wherein, if the form of the described each row of API document is the most identical with the form of the described each row of API destination document, or, if The form of the length occupying more than n% in described API document is identical with the form of described API destination document, then it is assumed that described API The form of document matches with the form of described API destination document, and described API document is API standard document, and wherein n is default The numerical value more than o.
Such as, if in described API destination document, set the type of each item data mutual between API and server Preset format be "<type></type>", if in the API document received, for a certain item data comprise described below "< Type>long</type>", this description is long (integer) for representing the type of this item data, in this case, it is believed that The form of this row is identical with the form of this row in described API destination document.
About the device in above-described embodiment, wherein modules performs the concrete mode of operation in relevant the method Embodiment in be described in detail, explanation will be not set forth in detail herein.
Accordingly, the open a kind of terminal unit of the embodiment of the present invention five.Described terminal unit includes:
Processor;
For storing the memorizer of processor executable;
Wherein, described processor is configured to:
After the API standard document obtaining API to be measured, according to preset format, read and described API standard document comprises The test parameter of described API to be measured, wherein, described API standard document is the API document write according to preset format;
According to the test parameter of described API to be measured, generate the test request of described API to be measured;
Described test request is transmitted to server by described API to be measured, and receives described clothes by described API to be measured The response message of business device feedback, determines the performance of described API to be measured according to described response message.
Described server, after the test request receiving described API to be measured transmission, can produce according to described test request Corresponding response message is also fed back, and terminal unit can receive described response message by described API to be measured.
It addition, when determining the performance of described API to be measured according to the response message of server feedback, can set in terminal in advance The response message that standby middle storage API to be measured should get in the case of functional, and by itself and this test process The response message received compares, and determines the performance of described API to be measured according to the matching degree of the two.Wherein, the two coupling Degree is the highest, illustrates that the performance of described API to be measured is the best.
By terminal unit disclosed in the embodiment of the present invention, it is possible to realize the test to API, and, in test process, Obtained the test parameter of API to be measured by the API standard document write according to preset format, thus decrease Test Engineer with The communication of backstage research and development engineer, reduces the consuming of manpower, and reduces time for communication, improve the testing efficiency of API.
Wherein, the test parameter of described API to be measured includes:
Between interactive mode between described API to be measured and server, and described API to be measured and server mutual each The type of item data and the span of described each item data.
Multiple interactive mode is there is between API and server.Wherein, at HTTP (HyperText Transfer Protocol, HTML (Hypertext Markup Language)) in, the interactive mode of definition includes searching type (i.e. GET type) and revising type (i.e. POST type) etc. type.
Further, the mutual of many item data, wherein, the API of difference in functionality and clothes can be carried out between each API and server The business mutual data of device are the most different.Described test parameter includes the type of each item data, as set the class of certain item data Type is integer, and the type of another data is character string type.It addition, described test parameter also includes the value model of each item data Enclose.Described span includes the default value of data, the maximum of permission and minima etc..
Further, described processor is also configured to obtaining after API document, it is judged that whether described API document is API standard document, if it is not, delete described API document.
If described API document is not API standard document, the survey of described API to be measured often cannot be read according to preset format Examination parameter, but need the communication repeatedly of Test Engineer and backstage research and development engineer, could obtain and comprise in this API document Test parameter.In this case, described API document can be deleted, thus reduce and memory space in terminal unit is taken.
Further, described judge whether described API document is that API standard document includes: obtaining described API document After, it is judged that whether described API document comprises standard logo, if so, determines that described API document is described API standard document.
And/or, described judge whether described API document is that API standard document includes:
Described API document is contrasted line by line with the API destination document prestored, if the form of described API document Match with the form of described API destination document, determine that described API document is API standard document, wherein, described API target literary composition Shelves are the API document write according to described preset format.
Those skilled in the art, after considering description and putting into practice invention disclosed, will readily occur to other reality of the present invention Execute scheme.The application is intended to any modification, purposes or the adaptations of the present invention, these modification, purposes or suitable The change of answering property is followed the general principle of the present invention and includes the undocumented common knowledge or used in the art of the present invention Use technological means.Description and embodiments is considered only as exemplary, and true scope and spirit of the invention are by following right Requirement is pointed out.
It should be appreciated that the invention is not limited in precision architecture described above and illustrated in the accompanying drawings, and And various modifications and changes can carried out without departing from the scope.The scope of the present invention is only limited by appended claim.

Claims (11)

1. an application programming interface API method of testing, it is characterised in that including:
After the API standard document obtaining API to be measured, according to preset format, read comprise in described API standard document described The test parameter of API to be measured, wherein, described API standard document is the API document write according to preset format;
According to the test parameter of described API to be measured, generate the test request of described API to be measured;
Described test request is transmitted to server by described API to be measured, and receives described server by described API to be measured The response message of feedback, determines the performance of described API to be measured according to described response message.
API method of testing the most according to claim 1, it is characterised in that also include:
After obtaining API document, it is judged that whether described API document is API standard document, if it is not, delete described API document.
API method of testing the most according to claim 2, it is characterised in that described judge whether described API document is API Standard document includes:
After obtaining described API document, it is judged that whether described API document comprises standard logo, if so, determine described API literary composition Shelves are described API standard document.
API method of testing the most according to claim 2, it is characterised in that described judge whether described API document is API Standard document includes:
Described API document is contrasted line by line with the API destination document prestored, if the form of described API document and institute The form stating API destination document matches, and determines that described API document is API standard document, and wherein, described API destination document is The API document write according to described preset format.
API method of testing the most according to claim 1, it is characterised in that the test parameter of described API to be measured includes:
Each item number mutual between interactive mode between described API to be measured and server, and described API to be measured and server According to type and the span of described each item data.
6. an application programming interface API test device, it is characterised in that including:
Test parameter read module, for after the API standard document obtaining API to be measured, according to preset format, reads described The test parameter of the API described to be measured comprised in API standard document, wherein, described API standard document is to compile according to preset format The API document write;
Test request generation module, for the test parameter according to described API to be measured, generates the test request of described API to be measured;
Performance determines module, for described test request being transmitted to server by described API to be measured, and by described to be measured API receives the response message of described server feedback, determines the performance of described API to be measured according to described response message.
API the most according to claim 6 tests device, it is characterised in that also include:
Document judge module, for after obtaining API document, it is judged that whether described API document is API standard document, if it is not, delete Except described API document.
API the most according to claim 7 tests device, it is characterised in that described document judge module includes:
First judging unit, for after obtaining described API document, it is judged that whether described API document comprises standard logo, if It is to determine that described API document is described API standard document.
API the most according to claim 7 tests device, it is characterised in that described document judge module includes:
Second judging unit, for described API document is contrasted line by line with the API destination document prestored, if described The form of API document matches with the form of described API destination document, determines that described API document is API standard document, wherein, Described API destination document is the API document write according to described preset format.
API the most according to claim 6 tests device, it is characterised in that the test parameter of described API to be measured includes:
Each item number mutual between interactive mode between described API to be measured and server, and described API to be measured and server According to type and the span of described each item data.
11. 1 kinds of terminal units, including:
Processor;
For storing the memorizer of processor executable;
Wherein, described processor is configured to:
After the API standard document obtaining API to be measured, according to preset format, read comprise in described API standard document described The test parameter of API to be measured, wherein, described API standard document is the API document write according to preset format;
According to the test parameter of described API to be measured, generate the test request of described API to be measured;
Described test request is transmitted to server by described API to be measured, and receives described server by described API to be measured The response message of feedback, determines the performance of described API to be measured according to described response message.
CN201610482242.8A 2016-06-27 2016-06-27 A kind of application programming interface API method of testing, device and terminal unit Pending CN106201865A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201610482242.8A CN106201865A (en) 2016-06-27 2016-06-27 A kind of application programming interface API method of testing, device and terminal unit

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201610482242.8A CN106201865A (en) 2016-06-27 2016-06-27 A kind of application programming interface API method of testing, device and terminal unit

Publications (1)

Publication Number Publication Date
CN106201865A true CN106201865A (en) 2016-12-07

Family

ID=57461306

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201610482242.8A Pending CN106201865A (en) 2016-06-27 2016-06-27 A kind of application programming interface API method of testing, device and terminal unit

Country Status (1)

Country Link
CN (1) CN106201865A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109522220A (en) * 2018-10-23 2019-03-26 中国银行股份有限公司 A kind of text test method and device
CN109828902A (en) * 2018-12-15 2019-05-31 中国平安人寿保险股份有限公司 Interface parameters determines method, apparatus, electronic equipment and storage medium
CN110069397A (en) * 2019-03-15 2019-07-30 深圳壹账通智能科技有限公司 Function test method, device, computer equipment and storage medium
CN110750434A (en) * 2018-07-23 2020-02-04 北京奇虎科技有限公司 Interface testing method and device, electronic equipment and computer readable storage medium
CN112612700A (en) * 2020-12-21 2021-04-06 北京达佳互联信息技术有限公司 Interface test method and device and electronic equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101227345A (en) * 2008-02-05 2008-07-23 中兴通讯股份有限公司 Automatic testing method based on application program interface
US20110087874A1 (en) * 2009-10-12 2011-04-14 Veeam Software International Ltd. Item-level restoration and verification of image level backups
CN102750375A (en) * 2012-06-21 2012-10-24 武汉大学 Service and tag recommendation method based on random walk
CN102799613A (en) * 2012-06-14 2012-11-28 腾讯科技(深圳)有限公司 Showing method and device for recently-used file
CN105468776A (en) * 2015-12-11 2016-04-06 北京奇虎科技有限公司 Method, device and system for operating database

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101227345A (en) * 2008-02-05 2008-07-23 中兴通讯股份有限公司 Automatic testing method based on application program interface
US20110087874A1 (en) * 2009-10-12 2011-04-14 Veeam Software International Ltd. Item-level restoration and verification of image level backups
CN102799613A (en) * 2012-06-14 2012-11-28 腾讯科技(深圳)有限公司 Showing method and device for recently-used file
CN102750375A (en) * 2012-06-21 2012-10-24 武汉大学 Service and tag recommendation method based on random walk
CN105468776A (en) * 2015-12-11 2016-04-06 北京奇虎科技有限公司 Method, device and system for operating database

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110750434A (en) * 2018-07-23 2020-02-04 北京奇虎科技有限公司 Interface testing method and device, electronic equipment and computer readable storage medium
CN109522220A (en) * 2018-10-23 2019-03-26 中国银行股份有限公司 A kind of text test method and device
CN109828902A (en) * 2018-12-15 2019-05-31 中国平安人寿保险股份有限公司 Interface parameters determines method, apparatus, electronic equipment and storage medium
CN110069397A (en) * 2019-03-15 2019-07-30 深圳壹账通智能科技有限公司 Function test method, device, computer equipment and storage medium
CN112612700A (en) * 2020-12-21 2021-04-06 北京达佳互联信息技术有限公司 Interface test method and device and electronic equipment

Similar Documents

Publication Publication Date Title
CN107133180B (en) Dynamic page testing method, testing device and storage medium
CN105302710B (en) The method and apparatus that a kind of determination needs the test case of regression test
CN106201865A (en) A kind of application programming interface API method of testing, device and terminal unit
CN100399323C (en) Apparatus and method for parsing xml document by using external xml validator
CN106970873A (en) Mock method of testings, apparatus and system on line
CN109408375B (en) Method and device for generating interface document
CN106095673A (en) Automated testing method based on WEB interface and system
CN105630685A (en) Method and device for testing program interface
CN112256321A (en) Static library packaging method and device, computer equipment and storage medium
CN109783388A (en) UI automated testing method, device and electronic equipment
CN110221968A (en) Method for testing software and Related product
CN105637478A (en) Computer-aided development of native mobile application code
CN104468655B (en) The method and system tested reverse proxy software
CN109308254A (en) A kind of test method, device and test equipment
CN105556505A (en) Legacy system
CN110149363A (en) A kind of information push method, device and storage medium
CN106201864A (en) A kind of application programming interface API method of testing, device and mobile device
CN107133160A (en) Test system
CN108111369A (en) The test method and device of a kind of webpage performance of mobile terminal
JP4220519B2 (en) Program generation system and program generation program
CN111159040A (en) Test data generation method, device, equipment and storage medium
CN110019444A (en) A kind of operation requests processing method, device, equipment and system
CN104991857B (en) Trace debug method and device
MacIntyre et al. Pro PHP programming
CN106776266A (en) The collocation method and terminal device of testing tool

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
WD01 Invention patent application deemed withdrawn after publication
WD01 Invention patent application deemed withdrawn after publication

Application publication date: 20161207