Interface testing method, device, electronic device and storage medium
By displaying and filling in interface test parameters and engine execution parameters, and using matching engines to execute interface tests, the problem that the interface test system in the existing technology cannot meet the needs of multi-service systems is solved, efficient and flexible interface testing is achieved, and development is reduced. cost.
Patent Information
- Application Number
- CN202111098322.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-09-18
- Publication Date
- 2024-11-12
- Estimated Expiration
- 2041-09-18
AI Technical Summary
The existing interface testing system can only implement the testing of a single type of interface, and requires the establishment of different interface testing systems for different business systems, which leads to cumbersome and time-consuming and labor-intensive testing, and cannot meet the interface testing needs of multi-service systems.
By displaying the parameter item information of the target interface template, obtaining and filling in the interface test parameters and engine execution parameters, using the matching engine to execute interface tests, supporting universality testing of multi-service interfaces, and providing the interface template and engine editing functions to achieve the Support for different business systems.
It improves the efficiency and flexibility of interface testing, reduces the development of multiple interface testing systems, reduces the time and labor costs, and realizes the universal testing of business interfaces of different business systems.
Smart Images

Figure CN113836014B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the field of software development, and in particular to an interface testing method, device, electronic device and storage medium. Background Art
[0002] With the rapid development of network technology, more and more application services have come into people's sight, and the business systems that provide application services are also constantly iterating and updating. Therefore, the demand for interface testing of various business systems has become extremely frequent.
[0003] Existing interface testing systems usually choose the Django framework based on the Python language, or the SSM (Spring+SpringMVC+MyBatis) framework as the development framework of the interface testing system, and use it to implement interface testing of the business system.
[0004] However, the above-mentioned interface testing method can only realize the testing of a single type of interface, such as RESTful interface or Dubbo interface, which has relatively simple functionality. For business interfaces under different business systems, different interface testing systems need to be established respectively, and interface testing needs to be performed separately under each interface testing system. Not only is the interface testing process cumbersome, but the development of the interface testing system also requires a lot of time and manpower costs. Summary of the invention
[0005] The embodiment of the present invention provides an interface testing method, apparatus, device and storage medium, which implements interface testing through an engine based on interface testing parameters and engine execution parameters.
[0006] In a first aspect, an embodiment of the present invention provides an interface testing method, comprising:
[0007] In response to obtaining the template selection instruction, displaying parameter item information of the target interface template; wherein the parameter item information includes interface test parameter items, engine identification items and engine execution parameter items;
[0008] According to the target interface template filled with the parameter item information, obtaining interface test parameters, a first target engine and engine execution parameters;
[0009] According to the interface test parameters and the engine execution parameters, the interface test is performed through the first target engine, and the interface test result is obtained according to the interface feedback information.
[0010] The interface testing method also includes: in response to obtaining a template addition instruction, displaying an interface template editing template to obtain a newly added interface template that has been edited; and / or in response to obtaining a first engine addition instruction, displaying an engine editing template to obtain a first newly added engine that has been edited. The newly added interface template and the newly added engine template ensure that the interface testing system supports the testing of the newly added business interface and realizes the universal support for the business interfaces of different business systems; the engine editing template also avoids the phenomenon that the user's uploaded engine cannot be recognized due to different engine editing formats.
[0011] After displaying the interface template editing template, it also includes: if the engine selection instruction is obtained through the interface template editing template, the engine execution parameter items of the second target engine are displayed in the interface template editing template; if the second engine addition instruction is obtained through the interface template editing template, the engine editing template is displayed in the interface template editing template to obtain the edited second added engine. By providing the selection of existing engines and the editing function of new engines in the interface template editing template, testers can use existing engines stored in the interface test system or edit new engines when writing interface templates, which improves the editing flexibility of interface templates and improves the editing efficiency of interface templates.
[0012] The parameter item information also includes an assertion mode item and an assertion execution parameter item; after displaying the parameter item information of the target interface template, it also includes: obtaining the assertion mode and assertion execution parameters according to the target interface template filled in with the parameter item information; the interface test result is obtained according to the interface feedback information, including: obtaining the interface assertion result according to the interface feedback information, the assertion mode and the assertion execution parameters. The interface assertion result is obtained through the interface feedback information, the assertion mode and the assertion execution parameters, so as to realize the assertion test of the business interface, verify the code accuracy of the business interface, and improve the business performance of the interface.
[0013] After the target interface template filled in with the parameter item information obtains the interface test parameters, the first target engine and the engine execution parameters, it also includes: creating and saving an interface test task according to the interface test parameters, the first target engine and the engine execution parameters; or creating and saving an interface test task according to the interface test parameters, the first target engine, the engine execution parameters, the assertion mode and the assertion execution parameters; in response to obtaining a task selection instruction, executing the target interface test task. The reuse of interface test tasks is realized, which is convenient for testers to retest business interfaces, improves the tester's operational convenience, and avoids the tedious process of testers repeatedly filling in parameter item information.
[0014] The assertion mode includes at least one of equal assertion, greater than assertion, less than assertion, range assertion, empty assertion and regular assertion. The diverse assertion modes enable the interface testing system to perform personalized tests on different business interfaces. Testers can choose different assertion modes according to the data characteristics of different business interfaces, thereby improving the accuracy and matching of test results.
[0015] Before obtaining the interface assertion result according to the interface feedback information, the assertion mode and the assertion execution parameters, the following steps are included: if the data format of the interface feedback information is in Json format, the interface feedback information is parsed through JsonPath; if the data format of the interface feedback information is in Xml format, the interface feedback information is parsed through XPath. By using JsonPath and XPath, the Json assertion and Xml assertion of the business interface are realized, the data diversity of the interface test is ensured, and the test support of business interfaces with different data formats is realized.
[0016] In a second aspect, an embodiment of the present invention provides an interface testing device, including:
[0017] A target interface template display module, used to display parameter item information of the target interface template in response to obtaining a template selection instruction; wherein the parameter item information includes an interface test parameter item, an engine identification item, and an engine execution parameter item;
[0018] A parameter acquisition module, used to acquire interface test parameters, a first target engine and engine execution parameters according to the target interface template filled in with the parameter item information;
[0019] The interface test result acquisition module is used to execute the interface test through the first target engine according to the interface test parameters and the engine execution parameters, and acquire the interface test result according to the interface feedback information.
[0020] In a third aspect, an embodiment of the present invention further provides an electronic device, the electronic device comprising:
[0021] one or more processors;
[0022] A storage device for storing one or more programs;
[0023] When the one or more programs are executed by the one or more processors, the one or more processors implement the interface testing method described in any embodiment of the present invention.
[0024] In a fourth aspect, an embodiment of the present invention further provides a storage medium comprising computer executable instructions, which, when executed by a computer processor, implements the interface testing method described in any embodiment of the present invention.
[0025] The technical solution provided by the embodiment of the present invention obtains the interface test parameters and engine execution parameters filled in by the user by displaying the interface test parameter items, engine identification items and engine execution parameter items of the target interface template, and executes the interface test according to the first target engine matching the target interface template, thereby realizing the universality test of multiple business interfaces under the interface test system, improving the interface test efficiency, avoiding the development of multiple interface test systems, and reducing the time and labor costs of system development. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] Figure 1 is a flow chart of an interface testing method provided by Embodiment 1 of the present invention;
[0027] Figure 2 is a flow chart of an interface testing method provided by Embodiment 2 of the present invention;
[0028] Figure 3 is a structural block diagram of an interface testing system provided by Embodiment 3 of the present invention;
[0029] Figure 4 is a structural block diagram of an interface testing device provided by Embodiment 4 of the present invention;
[0030] Figure 5 This is a structural block diagram of an electronic device provided in Embodiment 5 of the present invention. DETAILED DESCRIPTION
[0031] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It should also be noted that, for ease of description, only the parts related to the present invention, rather than all structures, are shown in the accompanying drawings.
[0032] Embodiment 1
[0033] Figure 1 This is a flowchart of an interface testing method provided in the first embodiment of the present invention. This embodiment can be applied to executing an interface test through an engine according to interface test parameter items and engine execution parameter items filled in by a tester. The method can be executed by an interface testing device in the embodiment of the present invention. The device can be implemented by software and / or hardware and integrated in an interface testing system. Typically, it can be integrated in an electronic device equipped with an interface testing system. The method specifically includes the following steps:
[0034] S110. In response to obtaining a template selection instruction, display parameter item information of a target interface template; wherein the parameter item information includes an interface test parameter item, an engine identification item, and an engine execution parameter item.
[0035] The interface testing system is connected to the business interfaces under multiple business systems, and each interface template corresponds to the business interfaces under different business systems; the interface testing system can display the various interface templates stored in the system in the form of an interface template list; the interface template is a set of parameter items for the parameters required for interface testing of the business interface, and each interface template includes multiple parameter item information to be filled in; among which, the interface test parameter items are the parameter requirements for the data information sent by the interface testing system to the business interface, and the interface test parameter items may include one or more of the interface name, calling protocol type, request parameter format, request body structure and return result format.
[0036] Specifically, the calling protocol type is the type of communication protocol supported by the business interface, such as HTTP (HyperText Transfer Protocol), Web Service (World Wide Web Service) protocol and Dubbo protocol; the request parameter format is the parameter format of the request sent by the interface testing system to the business interface, such as integer, floating point, string, Key-Value format (i.e. keyword value), Json format and XML format, etc.; the request body structure is the request structure customized by the tester, corresponding to the request parameter format. If the request parameter format is Key-Value format, Json format or XML format, the request body structure is given by the tester as input. For example, if the request parameter format is Key-Value format, the request body structure can be the specified "Key" name; if the request parameter format is Json format and XML format, the request body structure can be the specified node name; the return result format is the parameter format of the data information returned by the business interface to the interface testing system, which can include integer, floating point, string, Key-Value format, JSON format and XML format, etc.
[0037] The engine is a program component of the interface testing system. The interface testing system calls the interface through the engine and sends test data to the interface through the engine. The engine is pre-written by the tester and stored in the interface testing system. Different engines correspond to different business interfaces and send different test data. The engine identification item indicates the number of the engine used by the interface template. When the interface template is created, the interface template is associated with the engine according to the engine selected by the tester. When the template selection instruction is obtained and the parameter item information of the target interface template is displayed to the tester, the interface testing system displays the engine identification corresponding to the target interface template according to the recorded association relationship between the interface template and the engine. In particular, after displaying the target interface template, if the engine identification modification instruction issued by the tester is obtained, the modified engine identification is used as the engine identification corresponding to the target interface template.
[0038] The engine execution parameter item is the addressing information when the interface test system tests the interface through the engine, that is, the identity and location of the interface to be tested are determined according to the engine execution parameter item; the engine execution parameter item includes the connection timeout and the read timeout; the connection timeout is the maximum connection time with the interface when the engine calls the interface; the read timeout is the maximum read time for reading the interface feedback information when the engine calls the interface; in particular, if the engine tests the interface based on the HTTP protocol, the engine execution parameter item also includes the interface IP (Internet Protocol) address, interface request port, calling method, interface path and Header parameters; wherein the calling method can be set to "POST" (create), "DELETE" (delete), "PUT" (update) and "GET" (view); if the engine tests the interface based on the Web Service protocol, the engine execution parameter item also includes Url (Uniform Resource Locator) information and the interface name; if the engine tests the interface based on the Dubbo protocol, the engine execution parameter item also includes the interface definition file (for example, a library file package in Java format) and the interface configuration file.
[0039] S120. Obtain interface test parameters, a first target engine, and engine execution parameters according to the target interface template filled in with the parameter item information.
[0040] The data information filled in by the tester in the interface test parameter item is the interface test parameter, and the data information filled in by the tester in the engine execution parameter item is the engine test parameter. The engine identifier indicates the number of the engine used by the interface template. The first target engine can be determined based on the engine identifier.
[0041] S130. Execute an interface test through the first target engine according to the interface test parameters and the engine execution parameters, and obtain an interface test result according to interface feedback information.
[0042] According to the engine execution parameters, the target interface to be tested among the multiple business interfaces of the access interface test system can be determined; the engine includes a complete business execution logic, for example, the business execution logic is to send the value 100 to the interface, that is, the engine itself already includes the program code related to executing the "send value 100" action. Since the interface test parameters reflect the parameter requirements of the data information sent to the interface, the above action is executed according to the obtained parameter requirements; after obtaining the data fed back by the business interface, the interface response time, the packet loss rate of the interface response and the amount of data in the interface response can be determined according to the interface feedback information.
[0043] Optionally, in an embodiment of the present invention, the interface testing method further includes: in response to obtaining a template addition instruction, displaying an interface template editing template to obtain a newly added interface template that has been edited; and / or in response to obtaining a first engine addition instruction, displaying an engine editing template to obtain a first newly added engine that has been edited. The interface testing system has an interface template extension function. By displaying an interface template editing template, testers can write parameter items in the interface template according to the test requirements of different business interfaces to meet the test requirements of different business interfaces; wherein the interface template editing template includes a plurality of pre-set optional parameter items for the convenience of testers to choose and use, and can also add all new parameter items appearing in each newly added interface template to the optional parameter items to ensure the integrity of the optional parameter items; the interface testing system also has an engine extension function. By displaying an engine editing template, testers can write different function engines according to different business data. At the same time, the engine editing template also avoids the phenomenon that the user's uploaded engine cannot be recognized due to different engine editing formats; the newly added interface template and the newly added engine template ensure that the interface testing system supports the test of the newly added business interface and realizes the universal support of the business interfaces of different business systems.
[0044] Optionally, in an embodiment of the present invention, after displaying the interface template editing template, it also includes: if an engine selection instruction is obtained through the interface template editing template, the engine execution parameter items of the second target engine are displayed in the interface template editing template; if a second engine addition instruction is obtained through the interface template editing template, the engine editing template is displayed in the interface template editing template to obtain the edited second added engine. By providing the selection of existing engines and the editing function of new engines in the interface template editing template, testers can use existing engines stored in the interface test system or edit new engines when writing interface templates, thereby improving the editing flexibility of interface templates and the editing efficiency of interface templates.
[0045] Optionally, in an embodiment of the present invention, after obtaining the interface test parameters, the first target engine and the engine execution parameters according to the target interface template filled in with the parameter item information, it also includes: creating and saving an interface test task according to the interface test parameters, the first target engine and the engine execution parameters; and executing the target interface test task in response to obtaining a task selection instruction. The interface test system creates and saves an interface test task according to the parameter item information filled in by the user, thereby realizing the reuse of interface test tasks, facilitating testers to retest business interfaces, improving the testers' operational convenience, and avoiding the tedious process of testers repeatedly filling in parameter item information.
[0046] The technical solution provided by the embodiment of the present invention obtains the interface test parameters and engine execution parameters filled in by the user by displaying the interface test parameter items, engine identification items and engine execution parameter items of the target interface template, and executes the interface test according to the first target engine matching the target interface template, thereby realizing the universality test of multiple business interfaces under the interface test system, improving the interface test efficiency, avoiding the development of multiple interface test systems, and reducing the time and labor costs of system development.
[0047] Embodiment 2
[0048] Figure 2 A flowchart of an interface testing method provided in Embodiment 2 of the present invention. This embodiment is specific based on the above technical solution. In this embodiment, the assertion mode item and the assertion execution parameter item in the parameter item information are used to obtain the interface assertion result. The method specifically includes:
[0049] S210. In response to obtaining a template selection instruction, display parameter item information of a target interface template; wherein the parameter item information includes an interface test parameter item, an engine identification item, an engine execution parameter item, an assertion mode, and an assertion execution parameter.
[0050] Assertion is a debugging mechanism, consisting of one or more Boolean expressions, used to verify whether the program code of the business interface meets the expectations of the coder; the assertion mode, that is, the specific verification method, the assertion execution parameter is the assertion value matching the assertion mode, that is, the expected value of the above verification mode; optionally, in an embodiment of the present invention, the assertion mode includes at least one of equal assertion, greater than assertion, less than assertion, range assertion, empty assertion and regular assertion. Equality assertion is to judge whether the interface feedback information is equal to the assertion value, and the assertion value is a specific numerical value; greater than assertion is to judge whether the interface feedback information is greater than the assertion value, and the assertion value is also a specific numerical value; less than assertion is to judge whether the interface feedback information is less than the assertion value, and the assertion value is also a specific numerical value; range assertion is to judge whether the interface feedback information is within a given range interval or within a given enumeration value, and the assertion value is a range interval or an enumeration set; empty assertion is to judge whether the interface feedback information is empty, and the corresponding assertion value is empty; regular assertion is to judge whether the interface feedback information matches a given regular expression, and the assertion value is a regular expression.
[0051] In particular, the assertion mode can also be a composite assertion, that is, a combination of the above-mentioned multiple assertion modes. For example, the symbol “&&” represents the “and” relationship, that is, two or more assertion modes are satisfied at the same time; the symbol “||” represents the “or” relationship, that is, any one of two or more assertion modes is satisfied; the symbol “!” represents the “not” relationship, that is, the opposite of the assertion value; the symbol “()” represents the “priority” relationship, that is, the assertion mode within the symbol is calculated first; the diversified assertion modes enable the interface testing system to perform personalized tests on different business interfaces, and testers can choose different assertion modes according to the data characteristics of different business interfaces, thereby improving the accuracy and matching of the test results.
[0052] S220. According to the target interface template filled with the parameter item information, obtain interface test parameters, a first target engine, engine execution parameters, assertion mode, and assertion execution parameters.
[0053] After obtaining the interface test parameters, the first target engine, the engine execution parameters, the assertion mode and the assertion execution parameters, an interface test task is created and saved, thereby realizing the reuse of the interface test task.
[0054] S230: Execute the interface test through the first target engine according to the interface test parameters and the engine execution parameters.
[0055] S240: Obtain an interface assertion result according to the interface feedback information, the assertion mode, and the assertion execution parameter.
[0056] After obtaining the result data fed back by the interface, the result data is matched with the assertion execution parameters according to the assertion method to determine whether the result data conforms to the assertion execution parameters, that is, to determine whether the result data conforms to the expected data; if the interface assertion result is not conforming, it indicates that there are code defects in the business interface and an error alarm is issued; if the interface assertion result is conforming, it indicates that the code writing of the business interface is more standardized.
[0057] Optionally, in an embodiment of the present invention, before obtaining the interface assertion result according to the interface feedback information, the assertion mode and the assertion execution parameters, it includes: if the data format of the interface feedback information is in Json format, the interface feedback information is parsed through JsonPath; if the data format of the interface feedback information is in Xml format, the interface feedback information is parsed through XPath. According to the return result format in the interface test parameter item, the data format of the obtained interface feedback information can be determined; JsonPath is a parsing tool for Json format data, as an information extraction class library, it can extract specified information from a Json format text; XPath is a parsing tool for Xml format data, which is used to extract specified information from an Xml format text; after parsing the interface feedback information through JsonPath or XPath, according to the assertion mode, the parsing result is matched with the assertion execution parameters to determine whether the interface feedback information meets the assertion execution parameters; through the use of JsonPath and XPath, the Json assertion and Xml assertion of the business interface are realized, the data diversity of the interface test is ensured, and the test support of business interfaces with different data formats is realized.
[0058] The technical solution provided by the embodiment of the present invention, after obtaining the assertion mode and assertion execution parameters according to the assertion mode item and assertion execution parameter item in the parameter item information, obtains the interface assertion result through interface feedback information, assertion mode and assertion execution parameters, thereby realizing assertion testing of the business interface, verifying whether the code of the business interface is accurate, and improving the business processing performance of the interface. At the same time, the data diversity of the interface test also ensures test support for business interfaces with different data formats.
[0059] Embodiment 3
[0060] Figure 3 It is a structural block diagram of an interface testing system disclosed in Embodiment 3 of the present invention, specifically including: an interactive execution module 310, an interface template management module 320, an engine management module 330, a configuration execution module 340, a call execution module 350, a result analysis module 360 and a storage module 370.
[0061] The interactive execution module 310 is used to obtain a template selection instruction, and in response to obtaining the template selection instruction, display the parameter item information of the target interface template; obtain a template addition instruction, and in response to obtaining the template addition instruction, display the interface template editing template to obtain the newly added interface template that has been edited; obtain a first engine addition instruction, and in response to obtaining the first engine addition instruction, display the engine editing template to obtain the first newly added engine that has been edited; obtain an engine selection instruction through the interface template editing template, and display the engine execution parameter items of the second target engine in the interface template editing template; obtain a second engine addition instruction through the interface template editing template, and display the engine editing template in the interface template editing template to obtain the second newly added engine that has been edited; obtain a task selection instruction, and in response to obtaining the task selection instruction, execute the target interface test task by calling the execution module; and display the interface assertion result.
[0062] The interface template management module 320 is used to obtain a matching target interface template in the storage module 370 according to the template selection instruction sent by the interactive execution module 310, and send the target interface template to the interactive execution module 310; obtain an interface template editing template in the storage module 370 according to the template addition instruction sent by the interactive execution module 310, and send the interface template editing template to the interactive execution module 310; and send the edited newly added interface template to the storage module 370.
[0063] The engine management module 330 is used to obtain the engine editing template in the storage module 370 according to the first engine addition instruction or the second engine addition instruction sent by the interactive execution module 310, and send the engine editing template to the interactive execution module 310; send the edited first added engine and the second added engine to the storage module 370; and parse and obtain the engine execution parameter items of the second target engine according to the engine selection instruction sent by the interactive execution module 310, and send the engine execution parameter items of the second target engine to the interactive execution module 310.
[0064] The configuration execution module 340 is used to obtain the interface test parameters, the first target engine and the engine execution parameters according to the target interface template filled in with the parameter item information; or to obtain the interface test parameters, the first target engine, the engine execution parameters, the assertion mode and the assertion execution parameters according to the target interface template filled in with the parameter item information.
[0065] The calling execution module 350 is used to execute the interface test through the first target engine in the storage module 370 according to the interface test parameters and the engine execution parameters.
[0066] The result analysis module 360 is used to obtain the interface test result according to the interface feedback information sent by the first target engine; or to obtain the interface assertion result according to the interface feedback information, the assertion mode and the assertion execution parameter.
[0067] The storage module 370 is used to store interface templates, interface template editing templates, engines, engine editing templates, interface test tasks and interface assertion results.
[0068] According to the technical solution provided by the embodiment of the present invention, the interface testing system displays the interface testing parameter items, engine identification items and engine execution parameter items of the target interface template through the interactive execution module, obtains the interface testing parameters and engine execution parameters filled in by the user by configuring the execution module, and executes the interface test by calling the execution module and the first target engine matching the target interface template, thereby realizing the universality test of multiple business interfaces under the interface testing system, improving the interface testing efficiency, avoiding the development of multiple interface testing systems, and reducing the time cost and labor cost of system development.
[0069] Embodiment 4
[0070] Figure 4 It is a structural block diagram of an interface testing device provided by the fourth embodiment of the present invention, and the device specifically comprises: a target interface template display module 410, a parameter acquisition module 420 and an interface test result acquisition module 430;
[0071] The target interface template display module 410 is used to display parameter item information of the target interface template in response to obtaining the template selection instruction; wherein the parameter item information includes interface test parameter items, engine identification items and engine execution parameter items;
[0072] A parameter acquisition module 420, configured to acquire interface test parameters, a first target engine, and engine execution parameters according to the target interface template filled in with the parameter item information;
[0073] The interface test result acquisition module 430 is used to execute the interface test through the first target engine according to the interface test parameters and the engine execution parameters, and acquire the interface test result according to the interface feedback information.
[0074] The technical solution provided by the embodiment of the present invention obtains the interface test parameters and engine execution parameters filled in by the user by displaying the interface test parameter items, engine identification items and engine execution parameter items of the target interface template, and executes the interface test according to the first target engine matching the target interface template, thereby realizing the universality test of multiple business interfaces under the interface test system, improving the interface test efficiency, avoiding the development of multiple interface test systems, and reducing the time and labor costs of system development.
[0075] Optionally, based on the above technical solution, the interface testing device further includes:
[0076] The interface template editing template display module is used to display the interface template editing template in response to obtaining the template adding instruction to obtain the newly added interface template after editing;
[0077] And / or an engine editing template display module, used for displaying the engine editing template in response to obtaining the first engine adding instruction, so as to obtain the first added engine after editing.
[0078] Optionally, based on the above technical solution, the interface template editing template display module further includes:
[0079] an engine selection instruction acquisition unit, configured to display the engine execution parameter items of the second target engine in the interface template editing template if the engine selection instruction is acquired through the interface template editing template;
[0080] The second engine newly added instruction acquisition unit is used to display the engine editing template in the interface template editing template if the second engine newly added instruction is acquired through the interface template editing template, so as to obtain the edited second newly added engine.
[0081] Optionally, based on the above technical solution, the parameter item information also includes an assertion mode item and an assertion execution parameter item.
[0082] Optionally, based on the above technical solution, the parameter acquisition module is further used to obtain the assertion mode and assertion execution parameters according to the target interface template filled in with the parameter item information.
[0083] Optionally, based on the above technical solution, an interface test result acquisition module is specifically used to obtain an interface assertion result according to the interface feedback information, the assertion mode and the assertion execution parameters.
[0084] Optionally, based on the above technical solution, the interface testing device further includes:
[0085] An interface test task saving module is used to create and save an interface test task according to the interface test parameters, the first target engine and the engine execution parameters; or to create and save an interface test task according to the interface test parameters, the first target engine, the engine execution parameters, the assertion mode and the assertion execution parameters.
[0086] Optionally, based on the above technical solution, the interface testing device further includes:
[0087] The task selection instruction acquisition module is used to execute the target interface test task in response to acquiring the task selection instruction.
[0088] Optionally, based on the above technical solution, the assertion method includes at least one of an equal value assertion, a greater than assertion, a less than assertion, a range assertion, a null assertion and a regular assertion.
[0089] Optionally, based on the above technical solution, the interface testing device further includes:
[0090] A first parsing execution module, configured to parse the interface feedback information through JsonPath if the data format of the interface feedback information is in Json format;
[0091] The second parsing execution module is used to parse the interface feedback information through XPath if the data format of the interface feedback information is in Xml format.
[0092] The above device can execute the interface testing method provided by any embodiment of the present invention, and has the functional modules and beneficial effects corresponding to the execution method. For technical details not described in detail in this embodiment, please refer to the method provided by any embodiment of the present invention.
[0093] Embodiment 5
[0094] Figure 5 This is a schematic diagram of the structure of an electronic device provided in Embodiment 5 of the present invention. Figure 5 A block diagram of an exemplary electronic device 12 suitable for use in implementing embodiments of the present invention is shown. Figure 5 The electronic device 12 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.
[0095] like Figure 5 As shown, the electronic device 12 is in the form of a general purpose computing device. The components of the electronic device 12 may include, but are not limited to: one or more processors or processing units 16, a memory 28, and a bus 18 that connects various system components (including the memory 28 and the processing unit 16).
[0096] Bus 18 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor or a local bus using any of a variety of bus architectures. By way of example, these architectures include, but are not limited to, an Industry Standard Architecture (ISA) bus, a Micro Channel Architecture (MAC) bus, an Enhanced ISA bus, a Video Electronics Standards Association (VESA) local bus, and a Peripheral Component Interconnect (PCI) bus.
[0097] The electronic device 12 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by the electronic device 12, including volatile and non-volatile media, removable and non-removable media.
[0098] The memory 28 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 30 and / or cache memory 32. The electronic device 12 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, the storage system 34 may be used to read and write non-removable, non-volatile magnetic media ( Figure 5 not shown, usually called a "hard drive"). Although Figure 5 Not shown in the figure, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk"), and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, a DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to the bus 18 via one or more data medium interfaces. The memory 28 may include at least one program product having a set (e.g., at least one) of program modules that are configured to perform the functions of the various embodiments of the present invention.
[0099] A program / utility 40 having a set (at least one) of program modules 42 may be stored, for example, in the memory 28, such program modules 42 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment. The program modules 42 generally perform the functions and / or methods of the embodiments described herein.
[0100] The electronic device 12 may also communicate with one or more external devices 14 (e.g., keyboards, pointing devices, displays 24, etc.), may communicate with one or more devices that enable a user to interact with the electronic device 12, and / or may communicate with any device that enables the electronic device 12 to communicate with one or more other computing devices (e.g., network cards, modems, etc.). Such communication may be performed via an input / output (I / O) interface 22. Furthermore, the electronic device 12 may also communicate with one or more networks (e.g., local area networks (LANs), wide area networks (WANs), and / or public networks, such as the Internet) via a network adapter 20. As shown, the network adapter 20 communicates with other modules of the electronic device 12 via a bus 18. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 12, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0101] The processing unit 16 executes various functional applications and data processing by running the program stored in the memory 28, such as implementing the interface testing method provided by the embodiment of the present invention. That is: in response to obtaining the template selection instruction, the parameter item information of the target interface template is displayed; wherein the parameter item information includes the interface test parameter item, the engine identification item and the engine execution parameter item; according to the target interface template filled in with the parameter item information, the interface test parameters, the first target engine and the engine execution parameters are obtained; according to the interface test parameters and the engine execution parameters, the interface test is performed through the first target engine, and the interface test result is obtained according to the interface feedback information.
[0102] Embodiment 6
[0103] Embodiment 6 of the present invention further provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the interface testing method according to any embodiment of the present invention is implemented; the method includes:
[0104] In response to obtaining the template selection instruction, displaying parameter item information of the target interface template; wherein the parameter item information includes interface test parameter items, engine identification items and engine execution parameter items;
[0105] According to the target interface template filled with the parameter item information, obtaining interface test parameters, a first target engine and engine execution parameters;
[0106] According to the interface test parameters and the engine execution parameters, the interface test is performed through the first target engine, and the interface test result is obtained according to the interface feedback information.
[0107] The computer storage medium of the embodiment of the present invention can adopt any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, a computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by an instruction execution system, device or device or used in combination with it.
[0108] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, which carry computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.
[0109] Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
[0110] Computer program code for performing the operations of the present invention may be written in one or more programming languages or a combination thereof, including object-oriented programming languages such as Java, Smalltalk, C++, and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).
[0111] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.
Claims
1. An interface testing method, characterized in that: Applied to interface test systems, including: In response to obtaining the template selection instruction, the parameter item information of the target interface template is displayed; wherein, the parameter item information includes interface test parameter items, engine identification items and engine execution parameter items; the interface test parameter items include interface name, call protocol type, request parameter format, request body structure and return result format; the call protocol type indicates the communication protocol type supported by the business interface; the engine is a program component of the interface test system, and the interface test system calls the interface through the engine, and sends test data to the interface through the engine; the engine identification item indicates the number of the engine used by the interface template; the engine execution parameter item is the addressing information when testing the interface; different engines correspond to different business interfaces; different interface templates correspond to different business interfaces; After the target interface template is displayed, if the engine ID modification instruction issued by the tester is obtained, the modified engine ID is used as the engine ID corresponding to the target interface template; the interface template is edited based on the interface template editing template; the engine is edited based on the engine editing template; According to the target interface template filled with the parameter item information, obtaining interface test parameters, a first target engine and engine execution parameters; According to the interface test parameters and the engine execution parameters, the interface test is performed through the first target engine, and the interface test result is obtained according to the interface feedback information.
2. The method according to claim 1, characterized in that The interface testing method further includes: In response to obtaining the template adding instruction, displaying the interface template editing template to obtain the newly added interface template after editing; And / or in response to obtaining the first engine adding instruction, displaying the engine editing template to obtain the first added engine after editing.
3. The method according to claim 2, characterized in that After showing the interface template edit template, also include: If the engine selection instruction is obtained through the interface template editing template, the engine execution parameter items of the second target engine are displayed in the interface template editing template; If the second engine adding instruction is obtained through the interface template editing template, the engine editing template is displayed in the interface template editing template to obtain the second added engine after the editing is completed.
4. The method according to claim 1, characterized in that: The parameter item information also includes an assertion mode item and an assertion execution parameter item; After displaying the parameter item information of the target interface template, it also includes: Acquire assertion mode and assertion execution parameters according to the target interface template filled in with the parameter item information; The obtaining of the interface test result according to the interface feedback information includes: The interface assertion result is obtained according to the interface feedback information, the assertion mode and the assertion execution parameter.
5. The method according to claim 4, characterized in that After obtaining the interface test parameters, the first target engine and the engine execution parameters according to the target interface template filled in with the parameter item information, the following further includes: Creating and saving an interface test task according to the interface test parameters, the first target engine, and the engine execution parameters; or creating and saving an interface test task according to the interface test parameters, the first target engine, the engine execution parameters, the assertion mode and the assertion execution parameters; In response to obtaining the task selection instruction, the target interface test task is executed.
6. The method according to claim 4, characterized in that The assertion mode includes at least one of an equal value assertion, a greater than assertion, a less than assertion, a range assertion, a null assertion, and a regular assertion.
7. The method according to claim 6, characterized in that Before obtaining the interface assertion result according to the interface feedback information, the assertion mode and the assertion execution parameter, the method includes: If the data format of the interface feedback information is in Json format, the interface feedback information is parsed through JsonPath; If the data format of the interface feedback information is in Xml format, the interface feedback information is parsed through XPath.
8. An interface testing device, characterized in that: Applied to interface test systems, including: The target interface template display module is used to display the parameter item information of the target interface template in response to obtaining the template selection instruction; wherein the parameter item information includes the interface test parameter item, the engine identification item and the engine execution parameter item; the interface test parameter item includes the interface name, the calling protocol type, the request parameter format, the request body structure and the return result format; the calling protocol type indicates the communication protocol type supported by the business interface; the engine is the program component of the interface test system, and the interface test system calls the interface through the engine, and sends the test data to the interface through the engine; the engine identification item indicates the number of the engine used by the interface template; the engine execution parameter item is the addressing information when testing the interface; different engines correspond to different business interfaces; different interface templates correspond to different business interfaces; The interface testing system is also used to, after displaying the target interface template, if an engine identification modification instruction issued by the tester is obtained, use the modified engine identification as the engine identification corresponding to the target interface template; the interface template is edited based on the interface template editing template; the engine is edited based on the engine editing template; A parameter acquisition module, used to acquire interface test parameters, a first target engine and engine execution parameters according to the target interface template filled in with the parameter item information; The interface test result acquisition module is used to execute the interface test through the first target engine according to the interface test parameters and the engine execution parameters, and acquire the interface test result according to the interface feedback information.
9. An electronic device, characterized in that: The electronic device comprises: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the interface testing method as described in any one of claims 1-7.
10. A storage medium comprising computer executable instructions, wherein the computer executable instructions are used to perform the interface testing method according to any one of claims 1 to 7 when executed by a computer processor.
Citation Information
Patent Citations
Software interface test system and method
CN106021090A
Interface testing method and apparatus, computer equipment and storage medium
CN107908541A
Software testing method and device and electronic device
CN110674047A
Interface testing method and device, equipment and storage medium
CN112988555A
Generic software testing system and mechanism
US20040143819A1
