CN111694733A - API (application programming interface) testing method and device for software development kit SDK (software development kit) - Google Patents

API (application programming interface) testing method and device for software development kit SDK (software development kit) Download PDF

Info

Publication number
CN111694733A
CN111694733A CN202010439124.5A CN202010439124A CN111694733A CN 111694733 A CN111694733 A CN 111694733A CN 202010439124 A CN202010439124 A CN 202010439124A CN 111694733 A CN111694733 A CN 111694733A
Authority
CN
China
Prior art keywords
test
api
default
parameter
page
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010439124.5A
Other languages
Chinese (zh)
Inventor
况众文
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Wuba Co Ltd
Original Assignee
Wuba Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Wuba Co Ltd filed Critical Wuba Co Ltd
Priority to CN202010439124.5A priority Critical patent/CN111694733A/en
Publication of CN111694733A publication Critical patent/CN111694733A/en
Pending legal-status Critical Current

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/3684Test management for test design, e.g. generating new test cases
    • 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

Abstract

The application provides an API test method and a test device for a Software Development Kit (SDK), wherein the SDK comprises a plurality of Application Program Interfaces (APIs), and the method comprises the following steps: reading test list data of an API in the SDK to be tested from a target configuration file of the terminal; displaying a test list according to the read test list data; receiving a first trigger instruction of an edit control in a default test page of a target API in a plurality of APIs; responding to the first trigger instruction, and displaying a test editing page of the target API; receiving an edit instruction of a first test parameter in a test edit page of a target API; changing the parameter value of the first test parameter from the default test parameter value to the first test parameter value in response to the edit instruction; and testing the target API by using the parameter values of the test parameters contained in the test editing page of the target API. The test workload is small, a plurality of APIs contained in the SDK can be verified quickly, the operation process is simple, and convenience and quickness are achieved.

Description

