WO2020088087A1 - Method and device for testing application program interface (api) - Google Patents

Method and device for testing application program interface (api) Download PDF

Info

Publication number
WO2020088087A1
WO2020088087A1 PCT/CN2019/103993 CN2019103993W WO2020088087A1 WO 2020088087 A1 WO2020088087 A1 WO 2020088087A1 CN 2019103993 W CN2019103993 W CN 2019103993W WO 2020088087 A1 WO2020088087 A1 WO 2020088087A1
Authority
WO
WIPO (PCT)
Prior art keywords
restful api
dsl
api
request
specify
Prior art date
Application number
PCT/CN2019/103993
Other languages
French (fr)
Chinese (zh)
Inventor
杨波
Original Assignee
易保网络技术(上海)有限公司
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 易保网络技术(上海)有限公司 filed Critical 易保网络技术(上海)有限公司
Publication of WO2020088087A1 publication Critical patent/WO2020088087A1/en

Links

Images

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/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3664Environments for testing or debugging software

Definitions

  • the present invention relates to the field of computer networks, and more specifically, to a method and device for application program interface API testing.
  • Restful application program interface is a lightweight WEB service. Due to its simplicity and light weight, it is widely used in software design and implementation.
  • Restful API testing is one of the problems. Restful API needs to test the software as a black box after the software is ready. For the testing of a single Restful API, there is a lack of a unified and intuitive test solution, not to mention the test of multiple Restful APIs in series.
  • the present invention provides a method and equipment for API test of an application program interface.
  • a DSL statement that focuses on business rules in the field of Restful API testing can be defined according to the cucumber specification, and a graphical block corresponding to the DSL statement can be determined according to the Blockly specification. Therefore, it is convenient to test the restful API by dragging and dropping the graphical block, and it is convenient to conduct a unified and intuitive test of the Restful API.
  • an embodiment of the present invention provides a data processing method for API testing of an application program interface, including: determining a domain-specific language DSL statement that focuses on business rules in the field of restful API testing according to the cucumber specification; A graphical block corresponding to a DSL sentence, wherein the block is configured to be draggable in a predetermined editor and combined with each other.
  • an embodiment of the present invention further provides a computer device, including a processor; and a memory, for storing computer instructions, the computer instructions are adapted to be loaded by the processor to perform the method described in the first aspect above .
  • an embodiment of the present invention further provides a computer-readable medium that stores computer-readable instructions that are suitable for being loaded by a processor to perform the method described in the first aspect above.
  • an embodiment of the present invention further provides an API test method, including: receiving a user's drag and drop request for a graphical block Blcok for API test, where the block corresponds to a domain-specific language DSL sentence fragments;
  • the graphical block corresponding to the drag request is converted into a DSL script according to the Blockly specification; the converted DSL script is executed according to the cucumber specification to complete the testing of the restful API.
  • an embodiment of the present invention further provides a computer device, including a processor; and a memory, for storing computer instructions, the computer instructions are adapted to be loaded by the processor to perform the method described in the fourth aspect above .
  • an embodiment of the present invention further provides a computer-readable medium that stores computer-readable instructions that are suitable to be loaded by a processor to perform the method described in the fourth aspect above.
  • an embodiment of the present invention further provides an API test method, including: providing a graphical block block for API testing; receiving a user's drag request for the graphical block Blcok , Where the Block corresponds to the sentence fragment of the domain-specific language DSL; the graphical block corresponding to the drag request is converted into a DSL script according to the Blockly specification; API testing.
  • an embodiment of the present invention also provides a computer device, including a processor; and a memory, for storing computer instructions, the computer instructions are adapted to be loaded by the processor to perform the method described in the seventh aspect above .
  • an embodiment of the present invention also provides a computer-readable medium that stores computer-readable instructions that are suitable for being loaded by a processor to perform the method described in the seventh aspect above.
  • FIG. 1 is a schematic flowchart of a processing method for an API test according to an embodiment of the present invention.
  • FIG. 2 is a schematic diagram of a graphical block according to an embodiment of the invention.
  • FIG. 3 shows a schematic flowchart of an application program interface API testing method according to an embodiment of the present invention.
  • FIG. 4 is a schematic flowchart of an application program interface API testing method according to an embodiment of the present invention.
  • FIG. 5 is a schematic structural diagram of a computer device according to an embodiment of the present invention.
  • Restful API can refer to application or software design with Rest style. Among them, Rest, which is called Representational State Transfer, describes an architectural style network system, such as a web application. REST can refer to a set of architectural constraints and principles, and applications or designs that meet these constraints and principles can be considered Restful.
  • Cucumber is an automated testing tool that supports behavior-driven development (BDD) that can understand test cases described in common languages. It is written in Ruby and supports multiple development languages such as Java and .Net.
  • DSL which is called Domain Specific Language
  • Domain Specific Language is a domain-specific language. Its basic idea is "request for speciality but not completeness”. Unlike general-purpose languages, the target scope can cover all software problems, but it is a computer language specifically for a specific field.
  • FIG. 1 is a schematic flowchart of a processing method for application program interface API testing according to an embodiment of the present invention.
  • the processing method can be used to design test software for an application program interface API.
  • the processing method 100 may include steps 110 and 120. Next, these steps will be described in conjunction with specific examples.
  • Step 110 Determine the domain-specific language DSL sentence segment that focuses on business rules in the field of restful API testing according to the cucumber specification.
  • DSL is a computer language for a specific field. To implement the restful API through DSL, you first need to determine the business rules in this particular field. For Restful API, it is based on Hyper Text Transfer Protocol (Hyper Text Transfer Protocol, HTTP).
  • HTTP Hyper Text Transfer Protocol
  • business rules in the field of restful API testing may include business rules for testing a single restful API.
  • the business rules for a single restful API test can specifically include multiple aspects, and one aspect can be focused on by a corresponding DSL sentence segment.
  • the DSL sentence segment may be an action line of the DSL script, a line beginning with action guide words such as given, when, and, then.
  • the business rules for a single restful API test may include a combination of the following two or more aspects: Specify the method of the HTTP request of the restful API to be tested; specify the URL of the uniform resource locator of the HTTP request; specify the parameters of the request; Specify the request load; specify the request header information; verify the response code of the HTTP request after the restful API is called; verify the response header of the HTTP request after the restful API is called; verify the response load of the HTTP request after the restful API is called . It should be noted that business rules in the field of restful API testing are not limited to the above-mentioned aspects, and other business rules can be determined according to the needs of specific tests. For a single restful API test, you need to ensure that the test data meets the predetermined requirements, otherwise the corresponding data may not be found during the test query.
  • the restful API is built on the basis of the HTTP protocol. According to the HTTP specification, it contains two parts, the request part and the response part.
  • Request method such as GET / POST / PUT / or other extension methods
  • the requested URL is a globally uniform resource identifier applied to resource requests and used to identify the location of restful APIs, such as HTTP://www.ebaocloud.com/api/mock;
  • the header of the request is essentially a key-value key-value pair.
  • some headers are predefined, but some headers can be defined during the implementation of the restful API. For example, token, a request can support multiple headers;
  • the load of the request is stored in the request body of the HTTP protocol.
  • it is generally text in the form of json, which represents business data.
  • the response code usually a number, represents the response status of the request. For example, 200 represents the successful response, 404 represents the resource (url) was not found, and 500 represents the internal error of the server.
  • the response header like the request header, is essentially a key-value pair, and the server-side implementation can place multiple response headers;
  • Response load in the response body of the HTTP protocol, for restful APIs, it is generally text in the form of json, which represents business data.
  • the server After the Restful API is called, you need to verify the HTTP response code, response header and response payload.
  • the server provides a restful API, and the client calls the restful API. It is necessary to check whether the result of the current call meets the tester's expectations, for example, whether the response code is consistent, whether a specific response header exists or whether its value is Consistent with the expected value, whether the content in the response load contains the business data of interest or consistent with the expected value.
  • the business rules in the field of restful API testing may include business rules for testing multiple associated restful APIs.
  • the business rules for multiple associated restful API tests may specifically include the following aspects: Specify the method of the hypertext transfer protocol HTTP request of the restful API to be tested; specify the uniform resource locator URL of the HTTP request; Specify the request parameters; specify the request payload; specify the request header information; verify the response code of the HTTP request after the restful API is called; verify the response header of the HTTP request after the restful API is called; verify the restful API after the call The response load of the HTTP request; obtaining partial data of the response body after the restful API is called; setting partial data of the response body after the restful API is called for testing of the next restful API associated with the restful API.
  • business rules in the field of restful API testing are not limited to the above-mentioned aspects, and other business rules can be determined according to the needs of specific tests. Among them, specify the method of the HTTP request of the restful API to be tested, the URL of the requested uniform resource locator, the parameters of the request, the request load and the request header information; verify the HTTP response code and response after the restful API is called
  • the header and response load are similar to the business rules used in the field of single restful API testing above, and will not be repeated here.
  • test scenario combination API for testing, you can use the delete-create-query-delete-query test process to ensure that it can be run repeatedly, so that it is less dependent on data preparation or other prerequisites of the test environment.
  • a user is created, and the id of the newly created user is included in the response load, and the query API uses the id as a parameter to query, therefore, we need to create a response from the API
  • the user id is extracted from the body and placed in the context of the test scenario (which can be called a variable pool).
  • the variable is referenced to obtain the user id to be queried.
  • the cucumber specification determine the DSL sentence fragments corresponding to the business rules of the restful API test, where the business rules may include multiple aspects, corresponding to multiple DSL sentence fragments, and one DSL sentence fragment focuses on one aspect of the business rules.
  • the DSL sentence fragment may be an Action line of the DSL script.
  • the DSL sentence fragment focuses on the combination of the following multiple (eg, greater than or equal to 2) aspects of the business rules: specifying the method of the hypertext transfer protocol HTTP request; specifying the uniform resource locator of the hypertext transfer protocol HTTP request URL; specify the name and value of the HTTP request header of the hypertext transfer protocol; specify the name and value of the parameters of the restful API request; specify the request load of the HTTP request of the hypertext transfer protocol; verify the response code of the HTTP request of the hypertext transfer protocol; Verify that the response header of the HTTP request of the Hypertext Transfer Protocol exists or matches the expected value.
  • the DSL sentence fragment focuses on the following aspects of the business rules: specifying the method of the hypertext transfer protocol HTTP request; specifying the uniform resource locator URL of the hypertext transfer protocol HTTP request; specifying the hypertext transfer protocol HTTP Request header name and value; specify the name and value of restful API request parameters; specify the request load of the hypertext transfer protocol HTTP request; verify the response code of the hypertext transfer protocol HTTP request; verify the hypertext transfer protocol HTTP request Whether the response header exists or matches the expected value; verify whether part of the data in the response body of the hypertext transfer protocol HTTP request meets the predetermined expected value; extract and store part of the data in the response body.
  • the following uses DSL-based test examples to illustrate aspects of DSL sentence fragments and corresponding business rules.
  • test process tests the deletion, creation, and query of the profile of the configuration center service.
  • a scene is defined, the name of the scene is remove the profile shawn-test-001
  • the DSL statement fragment is used to assign default values to two variables.
  • the default value of the variable apiBase is http://172.25.12.166:7101, and the default value of the variable profile is shawn-test-001.
  • the DSL script When the DSL script is When the Cucumber engine executes, it can pass global variables to the execution engine. If no specific variables are defined, the default values defined in the DSL are used.
  • the DSL statement fragment defines the url and http method name to be tested, where url is $ ⁇ apiBase ⁇ / configs / clear, and $ ⁇ means to resolve in the variable pool.
  • the http method is post here.
  • the DSL statement fragment adds the requested parameters, where the parameter name is profile and the value is $ ⁇ profile ⁇ , that is, the profile variable is obtained from the variable pool.
  • the DSL sentence fragment initiates a request to the server.
  • the DSL sentence fragment verifies that the response code is 200, which means success. If the response code is not 200, the test process reports an error.
  • determining the domain-specific language DSL sentence fragments focusing on the business rules of the restful API testing field according to the cucumber specification includes: determining multiple DSL sentence fragments corresponding to various aspects of the business rules of the restful API testing field according to the cucumber specification One aspect corresponds to a DSL sentence fragment, and the one DSL sentence fragment may be an action line.
  • Step 120 Determine the block corresponding to the DSL sentence segment according to the Blockly specification.
  • determining the block corresponding to the DSL sentence according to the Blockly specification may include converting a DSL sentence fragment (for example, an Action line) in the DSL sentence into a block according to the Blockly specification, and a DSL sentence fragment corresponding to A block.
  • a DSL sentence fragment for example, an Action line
  • the DSL sentence fragments corresponding to the different blocks can be obtained, which can be handed over to the cucumber tool for execution after combination, and the restful API test can be performed simply and intuitively by dragging and dropping the blocks.
  • the block corresponding to the DSL sentence fragment is a graphical block, which can be dragged and dropped on the canvas interface of the predetermined editor.
  • Each block has a visible text portion and an inputable portion that describe the drag-and-drop element of the block, and settings in which the block is connected up, down, left, and right.
  • a block Blcok can correspond to an instance of Block, for example,
  • the changed part is an input part. These are filled out by the user.
  • the user can fill in apiBase and http://172.25.12.166:7101; the other parts are actually visible text parts.
  • This part is fixed.
  • the change is something that the user cannot change.
  • the main function is to let the user understand the semantics of the block.
  • the visible text part does not need to correspond to the DSL line text.
  • the visible text part is only used to assist the user to understand the meaning of the block.
  • FIG. 3 shows a schematic flowchart of an application program interface API testing method according to an embodiment of the present invention.
  • the method 300 may include steps 310, 320, and 330. The above steps are described below in conjunction with specific examples.
  • Step S310 Receive a user's drag-and-drop request for the graphical block Blcok tested by the application program interface API, where the Block corresponds to a sentence fragment of the domain-specific language DSL.
  • DSL is a language for a specific field. In the embodiment of the present invention, DSL is aimed at the field of restful API testing.
  • the graphical block in step 310 may be a graphical block generated according to the method shown in FIG. In some embodiments of the present invention, the graphical block in step 310 may be a graphical block generated according to a method other than the method shown in FIG. 1.
  • business rules in the field of restful API testing may include business rules for testing a single restful API.
  • the business rules for a single restful API test can include the following aspects: Specify the method of the HTTP request of the restful API to be tested, the requested universal resource locator (Universal resource Locator, URL ), Request parameters, request payload and request header information; verify the HTTP response code, response header and response payload after the restful API is called.
  • business rules in the field of restful API testing are not limited to the above-mentioned aspects, and other business rules can be determined according to the needs of specific tests. For a single restful API test, you need to ensure that the test data meets the predetermined requirements, otherwise the corresponding data may not be found during the test query.
  • the restful API is built on the basis of the HTTP protocol. According to the HTTP specification, it contains two parts, the request part and the response part.
  • response part generally include: response code, response header, response load.
  • the server After the Restful API is called, you need to verify the HTTP response code, response header and response payload.
  • the server provides a restful API, and the client calls the restful API. It is necessary to check whether the result of the current call meets the tester's expectations, for example, whether the response code is consistent, whether a specific response header exists or whether its value is The expected value corresponds to whether the content in the response load contains the service data concerned or conforms to the expected value.
  • the business rules in the field of restful API testing may include business rules for testing multiple associated restful APIs.
  • the business rules for multiple associated restful API tests may specifically include the following aspects: the method of specifying the HTTP request of the restful API to be tested, the requested uniform resource locator URL, and the requested Parameters, request load and request header information; verify the HTTP response code, response header and response load after the restful API is called; get the predetermined message of the response body after the restful API is called and set it for association with the restful API The next restful API test.
  • business rules in the field of restful API testing are not limited to the above-mentioned aspects, and other business rules can be determined according to the needs of specific tests.
  • the header and response load are similar to the business rules used in the field of single restful API testing above, and will not be repeated here.
  • a test process to test user creation, query and deletion, corresponding to three restful APIs. According to the test scenario combination API for testing, you can use the delete-create-query-delete-query test process to ensure that it can be run repeatedly, so that it is less dependent on data preparation or other prerequisites of the test environment.
  • a user is created, and the id of the newly created user is included in the response load, and the query API uses the id as a parameter to query, therefore, we need to create a response from the API
  • the user id is extracted from the body and placed in the context of the test scenario (which can be called a variable pool).
  • the variable is referenced to obtain the user id to be queried.
  • the business rules in the restful API testing field may include multiple aspects, and one DSL sentence segment focuses on one aspect of the business rules in the restful testing field.
  • the multiple aspects are:
  • the multiple aspects include:
  • step S310 may include: receiving a drag request for one or more graphical blocks for API testing, where a graphical block corresponds to a DSL sentence segment, and different blocks correspond to different DSL sentences Fragment.
  • the DSL sentence fragment is an Action line.
  • a graphical block editing interface can be shown in Figure 2.
  • the left side of Figure 2 is the toolbar, which includes blocks of various graphics, and the right side is the canvas interface.
  • Receiving a user's drag-and-drop request for a graphical block of an API test may include an interactive interface in a predetermined editor, receiving a drag-and-drop request of a graphical block of a user's API test.
  • the graphical block is dragged into the canvas of the interactive interface, two pieces of data of the layout description data of the block in the canvas of the interactive interface and the corresponding DSL sentence fragments of the block will be generated, where the layout description data is available
  • the DSL sentence fragment is the DSL script corresponding to the graphical block.
  • the DSL sentence segment of the block can be converted by the translation function according to the Blockly specification, that is to say, converting the graphical block corresponding to the drag request into a DSL script according to the bockly specification includes: dragging and dropping the translation function according to the Blockly specification Request that the corresponding graphical block be converted into a DSL sentence fragment.
  • the translation function is a tool that converts a graphical block into a DSL.
  • the result of the translation function is a DSL line that meets the grammatical requirements.
  • Step 320 Convert the graphical block corresponding to the drag request into a DSL script according to the Blockly specification.
  • the graphical block includes an inputtable part and a visible text part, as well as settings for connecting up, down, left, and right.
  • Converting a graphical block into a DSL statement according to the blockly specification may include: according to the blockly specification, calling the block ’s API to convert the graphical block into a DSL fragment (for example, a line), a graphical block through the translation function of the block Translate into corresponding DSL fragments, multiple graphical blocks, and combine them through the connection settings of up, down, left, and right between these blocks to form a combination of multiple DSL sentence fragments to obtain a complete DSL script.
  • a DSL fragment for example, a line
  • a graphical block through the translation function of the block Translate into corresponding DSL fragments
  • multiple graphical blocks and combine them through the connection settings of up, down, left, and right between these blocks to form a combination of multiple DSL sentence fragments to obtain a complete DSL script.
  • Each block can correspond to each line of the DSL script, for example
  • the above DSL statement corresponds to the definition of the same Block, but on the drag and drop interface, there are two Block instances. Except for the guide word Given, the changed part is an input part. These are filled out by the user. The user may fill in apiBase and http://172.25.12.166:7101 or the user fills in the profile and shawn-test-001; the other parts are actually It is the visible text part. This part is fixed and cannot be changed by the user. The main function is to let the user understand the semantics of the block. The visible text part does not need to correspond to the text on the DSL line. The visible text is only used to help users understand the meaning of the block.
  • the translation function of the block When processing arbitrary graphics, the translation function of the block will be called to translate into specific DSL sentence fragments. Among them, the result of the translation function is a correct DSL line that meets the requirements. All the Block blocks have correctly translated the DSL line, then you will end up with a complete DSL script.
  • the drag request of the graphical block includes a drag request for a plurality of graphical blocks
  • the method further includes: multiple graphical blocks corresponding to the drag request, according to each The setting of the connection of up, down, left and right of the graphical block is combined to obtain multiple DSL sentence fragments as a DSL script.
  • Step 330 the converted DSL statement is executed according to the cucumber specification to complete the testing of the restful API.
  • the complete DSL script converted through step 320 can be executed according to the cucumber specification to complete the graphical testing of the restful API.
  • the block corresponding to the DSL sentence fragment is a graphical block, which can be dragged and dropped on the canvas interface of the editor.
  • Each block has a visible text portion and an inputable portion that describe the fast drag-and-drop element, and settings for connecting the up, down, left, and right of the block.
  • the graphical combination of each different block can be completed, and the restful API test can be completed without code writing, which assists the DSL-based code writing and reduces the technology of using DSL to implement related functions. Difficulty.
  • FIG. 4 shows a schematic flowchart of an application program interface API testing method according to an embodiment of the present invention.
  • the method 400 may include: step 410, step 420, step 430, and step 440, followed by a specific example The above steps will be explained.
  • Step S410 Provide a graphical block for application program interface API testing.
  • the provided graphical block for API testing may be a graphical block generated according to the method shown in FIG.
  • the graphical block for API testing provided in step 410 may be a graphical block generated according to other methods.
  • step 410 may include: determining a domain-specific language DSL sentence fragment that focuses on business rules in the restful API testing field according to the cucumber specification; and converting the DSL sentence fragment into a graphical block according to the Blockly specification .
  • step 410 may include: deploying a graphical block of restful API testing in a predetermined editor, for example, a generic version of the graphical block of restful API testing may also be deployed, and may also be deployed Restful API-tested graphical blocks that contain customized versions of specific graphical blocks.
  • business rules in the field of restful API testing are focused on through DSL sentence fragments, and the business rules may include multiple aspects, for example, greater than or equal to 2 aspects.
  • determining the domain-specific language DSL sentence fragment focusing on the business rules of the restful API testing field according to the cucumber specification includes: DSL sentence fragments, each aspect corresponds to a DSL sentence fragment.
  • the DSL sentence segment may be a DSL Action line.
  • converting the DSL sentence segment into a graphical block according to the Blockly specification Block may include: converting a DSL action line into a graphical block according to the Blockly specification Block.
  • multiple aspects of business rules in the field of restful API testing may include a combination of two or more of the following: Restful API Hypertext Transfer Protocol HTTP request method; specify the uniform resource locator URL of the HTTP request; specify the request parameters; specify the request load; specify the request header information; verify the response code of the HTTP request after the restful API is called; Check the response header of the HTTP request after the restful API is called; check the response load of the HTTP request after the restful API is called.
  • multiple aspects of business rules in the restful API testing field are all aspects listed above.
  • various aspects of business rules in the restful API testing field include a combination of the following two or more aspects: Specify to be tested The method of restful API hypertext transfer protocol HTTP request; specify the uniform resource locator URL of the HTTP request; specify the request parameters; specify the request load; specify the request header information; verify the response code of the HTTP request after the restful API is called ; Check the response header of the HTTP request after the restful API is called; check the response load of the HTTP request after the restful API is called; get the partial data of the response body after the restful API is called; set the response after the restful API is called Part of the data is used for the next restful API test associated with the restful API.
  • the business rules for multiple consecutive restful API tests include all aspects listed above.
  • the graphical block may include an inputtable part and a visible text part, as well as settings for connecting up, down, left, and right.
  • Step 420 Receive a user's drag-and-drop request to the graphical block Blcok, where the block block corresponds to a sentence fragment of a domain-specific language DSL.
  • the step 420 of receiving the user's drag request for the graphical block may include an interactive interface of a predetermined editor to receive the user's drag request for the API tested graphical block.
  • the interactive interface of the predetermined editor may be the interactive interface shown in FIG. 2.
  • the predetermined editor may include a plurality of graphical blocks, and each block may be dragged and dropped.
  • the combined graphical blocks can also be dragged as a whole.
  • step 420 while performing step 420, it may further include: when the graphical block is dragged to the canvas of the interactive interface of the predetermined editor, generating the graphical block in the interactive interface The layout description data in the canvas and the DSL sentence fragments corresponding to the graphical blocks. That is to say, when the graphical block is dragged on the canvas of the interactive interface, two pieces of data are generated at the same time, one piece of data is layout description data, which is used to describe the position of the graphical block in the canvas and other information, and the other The data is a DSL sentence fragment, which is used to generate the corresponding DSL script.
  • the graphical block includes the inputtable part and the visible text part, as well as the settings for connecting up, down, left, and right.
  • the method of the present invention may further include: when dragging the graphical block on the canvas interface, presenting the inputtable portion in a predetermined area of the graphical block to receive user input.
  • the drag request of the graphical block may include a drag request for multiple graphical blocks.
  • the method of the present invention It may include: combining a plurality of graphical blocks corresponding to the drag request according to the setting of connecting up, down, left, and right of each graphical block.
  • Step 430 Convert the graphical block corresponding to the drag request into a DSL script according to the Blockly specification.
  • step 430 converting the graphical block corresponding to the drag request into a DSL script according to the Blockly specification may include: converting the graphical block corresponding to the drag request through a translation function according to the Blockly specification Blocks are converted into DSL sentence fragments.
  • the graphical blocks may include two or more graphical blocks. These graphical blocks are respectively translated by corresponding translation functions to obtain multiple DSL sentence fragments to form a DSL test script.
  • step 440 the converted DSL script is executed according to the cucumber specification to complete the testing of the restful API.
  • the converted DSL script may include multiple DSL sentence fragments.
  • the converted DSL script may be a DSL script for testing a restful API.
  • the converted DSL script is a DSL script for testing multiple associated restful APIs. Execute the converted DSL script according to the cucumber specification to complete the test of a restful API or multiple associated restful APIs.
  • the restful API testing method converts the DSL sentence fragments concerned by the business rules of restful API testing into graphical blocks according to the Blockly specification, which is convenient for users to drag and drop the graphical blocks with a predetermined editor for combination and translation.
  • the function forms a DSL script to test the restful API.
  • the testing of restful APIs can be completed through graphical drag and drop, which is simple and intuitive, and forms a graphical auxiliary test solution for DSL, which reduces the technical difficulty of using DSL to implement test processing.
  • Embodiments of the present invention also provide a computer device.
  • the computer device 500 may include a processor 521, an input / output (I / O) device 522, a memory 523, a database 524, and a display 525.
  • the processor 521 may be one or more known processing devices, which may load computer instructions stored in the memory 523 for implementing the above method to cause the computer device to perform the above method.
  • the I / O device 522 may be configured to allow data to be received and / or transmitted.
  • I / O device 522 may include one or more digital and / or analog communication devices that allow computer device 500 to communicate with other machines and devices.
  • the computer device 500 may also include one or more databases 524, or be communicatively connected to the one or more databases 524 through a network.
  • the database 524 may be any suitable database suitable for the associated data processing of the method described above.
  • the display 525 may include a display screen, which may be used to display the output results of the input / output device 522 and intermediate results during data processing.
  • the present invention also provides a computer-readable storage medium on which computer instructions are stored.
  • the computer instructions are executed by a processor, the above-described method for application program interface API testing is implemented.

