CN114791885A - Interface test method, device, equipment and medium - Google Patents

Interface test method, device, equipment and medium Download PDF

Info

Publication number
CN114791885A
CN114791885A CN202210506257.9A CN202210506257A CN114791885A CN 114791885 A CN114791885 A CN 114791885A CN 202210506257 A CN202210506257 A CN 202210506257A CN 114791885 A CN114791885 A CN 114791885A
Authority
CN
China
Prior art keywords
interface
information
test case
interface test
parameter information
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
CN202210506257.9A
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.)
Industrial and Commercial Bank of China Ltd ICBC
Original Assignee
Industrial and Commercial Bank of China Ltd ICBC
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 Industrial and Commercial Bank of China Ltd ICBC filed Critical Industrial and Commercial Bank of China Ltd ICBC
Priority to CN202210506257.9A priority Critical patent/CN114791885A/en
Publication of CN114791885A publication Critical patent/CN114791885A/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

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)
  • Stored Programmes (AREA)

Abstract

The present disclosure provides an interface testing method, apparatus, device and medium, which can be applied to the computer technology field and the financial field. The interface testing method comprises the following steps: analyzing annotation information of the application program development source code to acquire interface parameter information and interface preset response information; generating to-be-tested data by calling a target function according to the interface parameter information; constructing an interface test case according to the data to be tested, the interface parameter information and the interface preset response information; and executing the interface test case by calling a target interface test engine to obtain an interface test result, wherein the target interface test engine is determined according to the interface parameter information.

Description