API (application programming interface) testing method and device for software development kit SDK (software development kit)
Technical Field
The present application relates to the field of communications technologies, and in particular, to an API testing method and an API testing apparatus for a software development kit SDK.
Background
In order to facilitate the Development of new applications, Software Development Kit (SDK) can be extracted from Applications (APPs) that have already been developed, and the purpose of extracting the SDK is to enable other APPs to quickly access required functions. Since the SDK is extracted from the APP, the SDK also needs to be tied back to the APP after the extraction is completed.
The SDK extracted from the APP generally belongs to the underlying tool of the APP, and if a problem occurs in the SDK, a great influence may be exerted on the upper-layer service of the APP. Therefore, after the SDK is connected back to the APP, a comprehensive test is also required to test all Application Programming Interfaces (APIs) of the SDK. At present, comprehensive tests mainly comprise two items of test contents, one item is to carry out coverage test on the whole business of the APP, and the other item is to preset various complex scenes through the SDK demo to carry out the test. However, the two tests have large repeated workload and complicated test process.
Disclosure of Invention
The application provides an API testing method and testing device for a Software Development Kit (SDK) to solve the problems that in the prior art, when testing the API of the SDK, the repeated workload is large, and the testing process is complicated.
In a first aspect, the present invention provides a method for testing APIs of an SDK, the SDK including a plurality of application program interfaces APIs, the method including:
reading test list data of an API in the SDK to be tested from a target configuration file of the terminal;
displaying a test list according to the read test list data, wherein the test list comprises a default test page of each API in a plurality of APIs, and the default test page of each API comprises a plurality of default test parameters corresponding to the API and a plurality of default test parameter values corresponding to the default test parameters one by one;
receiving a first trigger instruction of an edit control in a default test page of a target API in the plurality of APIs;
responding to the first trigger instruction, and displaying a test editing page of the target API, wherein the test editing page of the target API comprises a plurality of default test parameters corresponding to the target API;
receiving an edit instruction of a first test parameter in a test edit page of the target API, wherein the first test parameter is one of a plurality of default test parameters corresponding to the target API;
changing the parameter value of the first test parameter from a default test parameter value to a first test parameter value in response to the edit instruction;
and testing the target API by using the parameter values of the test parameters contained in the test editing page of the target API.
Further, before the step of testing the target API using the parameter values of the test parameters included in the test edit page of the target API, the method further includes:
receiving a second trigger instruction of adding a control in the test editing page of the target API;
responding to the second trigger instruction, and adding a second test parameter in a test editing page of the target API;
and setting the parameter value of the second test parameter as a second test parameter value.
Further, before the step of testing the target API using the parameter values of the test parameters included in the test edit page of the target API, the method further includes:
receiving a third trigger instruction for a deletion control in the test editing page of the target API;
and in response to the third trigger instruction, deleting a third test parameter and a parameter value of the third test parameter in a test editing page of the target API, where the third test parameter is a default test parameter different from the first test parameter in a plurality of default test parameters corresponding to the target API.
Further, the default test parameters include a request mode configuration, a uniform resource locator url, and an execution mode configuration.
In a second aspect, the present invention further provides an API testing apparatus for a software development kit SDK, where the SDK includes a plurality of application program interfaces APIs, and the API testing apparatus for the software development kit SDK includes:
the reading module is used for reading the test list data of the API in the SDK to be tested from the target configuration file of the terminal;
the first display module is used for displaying a test list according to the read test list data, wherein the test list comprises a default test page of each API in a plurality of APIs, and the default test page of each API comprises a plurality of default test parameters corresponding to the API and a plurality of default test parameter values corresponding to the default test parameters one by one;
the first receiving module is used for receiving a first trigger instruction of an editing control in a default test page of a target API in the plurality of APIs;
the second display module is used for responding to the first trigger instruction and displaying a test editing page of the target API, wherein the test editing page of the target API comprises a plurality of default test parameters corresponding to the target API;
a second receiving module, configured to receive an edit instruction for a first test parameter in a test edit page of the target API, where the first test parameter is one of a plurality of default test parameters corresponding to the target API;
the changing module is used for responding to the editing instruction and changing the parameter value of the first test parameter from a default test parameter value to a first test parameter value;
and the test module is used for testing the target API by using the parameter values of the test parameters contained in the test editing page of the target API.
Further, the API testing apparatus of the software development kit SDK further includes:
the third receiving module is used for receiving a second trigger instruction of adding a control in the test editing page of the target API;
the adding module is used for responding to the second trigger instruction and adding a second test parameter in the test editing page of the target API;
and the setting module is used for setting the parameter value of the second test parameter as a second test parameter value.
Further, the API testing apparatus of the software development kit SDK further includes:
a fourth receiving module, configured to receive a third trigger instruction for a deletion control in the test editing page of the target API;
and a deleting module, configured to delete, in response to the third trigger instruction, a third test parameter and a parameter value of the third test parameter in a test edit page of the target API, where the third test parameter is a default test parameter different from the first test parameter in a plurality of default test parameters corresponding to the target API.
Further, the default test parameters include a request mode configuration, a uniform resource locator url, and an execution mode configuration.
In a third aspect, the present invention further provides an electronic device, including:
a memory for storing program instructions;
and the processor is used for calling and executing the program instructions in the memory so as to realize the API test method of the software development kit SDK.
In a fourth aspect, the present invention further provides a readable storage medium, in which a computer program is stored, and when at least one processor of an API testing apparatus of a software development kit SDK executes the computer program, the API testing apparatus of the software development kit SDK executes the API testing method of the software development kit SDK according to the first aspect.
According to the technical scheme, the software development kit SDK provided by the embodiment of the invention comprises a plurality of Application Program Interfaces (APIs), and the SDK reads test list data of the APIs in the SDK to be tested from a target configuration file of a terminal; displaying a test list according to the read test list data, wherein the test list comprises a default test page of each API in a plurality of APIs, and the default test page of each API comprises a plurality of default test parameters corresponding to the API and a plurality of default test parameter values corresponding to the default test parameters one by one; receiving a first trigger instruction of an edit control in a default test page of a target API in the plurality of APIs; responding to the first trigger instruction, and displaying a test editing page of the target API, wherein the test editing page of the target API comprises a plurality of default test parameters corresponding to the target API; receiving an edit instruction of a first test parameter in a test edit page of the target API, wherein the first test parameter is one of a plurality of default test parameters corresponding to the target API; changing the parameter value of the first test parameter from a default test parameter value to a first test parameter value in response to the edit instruction; and testing the target API by using the parameter values of the test parameters contained in the test editing page of the target API. In this way, an edit instruction may be received for a first test parameter within a test edit page of the target API, and then, in response to the edit instruction, a parameter value of the first test parameter may be changed from a default test parameter value to the first test parameter value. Next, the target API may be tested using parameter values of the test parameters contained within the test edit page of the target API. The test workload is small, a plurality of APIs contained in the SDK can be verified quickly, the operation process is simple, and convenience and quickness are achieved.
Drawings
In order to more clearly explain the technical solution of the present application, the drawings needed to be used in the embodiments will be briefly described below, and it is obvious to those skilled in the art that other drawings can be obtained according to the drawings without creative efforts.
FIG. 1 is a flowchart of an API testing method for a software development kit SDK according to the present invention;
FIG. 2 is a schematic diagram of a test list provided by the present invention;
FIG. 3 is a schematic diagram of a test edit page of a target API provided by the present invention;
FIG. 4 is a flow chart of another method for testing the API of the SDK according to the present invention;
FIG. 5 is a flow chart of another method for testing the API of the SDK according to the present invention;
FIG. 6 is a block diagram of an API testing apparatus of the SDK according to the present invention;
FIG. 7 is a block diagram of an API test apparatus for another software development kit SDK according to the present invention;
FIG. 8 is a block diagram of an API test apparatus for another software development kit SDK according to the present invention;
fig. 9 is a schematic diagram of a hardware structure of an electronic device according to the present invention.
Detailed Description
Reference will now be made in detail to embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following examples do not represent all embodiments consistent with the present application. But merely as exemplifications of systems and methods consistent with certain aspects of the application, as recited in the claims.
Referring to fig. 1, fig. 1 is a flowchart of an API testing method for a software development kit SDK provided by the present invention, where the SDK includes a plurality of application program interfaces APIs. As shown in fig. 1, the method comprises the following steps:
step 101, reading test list data of the API in the SDK to be tested from a target configuration file of the terminal.
In step 101, test list data of the API in the SDK to be tested may be read from a target configuration file of the terminal.
And 102, displaying a test list according to the read test list data, wherein the test list comprises a default test page of each API in a plurality of APIs, and the default test page of each API comprises a plurality of default test parameters corresponding to the API and a plurality of default test parameter values corresponding to the default test parameters one by one.
In step 102, a test list may be displayed according to the read test list data. The test list comprises a default test page of each API in the plurality of APIs, and the default test page of each API comprises a plurality of default test parameters corresponding to the API and a plurality of default test parameter values corresponding to the default test parameters one by one. Fig. 2 is a schematic diagram of a test list.
In fig. 2, the test list includes a default test page for each of four APIs, which are a "post with parameter asynchronous execution" API, a "file upload" API, a "haha" API, and a "file download" API, respectively.
For the API "post with parameter asynchronous execution" in SDK, the default test page of the API contains 4 default test parameters: "request mode configuration", "uniform resource locator url", "execution mode configuration", and "key 1". And the default test parameter value of the default test parameter is 'post' in the 'request mode configuration'; the default test parameter value of the default test parameter of 'url' is http:// app.58. com/api/search/default; the default test parameter value of the default test parameter of the execution mode configuration is 'no scheduling execution'; the default test parameter value of the default test parameter "key 1" is "value 1".
For the API "file upload" in SDK, the default test page of the API contains 4 default test parameters: "request mode configuration", "url", "execution mode configuration", and "upload file path". And the default test parameter value of the default test parameter is 'upload' by 'requesting mode configuration'; the default test parameter value of the default test parameter of 'url' is http:// txapp.58.com/stationmgr/uploadinfo pic; the default test parameter value of the default test parameter is 'synchronous execution'; the default test parameter value of the default test parameter of the 'uploading file path' is/storage/empty/0/Wuba NetworkSDK-case/test-case.
For the API "Hahaha" in SDK, the default test page of the API contains 3 default test parameters: "request mode configuration", "url", and "execution mode configuration". And the default test parameter value of the default test parameter is 'post' in the 'request mode configuration'; "url" the default test parameter value for this default test parameter is "black warrior"; the default test parameter value of the "execution mode configuration" default test parameter is "synchronous execution".
For the API "file download" in SDK, the default test page of the API contains 2 default test parameters: "request mode configuration" and "url". And the default test parameter value of the default test parameter of the 'configuration in a request mode' is 'download'; the default test parameter value for "url" this default test parameter is "http:// img04. sogouctn. com/app/a/100520021".
Step 103, receiving a first trigger instruction for an edit control in a default test page of a target API in the plurality of APIs.
In step 103, a first triggering instruction for an edit control in a default test page of a target API of the plurality of APIs may be received. For example, in fig. 2, a click operation on an edit control in a default test page of a "haha" API in the four APIs may be received, that is, a first trigger instruction for the edit control in the default test page of the "haha" API in the four APIs may be received.
And 104, responding to the first trigger instruction, and displaying a test editing page of the target API, wherein the test editing page of the target API comprises a plurality of default test parameters corresponding to the target API.
In step 104, in response to the received first trigger instruction, a test edit page of the target API may be displayed. The test edit page of the target API may include a plurality of default test parameters corresponding to the target API. For example, a test edit page of the "haha" API may be displayed. Wherein, the test edit page of the 'haha' API may include 3 default test parameters corresponding to the 'haha' API: "request mode configuration", "url", and "execution mode configuration". Fig. 3 is a schematic diagram of a test edit page of a target API.
And 105, receiving an edit instruction of a first test parameter in a test edit page of the target API, where the first test parameter is one of a plurality of default test parameters corresponding to the target API.
In step 105, an edit instruction may be received for a first test parameter within a test edit page of a target API. The first test parameter is one of a plurality of default test parameters corresponding to the target API. For example, an edit instruction may be received for a first test parameter within a test edit page of a "haha" API. The first test parameter is one of 3 default test parameters corresponding to the 'haha' API.
And 106, responding to the editing instruction, and changing the parameter value of the first test parameter from a default test parameter value to a first test parameter value.
In step 106, in response to the received edit instruction, the parameter value of the first test parameter may be changed from the default test parameter value to the first test parameter value.
And 107, testing the target API by using the parameter values of the test parameters contained in the test editing page of the target API.
In step 107, the target API may be tested using parameter values of the test parameters contained within the test edit page of the target API. For example, the "haha" API may be tested using parameter values of test parameters contained within a test edit page of the "haha" API.
It should be noted that, in the prior art, when testing the API of the SDK, one item is to perform coverage test on the entire service of the APP, and the other item is to preset various complex scenarios through the SDK demo for test. However, the two tests have large repeated workload and complicated test process.
In the present application, an edit instruction for a first test parameter in a test edit page of a target API may be received, and then, in response to the edit instruction, a parameter value of the first test parameter may be changed from a default test parameter value to the first test parameter value. Next, the target API may be tested using parameter values of the test parameters contained within the test edit page of the target API. The test workload is small, a plurality of APIs contained in the SDK can be verified quickly, the operation process is simple, and convenience and quickness are achieved.
According to the technical scheme, the SDK comprises a plurality of Application Program Interfaces (APIs), and the test list data of the APIs in the SDK to be tested are read from the target configuration file of the terminal; displaying a test list according to the read test list data, wherein the test list comprises a default test page of each API in a plurality of APIs, and the default test page of each API comprises a plurality of default test parameters corresponding to the API and a plurality of default test parameter values corresponding to the default test parameters one by one; receiving a first trigger instruction of an edit control in a default test page of a target API in the plurality of APIs; responding to the first trigger instruction, and displaying a test editing page of the target API, wherein the test editing page of the target API comprises a plurality of default test parameters corresponding to the target API; receiving an edit instruction of a first test parameter in a test edit page of the target API, wherein the first test parameter is one of a plurality of default test parameters corresponding to the target API; changing the parameter value of the first test parameter from a default test parameter value to a first test parameter value in response to the edit instruction; and testing the target API by using the parameter values of the test parameters contained in the test editing page of the target API. In this way, an edit instruction may be received for a first test parameter within a test edit page of the target API, and then, in response to the edit instruction, a parameter value of the first test parameter may be changed from a default test parameter value to the first test parameter value. Next, the target API may be tested using parameter values of the test parameters contained within the test edit page of the target API. The test workload is small, a plurality of APIs contained in the SDK can be verified quickly, the operation process is simple, and convenience and quickness are achieved.
Referring to fig. 4, fig. 4 is a flowchart of an API testing method for an SDK according to another software development kit provided in the present invention, where the SDK includes a plurality of Application Program Interfaces (APIs). As shown in fig. 4, the method comprises the following steps:
step 401, reading test list data of the API in the SDK to be tested from the target configuration file of the terminal.
In step 401, test list data of the API in the SDK to be tested may be read from a target configuration file of the terminal.
Step 402, displaying a test list according to the read test list data, wherein the test list includes a default test page of each API in the plurality of APIs, and the default test page of each API includes a plurality of default test parameters corresponding to the API and a plurality of default test parameter values corresponding to the plurality of default test parameters one to one.
In step 402, a test list may be displayed based on the read test list data. The test list comprises a default test page of each API in the plurality of APIs, and the default test page of each API comprises a plurality of default test parameters corresponding to the API and a plurality of default test parameter values corresponding to the default test parameters one by one.
Still taking fig. 2 as an example, the test list includes a default test page of each of four APIs, which are a "post with reference asynchronous execution" API, a "file upload" API, a "haha" API, and a "file download" API, respectively.
For the API "post with parameter asynchronous execution" in SDK, the default test page of the API contains 4 default test parameters: "request mode configuration", "uniform resource locator url", "execution mode configuration", and "key 1". And the default test parameter value of the default test parameter is 'post' in the 'request mode configuration'; the default test parameter value of the default test parameter of 'url' is http:// app.58. com/api/search/default; the default test parameter value of the default test parameter of the execution mode configuration is 'no scheduling execution'; the default test parameter value of the default test parameter "key 1" is "value 1".
For the API "file upload" in SDK, the default test page of the API contains 4 default test parameters: "request mode configuration", "url", "execution mode configuration", and "upload file path". And the default test parameter value of the default test parameter is 'upload' by 'requesting mode configuration'; the default test parameter value of the default test parameter of 'url' is http:// txapp.58.com/stationmgr/uploadinfo pic; the default test parameter value of the default test parameter is 'synchronous execution'; the default test parameter value of the default test parameter of the 'uploading file path' is/storage/empty/0/Wuba NetworkSDK-case/test-case.
For the API "Hahaha" in SDK, the default test page of the API contains 3 default test parameters: "request mode configuration", "url", and "execution mode configuration". And the default test parameter value of the default test parameter is 'post' in the 'request mode configuration'; "url" the default test parameter value for this default test parameter is "black warrior"; the default test parameter value of the "execution mode configuration" default test parameter is "synchronous execution".
For the API "file download" in SDK, the default test page of the API contains 2 default test parameters: "request mode configuration" and "url". And the default test parameter value of the default test parameter of the 'configuration in a request mode' is 'download'; the default test parameter value for "url" this default test parameter is "http:// img04. sogouctn. com/app/a/100520021".
Optionally, the default test parameters include a request mode configuration, a uniform resource locator url, and an execution mode configuration.
It should be noted that the default test parameters corresponding to a certain API in the SDK may include a request mode configuration, a uniform resource locator url, and an execution mode configuration. For example, as mentioned above, as shown in fig. 2, for the API "haha" in the SDK, the API corresponds to 3 default test parameters: "request mode configuration", "url", and "execution mode configuration".
Step 403, receiving a first trigger instruction for an edit control in a default test page of a target API in the plurality of APIs.
In step 403, a first triggering instruction for an edit control in a default test page of a target API of the plurality of APIs may be received. For example, in fig. 2, a click operation on an edit control in a default test page of a "haha" API in the four APIs may be received, that is, a first trigger instruction for the edit control in the default test page of the "haha" API in the four APIs may be received.
Step 404, responding to the first trigger instruction, and displaying a test editing page of the target API, where the test editing page of the target API includes a plurality of default test parameters corresponding to the target API.
In step 404, in response to the received first trigger instruction, a test edit page of the target API may be displayed. The test edit page of the target API may include a plurality of default test parameters corresponding to the target API. For example, a test edit page of the "haha" API may be displayed. Wherein, the test edit page of the 'haha' API may include 3 default test parameters corresponding to the 'haha' API: "request mode configuration", "url", and "execution mode configuration". Still taking fig. 3 as an example, as shown in fig. 3, a schematic diagram of a test edit page of a target API is shown.
Step 405, receiving an edit instruction for a first test parameter in a test edit page of the target API, where the first test parameter is one of a plurality of default test parameters corresponding to the target API.
In step 405, an edit instruction may be received for a first test parameter within a test edit page of a target API. The first test parameter is one of a plurality of default test parameters corresponding to the target API. For example, an edit instruction may be received for a first test parameter within a test edit page of a "haha" API. The first test parameter is one of 3 default test parameters corresponding to the 'haha' API.
And 406, in response to the edit instruction, changing the parameter value of the first test parameter from the default test parameter value to the first test parameter value.
In step 406, in response to the received edit instruction, the parameter value of the first test parameter may be changed from the default test parameter value to the first test parameter value.
Step 407, receiving a second trigger instruction for adding a control in the test editing page of the target API.
In step 407, a second trigger instruction to add a control in the test edit page of the target API may also be received. For example, as shown in fig. 3, a click operation on an add control in the test edit page of the "haha" API may also be received, that is, a second trigger instruction for an add control in the test edit page of the "haha" API may be received.
And step 408, responding to the second trigger instruction, and adding a second test parameter in the test editing page of the target API.
In step 408, in response to the received second trigger instruction, a second test parameter may be added in the test edit page of the target API. For example, a second test parameter may be added within the test edit page of the "haha" API.
And 409, setting the parameter value of the second test parameter as a second test parameter value.
In step 409, the parameter value of the second test parameter may be set to the second test parameter value. That is, the parameter value of the second test parameter added in the test edit page of the haha API may be set as the second test parameter value.
Step 4010, using parameter values of the test parameters included in the test edit page of the target API, to test the target API.
In step 4010, the target API may be tested using parameter values of the test parameters included in the test edit page of the target API. For example, the "haha" API may be tested using parameter values of test parameters contained within a test edit page of the "haha" API. In this way, the user can add the second test parameter in the test editing page shown in fig. 3 according to the needs of the user, and set the parameter value of the second test parameter as the second test parameter value. Furthermore, the API testing apparatus of the SDK can test the target API using the parameter values of the test parameters included in the test edit page of the target API. The operation process is simple, convenient and fast.
According to the technical scheme, the SDK comprises a plurality of Application Program Interfaces (APIs) and the API testing method for the SDK provided by the embodiment of the invention is used for testing the APIs of the SDK. An edit instruction may be received for a first test parameter within a test edit page of the target API, and then, in response to the edit instruction, a parameter value of the first test parameter may be changed from a default test parameter value to the first test parameter value. Furthermore, the user can add a second test parameter in the test editing page of the target API according to the own needs, and set the parameter value of the second test parameter as the second test parameter value. Next, the target API may be tested using parameter values of the test parameters contained within the test edit page of the target API. The test workload is small, a plurality of APIs contained in the SDK can be verified quickly, the operation process is simple, and convenience and quickness are achieved.
Referring to fig. 5, fig. 5 is a flowchart of an API testing method for an SDK according to another software development kit provided in the present invention, where the SDK includes a plurality of Application Program Interfaces (APIs). As shown in fig. 5, the method comprises the following steps:
step 501, reading test list data of the API in the SDK to be tested from a target configuration file of the terminal.
In step 501, test list data of the API in the SDK to be tested may be read from a target configuration file of the terminal.
Step 502, displaying a test list according to the read test list data, wherein the test list includes a default test page of each API in the plurality of APIs, and the default test page of each API includes a plurality of default test parameters corresponding to the API and a plurality of default test parameter values corresponding to the plurality of default test parameters one to one.
In step 502, a test list may be displayed according to the read test list data. The test list comprises a default test page of each API in the plurality of APIs, and the default test page of each API comprises a plurality of default test parameters corresponding to the API and a plurality of default test parameter values corresponding to the default test parameters one by one.
Still taking fig. 2 as an example, in fig. 2, the test list includes a default test page of each of four APIs, which are a "post with argument asynchronous execution" API, a "file upload" API, a "haha" API, and a "file download" API, respectively.
For the API "post with parameter asynchronous execution" in SDK, the default test page of the API contains 4 default test parameters: "request mode configuration", "uniform resource locator url", "execution mode configuration", and "key 1". And the default test parameter value of the default test parameter is 'post' in the 'request mode configuration'; the default test parameter value of the default test parameter of 'url' is http:// app.58. com/api/search/default; the default test parameter value of the default test parameter of the execution mode configuration is 'no scheduling execution'; the default test parameter value of the default test parameter "key 1" is "value 1".
For the API "file upload" in SDK, the default test page of the API contains 4 default test parameters: "request mode configuration", "url", "execution mode configuration", and "upload file path". And the default test parameter value of the default test parameter is 'upload' by 'requesting mode configuration'; the default test parameter value of the default test parameter of 'url' is http:// txapp.58.com/stationmgr/uploadinfo pic; the default test parameter value of the default test parameter is 'synchronous execution'; the default test parameter value of the default test parameter of the 'uploading file path' is/storage/empty/0/Wuba NetworkSDK-case/test-case.
For the API "Hahaha" in SDK, the default test page of the API contains 3 default test parameters: "request mode configuration", "url", and "execution mode configuration". And the default test parameter value of the default test parameter is 'post' in the 'request mode configuration'; "url" the default test parameter value for this default test parameter is "black warrior"; the default test parameter value of the "execution mode configuration" default test parameter is "synchronous execution".
For the API "file download" in SDK, the default test page of the API contains 2 default test parameters: "request mode configuration" and "url". And the default test parameter value of the default test parameter of the 'configuration in a request mode' is 'download'; the default test parameter value for "url" this default test parameter is "http:// img04. sogouctn. com/app/a/100520021".
Optionally, the default test parameters include a request mode configuration, a uniform resource locator url, and an execution mode configuration.
It should be noted that the default test parameters corresponding to a certain API in the SDK may include a request mode configuration, a uniform resource locator url, and an execution mode configuration. For example, as mentioned above, as shown in fig. 2, for the API "haha" in the SDK, the API corresponds to 3 default test parameters: "request mode configuration", "url", and "execution mode configuration".
Step 503, receiving a first trigger instruction for an edit control in a default test page of a target API in the plurality of APIs.
In step 503, a first triggering instruction for an edit control in a default test page of a target API of the plurality of APIs may be received. For example, in fig. 2, a click operation on an edit control in a default test page of a "haha" API in the four APIs may be received, that is, a first trigger instruction for the edit control in the default test page of the "haha" API in the four APIs may be received.
Step 504, responding to the first trigger instruction, and displaying a test editing page of the target API, where the test editing page of the target API includes a plurality of default test parameters corresponding to the target API.
In step 504, in response to the received first trigger instruction, a test edit page of the target API may be displayed. The test edit page of the target API may include a plurality of default test parameters corresponding to the target API. For example, a test edit page of the "haha" API may be displayed. Wherein, the test edit page of the 'haha' API may include 3 default test parameters corresponding to the 'haha' API: "request mode configuration", "url", and "execution mode configuration". Still taking fig. 3 as an example, as shown in fig. 3, a schematic diagram of a test edit page of a target API is shown.
And 505, receiving an edit instruction of a first test parameter in a test edit page of the target API, where the first test parameter is one of a plurality of default test parameters corresponding to the target API.
In step 505, an edit instruction may be received for a first test parameter within a test edit page of a target API. The first test parameter is one of a plurality of default test parameters corresponding to the target API. For example, an edit instruction may be received for a first test parameter within a test edit page of a "haha" API. The first test parameter is one of 3 default test parameters corresponding to the 'haha' API.
Step 506, in response to the edit instruction, changing the parameter value of the first test parameter from the default test parameter value to the first test parameter value.
In step 506, in response to the received edit instruction, the parameter value of the first test parameter may be changed from the default test parameter value to the first test parameter value.
And 507, receiving a third trigger instruction for the deletion control in the test editing page of the target API.
In step 507, a third trigger instruction for a delete control in the test edit page of the target API may also be received. For example, as shown in fig. 3, a click operation on a delete control in the test edit page of the "haha" API may also be received, that is, a third trigger instruction for the delete control in the test edit page of the "haha" API may be received.
Step 508, in response to the third trigger instruction, deleting a third test parameter and a parameter value of the third test parameter in the test edit page of the target API, where the third test parameter is a default test parameter different from the first test parameter in the plurality of default test parameters corresponding to the target API.
In step 508, in response to the received third trigger instruction, the third test parameter and the parameter value of the third test parameter in the test edit page of the target API may be deleted. The third test parameter is a default test parameter different from the first test parameter in the plurality of default test parameters corresponding to the target API. For example, the third test parameter and the parameter value of the third test parameter within the test edit page of the "haha" API may be deleted. The third test parameter is a default test parameter different from the first test parameter in 3 default test parameters corresponding to the haha API.
Step 509, using the parameter values of the test parameters contained in the test edit page of the target API to test the target API.
In step 509, the target API may be tested using parameter values of the test parameters contained in the test edit page of the target API. For example, the "haha" API may be tested using parameter values of test parameters contained within a test edit page of the "haha" API. In this way, the user can delete the third test parameter and the parameter value of the third test parameter in the test edit page shown in fig. 3 according to the needs of the user. Furthermore, the API testing apparatus of the SDK can test the target API using the parameter values of the test parameters included in the test edit page of the target API. The operation process is simple, convenient and fast.
According to the technical scheme, the SDK comprises a plurality of Application Program Interfaces (APIs) and the API testing method for the SDK provided by the embodiment of the invention is used for testing the APIs of the SDK. An edit instruction may be received for a first test parameter within a test edit page of the target API, and then, in response to the edit instruction, a parameter value of the first test parameter may be changed from a default test parameter value to the first test parameter value. Furthermore, the user can delete the third test parameter and the parameter value of the third test parameter in the test edit page of the target API according to the needs of the user. Next, the target API may be tested using parameter values of the test parameters contained within the test edit page of the target API. The test workload is small, a plurality of APIs contained in the SDK can be verified quickly, the operation process is simple, and convenience and quickness are achieved.
Referring to fig. 6, fig. 6 is a structural diagram of an API testing apparatus of a software development kit SDK provided by the present invention, wherein the SDK includes a plurality of application program interfaces APIs. As shown in fig. 6, the API testing apparatus 600 of the software development kit SDK includes a reading module 601, a first display module 602, a first receiving module 603, a second display module 604, a second receiving module 605, a changing module 606, and a testing module 607, wherein:
a reading module 601, configured to read test list data of an API in an SDK to be tested from a target configuration file of a terminal;
a first display module 602, configured to display a test list according to the read test list data, where the test list includes a default test page of each API in a plurality of APIs, and the default test page of each API includes a plurality of default test parameters corresponding to the API and a plurality of default test parameter values corresponding to the plurality of default test parameters one to one;
a first receiving module 603, configured to receive a first trigger instruction for an edit control in a default test page of a target API in the multiple APIs;
a second display module 604, configured to display, in response to the first trigger instruction, a test editing page of the target API, where the test editing page of the target API includes a plurality of default test parameters corresponding to the target API;
a second receiving module 605, configured to receive an edit instruction of a first test parameter in a test edit page of the target API, where the first test parameter is one of a plurality of default test parameters corresponding to the target API;
a changing module 606, configured to change a parameter value of the first test parameter from a default test parameter value to a first test parameter value in response to the editing instruction;
the testing module 607 is configured to test the target API using the parameter values of the testing parameters included in the testing edit page of the target API.
Optionally, as shown in fig. 7, the API testing apparatus of the software development kit SDK further includes:
a third receiving module 608, configured to receive a second trigger instruction for adding a control in the test editing page of the target API;
an adding module 609, configured to add, in response to the second trigger instruction, a second test parameter in the test editing page of the target API;
a setting module 6010, configured to set a parameter value of the second test parameter as a second test parameter value.
Optionally, as shown in fig. 8, the API testing apparatus of the software development kit SDK further includes:
a fourth receiving module 6011, configured to receive a third trigger instruction for a delete control in the test editing page of the target API;
a deleting module 6012, configured to delete, in response to the third trigger instruction, a third test parameter in the test editing page of the target API and a parameter value of the third test parameter, where the third test parameter is a default test parameter different from the first test parameter in a plurality of default test parameters corresponding to the target API.
Optionally, the default test parameters include a request mode configuration, a uniform resource locator url, and an execution mode configuration.
The API testing apparatus 600 of the software development kit SDK can implement each process implemented by the API testing apparatus of the software development kit SDK in the method embodiments of fig. 1, fig. 4, and fig. 5, and is not described herein again to avoid repetition. And the API testing apparatus 600 of the software development kit SDK may implement receiving an edit instruction for the first test parameter in the test edit page of the target API, and then, in response to the edit instruction, may change the parameter value of the first test parameter from the default test parameter value to the first test parameter value. Next, the target API may be tested using parameter values of the test parameters contained within the test edit page of the target API. The test workload is small, a plurality of APIs contained in the SDK can be verified quickly, the operation process is simple, and convenience and quickness are achieved.
Fig. 9 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present invention. As shown in fig. 9, the electronic device includes:
a memory 901 for storing program instructions;
the processor 902 is configured to call and execute the program instructions in the memory to implement the API testing method of the software development kit SDK in the above embodiment. Reference may be made in particular to the description in relation to the preceding embodiments.
In this embodiment, the processor 902 and the memory 901 may be connected by a bus or other means. The processor may be a general-purpose processor, such as a central processing unit, a digital signal processor, an application specific integrated circuit, or one or more integrated circuits configured to implement embodiments of the present invention. The memory may include volatile memory, such as random access memory; the memory may also include non-volatile memory, such as read-only memory, flash memory, a hard disk, or a solid state disk.
An embodiment of the present invention further provides a readable storage medium, including: the readable storage medium stores therein a computer program that, when executed by at least one processor of the API testing apparatus of the software development kit SDK, the API testing apparatus of the software development kit SDK performs the API testing method of the software development kit SDK described in the above-described embodiments.
The readable storage medium may be a magnetic disk, an optical disk, a read-only memory (ROM) or a Random Access Memory (RAM).
Those skilled in the art will readily appreciate that the techniques of the embodiments of the present invention may be implemented as software plus a required general purpose hardware platform. Based on such understanding, the technical solutions in the embodiments of the present invention may be essentially or partially implemented in the form of a software product, which may be stored in a storage medium, such as ROM/RAM, magnetic disk, optical disk, etc., and includes several instructions for enabling a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the method according to the embodiments or some parts of the embodiments.
The same and similar parts in the various embodiments in this specification may be referred to each other. In particular, for the embodiments of the API testing apparatus, the electronic device and the readable storage medium of the software development kit SDK, since they are substantially similar to the embodiments of the method, the description is simple, and the relevant points can be referred to the description in the embodiments of the method.
The above-described embodiments of the present invention should not be construed as limiting the scope of the present invention.