Landscapes

  • Engineering & Computer Science (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

Provided by the present invention are a method and device for testing an application program interface (API). The method comprises: determining, according to Cucumber specifications, a domain-specific language (DSL) statement that focuses on service rules in a RESTful API test field; and determining, according to Blockly specifications, graphical blocks corresponding to the DSL statement and being configured to be capable of being dragged and combined with each other in a predetermined editor. The described method can express service rules of the RESTful API test with graphical blocks according to the DSL statement and the Blockly specifications, which is convenient, intuitive and makes API testing simple.

Description

用于应用程序接口API测试的方法和设备Method and equipment for application program interface API testing 技术领域Technical field
本发明涉及计算机网络领域,更为具体而言,涉及一种用于应用程序接口API测试的方法和设备。The present invention relates to the field of computer networks, and more specifically, to a method and device for application program interface API testing.
背景技术Background technique
Restful应用程序接口(Application program interface,简称API)是一种轻量级的WEB服务,由于其简单轻量,大量应用于软件设计和实现。Restful application program interface (API) is a lightweight WEB service. Due to its simplicity and light weight, it is widely used in software design and implementation.
Restful API的广泛使用带来了一些潜在的问题,Restful API的测试是其中的一个难题。Restful API需要在软件就绪之后,将软件作为黑盒进行测试。对于单个Restful API的测试,缺乏统一、直观的测试方案,更别提对多个Restful API串联进行测试的方案。The extensive use of Restful API brings some potential problems, Restful API testing is one of the problems. Restful API needs to test the software as a black box after the software is ready. For the testing of a single Restful API, there is a lack of a unified and intuitive test solution, not to mention the test of multiple Restful APIs in series.
发明内容Summary of the invention
本发明提供一种用于应用程序接口API接口测试的方法和设备,可以根据cucumber规范定义关注Restful API测试领域的业务规则的DSL语句,并根据Blockly规范确定DSL语句对应的图形化的块Block,从而方便通过拖拽图形化的块进行restful API的测试,便于对Restful API进行统一、直观的测试。The present invention provides a method and equipment for API test of an application program interface. A DSL statement that focuses on business rules in the field of Restful API testing can be defined according to the cucumber specification, and a graphical block corresponding to the DSL statement can be determined according to the Blockly specification. Therefore, it is convenient to test the restful API by dragging and dropping the graphical block, and it is convenient to conduct a unified and intuitive test of the Restful API.
第一方面,本发明实施方式提供一种用于应用程序接口API测试的数据处理方法,包括:根据cucumber规范确定关注restful API测试领域的业务规则的领域专用语言DSL语句;根据Blockly规范确定所述DSL语句对应的图形化的块Block,其中,所述Block配置为在预定编辑器中能够被拖拽并且彼此组合。In the first aspect, an embodiment of the present invention provides a data processing method for API testing of an application program interface, including: determining a domain-specific language DSL statement that focuses on business rules in the field of restful API testing according to the cucumber specification; A graphical block corresponding to a DSL sentence, wherein the block is configured to be draggable in a predetermined editor and combined with each other.
第二方面,本发明实施方式还提供一种计算机设备,包括处理器;和存储器,用于存储计算机指令,所述计算机指令适于被所述处理器加载以执行上述第一方面所述的方法。In a second aspect, an embodiment of the present invention further provides a computer device, including a processor; and a memory, for storing computer instructions, the computer instructions are adapted to be loaded by the processor to perform the method described in the first aspect above .
第三方面,本发明实施方式还提供一种计算机可读介质,其存储有计算机可读指令,所述指令适于被处理器加载以执行上述第一方面所述的方法。In a third aspect, an embodiment of the present invention further provides a computer-readable medium that stores computer-readable instructions that are suitable for being loaded by a processor to perform the method described in the first aspect above.
第四方面,本发明实施方式还提供一种应用程序接口API测试方法,包括:接收用户对应用程序接口API测试的图形化的块Blcok的拖拽请求,其中,所述块Block对应领域专用语言DSL的语句片段;According to a fourth aspect, an embodiment of the present invention further provides an API test method, including: receiving a user's drag and drop request for a graphical block Blcok for API test, where the block corresponds to a domain-specific language DSL sentence fragments;
根据Blockly规范将所述拖拽请求对应的图形化的块转换为DSL脚本;将转换后 的DSL脚本根据cucumber规范执行以完成对restful API的测试。The graphical block corresponding to the drag request is converted into a DSL script according to the Blockly specification; the converted DSL script is executed according to the cucumber specification to complete the testing of the restful API.
第五方面,本发明实施方式还提供一种计算机设备,包括处理器;和存储器,用于存储计算机指令,所述计算机指令适于被所述处理器加载以执行上述第四方面所述的方法。In a fifth aspect, an embodiment of the present invention further provides a computer device, including a processor; and a memory, for storing computer instructions, the computer instructions are adapted to be loaded by the processor to perform the method described in the fourth aspect above .
第六方面,本发明实施方式还提供一种计算机可读介质,其存储有计算机可读指令,所述指令适于被处理器加载以执行上述第四方面所述的方法。According to a sixth aspect, an embodiment of the present invention further provides a computer-readable medium that stores computer-readable instructions that are suitable to be loaded by a processor to perform the method described in the fourth aspect above.
第七方面,本发明实施方式还提供一种应用程序接口API测试方法,包括:提供用于应用程序接口API测试的图形化的块Block;接收用户对所述图形化的块Blcok的拖拽请求,其中,所述块Block对应领域专用语言DSL的语句片段;根据Blockly规范将所述拖拽请求对应的图形化的块转换为DSL脚本;将转换后的DSL脚本根据cucumber规范执行以完成对restful API的测试。In a seventh aspect, an embodiment of the present invention further provides an API test method, including: providing a graphical block block for API testing; receiving a user's drag request for the graphical block Blcok , Where the Block corresponds to the sentence fragment of the domain-specific language DSL; the graphical block corresponding to the drag request is converted into a DSL script according to the Blockly specification; API testing.
第八方面,本发明实施方式还提供一种计算机设备,包括处理器;和存储器,用于存储计算机指令,所述计算机指令适于被所述处理器加载以执行上述第七方面所述的方法。In an eighth aspect, an embodiment of the present invention also provides a computer device, including a processor; and a memory, for storing computer instructions, the computer instructions are adapted to be loaded by the processor to perform the method described in the seventh aspect above .
第九方面,本发明实施方式还提供一种计算机可读介质,其存储有计算机可读指令,所述指令适于被处理器加载以执行上述第七方面所述的方法。In a ninth aspect, an embodiment of the present invention also provides a computer-readable medium that stores computer-readable instructions that are suitable for being loaded by a processor to perform the method described in the seventh aspect above.
附图说明BRIEF DESCRIPTION
图1是根据本发明实施例的用于应用程序接口API测试的处理方法的流程示意图。FIG. 1 is a schematic flowchart of a processing method for an API test according to an embodiment of the present invention.
图2是根据本发明实施例的图形化的块的示意图。2 is a schematic diagram of a graphical block according to an embodiment of the invention.
图3示出了根据本发明实施例的应用程序接口API测试方法的流程示意图。FIG. 3 shows a schematic flowchart of an application program interface API testing method according to an embodiment of the present invention.
图4示出了根据本发明实施方式的应用程序接口API测试方法的流程示意图。4 is a schematic flowchart of an application program interface API testing method according to an embodiment of the present invention.
图5是根据本发明实施例的计算机设备的结构示意图。5 is a schematic structural diagram of a computer device according to an embodiment of the present invention.
具体实施方式detailed description
现参考示例性的实施方式详细描述本发明,一些实施例图示在附图中。以下描述参考附图进行,除非另有表示,否则在不同附图中的相同数字代表相同或类似的元件。以下示例性实施方式中描述的方案不代表本发明的所有方案。相反,这些方案仅是所附权利要求中涉及的本发明的各个方面的系统和方法的例子。The invention will now be described in detail with reference to exemplary embodiments, some of which are illustrated in the drawings. The following description is made with reference to the drawings, and unless otherwise indicated, the same numerals in different drawings represent the same or similar elements. The solutions described in the following exemplary embodiments do not represent all the solutions of the present invention. Rather, these solutions are merely examples of systems and methods of the various aspects of the invention referred to in the appended claims.
下面对本申请中将会使用的术语进行简要的解释和说明,需要说明的是,这些解释或说明仅是为了便于理解本发明的方案,而不应理解为是对这些术语的限定,这些术语的含义仍然在本领域通常的含义之内。The following will briefly explain and explain the terms that will be used in this application. It should be noted that these explanations or explanations are only for the convenience of understanding the solution of the present invention, and should not be understood as limiting these terms. The meaning is still within the usual meaning in the art.
Restful API,可以指具有Rest风格的应用程序或软件设计。其中,Rest,全称为Representational State Transfer,描述了一个架构样式的网络系统,例如,web应用程序。REST可以指一组架构约束条件和原则,满足这些约束条件和原则的应用程序或设计就可以认为是Restful。Restful API can refer to application or software design with Rest style. Among them, Rest, which is called Representational State Transfer, describes an architectural style network system, such as a web application. REST can refer to a set of architectural constraints and principles, and applications or designs that meet these constraints and principles can be considered Restful.
Cucumber,是一个能够理解用普通语言描述的测试用例的支持行为驱动开发(Behavior Driven Development,BDD)的自动化测试工具,用Ruby编写,支持Java和·Net等多种开发语言。Cucumber is an automated testing tool that supports behavior-driven development (BDD) that can understand test cases described in common languages. It is written in Ruby and supports multiple development languages such as Java and .Net.
DSL,全称为Domain specific language,领域专用语言,其基本思想是“求专不求全”,不像通用目的语言那样,目标范围能够涵盖一切软件问题,而是专门针对某一特定领域的计算机语言。DSL, which is called Domain Specific Language, is a domain-specific language. Its basic idea is "request for speciality but not completeness". Unlike general-purpose languages, the target scope can cover all software problems, but it is a computer language specifically for a specific field.
参见图1,图1是根据本发明实施例的用于应用程序接口API测试的处理方法的流程示意图,该处理方法可用于设计应用程序接口API的测试软件。Referring to FIG. 1, FIG. 1 is a schematic flowchart of a processing method for application program interface API testing according to an embodiment of the present invention. The processing method can be used to design test software for an application program interface API.
该处理方法100可包括:步骤110和步骤120。接下来结合具体的例子对这些步骤进行说明。The processing method 100 may include steps 110 and 120. Next, these steps will be described in conjunction with specific examples.
步骤110,根据cucumber规范确定关注restful API测试领域的业务规则的领域专用语言DSL语句片段。Step 110: Determine the domain-specific language DSL sentence segment that focuses on business rules in the field of restful API testing according to the cucumber specification.
如上所述,DSL作为一种针对特定领域的计算机语言。通过DSL对restful API进行程序实现,首先需要确定该特定领域的业务规则。对于Restful API,其是基于超文本传输协议(Hyper Text Transfer Protocol,HTTP)。As mentioned above, DSL is a computer language for a specific field. To implement the restful API through DSL, you first need to determine the business rules in this particular field. For Restful API, it is based on Hyper Text Transfer Protocol (Hyper Text Transfer Protocol, HTTP).
在一些实施例中,restful API测试领域的业务规则可以包括对单个restful API测试的业务规则。对单个的restful API测试的业务规则,具体而言,可包括多个方面,一个方面可以由对应的一个DSL语句片段关注。在一些实施例中,DSL语句片段可以是DSL脚本的一个动作Action行,以诸如given、when、and和then等动作引导词开头的行。In some embodiments, business rules in the field of restful API testing may include business rules for testing a single restful API. The business rules for a single restful API test can specifically include multiple aspects, and one aspect can be focused on by a corresponding DSL sentence segment. In some embodiments, the DSL sentence segment may be an action line of the DSL script, a line beginning with action guide words such as given, when, and, then.
对于单个restful API测试的业务规则可包括下述两个以上方面的组合:指定待测试的restful API的超文本传输协议HTTP请求的方法;指定HTTP请求的统 一资源定位符URL;指定请求的参数;指定请求负载;指定请求头信息;校验restful API被调用之后的HTTP请求的响应码;校验restful API被调用之后的HTTP请求的响应头;校验restful API被调用之后的HTTP请求的响应负载。需要说明的是,restful API测试领域的业务规则并不限于上述的方面,根据具体测试的需要,还可以确定其他的业务规则。对于单个restful API的测试,需要确保测试的数据符合预定要求,否则测试查询时可能会查不到相应的数据。The business rules for a single restful API test may include a combination of the following two or more aspects: Specify the method of the HTTP request of the restful API to be tested; specify the URL of the uniform resource locator of the HTTP request; specify the parameters of the request; Specify the request load; specify the request header information; verify the response code of the HTTP request after the restful API is called; verify the response header of the HTTP request after the restful API is called; verify the response load of the HTTP request after the restful API is called . It should be noted that business rules in the field of restful API testing are not limited to the above-mentioned aspects, and other business rules can be determined according to the needs of specific tests. For a single restful API test, you need to ensure that the test data meets the predetermined requirements, otherwise the corresponding data may not be found during the test query.
restful API是构建在HTTP协议基础之上,根据HTTP的规范,包含两部分,请求部分和应答部分。The restful API is built on the basis of the HTTP protocol. According to the HTTP specification, it contains two parts, the request part and the response part.
对于HTTP请求,必须指定:For HTTP requests, you must specify:
请求的方法,比如GET/POST/PUT/或者其他扩展方式;Request method, such as GET / POST / PUT / or other extension methods;
请求的URL,是全球统一的应用于资源请求的资源标识符,用于标识restful API的位置,例如HTTP://www.ebaocloud.com/api/mock;The requested URL is a globally uniform resource identifier applied to resource requests and used to identify the location of restful APIs, such as HTTP://www.ebaocloud.com/api/mock;
请求的头header,本质是key-value键值对,在HTTP规范中,预定义了部分header,但是restful API的实现过程中可以自行定义一些header,例如,token,一个请求可以支持多个header;The header of the request is essentially a key-value key-value pair. In the HTTP specification, some headers are predefined, but some headers can be defined during the implementation of the restful API. For example, token, a request can support multiple headers;
请求的参数,本质也是key-value键值对,可以出现在路径上,比如HTTP://www.ebaocloud.com/api/mock?name=foo&version=1,上述路径中定义了两个参数,其中,name参数的值为foo,version参数的值为1;对于某些请求method,参数将被编码到请求负载(body)中;The parameters of the request are essentially key-value key-value pairs, which can appear on the path, such as HTTP://www.ebaocloud.com/api/mock? name = foo & version = 1, two parameters are defined in the above path, where the value of the name parameter is foo and the value of the version parameter is 1; for some request methods, the parameters will be encoded into the request payload (body);
请求的负载,存放于HTTP协议的请求体body中,对于restful API一般是json形式的文本,代表了业务数据。The load of the request is stored in the request body of the HTTP protocol. For restful APIs, it is generally text in the form of json, which represents business data.
对于应答部分,一般包括:For the response part, it generally includes:
响应码,通常为一个数字,代表这个请求的响应状态,比如200代表响应成功,404代表资源(url)未找到,500代表服务端内部错误等;The response code, usually a number, represents the response status of the request. For example, 200 represents the successful response, 404 represents the resource (url) was not found, and 500 represents the internal error of the server.
响应头header,如同请求的header,本质是键值对,服务器端实现可以放置多个应答header;The response header, like the request header, is essentially a key-value pair, and the server-side implementation can place multiple response headers;
响应负载,在HTTP协议的响应体body中,对于restful API,一般是json形式的文本,代表了业务数据。Response load, in the response body of the HTTP protocol, for restful APIs, it is generally text in the form of json, which represents business data.
Restful API被调用之后,需要校验HTTP响应码、响应头和响应负载。也就 是说,服务端提供了restful API,客户端来调用这个restful API,需要检查当前调用的结果是否符合测试者的预期,例如,响应码是否一致,特定的响应头header是否存在或者其值是否和期望的值相符,响应负载中的内容是否含有关心的业务数据或者和与期望的值相符。After the Restful API is called, you need to verify the HTTP response code, response header and response payload. In other words, the server provides a restful API, and the client calls the restful API. It is necessary to check whether the result of the current call meets the tester's expectations, for example, whether the response code is consistent, whether a specific response header exists or whether its value is Consistent with the expected value, whether the content in the response load contains the business data of interest or consistent with the expected value.
在另外一些实施例中,restful API测试领域的业务规则可包括对多个关联的restful API测试的业务规则。对多个关联的restful API测试的业务规则,具体而言,可包括下述多个方面:指定待测试的restful API的超文本传输协议HTTP请求的方法;指定HTTP请求的统一资源定位符URL;指定请求的参数;指定请求负载;指定请求头信息;校验restful API被调用之后的HTTP请求的响应码;校验restful API被调用之后的HTTP请求的响应头;校验restful API被调用之后的HTTP请求的响应负载;获取restful API被调用之后的响应体的部分数据;设置restful API被调用之后的响应体的部分数据以用于与所述restful API关联的下一个restful API的测试。需要说明的是,restful API测试领域的业务规则并不限于上述的方面,根据具体测试的需要,还可以确定其他的业务规则。其中,指定待测试的restful API的超文本传输协议HTTP请求的方法、请求的统一资源定位符URL、请求的参数、请求负载和请求头信息;校验restful API被调用之后的HTTP响应码、响应头和响应负载,与上面用于单个restful API测试领域的业务规则类似,在此不再赘述。In other embodiments, the business rules in the field of restful API testing may include business rules for testing multiple associated restful APIs. The business rules for multiple associated restful API tests may specifically include the following aspects: Specify the method of the hypertext transfer protocol HTTP request of the restful API to be tested; specify the uniform resource locator URL of the HTTP request; Specify the request parameters; specify the request payload; specify the request header information; verify the response code of the HTTP request after the restful API is called; verify the response header of the HTTP request after the restful API is called; verify the restful API after the call The response load of the HTTP request; obtaining partial data of the response body after the restful API is called; setting partial data of the response body after the restful API is called for testing of the next restful API associated with the restful API. It should be noted that business rules in the field of restful API testing are not limited to the above-mentioned aspects, and other business rules can be determined according to the needs of specific tests. Among them, specify the method of the HTTP request of the restful API to be tested, the URL of the requested uniform resource locator, the parameters of the request, the request load and the request header information; verify the HTTP response code and response after the restful API is called The header and response load are similar to the business rules used in the field of single restful API testing above, and will not be repeated here.
获取restful API被调用之后的响应体的预定部分数据并设置以用于与所述restful API关联的下一个restful API的测试,具体而言,可包括:在restful API被调用之后,获取响应体中的预定的部分数据(例如,文本形式的数据),确定该部分数据是否满足预定的期望值;提取响应体中的该部分数据并存储,以用于本次restful API测试关联的下一个restful API的测试。例如,定义一个测试流程,测试用户的创建、查询和删除,对应三个restful API。按测试场景组合API进行测试,就可以采用删除-创建-查询-删除-查询测试流程,从而保证是可以重复运行,这样对测试环境的数据准备或者其他先决条件的依赖较少。继续上述的例子,在这个测试流程中,创建了user,在响应的负载中,包含了新建user的id,而查询API是正是采用id作为参数来查询的,因此,我们需要从创建API的响应body中提取用户id,放在测试场景的上下文(可以称为变量池)中,下一个api测试(用 户查询)时,去引用这个变量,从而获取到要查询的用户id。继续上述的例子,如果创建之后的查询是成功的,证明创建是有效的,删除操作如果成功,后面的查询应该查不到该用户,从而证明删除操作是有效的。Obtain the predetermined part of the data of the response body after the restful API is called and set it for the test of the next restful API associated with the restful API. Specifically, it may include: after the restful API is called, get the response body The predetermined part of the data (for example, text data) to determine whether the part of the data meets the predetermined expected value; extract the part of the data in the response body and store it for the next restful API associated with this restful API test test. For example, define a test process to test user creation, query and deletion, corresponding to three restful APIs. According to the test scenario combination API for testing, you can use the delete-create-query-delete-query test process to ensure that it can be run repeatedly, so that it is less dependent on data preparation or other prerequisites of the test environment. Continuing the above example, in this test process, a user is created, and the id of the newly created user is included in the response load, and the query API uses the id as a parameter to query, therefore, we need to create a response from the API The user id is extracted from the body and placed in the context of the test scenario (which can be called a variable pool). When the next api test (user query), the variable is referenced to obtain the user id to be queried. Continuing the above example, if the query after creation is successful, it proves that the creation is effective, and if the delete operation is successful, the subsequent query should not find the user, thus proving that the delete operation is effective.
根据cucumber规范确定restful API测试的业务规则对应的DSL语句片段,其中,业务规则可包括多个方面,对应多个DSL语句片段,一个DSL语句片段关注业务规则的一个方面。一些实施例中,DSL语句片段可以是DSL脚本的一个动作Action行。According to the cucumber specification, determine the DSL sentence fragments corresponding to the business rules of the restful API test, where the business rules may include multiple aspects, corresponding to multiple DSL sentence fragments, and one DSL sentence fragment focuses on one aspect of the business rules. In some embodiments, the DSL sentence fragment may be an Action line of the DSL script.
一些实施例中,DSL语句片段关注业务规则的下述多个(例如,大于或等于2)方面的组合:指定超文本传输协议HTTP请求的方法;指定超文本传输协议HTTP请求的统一资源定位符URL;指定超文本传输协议HTTP请求头的名称和值;指定restful API请求的参数的名称和值;指定超文本传输协议HTTP请求的请求负载;校验超文本传输协议HTTP请求的响应码;校验超文本传输协议HTTP请求的响应头是否存在或者是否与期望的值匹配。In some embodiments, the DSL sentence fragment focuses on the combination of the following multiple (eg, greater than or equal to 2) aspects of the business rules: specifying the method of the hypertext transfer protocol HTTP request; specifying the uniform resource locator of the hypertext transfer protocol HTTP request URL; specify the name and value of the HTTP request header of the hypertext transfer protocol; specify the name and value of the parameters of the restful API request; specify the request load of the HTTP request of the hypertext transfer protocol; verify the response code of the HTTP request of the hypertext transfer protocol; Verify that the response header of the HTTP request of the Hypertext Transfer Protocol exists or matches the expected value.
在另外一些实施例中,DSL语句片段关注业务规则的下述多个方面:指定超文本传输协议HTTP请求的方法;指定超文本传输协议HTTP请求的统一资源定位符URL;指定超文本传输协议HTTP请求头的名称和值;指定restful API请求的参数的名称和值;指定超文本传输协议HTTP请求的请求负载;校验超文本传输协议HTTP请求的响应码;校验超文本传输协议HTTP请求的响应头是否存在或者是否与期望的值匹配;校验超文本传输协议HTTP请求的响应体中的部分数据是否满足预定期望值;提取所述响应体中的部分数据并存储。In other embodiments, the DSL sentence fragment focuses on the following aspects of the business rules: specifying the method of the hypertext transfer protocol HTTP request; specifying the uniform resource locator URL of the hypertext transfer protocol HTTP request; specifying the hypertext transfer protocol HTTP Request header name and value; specify the name and value of restful API request parameters; specify the request load of the hypertext transfer protocol HTTP request; verify the response code of the hypertext transfer protocol HTTP request; verify the hypertext transfer protocol HTTP request Whether the response header exists or matches the expected value; verify whether part of the data in the response body of the hypertext transfer protocol HTTP request meets the predetermined expected value; extract and store part of the data in the response body.
下面以基于DSL的测试例子说明DSL语句片段和对应的业务规则的方面。The following uses DSL-based test examples to illustrate aspects of DSL sentence fragments and corresponding business rules.
Feature:Bose Api testFeature: BoseApitest
定义测试流程,以Feature:关键字开头,流程名称是Bose Api test,这个测试流程测试了配置中心服务的profile的删除、创建和查询。Define the test process, starting with the Feature: keyword, and the process name is Bose Api test. This test process tests the deletion, creation, and query of the profile of the configuration center service.
Scenario:remove the profile shawn-test-001Scenario: remove the profile shawn-test-001
定义了一个场景,场景名称是remove the profile shawn-test-001A scene is defined, the name of the scene is remove the profile shawn-test-001
Given variable apiBase with default http://172.25.12.166:7101Given variable apiBase with default http://172.25.12.166:7101
Given variable profile with default shawn-test-001Given variable withwith default shawn-test-001
该DSL语句片段用于给两个变量赋予缺省值,变量的apiBase的默认值是 http://172.25.12.166:7101,变量的profile的默认值是shawn-test-001,当这个DSL脚本被Cucumber引擎执行时,可以传递全局变量给执行引擎,如果没有定义特定的变量,就用DSL中定义的默认值。The DSL statement fragment is used to assign default values to two variables. The default value of the variable apiBase is http://172.25.12.166:7101, and the default value of the variable profile is shawn-test-001. When the DSL script is When the Cucumber engine executes, it can pass global variables to the execution engine. If no specific variables are defined, the default values defined in the DSL are used.
When test post for${apiBase}/configs/clearWhen “test” post for $ {apiBase} / configs / clear
该DSL语句片段定义要测试的url和http方法名称,其中url是${apiBase}/configs/clear,${}表示到变量池中解析。http方法在这里是post。The DSL statement fragment defines the url and http method name to be tested, where url is $ {apiBase} / configs / clear, and $ {} means to resolve in the variable pool. The http method is post here.
And param profile is${profile}And paramprofile is $ {profile}
And param application is publicAnd paramapplication is public
And param label is snapshotAnd param label is snapshot
该DSL语句片段添加请求的参数,其中参数名称是profile,值为${profile},即到变量池中获取profile变量。The DSL statement fragment adds the requested parameters, where the parameter name is profile and the value is $ {profile}, that is, the profile variable is obtained from the variable pool.
Then check responseThen check response
该DSL语句片段向服务器端发起请求。The DSL sentence fragment initiates a request to the server.
And response status is 200And response status is 200
该DSL语句片段验证响应码是200,即成功,如果响应码不是200,该测试流程报错。The DSL sentence fragment verifies that the response code is 200, which means success. If the response code is not 200, the test process reports an error.
Scenario:add config to profile shawn-test-001Scenario: add config to profile shawn-test-001
Given variable apiBase with default http://172.25.12.166:7101Given variable apiBase with default http://172.25.12.166:7101
Given variable profile with default shawn-test-001Given variable withwith default shawn-test-001
When test post for${apiBase}/configs/updateWhen test post for $ {apiBase} / configs / update
And param profile is${profile}And paramprofile is $ {profile}
And param application is publicAnd paramapplication is public
And param label is snapshotAnd param label is snapshot
And param key is testAnd param key is test
And param value is 1111And param value is 1111
Then check responseThen check response
And response status is 200And response status is 200
定义测试场景,向配置中心添加配置。Define test scenarios and add configurations to the configuration center.
Scenario:get config of profile shawn-test-001Scenario: get config of profileshawn-test-001
Given variable apiBase with default http://172.25.12.166:7101Given variable apiBase with default http://172.25.12.166:7101
Given variable profile with default shawn-test-001Given variable withwith default shawn-test-001
定义测试场景,获取上一过程添加的配置。Define test scenarios and obtain the configuration added in the previous procedure.
When test get for${apiBase}/configsWhen tested for $ {apiBase} / configs
And param profile is${profile}And paramprofile is $ {profile}
And param application is publicAnd paramapplication is public
And param label is snapshotAnd param label is snapshot
Then check responseThen check response
And response status is 200And response status is 200
And response json data.test is 1111And response json data.test is 1111
验证响应的负载中,json的path data.test对应的值是1111。如果不是1111,那么测试将在此步骤报错。In the payload of the verification response, the value of path.data.test in json is 1111. If it is not 1111, then the test will report an error at this step.
Scenario:clean the profile shawn-test-001Scenario: clean the profile shawn-test-001
Given variable apiBase with default http://172.25.12.166:7101Given variable apiBase with default http://172.25.12.166:7101
Given variable profile with default shawn-test-001Given variable withwith default shawn-test-001
When test post for${apiBase}/configs/removeWhen “test” post for $ {apiBase} / configs / remove
And param profile is${profile}And paramprofile is $ {profile}
And param application is publicAnd paramapplication is public
And param label is snapshotAnd param label is snapshot
And param key is testAnd param key is test
Then check responseThen check response
And response status is 200And response status is 200
移除前述场景创建的数据,恢复测试环境的数据。Remove the data created in the previous scenario and restore the data in the test environment.
在一些实施例中,根据cucumber规范确定关注restful API测试领域的业务规则的领域专用语言DSL语句片段包括:根据cucumber规范确定关注restful API测试领域的业务规则的多个方面对应的多个DSL语句片段,一个方面对应一个DSL语句片段,该一个DSL语句片段可以是一个动作Action行。In some embodiments, determining the domain-specific language DSL sentence fragments focusing on the business rules of the restful API testing field according to the cucumber specification includes: determining multiple DSL sentence fragments corresponding to various aspects of the business rules of the restful API testing field according to the cucumber specification One aspect corresponds to a DSL sentence fragment, and the one DSL sentence fragment may be an action line.
步骤120,根据Blockly规范确定所述DSL语句片段对应的Block。Step 120: Determine the block corresponding to the DSL sentence segment according to the Blockly specification.
在本发明的一些实施例中,根据Blockly规范确定DSL语句对应的block可包括根据Blockly规范将DSL语句中的一个DSL语句片段(例如,一个动作Action 行)转换为一个block,一个DSL语句片段对应一个block。通过推拽不同的block,可以获得所述不同的block对应的DSL语句片段,组合后可以交给cucumber工具执行,通过块的拖拽即可简单、直观地进行restful API测试。In some embodiments of the present invention, determining the block corresponding to the DSL sentence according to the Blockly specification may include converting a DSL sentence fragment (for example, an Action line) in the DSL sentence into a block according to the Blockly specification, and a DSL sentence fragment corresponding to A block. By dragging and dropping different blocks, the DSL sentence fragments corresponding to the different blocks can be obtained, which can be handed over to the cucumber tool for execution after combination, and the restful API test can be performed simply and intuitively by dragging and dropping the blocks.
而且,通过关注多个关联的restful API测试领域的业务规则,可以简单、直观地进行多个串联的restful API的测试。Moreover, by focusing on the business rules of multiple associated restful API testing areas, multiple serially connected restful API tests can be performed simply and intuitively.
DSL语句片段对应的块Block,为图形化的块,可以在预定编辑器的画布界面上进行拖拽。每个块具有描述该块的用于拖拽的元素的可见文本部分和可输入部分,以及该块的上下左右衔接的设置。The block corresponding to the DSL sentence fragment is a graphical block, which can be dragged and dropped on the canvas interface of the predetermined editor. Each block has a visible text portion and an inputable portion that describe the drag-and-drop element of the block, and settings in which the block is connected up, down, left, and right.
如图2所示,在预定的编辑器中,在画布界面通过块的上下左右衔接设置可以将不同的块进行组合,从而完成各个不同块的图形化的组合,无需代码编写,即可简单、直观地完成restful API的测试,降低了根据DSL进行restful API测试的应用难度。而且,图形化的块在被拖拽到画布界面上时能够将其可输入部分呈现在画布的交互界面上,接收用户的输入,改善了应用图形化的块进行restful API测试的灵活性。As shown in Figure 2, in a predetermined editor, different blocks can be combined through the connection of the upper, lower, left, and right of the block on the canvas interface, so as to complete the graphical combination of different blocks. No code writing is required. Complete restful API testing intuitively, reducing the difficulty of applying restful API testing based on DSL. Moreover, when the graphical block is dragged onto the canvas interface, its inputtable part can be presented on the interactive interface of the canvas to receive user input, which improves the flexibility of applying graphical blocks for restful API testing.
在拖拽的界面上,一个块Blcok可对应一个Block的实例,例如,On the drag and drop interface, a block Blcok can correspond to an instance of Block, for example,
Given variable apiBase with default http://172.25.12.166:7101Given variable apiBase with default http://172.25.12.166:7101
除开引导词Given,变化的部分是可输入部分,这些由用户自行填写,用户可填写apiBase与http://172.25.12.166:7101;其他的部分,实际上是可见文本部分,这部分是固定不变的,是用户没法改变的,主要作用是让用户了解该Block的语义,可见文本部分并不需要和DSL行的文本对应,可见文本部分仅仅用来辅助用户了解块的含义。Except for the guide word Given, the changed part is an input part. These are filled out by the user. The user can fill in apiBase and http://172.25.12.166:7101; the other parts are actually visible text parts. This part is fixed. The change is something that the user cannot change. The main function is to let the user understand the semantics of the block. The visible text part does not need to correspond to the DSL line text. The visible text part is only used to assist the user to understand the meaning of the block.
参见图3,图3示出了根据本发明实施例的应用程序接口API测试方法的流程示意图,该方法300可包括:步骤310、步骤320和330,下面结合具体的例子对上述步骤进行说明。Referring to FIG. 3, FIG. 3 shows a schematic flowchart of an application program interface API testing method according to an embodiment of the present invention. The method 300 may include steps 310, 320, and 330. The above steps are described below in conjunction with specific examples.
步骤S310,接收用户对应用程序接口API测试的图形化的块Blcok的拖拽请求,其中,所述Block对应领域专用语言DSL的语句片段。Step S310: Receive a user's drag-and-drop request for the graphical block Blcok tested by the application program interface API, where the Block corresponds to a sentence fragment of the domain-specific language DSL.
DSL是针对特定领域的语言。在本发明实施例中,DSL是针对restful API测试领域的。DSL is a language for a specific field. In the embodiment of the present invention, DSL is aimed at the field of restful API testing.
在本发明的一些实施例中,步骤310中的图形化的块可以根据图1所示的方 法产生的图形化的块。在本发明的一些实施例中,步骤310中的图形化的块可以是根据不同于图1所示方法的其他方法产生的图形化的块。In some embodiments of the present invention, the graphical block in step 310 may be a graphical block generated according to the method shown in FIG. In some embodiments of the present invention, the graphical block in step 310 may be a graphical block generated according to a method other than the method shown in FIG. 1.
在本发明的一些实施例中,restful API测试领域的业务规则可以包括对单个restful API测试的业务规则。对单个的restful API测试的业务规则,具体而言,可包括下述多个方面:指定待测试的restful API的超文本传输协议HTTP请求的方法、请求的统一资源定位符(Universal resource Locator,URL)、请求参数、请求负载和请求头信息;校验restful API被调用过之后的HTTP响应码、响应头和响应负载。需要说明的是,restful API测试领域的业务规则并不限于上述的方面,根据具体测试的需要,还可以确定其他的业务规则。对于单个restful API的测试,需要确保测试的数据符合预定要求,否则测试查询时可能会查不到相应的数据。In some embodiments of the present invention, business rules in the field of restful API testing may include business rules for testing a single restful API. The business rules for a single restful API test, specifically, can include the following aspects: Specify the method of the HTTP request of the restful API to be tested, the requested universal resource locator (Universal resource Locator, URL ), Request parameters, request payload and request header information; verify the HTTP response code, response header and response payload after the restful API is called. It should be noted that business rules in the field of restful API testing are not limited to the above-mentioned aspects, and other business rules can be determined according to the needs of specific tests. For a single restful API test, you need to ensure that the test data meets the predetermined requirements, otherwise the corresponding data may not be found during the test query.
restful API是构建在HTTP协议基础之上,根据HTTP的规范,包含两部分,请求部分和应答部分。The restful API is built on the basis of the HTTP protocol. According to the HTTP specification, it contains two parts, the request part and the response part.
对于HTTP请求,必须指定:请求的方法,请求的URL,请求的头header,请求的参数,请求的负载。For HTTP requests, you must specify: the method of the request, the URL of the request, the header of the request, the parameters of the request, and the load of the request.
对于应答部分,一般包括:响应码,响应头header,响应负载。For the response part, generally include: response code, response header, response load.
Restful API被调用之后,需要校验HTTP响应码、响应头和响应负载。也就是说,服务端提供了restful API,客户端来调用这个restful API,需要检查当前调用的结果是否符合测试者的预期,例如,响应码是否一致,特定的响应header是否存在或者其值是否和期望的值相符,响应负载中的内容是否含有关心的业务数据或者和与期望的值相符。After the Restful API is called, you need to verify the HTTP response code, response header and response payload. In other words, the server provides a restful API, and the client calls the restful API. It is necessary to check whether the result of the current call meets the tester's expectations, for example, whether the response code is consistent, whether a specific response header exists or whether its value is The expected value corresponds to whether the content in the response load contains the service data concerned or conforms to the expected value.
在另外一些实施例中,restful API测试领域的业务规则可包括对多个关联的restful API测试的业务规则。对多个关联的restful API测试的业务规则,具体而言,可包括下述多个方面:指定待测试的restful API的超文本传输协议HTTP请求的方法、请求的统一资源定位符URL、请求的参数、请求负载和请求头信息;校验restful API被调用之后的HTTP响应码、响应头和响应负载;获取restful API被调用之后的响应体的预定消息并设置以用于与所述restful API关联的下一个restful API的测试。需要说明的是,restful API测试领域的业务规则并不限于上述的方面,根据具体测试的需要,还可以确定其他的业务规则。其中,指定待测试的restful API的超文本传输协议HTTP请求的方法、请求的统一资源定位符 URL、请求的参数、请求负载和请求头信息;校验restful API被调用之后的HTTP响应码、响应头和响应负载,与上面用于单个restful API测试领域的业务规则类似,在此不再赘述。In other embodiments, the business rules in the field of restful API testing may include business rules for testing multiple associated restful APIs. The business rules for multiple associated restful API tests may specifically include the following aspects: the method of specifying the HTTP request of the restful API to be tested, the requested uniform resource locator URL, and the requested Parameters, request load and request header information; verify the HTTP response code, response header and response load after the restful API is called; get the predetermined message of the response body after the restful API is called and set it for association with the restful API The next restful API test. It should be noted that business rules in the field of restful API testing are not limited to the above-mentioned aspects, and other business rules can be determined according to the needs of specific tests. Among them, specify the method of the HTTP request of the restful API to be tested, the URL of the requested uniform resource locator, the parameters of the request, the request load and the request header information; verify the HTTP response code and response after the restful API is called The header and response load are similar to the business rules used in the field of single restful API testing above, and will not be repeated here.
获取restful API被调用之后的响应体的预定消息并设置以用于与所述restful API关联的下一个restful API的测试,具体而言,可包括:在restful API被调用之后,获取响应体中的预定的部分文本,确定该部分文本是否满足预定的期望值;提取响应体中的该部分文本数据并存储,以用于本次restful API测试关联的下一个restful API的测试。例如,定义一个测试流程,测试用户的创建、查询和删除,对应三个restful API。按测试场景组合API进行测试,就可以采用删除-创建-查询-删除-查询测试流程,从而保证是可以重复运行,这样对测试环境的数据准备或者其他先决条件的依赖较少。继续上述的例子,在这个测试流程中,创建了user,在响应的负载中,包含了新建user的id,而查询API是正是采用id作为参数来查询的,因此,我们需要从创建API的响应body中提取用户id,放在测试场景的上下文(可以称为变量池)中,下一个api测试(用户查询)时,去引用这个变量,从而获取到要查询的用户id。继续上述的例子,如果创建之后的查询是成功的,证明创建是有效的,删除操作如果成功,后面的查询应该查不到该用户,从而证明删除操作是有效的。Obtain the predetermined message of the response body after the restful API is called and set it for the test of the next restful API associated with the restful API. Specifically, it may include: after the restful API is called, obtain the information in the response body A predetermined partial text to determine whether the partial text meets a predetermined expected value; extract and store the partial text data in the response body for the next restful API test associated with this restful API test. For example, define a test process to test user creation, query and deletion, corresponding to three restful APIs. According to the test scenario combination API for testing, you can use the delete-create-query-delete-query test process to ensure that it can be run repeatedly, so that it is less dependent on data preparation or other prerequisites of the test environment. Continuing the above example, in this test process, a user is created, and the id of the newly created user is included in the response load, and the query API uses the id as a parameter to query, therefore, we need to create a response from the API The user id is extracted from the body and placed in the context of the test scenario (which can be called a variable pool). When the next api test (user query), the variable is referenced to obtain the user id to be queried. Continuing the above example, if the query after creation is successful, it proves that the creation is effective, and if the delete operation is successful, the subsequent query should not find the user, thus proving that the delete operation is effective.
在一些实施例中,restful API测试领域的业务规则可包括多个方面,一个DSL语句片段关注restful测试领域的业务规则的一个方面。在一种具体的例子中,所述多个方面为:In some embodiments, the business rules in the restful API testing field may include multiple aspects, and one DSL sentence segment focuses on one aspect of the business rules in the restful testing field. In a specific example, the multiple aspects are:
所述多个方面包括:The multiple aspects include:
指定待测试的restful API的超文本传输协议HTTP请求的方法;Specify the method of restful API hypertext transfer protocol HTTP request to be tested;
指定HTTP请求的统一资源定位符URL;Specify the uniform resource locator URL for HTTP requests;
指定请求的参数;Specify the requested parameters;
指定请求负载;Specify the request load;
指定请求头信息;Specify the request header information;
校验restful API被调用之后的HTTP请求的响应码;Verify the response code of the HTTP request after the restful API is called;
校验restful API被调用之后的HTTP请求的响应头;Verify the response header of the HTTP request after the restful API is called;
校验restful API被调用之后的HTTP请求的响应负载;Verify the response load of the HTTP request after the restful API is called;
获取restful API被调用之后的响应体的部分数据;Get part of the response body data after the restful API is called;
设置restful API被调用之后的响应体的部分数据以用于与所述restful API关联的下一个restful API的测试。Set part of the data of the response body after the restful API is called for testing of the next restful API associated with the restful API.
一些实施例中,步骤S310可包括:接收用于对API测试的一个或多个图形化块的拖拽请求,其中,一个图形化的块对应一个DSL语句片段,不同的块对应不同的DSL语句片段。在一种具体的实施例中,DSL语句片段是一个动作Action行。In some embodiments, step S310 may include: receiving a drag request for one or more graphical blocks for API testing, where a graphical block corresponds to a DSL sentence segment, and different blocks correspond to different DSL sentences Fragment. In a specific embodiment, the DSL sentence fragment is an Action line.
一种图形化的块的编辑界面可以如图2所示。图2的左侧为工具栏,其中,包括各种图形的块,右侧为画布界面。接收用户对API测试的图形化的块的拖拽请求可包括在预定编辑器中的交互界面,接收用户的API测试的图形化的块的拖拽请求。在图形化的块被拖拽到该交互界面的画布中时,将产生该块在该交互界面的画布中的布局描述数据和该块对应的DSL语句片段两份数据,其中,布局描述数据可用于重现画布和图形化的块的布局,DSL语句片段是该图形化的块对应的DSL脚本。该块的DSL语句片段可以根据Blockly规范通过翻译函数转换得到,也就是说,根据bockly规范将所述拖拽请求对应的图形化的块转换为DSL脚本包括:根据Blockly规范通过翻译函数将拖拽请求对应的图形化的块转换为DSL语句片段。翻译函数是将图形化的块转换为DSL的工具,该翻译函数的结果是一个符合语法要求的DSL行。在画布界面上拖拽图形化的块时,在图形化的块的预定区域呈现可输入部分,接收用户的输入。A graphical block editing interface can be shown in Figure 2. The left side of Figure 2 is the toolbar, which includes blocks of various graphics, and the right side is the canvas interface. Receiving a user's drag-and-drop request for a graphical block of an API test may include an interactive interface in a predetermined editor, receiving a drag-and-drop request of a graphical block of a user's API test. When the graphical block is dragged into the canvas of the interactive interface, two pieces of data of the layout description data of the block in the canvas of the interactive interface and the corresponding DSL sentence fragments of the block will be generated, where the layout description data is available To reproduce the layout of the canvas and the graphical block, the DSL sentence fragment is the DSL script corresponding to the graphical block. The DSL sentence segment of the block can be converted by the translation function according to the Blockly specification, that is to say, converting the graphical block corresponding to the drag request into a DSL script according to the bockly specification includes: dragging and dropping the translation function according to the Blockly specification Request that the corresponding graphical block be converted into a DSL sentence fragment. The translation function is a tool that converts a graphical block into a DSL. The result of the translation function is a DSL line that meets the grammatical requirements. When dragging the graphical block on the canvas interface, an inputable part is presented in a predetermined area of the graphical block to receive user input.
步骤320,根据Blockly规范将所述拖拽请求对应的图形化的块转换为DSL脚本。Step 320: Convert the graphical block corresponding to the drag request into a DSL script according to the Blockly specification.
在本发明的实施例中,图形化的块包括可输入部分和可见文本部分,以及上下左右衔接的设置。In an embodiment of the present invention, the graphical block includes an inputtable part and a visible text part, as well as settings for connecting up, down, left, and right.
根据blockly规范将图形化的block转换为DSL语句可包括:根据blockly规范,调用block的API来将图形化的块转换为DSL片段(例如,一行),一个图形化的块通过该块的翻译函数翻译成对应的DSL片段,多个图形化的块,通过这些块之间的上下左右的衔接设置进行组合,形成多个DSL语句片段的组合,得到完整的DSL脚本。Converting a graphical block into a DSL statement according to the blockly specification may include: according to the blockly specification, calling the block ’s API to convert the graphical block into a DSL fragment (for example, a line), a graphical block through the translation function of the block Translate into corresponding DSL fragments, multiple graphical blocks, and combine them through the connection settings of up, down, left, and right between these blocks to form a combination of multiple DSL sentence fragments to obtain a complete DSL script.
每个块可对应于DSL脚本的每一行,比如说Each block can correspond to each line of the DSL script, for example
Given variable apiBase with default http://172.25.12.166:7101Given variable apiBase with default http://172.25.12.166:7101
Given variable profile with default shawn-test-001Given variable withwith default shawn-test-001
上述DSL语句对应于同一个Block的定义,但是在拖拽的界面上,是两个Block的实例。除开引导词Given,变化的部分是可输入部分,这些由用户自行填写,用户可能填写apiBase与http://172.25.12.166:7101或者用户填写profile和shawn-test-001;其他的部分,实际上是可见文本部分,这部分是固定不变的,是用户没法改变,主要作用是让用户了解该Block的语义。可见文本部分并不需要和DSL行的文本对应,可见文本仅仅用来辅助用户了解块的含义。The above DSL statement corresponds to the definition of the same Block, but on the drag and drop interface, there are two Block instances. Except for the guide word Given, the changed part is an input part. These are filled out by the user. The user may fill in apiBase and http://172.25.12.166:7101 or the user fills in the profile and shawn-test-001; the other parts are actually It is the visible text part. This part is fixed and cannot be changed by the user. The main function is to let the user understand the semantics of the block. The visible text part does not need to correspond to the text on the DSL line. The visible text is only used to help users understand the meaning of the block.
当处理任意图形时,将调用该块的翻译函数来翻译成特定的DSL语句片段。其中,翻译函数的结果是一个正确的,符合要求的DSL行。所有的Block块都正确翻译了DSL行,那么就最终得到了完整的DSL脚本。When processing arbitrary graphics, the translation function of the block will be called to translate into specific DSL sentence fragments. Among them, the result of the translation function is a correct DSL line that meets the requirements. All the Block blocks have correctly translated the DSL line, then you will end up with a complete DSL script.
在一些实施例中,图形化的块的拖拽请求包括对多个图形化的块的拖拽请求,所述方法还包括:将所述拖拽请求对应的多个图形化的块,根据各图形化的块的上下左右衔接的设置,进行组合,得到多个DSL语句片段,作为DSL脚本。In some embodiments, the drag request of the graphical block includes a drag request for a plurality of graphical blocks, and the method further includes: multiple graphical blocks corresponding to the drag request, according to each The setting of the connection of up, down, left and right of the graphical block is combined to obtain multiple DSL sentence fragments as a DSL script.
步骤330,将转换后的DSL语句根据cucumber规范执行以完成对restful API的测试。 Step 330, the converted DSL statement is executed according to the cucumber specification to complete the testing of the restful API.
通过步骤320转换得到的完整的DSL脚本可以根据cucumber规范执行,从而完成对restful API的图形化测试。The complete DSL script converted through step 320 can be executed according to the cucumber specification to complete the graphical testing of the restful API.
DSL语句片段对应的块Block,为图形化的块,可以在编辑器的画布界面上进行拖拽。每个块具有描述该快的用于拖拽的元素的可见文本部分和可输入部分,以及该块的上下左右衔接的设置。通过块的上下左右衔接的设置,可完成各个不同块的图形化的组合,无需代码编写,即可完成restful API的测试,辅助了基于DSL的代码编写,降低了采用DSL实现相关功能处理的技术难度。The block corresponding to the DSL sentence fragment is a graphical block, which can be dragged and dropped on the canvas interface of the editor. Each block has a visible text portion and an inputable portion that describe the fast drag-and-drop element, and settings for connecting the up, down, left, and right of the block. Through the setting of the connection of the upper, lower, left and right of the block, the graphical combination of each different block can be completed, and the restful API test can be completed without code writing, which assists the DSL-based code writing and reduces the technology of using DSL to implement related functions. Difficulty.
参见图4,图4示出了根据本发明实施方式的应用程序接口API测试方法的流程示意图,该方法400可包括:步骤410、步骤420、步骤430和步骤440,接下来结合具体的实施例对上述步骤进行说明。Referring to FIG. 4, FIG. 4 shows a schematic flowchart of an application program interface API testing method according to an embodiment of the present invention. The method 400 may include: step 410, step 420, step 430, and step 440, followed by a specific example The above steps will be explained.
步骤S410,提供用于应用程序接口API测试的图形化的块Block。Step S410: Provide a graphical block for application program interface API testing.
在本发明的一些实施例中,步骤410中,提供的用于API测试的图形化的块可以是根据图1所示的方法产生的图形化的块。在另外一些实施例中,步骤410中提供的用于API测试的图形化的块可以是根据其他方法产生的图形化的 块。In some embodiments of the present invention, in step 410, the provided graphical block for API testing may be a graphical block generated according to the method shown in FIG. In other embodiments, the graphical block for API testing provided in step 410 may be a graphical block generated according to other methods.
在本发明的一些实施例中,步骤410可包括:根据cucumber规范确定关注restful API测试领域的业务规则的领域专用语言DSL语句片段;根据Blockly规范将所述DSL语句片段转换为图形化的块Block。关于这些步骤的具体说明可参考关于图1的相关描述,在此不再赘述。In some embodiments of the present invention, step 410 may include: determining a domain-specific language DSL sentence fragment that focuses on business rules in the restful API testing field according to the cucumber specification; and converting the DSL sentence fragment into a graphical block according to the Blockly specification . For specific descriptions of these steps, reference may be made to the related description of FIG. 1, and details are not repeated here.
在本发明的一些实施例中,步骤410可包括:在预定的编辑器中,部署restful API测试的图形化的块,例如,可以部署restful API测试的通用版的图形化的块,也可以部署restful API测试的包含特定图形化的块的定制版的图形化的块。In some embodiments of the present invention, step 410 may include: deploying a graphical block of restful API testing in a predetermined editor, for example, a generic version of the graphical block of restful API testing may also be deployed, and may also be deployed Restful API-tested graphical blocks that contain customized versions of specific graphical blocks.
在本发明的一些实施例中,通过DSL语句片段关注restful API测试领域的业务规则,所述业务规则可包括多个方面,例如,大于或等于2个方面。一个DSL语句片段关于业务规则的一个方面。In some embodiments of the present invention, business rules in the field of restful API testing are focused on through DSL sentence fragments, and the business rules may include multiple aspects, for example, greater than or equal to 2 aspects. A piece of DSL statement about an aspect of business rules.
在本发明的一些实施例中,根据cucumber规范确定关注restful API测试领域的业务规则的领域专用语言DSL语句片段包括:根据cucumber规范确定关注restful API测试领域的业务规则的多个方面对应的多个DSL语句片段,每个方面分别对应一个DSL语句片段。In some embodiments of the present invention, determining the domain-specific language DSL sentence fragment focusing on the business rules of the restful API testing field according to the cucumber specification includes: DSL sentence fragments, each aspect corresponds to a DSL sentence fragment.
在本发明的一些实施例中,DSL语句片段可以是一个DSL的动作Action行。在DSL语句片段为DSL的动作Action行的情况下,根据Blockly规范将所述DSL语句片段转换为图形化的块Block可包括:根据Blockly规范将一个DSL的动作Action行转换为一个图形化的块Block。In some embodiments of the present invention, the DSL sentence segment may be a DSL Action line. In the case where the DSL sentence segment is a DSL action line, converting the DSL sentence segment into a graphical block according to the Blockly specification Block may include: converting a DSL action line into a graphical block according to the Blockly specification Block.
在本发明的一些实施例中,在对单个restful API进行测试的场景下,restful API测试领域的业务规则的多个方面可包括下述的两个或更多个方面的组合:指定待测试的restful API的超文本传输协议HTTP请求的方法;指定HTTP请求的统一资源定位符URL;指定请求的参数;指定请求负载;指定请求头信息;校验restful API被调用之后的HTTP请求的响应码;校验restful API被调用之后的HTTP请求的响应头;校验restful API被调用之后的HTTP请求的响应负载。在一些实施例中,restful API测试领域的业务规则的多个方面为上面列出的所有方面。In some embodiments of the present invention, in a scenario where a single restful API is tested, multiple aspects of business rules in the field of restful API testing may include a combination of two or more of the following: Restful API Hypertext Transfer Protocol HTTP request method; specify the uniform resource locator URL of the HTTP request; specify the request parameters; specify the request load; specify the request header information; verify the response code of the HTTP request after the restful API is called; Check the response header of the HTTP request after the restful API is called; check the response load of the HTTP request after the restful API is called. In some embodiments, multiple aspects of business rules in the restful API testing field are all aspects listed above.
在本发明的一些实施例中,在对多个连续的restful API进行测试的场景中,restful API测试领域的业务规则的多个方面包括下述两个或更多个方面的组合: 指定待测试的restful API的超文本传输协议HTTP请求的方法;指定HTTP请求的统一资源定位符URL;指定请求的参数;指定请求负载;指定请求头信息;校验restful API被调用之后的HTTP请求的响应码;校验restful API被调用之后的HTTP请求的响应头;校验restful API被调用之后的HTTP请求的响应负载;获取restful API被调用之后的响应体的部分数据;设置restful API被调用之后的响应体的部分数据以用于与所述restful API关联的下一个restful API的测试。在本发明的一些实施例中,多个连续的restful API测试的业务规则包括上面列出的所有方面。In some embodiments of the present invention, in a scenario where multiple consecutive restful APIs are tested, various aspects of business rules in the restful API testing field include a combination of the following two or more aspects: Specify to be tested The method of restful API hypertext transfer protocol HTTP request; specify the uniform resource locator URL of the HTTP request; specify the request parameters; specify the request load; specify the request header information; verify the response code of the HTTP request after the restful API is called ; Check the response header of the HTTP request after the restful API is called; check the response load of the HTTP request after the restful API is called; get the partial data of the response body after the restful API is called; set the response after the restful API is called Part of the data is used for the next restful API test associated with the restful API. In some embodiments of the invention, the business rules for multiple consecutive restful API tests include all aspects listed above.
在本发明的一些实施方式中,图形化的块可包括可输入部分和可见文本部分,以及上下左右衔接的设置。In some embodiments of the present invention, the graphical block may include an inputtable part and a visible text part, as well as settings for connecting up, down, left, and right.
步骤420,接收用户对所述图形化的块Blcok的拖拽请求,其中,所述块Block对应领域专用语言DSL的语句片段。Step 420: Receive a user's drag-and-drop request to the graphical block Blcok, where the block block corresponds to a sentence fragment of a domain-specific language DSL.
在本发明的一些实施例中,步骤420接收用户对图形化的块的拖拽请求可包括在预定编辑器的交互界面,接收用户对API测试的图形化的块的拖拽请求。其中,预定的编辑器的交互界面可以是如图2所示的交互界面。该预定编辑器可包括多个图形化的块,每个块都可以进行拖拽操作。在该编辑器的交互界面中,存在编辑界面,在该编辑界面中,可以对一个图形化的块进行多次拖拽。在一些实施例中,还可以对组合的图形化的块进行整体拖拽。In some embodiments of the present invention, the step 420 of receiving the user's drag request for the graphical block may include an interactive interface of a predetermined editor to receive the user's drag request for the API tested graphical block. The interactive interface of the predetermined editor may be the interactive interface shown in FIG. 2. The predetermined editor may include a plurality of graphical blocks, and each block may be dragged and dropped. In the interactive interface of the editor, there is an editing interface in which a graphical block can be dragged multiple times. In some embodiments, the combined graphical blocks can also be dragged as a whole.
在本发明的一些实施例中,在执行步骤420的同时,还可以包括:在图形化的块被拖拽到预定编辑器的交互界面的画布中时,产生该图形化的块在该交互界面的画布中的布局描述数据和图形化的块对应的DSL语句片段。也就是说,在图形化的块在交互界面的画布中拖拽时,同时产生两份数据,一份数据为布局描述数据,用于描述图形化的块在画布中的位置等信息,另一份数据为DSL语句片段,用于产生对应的DSL脚本。In some embodiments of the present invention, while performing step 420, it may further include: when the graphical block is dragged to the canvas of the interactive interface of the predetermined editor, generating the graphical block in the interactive interface The layout description data in the canvas and the DSL sentence fragments corresponding to the graphical blocks. That is to say, when the graphical block is dragged on the canvas of the interactive interface, two pieces of data are generated at the same time, one piece of data is layout description data, which is used to describe the position of the graphical block in the canvas and other information, and the other The data is a DSL sentence fragment, which is used to generate the corresponding DSL script.
如上所述,图形化的块包括可输入部分和可见文本部分,以及上下左右衔接的设置。在本发明的一些实施例中,本发明的方法还可包括:在画布界面上拖拽图形化的块时,在图形化的块的预定区域呈现所述可输入部分,接收用户的输入。在本发明的一些实施例中,图形化的块的拖拽请求可包括对多个图形化的块的拖拽请求,在对多个图形化的块进行拖拽的情形下,本发明的方法可包括:将拖拽 请求对应的多个图形化的块,根据各图形化的块的上下左右衔接的设置,进行组合。As mentioned above, the graphical block includes the inputtable part and the visible text part, as well as the settings for connecting up, down, left, and right. In some embodiments of the present invention, the method of the present invention may further include: when dragging the graphical block on the canvas interface, presenting the inputtable portion in a predetermined area of the graphical block to receive user input. In some embodiments of the present invention, the drag request of the graphical block may include a drag request for multiple graphical blocks. In the case of dragging multiple graphical blocks, the method of the present invention It may include: combining a plurality of graphical blocks corresponding to the drag request according to the setting of connecting up, down, left, and right of each graphical block.
步骤430,根据Blockly规范将所述拖拽请求对应的图形化的块转换为DSL脚本。Step 430: Convert the graphical block corresponding to the drag request into a DSL script according to the Blockly specification.
在本发明的一些实施例中,步骤430根据Blockly规范将所述拖拽请求对应的图形化的块转换为DSL脚本可包括:根据Blockly规范通过翻译函数将所述拖拽请求对应的图形化的块转换为DSL语句片段。在一些实施例中,图形化的块可包括两个或更多个图形化的块。这些图形化的块分别通过对应的翻译函数翻译,得到多个DSL语句片段,形成DSL测试脚本。In some embodiments of the present invention, step 430 converting the graphical block corresponding to the drag request into a DSL script according to the Blockly specification may include: converting the graphical block corresponding to the drag request through a translation function according to the Blockly specification Blocks are converted into DSL sentence fragments. In some embodiments, the graphical blocks may include two or more graphical blocks. These graphical blocks are respectively translated by corresponding translation functions to obtain multiple DSL sentence fragments to form a DSL test script.
步骤440,将转换后的DSL脚本根据cucumber规范执行以完成对restful API的测试。In step 440, the converted DSL script is executed according to the cucumber specification to complete the testing of the restful API.
在本发明的一些实施例中,转换后的DSL脚本,例如,可包括多个DSL语句片段。在一些实施例中,转换后的DSL脚本可以是对一个restful API测试的DSL脚本,在另外一些实施例中,转换后的DSL脚本是对多个关联的restful API测试的DSL脚本。根据cucumber规范执行转换后的DSL脚本,完成对一个restful API或多个关联的restful API的测试。In some embodiments of the present invention, the converted DSL script, for example, may include multiple DSL sentence fragments. In some embodiments, the converted DSL script may be a DSL script for testing a restful API. In other embodiments, the converted DSL script is a DSL script for testing multiple associated restful APIs. Execute the converted DSL script according to the cucumber specification to complete the test of a restful API or multiple associated restful APIs.
本发明实施方式提供的restful API测试方法,根据Blockly规范将restful API测试的业务规则关注的DSL语句片段转换为图形化的块,方便用户利用预定编辑器拖拽图形的块,进行组合,通过翻译函数形成DSL脚本进行restful API的测试。通过图形化的拖拽即可完成restful API的测试,简单直观,而且形成DSL的图形化辅助测试方案,降低了采用DSL实现测试处理的技术难度。The restful API testing method provided by the embodiment of the present invention converts the DSL sentence fragments concerned by the business rules of restful API testing into graphical blocks according to the Blockly specification, which is convenient for users to drag and drop the graphical blocks with a predetermined editor for combination and translation. The function forms a DSL script to test the restful API. The testing of restful APIs can be completed through graphical drag and drop, which is simple and intuitive, and forms a graphical auxiliary test solution for DSL, which reduces the technical difficulty of using DSL to implement test processing.
本发明实施方式还提供一种计算机设备。如图5所示,该计算机设备500可包括处理器521、输入/输出(I/O)设备522、存储器523、数据库524和显示器525。Embodiments of the present invention also provide a computer device. As shown in FIG. 5, the computer device 500 may include a processor 521, an input / output (I / O) device 522, a memory 523, a database 524, and a display 525.
处理器521可为一个或多个已知的处理装置,其可以加载存储器523中存储的用于实现上述方法的计算机指令以使计算机设备执行上述的方法。The processor 521 may be one or more known processing devices, which may load computer instructions stored in the memory 523 for implementing the above method to cause the computer device to perform the above method.
I/O设备522可被配置以允许数据被接收和/或传输。I/O设备522可包括一个或多个数字和/或模拟通信设备,其允许计算机设备500与其他机器和设备通信。计算机设备500还可包括一个或多个数据库524,或通过网络与一个或多个 数据库524通信连接。例如,数据库524可以是适于进行上述所描述的方法的关联数据处理的任意合适的数据库。The I / O device 522 may be configured to allow data to be received and / or transmitted. I / O device 522 may include one or more digital and / or analog communication devices that allow computer device 500 to communicate with other machines and devices. The computer device 500 may also include one or more databases 524, or be communicatively connected to the one or more databases 524 through a network. For example, the database 524 may be any suitable database suitable for the associated data processing of the method described above.
显示器525可包括显示屏,其可用于显示输入/输出设备522的输出结果以及数据处理过程中的中间结果。The display 525 may include a display screen, which may be used to display the output results of the input / output device 522 and intermediate results during data processing.
本发明还提供一种计算机可读的存储介质,其上存储有计算机指令,所述计算机指令被处理器执行时实现上面所描述的用于应用程序接口API测试的方法。The present invention also provides a computer-readable storage medium on which computer instructions are stored. When the computer instructions are executed by a processor, the above-described method for application program interface API testing is implemented.
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到本发明可借助软件结合硬件平台的方式来实现。基于这样的理解,本发明的技术方案对背景技术做出贡献的全部或者部分可以以软件产品的形式体现出来,该计算机软件产品可以存储在存储介质中,如ROM/RAM、磁碟、光盘等,包括若干指令用以使得一台计算机设备(可以是个人计算机,服务器,智能手机或者网络设备等)执行本发明各个实施例或者实施例的某些部分所述的方法。Through the description of the above embodiments, those skilled in the art can clearly understand that the present invention can be implemented by means of software in combination with a hardware platform. Based on this understanding, all or part of the technical solutions of the present invention contributing to the background technology can be embodied in the form of software products, and the computer software products can be stored in storage media, such as ROM / RAM, magnetic disks, optical disks, etc. , Including several instructions to enable a computer device (which may be a personal computer, server, smart phone, or network device, etc.) to perform the methods described in various embodiments of the present invention or some parts of the embodiments.
本发明说明书中使用的术语和措辞仅仅为了举例说明,并不意味构成限定。本领域技术人员应当理解,在不脱离所公开的实施方式的基本原理的前提下,对上述实施方式中的各细节可进行各种变化。因此,本发明的范围只由权利要求确定,在权利要求中,除非另有说明,所有的术语应按最宽泛合理的意思进行理解。The terms and expressions used in the description of the present invention are for illustration only and are not meant to be limiting. Those skilled in the art should understand that various details can be changed in the above embodiments without departing from the basic principles of the disclosed embodiments. Therefore, the scope of the present invention is determined only by the claims. In the claims, unless otherwise stated, all terms should be understood in the broadest reasonable sense.

Claims (12)

  1. 一种用于应用程序接口API测试的数据处理方法,其特征在于,包括:A data processing method for application program interface API testing, which includes:
    根据cucumber规范确定关注restful API测试领域的业务规则的领域专用语言DSL语句片段;According to the cucumber specification, determine the domain specific language DSL sentence fragments that focus on the business rules of the restful API testing field;
    根据Blockly规范将所述DSL语句片段转换为图形化的块Block,其中,所述Block配置为在预定编辑器中能够被拖拽并且彼此组合。The DSL sentence fragment is converted into a graphical block Block according to the Blockly specification, wherein the Block is configured to be draggable and combined with each other in a predetermined editor.
  2. 根据权利要求1所述的方法,其特征在于,所述块Block包括用于拖拽的元素的可见文本部分和可输入部分,以及上下左右衔接设置。The method according to claim 1, wherein the block includes a visible text portion and an inputable portion for dragging elements, and a connection setting of up, down, left, and right.
  3. 根据权利要求1所述的方法,其特征在于,所述restful API测试领域的业务规则包括多个方面,一个方面由对应的DSL语句片段关注。The method according to claim 1, wherein the business rules in the restful API testing field include multiple aspects, one of which is concerned by the corresponding DSL sentence segment.
  4. 根据权利要求3所述的方法,其特征在于,所述多个方面包括下述两个以上方面的组合:The method of claim 3, wherein the multiple aspects include a combination of the following two or more aspects:
    指定待测试的restful API的超文本传输协议HTTP请求的方法;Specify the method of restful API hypertext transfer protocol HTTP request to be tested;
    指定HTTP请求的统一资源定位符URL;Specify the uniform resource locator URL for HTTP requests;
    指定请求的参数;Specify the requested parameters;
    指定请求负载;Specify the request load;
    指定请求头信息;Specify the request header information;
    校验restful API被调用之后的HTTP请求的响应码;Verify the response code of the HTTP request after the restful API is called;
    校验restful API被调用之后的HTTP请求的响应头;Verify the response header of the HTTP request after the restful API is called;
    校验restful API被调用之后的HTTP请求的响应负载。Verify the response load of the HTTP request after the restful API is called.
  5. 根据权利要求1所述的方法,其特征在于,所述Restful API测试领域的业务规则包括多个关联的Restful API测试的业务规则,所述多个关联的restful API测试的业务规则包括:The method according to claim 1, wherein the business rules in the field of Restful API testing include business rules of multiple associated Restful API tests, and the business rules of the plurality of associated restful API tests include:
    指定待测试的restful API的超文本传输协议HTTP请求的方法;Specify the method of restful API hypertext transfer protocol HTTP request to be tested;
    指定HTTP请求的统一资源定位符URL;Specify the uniform resource locator URL for HTTP requests;
    指定请求的参数;Specify the requested parameters;
    指定请求负载;Specify the request load;
    指定请求头信息;Specify the request header information;
    校验restful API被调用之后的HTTP请求的响应码;Verify the response code of the HTTP request after the restful API is called;
    校验restful API被调用之后的HTTP请求的响应头;Verify the response header of the HTTP request after the restful API is called;
    校验restful API被调用之后的HTTP请求的响应负载;Verify the response load of the HTTP request after the restful API is called;
    获取restful API被调用之后的响应体的部分数据;Get part of the response body data after the restful API is called;
    设置restful API被调用之后的响应体的部分数据以用于与所述restful API关联的下一个restful API的测试。Set part of the data of the response body after the restful API is called for testing of the next restful API associated with the restful API.
  6. 根据权利要求3所述的方法,其特征在于,所述DSL语句片段为DSL的动作Action行。The method according to claim 3, wherein the DSL sentence segment is a DSL Action line.
  7. 根据权利要求3所述的方法,其特征在于,所述根据cucumber规范确定关注restful API测试领域的业务规则的领域专用语言DSL语句片段包括:The method according to claim 3, characterized in that the domain-specific language DSL sentence segment determined according to the cucumber specification to focus on business rules in the field of restful API testing includes:
    根据cucumber规范确定关注restful API测试领域的业务规则的多个方面对应的多个DSL语句片段。According to the cucumber specification, determine multiple DSL sentence fragments corresponding to multiple aspects of business rules in the field of restful API testing.
  8. 根据权利要求6所述的方法,其特征在于,所述根据Blockly规范确定所述DSL语句片段对应的图形化的块Block包括:The method according to claim 6, wherein the determining of the graphical block corresponding to the DSL sentence segment according to the Blockly specification includes:
    根据Blockly规范将一个DSL的动作Action行转换为一个图形化的块Block。According to the Blockly specification, a DSL Action line is converted into a graphical block.
  9. 根据权利要求2所述的方法,其特征在于,所述图形化的块Block配置为在所述预定编辑器的画布界面根据该块Block的上下左右衔接设置进行组合。The method according to claim 2, wherein the graphical block is configured to be combined on the canvas interface of the predetermined editor according to the connection settings of the up, down, left, and right of the block.
  10. 根据权利要求9所述的方法,其特征在于,所述图形化的块Block配置为在被拖拽到所述画布界面时将所述可输入部分呈现在交互界面上,接收用户的输入。The method according to claim 9, wherein the graphical block is configured to present the inputtable portion on the interactive interface when being dragged to the canvas interface and receive user input.
  11. 一种计算机设备,其包括:A computer device, including:
    处理器;和Processor; and
    存储器,用于存储计算机指令,所述计算机指令适于被所述处理器加载以执行权利要求1至10的任何一项所述的方法。A memory for storing computer instructions adapted to be loaded by the processor to perform the method of any one of claims 1 to 10.
  12. 一种计算机可读介质,其存储有计算机可读指令,所述指令适于被处理器加载以执行权利要求1至10的任何一项所述的方法。A computer-readable medium storing computer-readable instructions adapted to be loaded by a processor to perform the method of any one of claims 1 to 10.
PCT/CN2019/103993 2018-11-02 2019-09-02 Method and device for testing application program interface (api) WO2020088087A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201811312930.5A CN111143189A (en) 2018-11-02 2018-11-02 Method and apparatus for application program interface API testing
CN201811312930.5 2018-11-02

Publications (1)

Publication Number Publication Date
WO2020088087A1 true WO2020088087A1 (en) 2020-05-07

Family

ID=70463444

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2019/103993 WO2020088087A1 (en) 2018-11-02 2019-09-02 Method and device for testing application program interface (api)

Country Status (2)

Country Link
CN (1) CN111143189A (en)
WO (1) WO2020088087A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20220279020A1 (en) * 2021-02-26 2022-09-01 Ncr Corporation Application programming interface (api) domain specific language
US12021899B2 (en) * 2021-02-26 2024-06-25 Ncr Voyix Corporation Application programming interface (API) domain specific language

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102222039A (en) * 2010-04-19 2011-10-19 微软公司 Using a DSL for calling APIs to test software
US8745641B1 (en) * 2011-07-14 2014-06-03 Google Inc. Automatic verification and anomaly detection in a representational state transfer (REST) application programming interface
CN106254423A (en) * 2016-07-20 2016-12-21 普元信息技术股份有限公司 The method realizing Restful service release quickly based on micro services framework
CN107562817A (en) * 2017-08-16 2018-01-09 北京深数科技有限公司 One B shareB quantifies method, apparatus, equipment and the storage medium of transaction

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9009670B2 (en) * 2011-07-08 2015-04-14 Microsoft Technology Licensing, Llc Automated testing of application program interfaces using genetic algorithms
CN106201846B (en) * 2016-06-30 2019-07-12 微梦创科网络科技(中国)有限公司 Method for monitoring performance and device in automatic test
CN106326115A (en) * 2016-08-17 2017-01-11 北京奇虎科技有限公司 Method, device and system for testing application programming interfaces (APIs)

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102222039A (en) * 2010-04-19 2011-10-19 微软公司 Using a DSL for calling APIs to test software
US8745641B1 (en) * 2011-07-14 2014-06-03 Google Inc. Automatic verification and anomaly detection in a representational state transfer (REST) application programming interface
CN106254423A (en) * 2016-07-20 2016-12-21 普元信息技术股份有限公司 The method realizing Restful service release quickly based on micro services framework
CN107562817A (en) * 2017-08-16 2018-01-09 北京深数科技有限公司 One B shareB quantifies method, apparatus, equipment and the storage medium of transaction

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20220279020A1 (en) * 2021-02-26 2022-09-01 Ncr Corporation Application programming interface (api) domain specific language
US12021899B2 (en) * 2021-02-26 2024-06-25 Ncr Voyix Corporation Application programming interface (API) domain specific language

Also Published As

Publication number Publication date
CN111143189A (en) 2020-05-12

Similar Documents

Publication Publication Date Title
US9767008B2 (en) Automatic test case generation
CN102597993B (en) Managing application state information by means of uniform resource identifier (URI)
US9195572B2 (en) Systems and methods for identifying user interface (UI) elements
US20200401382A1 (en) Autonomously delivering software features
US11327964B2 (en) Integration query builder framework
US11775262B2 (en) Multi-technology visual integrated data management and analytics development and deployment environment
US20150100946A1 (en) Using mock data to validate applications
US8166347B2 (en) Automatic testing for dynamic applications
US20060101403A1 (en) Method and system to automate software testing using sniffer side and browser side recording and a toolbar interface
WO2012014284A1 (en) Method of generating test scenario, test scenario generating system and test scenario generating program
US8311794B2 (en) Testing executable logic
US9703762B1 (en) Method and system for processing a style sheet defining a reusable theme for a web page and specifying a relative location of content
CN102567400B (en) Method for realizing Web visit and Web server
US11860963B2 (en) Enhanced methods and systems for automated skill generation and management
US10705949B2 (en) Evaluation of library test suites using mutation testing
KR20210038971A (en) Curriculum package development method and device, system, device and storage medium
US20210334149A1 (en) Api adapter creation device, api adapter creation method, and api adapter creation program
US9697105B2 (en) Composable test automation framework
CN113778897B (en) Automatic test method, device and equipment for interface and storage medium
JP6723976B2 (en) Test execution device and program
Grigera et al. Live versioning of web applications through refactoring
WO2020088087A1 (en) Method and device for testing application program interface (api)
US20160063119A1 (en) Test data reservation system
CN111143186A (en) Method and apparatus for application program interface API testing
US10235146B1 (en) Method and mechanism for composite data service generation and implementation

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 19879379

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 19879379

Country of ref document: EP

Kind code of ref document: A1