Interface test method, device, equipment and medium
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a method, an apparatus, a device, a medium, and a program product for testing an interface.
Background
The interface automatic test is a process of simulating a manual test step and automatically testing an interface by executing a test script compiled by a programming language.
In the related art, the interface test case is generally written manually by a programmer for a specific interface type, and the method is long in time consumption. Or converting the test data in the interface document into a to-be-tested data table which can be used for the test module to execute, and when the interface test is carried out, the test module reads the data in the to-be-tested data table according to a certain execution mode and executes the interface test. According to the data table to be tested converted from the parameters in the interface document, if the parameters in the interface document are missing, the interface test cannot be carried out, and the interface test efficiency is low.
Disclosure of Invention
In view of the above, the present disclosure provides an interface testing method, apparatus, device, medium, and program product.
According to an aspect of the present disclosure, there is provided an interface testing method, including:
analyzing annotation information of the application program development source code to acquire interface parameter information and interface preset response information;
generating data to be tested by calling a target function according to the interface parameter information;
constructing an interface test case according to the data to be tested, the interface parameter information and the interface preset response information; and
and executing the interface test case by calling a target interface test engine to obtain an interface test result, wherein the target interface test engine is determined according to the interface parameter information.
According to the embodiment of the disclosure, an interface test case is constructed according to data to be tested, interface parameter information and interface preset response information, and the method comprises the following steps:
determining an interface test case template according to the interface parameter information;
and encapsulating the data to be tested and the interface preset response information according to the interface test case template to obtain an interface test case.
According to the embodiment of the disclosure, the interface test result is obtained by calling the target interface test engine to execute the interface test case, which includes:
executing the interface test case by calling a target interface test engine to obtain actual interface response information;
and determining an interface test result by checking the actual interface response information and the preset interface response information.
According to the embodiment of the disclosure, generating data to be tested by calling a target function according to interface parameter information includes:
determining the type of the interface parameter according to the interface parameter information;
determining a target function according to the interface parameter type;
and generating the data to be tested by calling a target function.
According to an embodiment of the present disclosure, the interface testing method further includes:
analyzing annotation information of the application development source code to acquire interface communication area information;
and generating an interface document according to the interface parameter information, the interface preset response information and the interface communication area information.
According to an embodiment of the present disclosure, the interface testing method further includes:
acquiring a change request instruction of a target interface, wherein the change request instruction comprises target interface identification information and parameter information of an interface to be changed;
acquiring a first interface test case from an interface test case database according to the identification information of the target interface,
and changing the parameter information of the interface to be changed in the first interface test case according to the parameter information of the interface to be changed to obtain a second interface test case for executing the target interface test.
Another aspect of the present disclosure provides an interface test apparatus including: the device comprises a first acquisition module, a first generation module, a construction module and a test module. The first obtaining module is used for obtaining the interface parameter information and the interface preset response information by analyzing the annotation information of the application program development source code. And the first generation module is used for generating the data to be tested by calling a target function according to the interface parameter information. And the construction module is used for constructing an interface test case according to the to-be-tested data, the interface information and the interface preset response information. And the test module is used for executing the interface test case by calling a target interface test engine to obtain an interface test result, wherein the target interface test engine is determined according to the interface parameter information.
According to an embodiment of the present disclosure, a building block includes a first determining unit and an encapsulating unit. The first determining unit is used for determining the interface test case template according to the interface parameter information. And the packaging unit is used for packaging the data to be tested and the interface preset response information according to the interface test case template to obtain the interface test case.
According to an embodiment of the present disclosure, a test module includes a test unit and a verification unit. The test unit is used for executing the interface test case by calling the target interface test engine to obtain the actual interface response information. And the checking unit is used for determining an interface test result by checking the actual interface response information and the preset interface response information.
According to an embodiment of the present disclosure, the first generation module includes a second determination unit, a third determination unit, and a generation unit. And the second determining unit is used for determining the type of the interface parameter according to the interface parameter information. And the third determining unit is used for determining the target function according to the interface parameter type. And the generating unit is used for generating the data to be tested by calling the target function.
According to an embodiment of the present disclosure, the interface testing apparatus further includes a second obtaining module and a second generating module. The second acquisition module is used for acquiring the interface communication area information by analyzing the annotation information of the application program development source code. And the second generation module is used for generating an interface document according to the interface parameter information, the interface preset response information and the interface communication area information.
According to an embodiment of the present disclosure, the interface testing apparatus further includes a third obtaining module, a fourth obtaining module, and a changing module. The third obtaining module is configured to obtain a change request instruction of the target interface, where the change request instruction includes target interface identification information and parameter information of an interface to be changed. And the fourth acquisition module is used for acquiring the first interface test case from the interface test case database according to the target interface identification information. And the changing module is used for changing the parameter information of the interface to be changed in the first interface test case according to the parameter information of the interface to be changed to obtain a second interface test case for executing the target interface test.
Another aspect of the present disclosure provides an electronic device including: one or more processors; a memory for storing one or more programs, wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to perform the above-described interface testing method.
Another aspect of the present disclosure also provides a computer-readable storage medium having stored thereon executable instructions that, when executed by a processor, cause the processor to perform the above-described interface testing method.
Another aspect of the disclosure also provides a computer program product comprising a computer program which, when executed by a processor, implements the interface testing method described above.
According to the embodiment of the disclosure, the annotation information of the source code is developed by analyzing the application program, and the interface parameter information and the interface preset response information are obtained. And then generating to-be-tested data by calling a target function according to the interface parameter information. And then constructing an interface test case according to the data to be tested, the interface parameter information and the interface preset response information. Because the interface parameter information and the interface preset response information in the interface test case are obtained by analyzing the annotation information of the application program development source code, the data to be tested is generated by calling the target function, and the interface test case is executed as an instantiated test object, the automatic generation of the interface test case is realized, and the efficiency of the interface test is improved.
Drawings
The foregoing and other objects, features and advantages of the disclosure will be apparent from the following description of embodiments of the disclosure, which proceeds with reference to the accompanying drawings, in which:
FIG. 1 schematically illustrates an application scenario diagram of an interface testing method, apparatus, device, medium, and program product according to embodiments of the disclosure;
FIG. 2 schematically illustrates a flow chart of a method of interface testing according to an embodiment of the disclosure;
FIG. 3 schematically illustrates a flow chart of a method of constructing an interface test case according to an embodiment of the present disclosure;
FIG. 4 schematically illustrates a flow chart of a method of executing an interface test case according to an embodiment of the present disclosure;
FIG. 5 schematically illustrates a flow chart of a method of interface test case change according to an embodiment of the present disclosure;
FIG. 6 schematically shows a block diagram of an interface test apparatus according to an embodiment of the present disclosure; and
fig. 7 schematically shows a block diagram of an electronic device adapted to implement the interface testing method according to an embodiment of the present disclosure.
Detailed Description
Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. It should be understood that these descriptions are illustrative only and are not intended to limit the scope of the present disclosure. In the following detailed description, for purposes of explanation, numerous specific details are set forth in order to provide a thorough understanding of the embodiments of the disclosure. It may be evident, however, that one or more embodiments may be practiced without these specific details. Moreover, in the following description, descriptions of well-known structures and techniques are omitted so as to not unnecessarily obscure the concepts of the present disclosure.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the disclosure. The terms "comprises," "comprising," and the like, as used herein, specify the presence of stated features, steps, operations, and/or components, but do not preclude the presence or addition of one or more other features, steps, operations, or components.
All terms (including technical and scientific terms) used herein have the same meaning as commonly understood by one of ordinary skill in the art unless otherwise defined. It is noted that the terms used herein should be interpreted as having a meaning that is consistent with the context of this specification and should not be interpreted in an idealized or overly formal sense.
Where a convention analogous to "at least one of A, B and C, etc." is used, in general such a construction is intended in the sense one having skill in the art would understand the convention (e.g., "a system having at least one of A, B and C" would include but not be limited to systems that have a alone, B alone, C alone, a and B together, a and C together, B and C together, and/or A, B, C together, etc.).
It should be noted that the interface testing method and apparatus of the present disclosure may be used in the financial field and the computer technology field, and may also be used in any field other than the financial field.
The embodiment of the disclosure provides an interface testing method, which includes the steps of firstly analyzing annotation information of a source code developed by an application program to obtain interface parameter information and interface preset response information. And then generating to-be-tested data by calling a target function according to the interface parameter information. And then constructing an interface test case according to the data to be tested, the interface parameter information and the interface preset response information. Because the interface parameter information and the interface preset response information in the interface test case are obtained by analyzing the annotation information of the application program development source code, and the data to be tested is generated by calling the target function, the automatic generation of the interface test case is realized, and the efficiency of the interface test is improved.
Fig. 1 schematically shows an application scenario diagram of an interface testing method according to an embodiment of the present disclosure.
As shown in fig. 1, the application scenario 100 according to this embodiment may include a common module 101, a driver module 102, an interface document generation module 103, an interface test case generation module 104, an interface test case execution module 105, and an interface test case database 106.
According to the embodiment of the present disclosure, the common module 101 includes a parsing sub-module 1011, an interface information obtaining sub-module 1012, a data to be tested generating sub-module 1013, a test log sub-module 1014, and a changing sub-module 1015. The parsing sub-module 1011 is configured to parse annotation information of the application development source code. The interface information obtaining module 1012 is communicatively connected to the parsing sub-module 1011, and is configured to obtain interface parameter information and interface response information from the annotation information of the application development source code. The to-be-tested data generation sub-module 1013 is communicatively connected to the interface information obtaining module 1012, and is configured to call a target function according to the interface parameter information to generate to-be-tested data. The test log sub-module 1014 is communicatively coupled to the driver module 102 and is configured to record operation information during the interface test. The changing submodule 1015 is in communication connection with the interface test case database 106, and is configured to change the interface parameter information in the interface test case to be changed in the interface test case database.
According to the embodiment of the disclosure, the driver module 102 is in communication connection with the interface document generation module 103 and the interface test case generation module 104, respectively. For driving the interface document generation module 103 to generate interface documents and the interface test case generation module 104 to generate interface test cases.
The interface document generating module 103 is communicatively connected to the interface information obtaining sub-module 1012, and is configured to obtain interface parameter information, interface response information, and interface communication area information, and generate an interface document.
The interface test case generating module 104 is communicatively connected to the to-be-tested data generating sub-module 1013, and is configured to obtain the to-be-tested data and generate an interface test case.
The interface test case executing module 105 is respectively in communication connection with the interface test case generating module 104 and the interface test case database 106, and is configured to execute the interface test cases.
The interface test method of the disclosed embodiment will be described in detail below with fig. 2 to 5 based on the scenario described in fig. 1.
Fig. 2 schematically shows a flow chart of an interface testing method according to an embodiment of the present disclosure.
As shown in fig. 2, the interface test of this embodiment includes operations S210 to S240.
In operation S210, interface parameter information and interface preset response information are acquired by parsing annotation information of the application development source code.
According to the embodiment of the disclosure, taking the login interface as an example, by analyzing the annotation information of the application development source code, the acquired interface parameter information may include a user ID, a user name, a password, and the like.
According to an embodiment of the present disclosure, by analyzing the annotation information of the application development source code, the interface parameter information that can be obtained includes: ID. User name, age, etc. The interface preset response information may include a response code number XX, response result information MM, response port information YY, and the like.
In operation S220, data to be tested is generated by calling the target function according to the interface parameter information.
According to embodiments of the present disclosure, the objective function is generally determined according to the data type of the interface parameters, such as: the data type of the ID parameter may be determined to be an integer based on the application source code annotation information. For the ID parameter, the objective function may be a random number generation function, such as: CACS _ RANDOM _ I4 function. The generated data to be tested may be xxxxxx, for example: 102394.
according to an embodiment of the present disclosure, for example: and determining the data type of the user name parameter as a character string according to the source code annotation information of the application program. For the username parameter, the objective function may be a random string generating function, such as: and a function of rand (). The generated data to be tested may be a character string composed of a plurality of letters, for example: AFDKJIHLJ.
In operation S230, an interface test case is constructed according to the data to be tested, the interface parameter information, and the interface preset response information.
According to the embodiment of the disclosure, the interface test case can be an instance object of the JAVA class, and the instance object of the JAVA class is constructed according to the data to be tested, the interface parameter information, and the interface preset response information and according to the structure of the JAVA class.
In operation S240, an interface test result is obtained by calling a target interface test engine to execute an interface test case, where the target interface test engine is determined according to the interface parameter information.
According to embodiments of the present disclosure, the target interface test engine may include an Http interface engine, an RPC interface engine, and/or the like. The interface type may be determined according to the interface parameter information, and may include an Http interface, an RPC interface, and the like. And selecting a corresponding target interface test engine to execute the interface test case according to the interface type.
The embodiment of the disclosure provides an interface testing method, which includes that annotation information of a source code is developed through an analysis application program, and interface parameter information and interface preset response information are obtained. And then generating to-be-tested data by calling a target function according to the interface parameter information. And then constructing an interface test case according to the data to be tested, the interface parameter information and the interface preset response information. Because the interface parameter information and the interface preset response information in the interface test case are obtained by analyzing the annotation information of the application program development source code, and the data to be tested is generated by calling the target function, the automatic generation of the interface test case is realized, and the efficiency of the interface test is improved.
FIG. 3 schematically shows a flowchart of a method of constructing an interface test case according to an embodiment of the present disclosure.
As shown in fig. 3, this embodiment includes operations S310 to S320.
In operation S310, an interface test case template is determined according to the interface parameter information.
According to the embodiment of the disclosure, the interface test case template may be a template in a JAVA class, and the corresponding JAVA class is determined according to the interface parameter information.
In operation S320, the data to be tested and the interface preset response information are encapsulated according to the interface test case template to obtain an interface test case.
According to the embodiment of the disclosure, the data to be tested and the interface preset response information can be packaged according to JAVA classes to obtain JAVA class instance objects, namely interface test cases. For example: taking the login interface as an example, the generated random character string corresponding to the user name and the generated random number corresponding to the login password can be packaged with the preset response information of the interface to obtain the interface test case.
According to the embodiment of the disclosure, the data to be tested and the interface preset response information are packaged according to the interface test case template, and the interface test case is automatically generated and can be stored in the interface test case database as the interface test case is an instantiated object, so that the interface test case can be directly called from the interface test case database when the interface is repeatedly tested, the interface test case does not need to be regenerated, and the interface test efficiency is improved.
Fig. 4 schematically illustrates a flowchart of a method of executing an interface test case according to an embodiment of the present disclosure.
As shown in fig. 4, this embodiment includes operations S410 to S420.
In operation S410, the interface test case is executed by calling the target interface test engine to obtain the actual interface response information.
According to an embodiment of the present disclosure, for example: for the http interface, an http interface test engine is called to execute an http interface test case, which may be obtained from an http interface test case generation module or from an http interface test case database, to obtain actual response information of the http interface. For example: the interface actual response information may be a response code number XX, response result information MM, and response port information YY.
In operation S420, an interface test result is determined by verifying the interface actual response information and the interface preset response information.
According to an embodiment of the present disclosure, for example: the interface preset response information obtained from the application program source code annotation information is a response code number XX, response result information MM and response port information YY. The actual response information of the interface and the preset response information of the interface are verified to be known, the actual response information of the interface is the same as the preset response information of the interface, and the result of the interface test can be determined to be that the interface returns successfully. The interface test result information can also be expressed as assertion, and the assertion is true under the condition that the actual interface response information is the same as the preset interface response information.
According to the embodiment of the disclosure, the interface test result is determined by verifying the actual interface response information and the interface preset response information acquired from the application program source code annotation information, so that the automatic identification of the interface test result is realized.
Fig. 5 schematically illustrates a flowchart of a method for interface test case change according to an embodiment of the present disclosure.
As shown in FIG. 5, this embodiment includes operations S510-S530.
In operation S510, an interface parameter type is determined according to the interface parameter information.
According to an embodiment of the present disclosure, the interface parameter type may be a data type of the interface parameter, including a character type, a numerical type, a floating point type, and the like. For example: the interface parameter is "age", and the type of the interface parameter can be determined to be numerical. The interface parameter is 'user name', and the type of the interface parameter can be determined to be character type.
In operation S520, an objective function is determined according to the interface parameter type.
According to an embodiment of the present disclosure, when the interface parameter type is a character type, it may be determined that the objective function is a random character generation function, for example: function rand (): rand ()% (n-m +1) + m. When the type of the interface parameter is a numerical type, the objective function may be determined to be a random number generation function, for example: randbetween () function, rand () function, etc.
In operation S530, data to be tested is generated by calling a target function.
According to an embodiment of the present disclosure, for example: for the username parameter, the objective function may be a random string generation function, such as: and a function of rand (). The generated data to be tested may be a character string composed of a plurality of letters, for example: AFDKJIHLJ.
According to the embodiment of the disclosure, the target function is determined according to the type of the interface parameter, and the data to be tested is automatically generated by calling the target function, so that the data to be tested is automatically generated, the dependence on manual coding is avoided, and the interface testing efficiency is improved.
In the related art, the interface document is generated mainly in the following ways: one way is to monitor the historical interface test, extract the interface parameter information from the log of the historical interface test according to a regular expression, and generate an interface document. Another way is to generate the interface document using Swagger, APIDoc, etc. tools. However, the inventor finds that, in the process of designing the embodiment of the present disclosure, the above-mentioned manners are to generate the interface document separately, and then generate the interface test case according to the parameter information in the interface document, so as to execute the interface test. If the developer does not retain the interface document in the development process, the programmer cannot write the interface test case.
In view of this, according to an embodiment of the present disclosure, the interface testing method further includes:
analyzing annotation information of the application development source code to acquire interface communication area information;
and generating an interface document according to the interface parameter information, the interface preset response information and the interface communication area information.
According to an embodiment of the present disclosure, the interface communication area information may include information such as a request URL. Interface documents can be generated according to the interface parameter information ' ID ', ' UserName ', ' Age ', the interface preset response information ' response code number XX ', the response result information MM, the response port information YY ' and the interface communication area information ' request URL ', and are used by developers of application programs in the process of upgrading and developing the application programs or in the process of modifying the interface parameters.
According to the embodiment of the disclosure, since the interface document is generated according to the interface parameter information, the interface preset response information and the interface communication area information acquired from the application program source code annotation information, the interface document and the interface test case can be generated in the process of writing the program source code by an application program developer, development and test personnel do not need to write the interface test case separately, and the interface test efficiency is improved
In the related art, an interface test case generally automatically generates an excel table with data to be tested. The interface test case is complex to operate when the interface parameter information is added or deleted.
In view of this, according to an embodiment of the present disclosure, the interface testing method further includes:
and acquiring a change request instruction of the target interface, wherein the change request instruction comprises target interface identification information and parameter information of the interface to be changed.
According to an embodiment of the present disclosure, for example: the target interface identification information in the change request command may be an interface ID, or may be combination information of an interface name and an ID, for example: the login interface 001. The interface parameter information to be changed, for example: the interface parameters in the original login interface comprise a user name and a password, and the interface parameter information to be changed can be a verification code and random data to be tested of the interface parameter to be changed.
And acquiring a first interface test case from the interface test case database according to the target interface identification information.
According to the embodiment of the disclosure, JAVA class instance objects of different interfaces are stored in the interface test case database, and each JAVA class instance object represents a test case of one interface. For example: and acquiring a first interface test case of the interface from an interface test case database according to the target interface identification information 'login interface 001'.
And changing the interface parameter information to be changed in the first interface test case according to the interface parameter information to be changed to obtain a second interface test case for executing the target interface test.
According to an embodiment of the present disclosure, for example: the interface parameter information included in the first interface test case may be a user name, a password, and to-be-tested data and interface preset response information corresponding to the interface parameter, and the interface parameter information included in the second interface test case after the change may be a user name, a password, a verification code, and to-be-tested data corresponding to the interface parameter.
According to the embodiment of the disclosure, when the interface parameter of a certain interface needs to be added or deleted, the target interface test case can be obtained from the interface test case database for addition or deletion, and the interface test case is an instantiated object, so that the change operation is simple and convenient.
Based on the interface test method, the disclosure also provides an interface test device. The apparatus will be described in detail below with reference to fig. 6.
Fig. 6 schematically shows a block diagram of an interface test apparatus according to an embodiment of the present disclosure.
As shown in fig. 6, the interface test apparatus 600 of this embodiment includes: a first acquisition module 610, a first generation module 620, a construction module 630, and a testing module 640.
The first obtaining module 610 is configured to obtain interface parameter information and interface preset response information by analyzing annotation information of the application development source code. In an embodiment, the first obtaining module 610 may be configured to perform the operation S210 described above, which is not described herein again.
And the first generating module 620 is configured to generate the data to be tested by calling the target function according to the interface parameter information. In an embodiment, the first generating module 620 may be configured to perform the operation S220 described above, which is not described herein again.
The constructing module 630 is configured to construct an interface test case according to the to-be-tested data, the interface information, and the interface preset response information. In an embodiment, the constructing module 630 may be configured to perform the operation S230 described above, which is not described herein again.
The testing module 640 is configured to execute the interface test case by calling a target interface test engine to obtain an interface test result, where the target interface test engine is determined according to the interface parameter information. In an embodiment, the test module 640 may be configured to perform the operation S240 described above, which is not described herein again.
According to an embodiment of the present disclosure, a building block includes a first determining unit and an encapsulating unit. The first determining unit is used for determining the interface test case template according to the interface parameter information. And the packaging unit is used for packaging the data to be tested and the interface preset response information according to the interface test case template to obtain the interface test case.
According to an embodiment of the present disclosure, a test module includes a test unit and a verification unit. The testing unit is used for executing the interface testing case by calling the target interface testing engine to obtain the actual interface response information. And the checking unit is used for determining an interface test result by checking the actual interface response information and the preset interface response information.
According to an embodiment of the present disclosure, the first generation module includes a second determination unit, a third determination unit, and a generation unit. And the second determining unit is used for determining the type of the interface parameter according to the interface parameter information. And the third determining unit is used for determining the target function according to the interface parameter type. And the generating unit is used for generating the data to be tested by calling the target function.
According to an embodiment of the present disclosure, the interface testing apparatus further includes a second obtaining module and a second generating module. The second acquisition module is used for acquiring the interface communication area information by analyzing the annotation information of the application development source code. And the second generation module is used for generating an interface document according to the interface parameter information, the interface preset response information and the interface communication area information.
According to an embodiment of the present disclosure, the interface testing apparatus further includes a third obtaining module, a fourth obtaining module, and a changing module. The third obtaining module is used for obtaining a change request instruction of the target interface, wherein the change request instruction comprises target interface identification information and parameter information of the interface to be changed. And the fourth acquisition module is used for acquiring the first interface test case from the interface test case database according to the target interface identification information. And the changing module is used for changing the parameter information of the interface to be changed in the first interface test case according to the parameter information of the interface to be changed to obtain a second interface test case for executing the target interface test.
According to an embodiment of the present disclosure, any plurality of the first obtaining module 610, the first generating module 620, the constructing module 630, and the testing module 640 may be combined and implemented in one module, or any one of them may be split into a plurality of modules. Alternatively, at least part of the functionality of one or more of these modules may be combined with at least part of the functionality of other modules and implemented in one module. According to an embodiment of the present disclosure, at least one of the first obtaining module 610, the first generating module 620, the constructing module 630 and the testing module 640 may be at least partially implemented as a hardware circuit, such as a Field Programmable Gate Array (FPGA), a Programmable Logic Array (PLA), a system on a chip, a system on a substrate, a system on a package, an Application Specific Integrated Circuit (ASIC), or may be implemented by hardware or firmware in any other reasonable manner of integrating or packaging a circuit, or implemented by any one of three implementations of software, hardware and firmware, or implemented by a suitable combination of any of them. Alternatively, at least one of the first obtaining module 610, the first generating module 620, the building module 630 and the testing module 640 may be at least partially implemented as a computer program module, which when executed may perform a corresponding function.
Fig. 7 schematically shows a block diagram of an electronic device adapted to implement the interface testing method according to an embodiment of the present disclosure.
As shown in fig. 7, an electronic device 700 according to an embodiment of the present disclosure includes a processor 701, which can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)702 or a program loaded from a storage section 708 into a Random Access Memory (RAM) 703. The processor 701 may include, for example, a general purpose microprocessor (e.g., a CPU), an instruction set processor and/or associated chipset, and/or a special purpose microprocessor (e.g., an Application Specific Integrated Circuit (ASIC)), among others. The processor 701 may also include on-board memory for caching purposes. The processor 701 may comprise a single processing unit or a plurality of processing units for performing the different actions of the method flows according to embodiments of the present disclosure.
In the RAM 703, various programs and data necessary for the operation of the electronic apparatus 700 are stored. The processor 701, the ROM 702, and the RAM 703 are connected to each other by a bus 704. The processor 701 performs various operations of the method flows according to the embodiments of the present disclosure by executing programs in the ROM 702 and/or the RAM 703. Note that the programs may also be stored in one or more memories other than the ROM 702 and the RAM 703. The processor 701 may also perform various operations of method flows according to embodiments of the present disclosure by executing programs stored in the one or more memories.
Electronic device 700 may also include input/output (I/O) interface 705, which input/output (I/O) interface 705 is also connected to bus 704, according to an embodiment of the present disclosure. The electronic device 700 may also include one or more of the following components connected to the I/O interface 705: an input portion 706 including a keyboard, a mouse, and the like; an output section 707 including components such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and a speaker; a storage section 708 including a hard disk and the like; and a communication section 709 including a network interface card such as a LAN card, a modem, or the like. The communication section 709 performs communication processing via a network such as the internet. A drive 710 is also connected to the I/O interface 705 as needed. A removable medium 711 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 710 as necessary, so that a computer program read out therefrom is mounted into the storage section 708 as necessary.
The present disclosure also provides a computer-readable storage medium, which may be contained in the apparatus/device/system described in the above embodiments; or may exist alone without being assembled into the device/apparatus/system. The computer-readable storage medium carries one or more programs which, when executed, implement a method according to an embodiment of the disclosure.
According to embodiments of the present disclosure, the computer-readable storage medium may be a non-volatile computer-readable storage medium, which may include, for example but is not limited to: a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. For example, according to embodiments of the present disclosure, a computer-readable storage medium may include the ROM 702 and/or the RAM 703 and/or one or more memories other than the ROM 702 and the RAM 703 described above.
Embodiments of the present disclosure also include a computer program product comprising a computer program containing program code for performing the method illustrated by the flow chart. When the computer program product runs in a computer system, the program code is used for causing the computer system to realize the method provided by the embodiment of the disclosure.
The computer program performs the above-described functions defined in the system/apparatus of the embodiments of the present disclosure when executed by the processor 701. The above described systems, devices, modules, units, etc. may be implemented by computer program modules according to embodiments of the present disclosure.
In one embodiment, the computer program may be hosted on a tangible storage medium such as an optical storage device, a magnetic storage device, and the like. In another embodiment, the computer program may also be transmitted in the form of a signal over a network medium, distributed, and downloaded and installed via the communication section 709, and/or installed from the removable medium 711. The computer program containing program code may be transmitted using any suitable network medium, including but not limited to: wireless, wired, etc., or any suitable combination of the foregoing.
In such an embodiment, the computer program can be downloaded and installed from a network through the communication section 709, and/or installed from the removable medium 711. The computer program, when executed by the processor 701, performs the above-described functions defined in the system of the embodiments of the present disclosure. The above described systems, devices, apparatuses, modules, units, etc. may be implemented by computer program modules according to embodiments of the present disclosure.
In accordance with embodiments of the present disclosure, program code for executing computer programs provided by embodiments of the present disclosure may be written in any combination of one or more programming languages, and in particular, these computer programs may be implemented using high level procedural and/or object oriented programming languages, and/or assembly/machine languages. The programming language includes, but is not limited to, programming languages such as Java, C + +, python, the "C" language, or the like. The program code may execute entirely on the user computing device, partly on the user device, partly on a remote computing device, or entirely on the remote computing device or server. In situations involving remote computing devices, the remote computing devices may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to external computing devices (e.g., through the internet using an internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems that perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
Those skilled in the art will appreciate that various combinations and/or combinations of features recited in the various embodiments and/or claims of the present disclosure can be made, even if such combinations or combinations are not expressly recited in the present disclosure. In particular, various combinations and/or combinations of the features recited in the various embodiments and/or claims of the present disclosure may be made without departing from the spirit or teaching of the present disclosure. All such combinations and/or associations are within the scope of the present disclosure.
The embodiments of the present disclosure have been described above. However, these examples are for illustrative purposes only and are not intended to limit the scope of the present disclosure. Although the embodiments are described separately above, this does not mean that the measures in the embodiments cannot be used in advantageous combination. The scope of the disclosure is defined by the appended claims and equivalents thereof. Various alternatives and modifications can be devised by those skilled in the art without departing from the scope of the disclosure, and these alternatives and modifications are intended to fall within the scope of the disclosure.

Claims (10)

1. An interface testing method, comprising:
analyzing annotation information of the application development source code to obtain interface parameter information and interface preset response information;
generating data to be tested by calling a target function according to the interface parameter information;
constructing an interface test case according to the to-be-tested data, the interface parameter information and the interface preset response information; and
and executing the interface test case by calling a target interface test engine to obtain an interface test result, wherein the target interface test engine is determined according to the interface parameter information.
2. The method of claim 1, wherein the constructing an interface test case according to the data to be tested, the interface parameter information and the interface preset response information comprises:
determining an interface test case template according to the interface parameter information;
and packaging the data to be tested and the interface preset response information according to the interface test case template to obtain the interface test case.
3. The method of claim 1, wherein said executing the interface test case by invoking a target interface test engine to obtain an interface test result comprises:
executing the interface test case by calling a target interface test engine to obtain actual interface response information;
and determining an interface test result by checking the actual interface response information and the preset interface response information.
4. The method of claim 1, wherein the generating data to be tested by calling a target function according to the interface parameter information comprises:
determining the type of interface parameters according to the interface parameter information;
determining the target function according to the interface parameter type;
and generating the data to be tested by calling the target function.
5. The method of claim 1, further comprising:
analyzing annotation information of the application program development source code to acquire interface communication area information;
and generating an interface document according to the interface parameter information, the interface preset response information and the interface communication area information.
6. The method of claim 1, further comprising:
acquiring a change request instruction of a target interface, wherein the change request instruction comprises target interface identification information and parameter information of an interface to be changed;
acquiring a first interface test case from an interface test case database according to the target interface identification information,
and changing the parameter information of the interface to be changed in the first interface test case according to the parameter information of the interface to be changed to obtain a second interface test case for executing the target interface test.
7. An interface test apparatus comprising:
the first acquisition module is used for acquiring interface parameter information and interface preset response information by analyzing annotation information of the application development source code;
the first generation module is used for generating to-be-tested data by calling a target function according to the interface parameter information;
the construction module is used for constructing an interface test case according to the to-be-tested data, the interface information and the interface preset response information; and
and the test module is used for executing the interface test case by calling a target interface test engine to obtain an interface test result, wherein the target interface test engine is determined according to the interface parameter information.
8. An electronic device, comprising:
one or more processors;
a storage device for storing one or more programs,
wherein the one or more programs, when executed by the one or more processors, cause the one or more processors to perform the method of any of claims 1-6.
9. A computer readable storage medium having stored thereon executable instructions which, when executed by a processor, cause the processor to perform the method of any one of claims 1 to 6.
10. A computer program product comprising a computer program which, when executed by a processor, implements a method according to any one of claims 1 to 6.
CN202210506257.9A 2022-05-10 2022-05-10 Interface test method, device, equipment and medium Pending CN114791885A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210506257.9A CN114791885A (en) 2022-05-10 2022-05-10 Interface test method, device, equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210506257.9A CN114791885A (en) 2022-05-10 2022-05-10 Interface test method, device, equipment and medium

Publications (1)

Publication Number Publication Date
CN114791885A true CN114791885A (en) 2022-07-26

Family

ID=82463779

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210506257.9A Pending CN114791885A (en) 2022-05-10 2022-05-10 Interface test method, device, equipment and medium

Country Status (1)

Country Link
CN (1) CN114791885A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115114177A (en) * 2022-08-31 2022-09-27 云账户技术(天津)有限公司 Method and device for generating gPC scene template
CN115733768A (en) * 2022-11-16 2023-03-03 京东科技信息技术有限公司 Network node performance test method, device, equipment and medium

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115114177A (en) * 2022-08-31 2022-09-27 云账户技术(天津)有限公司 Method and device for generating gPC scene template
CN115733768A (en) * 2022-11-16 2023-03-03 京东科技信息技术有限公司 Network node performance test method, device, equipment and medium
CN115733768B (en) * 2022-11-16 2024-10-18 京东科技信息技术有限公司 Network node performance test method, device, equipment and medium

Similar Documents

Publication Publication Date Title
US10642721B2 (en) Generation of automated testing scripts by converting manual test cases
US10831456B1 (en) External code integrations within a computing environment
WO2022142896A1 (en) Generation method and apparatus for visualizable template, device, and storage medium
CN110532185B (en) Test method, test device, electronic equipment and computer readable storage medium
CN114791885A (en) Interface test method, device, equipment and medium
CN110825431B (en) Interface document processing method, device, system, storage medium and electronic equipment
CN109871312B (en) Interface testing method, device, equipment and readable storage medium
US11422917B2 (en) Deriving software application dependency trees for white-box testing
CN113157572B (en) Test case generation method, system, electronic equipment and storage medium
US9274933B2 (en) Pretest setup planning
CN118113271A (en) Code generation method, system, terminal and medium based on large model
CN113032256A (en) Automatic test method, device, computer system and readable storage medium
Garcia et al. ESBMC^ QtOM Q t OM: A Bounded Model Checking Tool to Verify Qt Applications
CN111930629A (en) Page testing method and device, electronic equipment and storage medium
CN116756016A (en) Multi-browser testing method, device, equipment, medium and program product
CN112506871B (en) Automated task management and log management method, system, electronic device and medium
CN114035864A (en) Interface processing method, interface processing device, electronic device, and storage medium
CN114691527A (en) Unit test case generation method, apparatus, device, medium, and program product
CN113535568A (en) Verification method, device, equipment and medium for application deployment version
CN113778451A (en) File loading method and device, computer system and computer readable storage medium
CN114490580A (en) Configurable data migration method and apparatus executed by automation script
CN114116519A (en) Interface test method and device, electronic equipment and storage medium
CN114003492A (en) Demand test integrated generation method and device
CN113377377A (en) Static code analysis method, analysis device, electronic device and readable storage medium
CN118377722A (en) Page test method, device, equipment, medium and program product

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