Claims (10)

1. A method for testing APIs of an SDK, the SDK comprising a plurality of API, the method comprising:
reading test list data of an API in the SDK to be tested from a target configuration file of the terminal;
displaying a test list according to the read test list data, wherein the test list comprises a default test page of each API in a plurality of APIs, and the default test page of each API comprises a plurality of default test parameters corresponding to the API and a plurality of default test parameter values corresponding to the default test parameters one by one;
receiving a first trigger instruction of an edit control in a default test page of a target API in the plurality of APIs;
responding to the first trigger instruction, and displaying a test editing page of the target API, wherein the test editing page of the target API comprises a plurality of default test parameters corresponding to the target API;
receiving an edit instruction of a first test parameter in a test edit page of the target API, wherein the first test parameter is one of a plurality of default test parameters corresponding to the target API;
changing the parameter value of the first test parameter from a default test parameter value to a first test parameter value in response to the edit instruction;
and testing the target API by using the parameter values of the test parameters contained in the test editing page of the target API.
2. The method of claim 1, wherein prior to the step of testing the target API using parameter values of test parameters contained within the test edit page of the target API, the method further comprises:
receiving a second trigger instruction of adding a control in the test editing page of the target API;
responding to the second trigger instruction, and adding a second test parameter in a test editing page of the target API;
and setting the parameter value of the second test parameter as a second test parameter value.
3. The method of claim 1, wherein prior to the step of testing the target API using parameter values of test parameters contained within the test edit page of the target API, the method further comprises:
receiving a third trigger instruction for a deletion control in the test editing page of the target API;
and in response to the third trigger instruction, deleting a third test parameter and a parameter value of the third test parameter in a test editing page of the target API, where the third test parameter is a default test parameter different from the first test parameter in a plurality of default test parameters corresponding to the target API.
4. The method of any of claims 1-3, wherein the plurality of default test parameters includes a request mode configuration, a uniform resource locator url, and an execution mode configuration.
5. An API testing device of a Software Development Kit (SDK), wherein the SDK comprises a plurality of Application Program Interfaces (APIs), the API testing device of the SDK comprises:
the reading module is used for reading the test list data of the API in the SDK to be tested from the target configuration file of the terminal;
the first display module is used for displaying a test list according to the read test list data, wherein the test list comprises a default test page of each API in a plurality of APIs, and the default test page of each API comprises a plurality of default test parameters corresponding to the API and a plurality of default test parameter values corresponding to the default test parameters one by one;
the first receiving module is used for receiving a first trigger instruction of an editing control in a default test page of a target API in the plurality of APIs;
the second display module is used for responding to the first trigger instruction and displaying a test editing page of the target API, wherein the test editing page of the target API comprises a plurality of default test parameters corresponding to the target API;
a second receiving module, configured to receive an edit instruction for a first test parameter in a test edit page of the target API, where the first test parameter is one of a plurality of default test parameters corresponding to the target API;
the changing module is used for responding to the editing instruction and changing the parameter value of the first test parameter from a default test parameter value to a first test parameter value;
and the test module is used for testing the target API by using the parameter values of the test parameters contained in the test editing page of the target API.
6. The API testing apparatus of the software development kit SDK of claim 5, wherein the API testing apparatus of the software development kit SDK further comprises:
the third receiving module is used for receiving a second trigger instruction of adding a control in the test editing page of the target API;
the adding module is used for responding to the second trigger instruction and adding a second test parameter in the test editing page of the target API;
and the setting module is used for setting the parameter value of the second test parameter as a second test parameter value.
7. The API testing apparatus of the software development kit SDK of claim 5, wherein the API testing apparatus of the software development kit SDK further comprises:
a fourth receiving module, configured to receive a third trigger instruction for a deletion control in the test editing page of the target API;
and a deleting module, configured to delete, in response to the third trigger instruction, a third test parameter and a parameter value of the third test parameter in a test edit page of the target API, where the third test parameter is a default test parameter different from the first test parameter in a plurality of default test parameters corresponding to the target API.
8. The API testing apparatus of the software development kit SDK of any of claims 5 to 7, wherein the plurality of default test parameters includes a request mode configuration, a uniform resource locator url, and an execution mode configuration.
9. An electronic device, comprising:
a memory for storing program instructions;
a processor for calling and executing the program instructions in the memory to implement the API testing method of the software development kit SDK according to any one of claims 1 to 4.
10. A readable storage medium, in which a computer program is stored, wherein when the computer program is executed by at least one processor of an API testing apparatus of a software development kit SDK, the API testing apparatus of the software development kit SDK performs the API testing method of the software development kit SDK according to any one of claims 1 to 4.
CN202010439124.5A 2020-05-22 2020-05-22 API (application programming interface) testing method and device for software development kit SDK (software development kit) Pending CN111694733A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010439124.5A CN111694733A (en) 2020-05-22 2020-05-22 API (application programming interface) testing method and device for software development kit SDK (software development kit)

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010439124.5A CN111694733A (en) 2020-05-22 2020-05-22 API (application programming interface) testing method and device for software development kit SDK (software development kit)

