Interface testing method and device, electronic equipment, storage medium and program product
By installing the automatic interface testing tool on the local server to automatically generate and process XML messages, it solves the problems of low execution efficiency and high labor cost of existing interface testing methods, and realizes the automation and efficiency improvement of interface testing.
Patent Information
- Application Number
- CN202410701890.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-31
- Publication Date
- 2024-08-30
AI Technical Summary
Existing interface testing methods have low execution efficiency, resulting in high labor costs. Testers need to frequently manually modify XML messages for interface testing.
Install the interface automatic testing tool on the local server, automatically generate XML messages, obtain the parameters required for interface calls, store them in the parameter configuration file, and automatically read the messages to be sent from the message configuration file, send them to the application server, and obtain Test the packet and format it to complete the interface test.
It reduces human operations in the interface testing process, improves testing efficiency, reduces labor costs, and realizes the automation of interface testing.
Smart Images

Figure CN118567985A
Abstract
Description
Technical Field
[0001] The present application relates to the field of financial technology or other related fields, and in particular to an interface testing method, device, electronic device, storage medium and program product. Background Art
[0002] To ensure that the interfaces between different software systems can communicate and interact in accordance with specifications and expectations, interface testing will be used to verify the correctness, stability, reliability and security of the interfaces to ensure data exchange and information transfer between systems.
[0003] In the prior art, when performing interface testing, some applications use XML messages for interaction. Testers need to frequently modify XML messages during interface testing and then manually upload XML messages to interface testing tools to implement interface testing in different scenarios.
[0004] However, the inventors have discovered that the interface testing method in the prior art has at least the following technical problems: low test execution efficiency, resulting in high labor costs. Summary of the invention
[0005] The present application provides an interface testing method, device, electronic device, storage medium and program product to solve the technical problem of low test execution efficiency and high labor cost.
[0006] In a first aspect, the present application provides an interface testing method, which is applied to a local server, wherein an interface automatic testing tool is installed in the local server, and the interface automatic testing tool is used to automatically generate an extensible markup language XML message; the interface testing method comprises:
[0007] Get the parameters required for the interface call;
[0008] The parameters required for the interface call are stored in a parameter configuration file of the interface automatic test tool, and the message to be sent is stored in a storage space under the reading path of the message configuration file;
[0009] Reading the message to be sent from the storage space under the reading path of the message configuration file through the interface automatic testing tool;
[0010] Sending the parameter configuration file and the message to be sent to an application server to obtain a test message returned from the application server;
[0011] The test message is formatted to obtain an XML test message and displayed to complete the interface test.
[0012] In some implementations, the obtaining of the parameters required for the interface includes: obtaining the parameters required for the interface call in response to a file configuration operation performed by a tester through the interface automatic testing tool.
[0013] In some implementations, the parameters required for the interface call include application server IP, communication pre-information, database information, and message file reading path.
[0014] In some embodiments, the method of reading the message to be sent from the storage space under the reading path of the message configuration file by the interface automatic testing tool includes: when it is detected that the message to be sent is in XML file format, the interface automatic testing tool automatically reads the XML file in the storage space under the reading path of the message configuration file, wherein each XML file contains an XML message; when it is detected that the message to be sent is in text TXT file format, the interface automatic testing tool automatically reads the TXT file in the storage space under the reading path of the message configuration file, wherein the TXT file contains multiple XML messages, each XML message is separated by a message number separator, and all message numbers in each XML file are not repeated; when it is detected that the above-mentioned message is in the initialization INI file format, the interface automatic testing tool automatically reads the INI file in the storage space under the reading path of the message configuration file, wherein the INI file includes field names and field comments, and the field names of the INI file correspond one-to-one to the tags of the XML file in the storage space under the reading path of the message configuration file, and the field comments of the INI file are used to fill in test data.
[0015] In some implementations, when the message to be sent is a text TXT file, and the TXT contains multiple XML messages; accordingly, the sending of the parameter configuration file and the message to be sent to the application server to obtain the test message returned from the application server includes: splitting the TXT file into multiple XML messages through the interface automatic test tool; sending the parameter configuration file and the multiple XML messages to the application server one by one through the interface automatic test tool to obtain the test messages returned from the application server one by one.
[0016] In some implementations, the method further includes: exporting the XML test message to a local archive file, wherein the local archive file includes a test time, an automatically generated message number, a user-defined message number, a message to be sent, and an XML test message.
[0017] In some implementations, it also includes: when it is detected that the version in the application server of this interface test is different from the version in the application server of the previous interface test, the parameters required for the interface call are automatically replaced with the parameters required for the target interface call according to the version in the application server of this interface test.
[0018] In a second aspect, the present application provides an interface testing device, which is applied to a local server, wherein an interface automatic testing tool is installed in the local server, and the interface automatic testing tool is used to automatically generate an extensible markup language XML message; the interface testing device comprises:
[0019] Configuration file module, used to obtain the parameters required for interface calls;
[0020] The configuration file module is further used to store the parameters required for the interface call in the parameter configuration file of the interface automatic test tool, and store the message to be sent in the storage space under the reading path of the message configuration file;
[0021] A message processing module to be sent, used for reading the message to be sent from the storage space under the reading path of the message configuration file through the interface automatic test tool;
[0022] The message sending module is further used to send the parameter configuration file and the message to be sent to the application server to obtain a test message returned from the application server;
[0023] The message processing module is returned to format the test message, obtain the XML test message and display it to complete the interface test.
[0024] In some implementations, it also includes: a test record archiving module, which is used to export the XML test message to a local archive file, and the local archive file includes the test time, automatically generated message number, user-defined message number, message to be sent and XML test message.
[0025] In a third aspect, the present application provides an electronic device, comprising: a processor, and a memory communicatively connected to the processor;
[0026] The memory stores computer-executable instructions;
[0027] The processor executes the computer-executable instructions stored in the memory to implement the method described in the first aspect.
[0028] In a fourth aspect, the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed by a processor, they are used to implement the method described in the first aspect.
[0029] In a fifth aspect, the present application provides a computer program product, comprising a computer program, which implements the method described in the first aspect when executed by a processor.
[0030] The interface testing method, device, electronic device, storage medium and program product provided by the present application, wherein the method installs a pre-made interface automatic testing tool on a local server, stores the acquired parameters required for the interface call in the parameter configuration file of this interface automatic testing space, and places the message to be sent in the storage space under the reading path of the configuration file, and then reads the message to be sent from the storage space under the reading path through the interface automatic testing tool, and then sends the parameter configuration file and the message to be sent to the application server to obtain the test message returned from the application server, and finally formats the test message to obtain and display an XML test message, thereby reducing manual operations during the interface testing process, automatically executing the process of reading and sending messages, improving the execution efficiency of the interface testing, and reducing the labor cost of the interface testing. BRIEF DESCRIPTION OF THE DRAWINGS
[0031] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0032] Figure 1 A schematic diagram of an application scenario of the interface testing method provided in an embodiment of the present application.
[0033] Figure 2 A schematic diagram of the operating interface of the interface automatic testing tool provided in an embodiment of the present application.
[0034] Figure 3 A flowchart of an interface testing method provided in an embodiment of the present application.
[0035] Figure 4 A schematic diagram of the structure of the interface testing device provided in the embodiment of the present application Figure 1 .
[0036] Figure 5 A schematic diagram of the structure of the interface testing device provided in the embodiment of the present application Figure 2 .
[0037] Figure 6 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application.
[0038] The above-mentioned drawings have shown clear embodiments of the present application, which will be described in more detail hereinafter. These drawings and textual descriptions are not intended to limit the scope of the concept of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION
[0039] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.
[0040] It should be noted that the interface testing method, device, electronic device, storage medium and program product of the present application can be used in the field of financial technology, and can also be used in any field other than the field of financial technology. The application field of the interface testing method, device, electronic device, storage medium and program product of the present application is not limited.
[0041] At present, interface testing is a testing method for testing the interface between system components. Interface testing is mainly used to detect the interaction points between external systems and systems and between internal subsystems. The focus of the test is to check the data exchange, transmission and control management process, as well as the mutual logical dependencies between systems. Commonly used interface testing tools include Postman. Postman is equivalent to a client that can simulate various types of HTTP requests initiated by users, send request data to the server, obtain corresponding response results, and complete interface testing. However, when the inventor used this type of interface testing tool for interface testing, he found that existing interface testing tools, such as Postman, require testers to manually upload XML messages, cannot read and write databases, cannot read local configuration files to automatically upload multiple test data, and cannot automatically archive multiple return results. There is a problem of low interface testing efficiency and high labor costs.
[0042] In order to solve the above technical problems, the inventors proposed the following technical ideas: by designing an interface testing tool that automatically generates and uploads XML messages, the testing tool allows testers to store personalized parameters required for interface calls, such as application server IP, etc., in the tool's configuration file config.ini. At the same time, it can automatically read a single or multiple XML data from a local file as an upload message, and automatically upload it to the application server. After obtaining the return message, it is automatically formatted into XML format and displayed to the tester to complete the interface test. The actions and participation of the tester in the interface test process are reduced, the interface test execution efficiency is improved, and the labor cost of the interface test is reduced.
[0043] Figure 1 A schematic diagram of an application scenario of the interface testing method provided in an embodiment of the present application.
[0044] like Figure 1 As shown, the application scenario of the interface testing method includes: a terminal 101, a local server 102 and an application server 103.
[0045] Among them, the terminal 101 is used for the tester to store the personalized parameters required for the interface call in the configuration file config.ini of the tool and display the test results returned from the application server 103. The local server 102 is used to store the personalized parameters required for calling the interface to be tested, such as the application server IP, communication pre-information, database information, message file reading path, etc., in the configuration file config.ini generated in response to the tester's operation on the terminal 101, and send a message to the application server 103. The application server 103 is used to obtain the corresponding response result for the sent message and return it to the local server in the form of a message. The local server 102 automatically formats the returned message into the xml format and forms the test result through the terminal 101 and displays it to the tester to complete the interface test.
[0046] Figure 2 A schematic diagram of the operating interface of the interface automatic testing tool provided in an embodiment of the present application.
[0047] like Figure 2As shown, the tester can use the terminal to perform parameter configuration and storage operations on the operation interface of the interface automatic testing tool. The interface automatic testing tool can be an improved tool based on existing interface testing tools such as Postman. In this embodiment, the interface automatic testing tool includes a personalized parameter configuration file config.ini and an uploaded message configuration file config,xml, wherein config.ini is used to store personalized parameters required to call the interface to be tested, such as parameters related to the test environment and the storage path of the message to be sent. The reading path of the message file to be sent is configured in config,xml, so that the interface automatic testing tool can automatically perform file reading and processing operations on the above-mentioned files. Figure 1 and Figure 2 As shown, when the tester uses the interface automatic testing tool installed in the terminal and the local server, he first completes the configuration of config.ini and config.xml. Subsequently, the interface automatic testing tool will automatically complete the corresponding interface testing process.
[0048] Figure 3 A flowchart of an interface testing method provided in an embodiment of the present application.
[0049] The execution subject of this embodiment can be Figure 1 The local server 102 in the illustrated embodiment is applied to a local server, and an interface automatic testing tool is installed in the local server. The interface automatic testing tool is used to automatically generate extensible markup language XML messages. Of course, the executor of this embodiment may also be other computer-related devices, and there is no particular limitation on this embodiment.
[0050] The interface testing method provided in this application is intended to solve the above technical problems in the prior art.
[0051] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.
[0052] like Figure 3 As shown, the embodiment of the present application provides an interface testing method, comprising the following steps:
[0053] S301: Obtain parameters required for interface calling.
[0054] In this embodiment, obtaining the parameters required for the interface call may be automatically reading the parameters required for the interface that are manually set in advance according to different interface test environments, or may be manually set.
[0055] In an optional embodiment of the present application, step S301 specifically includes: in response to the file configuration operation performed by the tester through the interface automatic testing tool, obtaining the parameters required for the interface call.
[0056] In this embodiment, the tester can Figure 1 The terminal 101 shown, namely the keyboard, mouse and screen, uses the parameter configuration file config.ini of the interface automatic testing tool of the local server to store the personalized parameters required to call the interface to be tested. These interface required parameters can be parameters related to data interaction, transmission and control management process.
[0057] Specifically, in an optional embodiment of the present application, the interface required parameters described in step S201 include: application server IP, communication pre-information, database information and message file reading path.
[0058] In this embodiment, the application server IP may be the IP address or domain name of the application server where the interface to be tested is located. The communication pre-information may be authentication information for identity authentication for interface access. The database information may be database connection information such as database type, host address, port number, user name, and user password. The message file reading path may be a file path for storing messages to be sent by the interface.
[0059] S302: Storing parameters required for the interface call in a parameter configuration file of the interface automatic test tool, and storing the message to be sent in a storage space under the reading path of the message configuration file.
[0060] In this embodiment, the parameter configuration file can be Figure 2 The personalized parameter configuration file config.ini in the illustrated embodiment is used to store personalized parameters required for calling the interface to be tested, such as parameters related to the test environment and the storage path of the message to be sent. The message configuration file can be Figure 2 In the embodiment shown, the uploading message file config.xml configures the reading path of the message file to be sent in config.xml, so that the interface automatic test tool can automatically read and process the file to be sent. The message to be sent is stored in the storage space under the reading path of the message configuration file, and the interface automatic test tool can automatically read the message to be sent from the storage space.
[0061] S303: Read the message to be sent from the storage space under the reading path of the message configuration file through the interface automatic test tool.
[0062] In this embodiment, reading the message to be sent refers to indexing the message to be sent that needs to be sent according to the reading path of the message configuration file config,xml, and then reading the indexed message to be sent.
[0063] In an optional embodiment of the present application, in this embodiment, the storage space under the reading path of the message configuration file may contain files in the following three formats, namely, XML files, TXT files, and INI files. Based on this, for files of different formats, the reading methods are also different. Specifically, step S303 includes:
[0064] S303a: When it is detected that the message to be sent is in XML file format, the interface automatic test tool automatically reads XML files in the storage space under the reading path of the message configuration file, wherein each XML file contains an XML message.
[0065] In this embodiment, the XML message written by the tester is kept in XML file format, and each XML file can only store one complete XML message.
[0066] S303b: When it is detected that the message to be sent is in the TXT file format, the interface automatic test tool automatically reads the TXT file in the storage space under the reading path of the message configuration file, where the TXT file contains multiple XML messages, each XML message is separated by a message number separator, and all message numbers in each TXT file are not repeated.
[0067] In this embodiment, when the tester wants to select multiple XML messages to upload at one time, the multiple messages can be stored in TXT file format to obtain a TXT file. Each message is separated by a message number, for example, the message number separator is ===[messageId]===, where messageId is the message number. The message number can be an automatically generated serial number, and the message number is not repeated in the same TXT file.
[0068] S303c: When it is detected that the above-mentioned message is in the format of an initialized INI file, the interface automatic test tool automatically reads the INI file in the storage space under the reading path of the message configuration file, wherein the INI file includes field names and field comments, and the field names of the INI file correspond one-to-one to the tags of the XML file in the storage space under the reading path of the message configuration file, and the field comments of the INI file are used to fill in the test data.
[0069] In this embodiment, the INI file can be used in conjunction with the XML file. When the message to be sent is stored in the INI file format, the test data filled in by the tester can be known. At this time, the interface automatic testing tool can automatically generate an XML message based on the test data in the INI file.
[0070] S304: Send the parameter configuration file and the message to be sent to the application server to obtain a test message returned from the application server.
[0071] In this embodiment, the application server refers to the server where the interface to be tested is located. When the application server receives a request for interface test simulation, it will respond to the request, parameter configuration file, and message to be sent, perform environmental operations such as legitimacy verification and business processing, and return a response message as a test message.
[0072] Specifically, in an optional embodiment of the present application, when the message to be sent is a text TXT file, and the TXT contains multiple XML messages, correspondingly, step S304 includes:
[0073] S304a: Split the TXT file into multiple XML messages using the interface automatic testing tool.
[0074] S304b: Send the parameter configuration file and multiple XML messages to the application server one by one through the interface automatic test tool, so as to obtain the test messages returned from the application server one by one.
[0075] In this embodiment, when the user selects a file to be sent in a TXT file to upload, the interface automatic test tool first automatically splits the TXT file into multiple messages, and sends the messages to be sent to the application server one by one, which is equivalent to sending an interface test request. It should be noted that the messages to be sent and the test messages returned by the application server also appear in pairs, and one message to be sent corresponds to one test message, so that the tester can check the test results on the local server and grasp the details of the interface test.
[0076] S305: Format the test message to obtain an XML test message and display it to complete the interface test.
[0077] In this embodiment, formatting the test message may be first copying the test message returned by the application server, then performing a text editing operation, and converting the test message into an XML format message. The process of displaying the XML test message may be sending the XML test message to the terminal for display in the form of a graphical interface and text.
[0078] In summary, the interface testing method provided by the embodiment of the present application installs a pre-made interface automatic testing tool on a local server, stores the acquired parameters required for the interface call in the parameter configuration file of this interface automatic testing space, and places the message to be sent in the storage space under the reading path of the configuration file, and then reads the message to be sent from the storage space under the reading path through the interface automatic testing tool, and then sends the parameter configuration file and the message to be sent to the application server to obtain the test message returned from the application server, and finally formats the test message to obtain and display an XML test message, thereby reducing manual operations in the interface testing process, automatically executing the process of reading and sending messages, improving the execution efficiency of the interface testing, and reducing the labor cost of the interface testing.
[0079] Based on the above embodiment, the interface testing method provided in an optional embodiment of the present application further includes:
[0080] Step A: Export the XML test message to a local archive file. The local archive file includes the test time, automatically generated message number, user-defined message number, sent message, and returned message.
[0081] In this embodiment, exporting to a local archive file refers to saving all XML test messages into a local folder in a local server, where the local folder is used to store XML test messages for interface testing, wherein the local folder includes the test time of each interface test, the automatically generated message number messageId, messages to be sent, and XML test messages.
[0082] In summary, by using the interface automatic testing tool to export the XML test message, and at the same time save the relevant information of the interface test corresponding to the XML test message, such as the test time, the message to be sent, and the message number, the test records of the interface test are automatically archived, which facilitates the testers to conduct regression testing and review in the future, further reduces the subsequent work time of the testers, and thus achieves the purpose of saving time and effort.
[0083] On the basis of the above embodiment, an interface testing method provided as an optional embodiment of the present application further includes:
[0084] Step B: When it is detected that the version in the application server of this interface test is different from the version in the application server of the previous interface test, the parameters required for the interface call are automatically replaced with the parameters required for the target interface call according to the version in the application server of this interface test.
[0085] In this embodiment, the version of the application server can be the system version in the application server, and the version of the application server for the interface test can be determined according to the interface to be tested and the IP of the application server. When the system versions of the application servers are different, it indicates that the test environments will also be different. When the system versions are the same, the originally configured parameter configuration files can be directly used when other interface tests are performed later. This can save more time and improve the execution efficiency of the interface test.
[0086] In this embodiment, the inventor found that when the system version is different, the interface testing method provided in the embodiment of the present application can also automatically modify the parameters required for the interface call used in the last interface test according to the version in the application server, and replace the parameters required for the last interface call with the parameters required for the target interface call. For example: when the application servers are different, and other test environments are the same, you only need to modify the application server IP to automatically replace the parameters required for the interface call with the parameters required for the target interface call.
[0087] It should be noted that the local server applied to the local server described in any embodiment of the above-mentioned interface testing method does not only refer to a specific server. All servers used by testers who need to perform interface testing can be called local servers, which are used to install the interface automatic testing tool described in the above-mentioned embodiments.
[0088] Figure 4 A schematic diagram of the structure of the interface testing device provided in the embodiment of the present application Figure 1 .
[0089] like Figure 4 As shown, the interface testing device is applied to a local server, in which an interface automatic testing tool is installed, and the interface automatic testing tool is used to automatically generate an extensible markup language XML message; the interface testing device includes: a configuration file module 41, a message processing module 42 to be sent, a message sending module 43 and a return message processing module 44.
[0090] The configuration file module 41 is used to obtain the parameters required for the interface call.
[0091] The configuration file module 41 is also used to store the parameters required for the interface call in the parameter configuration file of the interface automatic test tool, and store the message to be sent in the storage space under the reading path of the message configuration file;
[0092] The message processing module 42 to be sent is used to read the message to be sent from the storage space under the reading path of the message configuration file through the interface automatic test tool;
[0093] The message sending module 43 is further used to send the parameter configuration file and the message to be sent to the application server to obtain the test message returned from the application server;
[0094] Return to the message processing module 44, which is used to format the test message, obtain the XML test message and display it to complete the interface test.
[0095] In an optional embodiment of the present application, the configuration file module 41 is specifically used to obtain parameters required for interface calling in response to file configuration operations performed by testers through an interface automatic testing tool.
[0096] In an optional embodiment of the present application, the configuration file module 41 is used to obtain the parameters required for the interface call including the application server IP, communication pre-information, database information and the message file reading path.
[0097] In an optional embodiment of the present application, the message processing module 42 to be sent is specifically used for: when it is detected that the message to be sent is in XML file format, the interface automatic test tool is used to automatically select the XML file in the storage space under the reading path of the message configuration file, wherein each XML file contains an XML message; when it is detected that the message to be sent is in text TXT file format, the interface automatic test tool is used to automatically select the TXT file in the storage space under the reading path of the message configuration file, wherein the TXT file contains multiple XML messages, each XML message is separated by a message number separator, and all message numbers in each XML file are not repeated; when it is detected that the above message is in the initialization INI file format, the interface automatic test tool is used to automatically select the INI file in the storage space under the reading path of the message configuration file, wherein the INI file includes field names and field comments, and the field names of the INI file correspond one-to-one to the tags of the XML file in the storage space under the reading path of the message configuration file, and the field comments of the INI file are used to fill in test data.
[0098] In an optional embodiment of the present application, the message sending module 43 is specifically used to: split the TXT file into multiple XML messages through the interface automatic testing tool; send the parameter configuration file and multiple XML messages to the application server one by one through the interface automatic testing tool to obtain the test messages returned from the application server one by one.
[0099] Figure 5 A schematic diagram of the structure of the interface testing device provided in the embodiment of the present application Figure 2 .
[0100] like Figure 5As shown, the interface testing device provided in an optional embodiment of the present application also includes: a test record archiving module 45, which is used to export the XML test message to a local archive file, and the local archive file includes the test time, the automatically generated message number, the user-defined message number, the message to be sent and the XML test message.
[0101] In an optional embodiment of the present application, the parameter configuration module 41 is also used to: when it is detected that the version in the application server of this interface test is different from the version in the application server of the previous interface test, automatically replace the parameters required for the interface call with the parameters required for the target interface call according to the version in the application server of this interface test.
[0102] The interface testing device provided in this embodiment can be used to execute the technical solution of the above method embodiment. Its implementation principle and technical effect are similar, and this embodiment will not be repeated here.
[0103] Figure 6 A schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present application is shown in FIG. Figure 6 As shown, the electronic device includes: a processor 601, and a memory 602 communicatively connected to the processor.
[0104] The memory 602 stores computer-executable instructions.
[0105] The processor 601 executes the computer-executable instructions stored in the memory 602 to implement the various steps involved in the above method embodiment. For details, please refer to the relevant description in the above method embodiment.
[0106] Optionally, the memory 602 may be independent or integrated with the processor 601 .
[0107] When the memory 602 is independently provided, the electronic device further includes a bus 603 for connecting the memory 602 and the processor 601 .
[0108] An embodiment of the present application also provides a computer-readable storage medium, in which computer-executable instructions are stored. When the computer-executable instructions are executed by a processor, the interface testing method described in the above method embodiment is implemented.
[0109] An embodiment of the present application also provides a computer program product, including a computer program, which, when executed by a processor, implements the interface testing method described in the above embodiment.
[0110] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the above modules is only a logical function division. There may be other division methods in actual implementation, such as multiple modules can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or modules, which can be electrical, mechanical or other forms.
[0111] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all optional embodiments, and the actions and modules involved are not necessarily required by the present application.
[0112] It should be further noted that, although the various steps in the flowchart are displayed in sequence according to the indication of the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless there is a clear description in this article, the execution of these steps is not strictly limited in order, and these steps can be executed in other orders. Moreover, at least a portion of the steps in the flowchart may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but can be executed at different times, and the execution order of these sub-steps or stages is not necessarily to be carried out in sequence, but can be executed in turn or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
[0113] It should be understood that the above-mentioned device embodiments are only illustrative, and the device of the present application can also be implemented in other ways. For example, the division of units / modules in the above-mentioned embodiments is only a logical function division, and there may be other division methods in actual implementation. For example, multiple units, modules or components can be combined, or can be integrated into another system, or some features can be ignored or not executed.
[0114] In addition, unless otherwise specified, each functional unit / module in each embodiment of the present application may be integrated into one unit / module, each unit / module may exist physically separately, or two or more units / modules may be integrated together. The above-mentioned integrated unit / module may be implemented in the form of hardware or in the form of a software program module.
[0115] If the integrated unit / module is implemented in the form of hardware, the hardware may be a digital circuit, an analog circuit, etc. The physical implementation of the hardware structure includes but is not limited to transistors, memristors, etc. If not specifically stated, the processor may be any appropriate hardware processor, such as a CPU, a GPU, an FPGA, a DSP, an ASIC, etc. If not specifically stated, the storage unit may be any appropriate magnetic storage medium or magneto-optical storage medium, such as a resistive random access memory RRAM (Resistive Random Access Memory), a dynamic random access memory DRAM (Dynamic Random Access Memory), a static random access memory SRAM (Static Random-Access Memory), an enhanced dynamic random access memory EDRAM (Enhanced Dynamic Random Access Memory), a high-bandwidth memory HBM (High-Bandwidth Memory), a hybrid memory cube HMC (Hybrid Memory Cube), etc.
[0116] If the integrated unit / module is implemented in the form of a software program module and sold or used as an independent product, it can be stored in a computer-readable memory. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or all or part of the technical solution, can be embodied in the form of a software product, which is stored in a memory and includes several instructions for a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the various embodiments of the present application. The aforementioned memory includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk and other media that can store program codes.
[0117] In the above embodiments, the description of each embodiment has its own emphasis. For parts not described in detail in a certain embodiment, please refer to the relevant description of other embodiments. The technical features of the above embodiments can be combined arbitrarily. In order to make the description concise, all possible combinations of the technical features in the above embodiments are not described. However, as long as there is no contradiction in the combination of these technical features, they should be considered to be within the scope of this specification.
[0118] Those skilled in the art will readily appreciate other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any modification, use or adaptation of the present application, which follows the general principles of the present application and includes common knowledge or customary techniques in the art that are not disclosed in the present application. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present application are indicated by the following claims.
[0119] It should be understood that the present application is not limited to the precise structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present application is limited only by the appended claims.
Claims
1. An interface testing method, It is characterized in that Applied to a local server, the local server is installed with an interface automatic testing tool, the interface automatic testing tool is used to automatically generate an extensible markup language XML message; the interface testing method includes: Get the parameters required for the interface call; The parameters required for the interface call are stored in a parameter configuration file of the interface automatic test tool, and the message to be sent is stored in a storage space under the reading path of the message configuration file; Reading the message to be sent from the storage space under the reading path of the message configuration file through the interface automatic testing tool; Sending the parameter configuration file and the message to be sent to an application server to obtain a test message returned from the application server; The test message is formatted to obtain an XML test message and displayed to complete the interface test.
2. The method according to claim 1, It is characterized in that The parameters required by the acquisition interface include: In response to the file configuration operation performed by the tester through the interface automatic testing tool, the parameters required for the interface call are obtained.
3. The method according to claim 2, It is characterized in that The parameters required for the interface call include the application server IP, communication pre-information, database information and message file reading path.
4. The method according to claim 1, It is characterized in that The step of reading the message to be sent from the storage space under the reading path of the message configuration file by the interface automatic test tool includes: When it is detected that the message to be sent is in XML file format, the interface automatic test tool automatically reads XML files in the storage space under the reading path of the message configuration file, wherein each XML file contains an XML message; When it is detected that the message to be sent is in a text TXT file format, the interface automatic test tool automatically reads a TXT file in the storage space under the reading path of the message configuration file, wherein the TXT file contains multiple XML messages, each XML message is separated by a message number separator, and all message numbers in each XML file are not repeated; When it is detected that the above-mentioned message is in the format of an initialized INI file, the interface automatic testing tool automatically reads the INI file in the storage space under the reading path of the message configuration file, wherein the INI file includes field names and field comments, and the field names of the INI file correspond one-to-one to the tags of the XML file in the storage space under the reading path of the message configuration file, and the field comments of the INI file are used to fill in test data.
5. The method according to claim 4, It is characterized in that When the message to be sent is a text TXT file, and the TXT contains multiple XML messages; Accordingly, the sending of the parameter configuration file and the message to be sent to the application server to obtain the test message returned from the application server includes: Splitting the TXT file into multiple XML messages through the interface automatic testing tool; The parameter configuration file and the multiple XML messages are sent to the application server one by one through the interface automatic testing tool, so as to obtain the test messages returned from the application server one by one.
6. The method according to claim 1, It is characterized in that Also includes: The XML test message is exported to a local archive file, wherein the local archive file includes the test time, the automatically generated message number, the user-defined message number, the message to be sent and the XML test message.
7. The method according to any one of claims 1 to 6, It is characterized in that Also includes: When it is detected that the version in the application server of this interface test is different from the version in the application server of the previous interface test, the parameters required for the interface call are automatically replaced with the parameters required for the target interface call according to the version in the application server of this interface test.
8. An interface testing device, It is characterized in that Applied to a local server, the local server is installed with an interface automatic testing tool, the interface automatic testing tool is used to automatically generate an extensible markup language XML message; the interface testing device includes: Configuration file module, used to obtain the parameters required for interface calls; The configuration file module is further used to store the parameters required for the interface call in the parameter configuration file of the interface automatic test tool, and store the message to be sent in the storage space under the reading path of the message configuration file; A message processing module to be sent, used for reading the message to be sent from the storage space under the reading path of the message configuration file through the interface automatic test tool; The message sending module is further used to send the parameter configuration file and the message to be sent to the application server to obtain a test message returned from the application server; The message processing module is returned to format the test message, obtain the XML test message and display it to complete the interface test.
9. An interface testing device, It is characterized in that Also includes: The test record archiving module is used to export the XML test message to a local archive file, wherein the local archive file includes the test time, the automatically generated message number, the user-defined message number, the message to be sent and the XML test message.
10. An electronic device, It is characterized in that include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the method according to any one of claims 1 to 7.
11. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores computer-executable instructions, which are used to implement the method according to any one of claims 1 to 7 when executed by a processor.
12. A computer program product, It is characterized in that The invention comprises a computer program, which implements the method according to any one of claims 1 to 7 when being executed by a processor.