Publications (1)

Publication Number Publication Date
CN111694733A true CN111694733A (en) 2020-09-22

Family

ID=72477482

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010439124.5A Pending CN111694733A (en) 2020-05-22 2020-05-22 API (application programming interface) testing method and device for software development kit SDK (software development kit)

Country Status (1)

Country Link
CN (1) CN111694733A (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113742207A (en) * 2020-09-23 2021-12-03 北京沃东天骏信息技术有限公司 Interface testing method, device, equipment and computer readable storage medium
CN113778869A (en) * 2021-09-06 2021-12-10 中国银行股份有限公司 SDK test method and device
CN115525578A (en) * 2022-11-23 2022-12-27 广州市千钧网络科技有限公司 Form generation method and device, electronic equipment and storage medium
US11803462B1 (en) * 2022-04-27 2023-10-31 Agora Lab, Inc. System and method for automatically generating test cases for testing SDKS

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107368420A (en) * 2017-07-27 2017-11-21 万帮充电设备有限公司 API method of testings, device and electronic equipment
CN107544910A (en) * 2017-10-23 2018-01-05 南京大全电气研究院有限公司 A kind of intelligent distribution transformer terminals automatization test system and method based on LUA scripts
US20180314613A1 (en) * 2017-04-28 2018-11-01 Advantest Corporation User control of automated test features with software application programming interface (api)
CN109376088A (en) * 2018-10-24 2019-02-22 网宿科技股份有限公司 A kind of automatization test system and automated testing method
CN109558290A (en) * 2018-11-12 2019-04-02 平安科技(深圳)有限公司 Server, automatic interface testing method and storage medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180314613A1 (en) * 2017-04-28 2018-11-01 Advantest Corporation User control of automated test features with software application programming interface (api)
CN107368420A (en) * 2017-07-27 2017-11-21 万帮充电设备有限公司 API method of testings, device and electronic equipment
CN107544910A (en) * 2017-10-23 2018-01-05 南京大全电气研究院有限公司 A kind of intelligent distribution transformer terminals automatization test system and method based on LUA scripts
CN109376088A (en) * 2018-10-24 2019-02-22 网宿科技股份有限公司 A kind of automatization test system and automated testing method
CN109558290A (en) * 2018-11-12 2019-04-02 平安科技(深圳)有限公司 Server, automatic interface testing method and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
姜新华等: "《Java Web应用开发》", 北京:北京航空航天大学出版社, pages: 91 - 95 *

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113742207A (en) * 2020-09-23 2021-12-03 北京沃东天骏信息技术有限公司 Interface testing method, device, equipment and computer readable storage medium
CN113778869A (en) * 2021-09-06 2021-12-10 中国银行股份有限公司 SDK test method and device
US11803462B1 (en) * 2022-04-27 2023-10-31 Agora Lab, Inc. System and method for automatically generating test cases for testing SDKS
US20230350789A1 (en) * 2022-04-27 2023-11-02 Agora Lab, Inc. System and method for automatically generating test cases for testing sdks
CN115525578A (en) * 2022-11-23 2022-12-27 广州市千钧网络科技有限公司 Form generation method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
CN111552473B (en) Application processing method, device and equipment
CN111694733A (en) API (application programming interface) testing method and device for software development kit SDK (software development kit)
CN110046101B (en) Page automatic testing method and device and computer storage medium
CN107729246B (en) Auxiliary test method, device and equipment for target application and storage medium
CN109857477A (en) Transition optimization method, device and equipment are applied in mixing
CN107276842B (en) Interface test method and device and electronic equipment
CN111274512A (en) Page loading method, device and medium
CN112783761A (en) Method, device and system for testing cold start duration of application program
CN113268243B (en) Memory prediction method and device, storage medium and electronic equipment
CN111475161A (en) Method, device and equipment for accessing component
CN113076253A (en) Test method and test device
CN112463634A (en) Software testing method and device under micro-service architecture
CN112631590A (en) Component library generation method and device, electronic equipment and computer readable medium
CN107368235B (en) Multi-task switching method of function machine and function machine
CN113885935A (en) Resource packaging method and device, electronic equipment and computer readable storage medium
CN112214405A (en) Software testing method and device, electronic equipment and readable storage medium
CN111444453A (en) Page return data processing method and device
CN111045698A (en) Redundant picture deleting method and device, electronic equipment and storage medium
CN112148395A (en) Page display method, device, equipment and storage medium
CN111338964B (en) Ordered batch test method, system, terminal and storage medium
CN112463519A (en) Flatter-based page use behavior data non-buried point statistical method, equipment and storage medium
CN113835803B (en) Application theme display method and device
CN114764335A (en) Method, device, terminal and storage medium for generating mirror image
CN111124386B (en) Animation event processing method, device, equipment and storage medium based on Unity
CN112463639A (en) Test script editing method, device and equipment

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination