Interface testing method and device and readable storage medium
By analyzing log information in real time, it automatically obtains interface information and automatically generates test cases, and solves the problems of high latency and low efficiency of existing interface testing methods, and realizes the automation and efficiency improvement of interface testing.
Patent Information
- Application Number
- CN202311003594.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2023-08-09
- Publication Date
- 2025-02-28
AI Technical Summary
Existing interface testing methods require manual acquisition and entry of interface information, resulting in high test delay and low efficiency.
By analyzing the log information generated by the target software system in the test and production stages in real time, automatically obtaining interface information, and automatically generating interface test cases based on this information to achieve automation of interface testing.
The interface test is automated, which reduces manual intervention, improves test efficiency and reduces test delay.
Smart Images

Figure CN119537193A_ABST
Abstract
Description
Technical Field
[0001] The present application belongs to the field of software development technology, and in particular, relates to an interface testing method, device and readable storage medium. Background Art
[0002] With the development of Internet technology, various software emerges in an endless stream. Under the premise of customer-centricity, the frequency of software release is getting higher and higher, so the effective testing time left for software testing is getting less and less. Interface testing has become an indispensable part of daily software testing because of its high stability, high consistency and high efficiency execution.
[0003] However, the current interface testing method requires manual acquisition of interface information, then inputting the interface information into the test platform, designing interface test cases based on the interface information in the test platform, and finally using relevant test cases to perform interface testing. In the process of interface testing, the amount of manual work required is large, resulting in large interface test delays and low test efficiency.
[0004] Therefore, how to reduce the latency of interface testing and improve the efficiency of interface testing has become a technical problem that needs to be solved urgently. Summary of the invention
[0005] The embodiments of the present application provide an interface testing method, device and readable storage medium, which can solve the technical problems of large interface testing delay and low efficiency in the prior art.
[0006] In a first aspect, an embodiment of the present application provides an interface testing method, comprising: automatically obtaining multiple interface information based on log information generated in real time by the target software system during the testing phase and / or the production phase, each interface information including relevant information of an interface request involved in the testing phase and / or the production phase of the target software system; automatically generating interface test cases based on the multiple interface information; automatically executing the interface test cases in the target software system to obtain interface test results of the target software system.
[0007] The above-mentioned interface testing method automatically obtains multiple interface information according to the log information generated in real time by the target software system in the testing stage and / or the production stage, and then automatically generates interface test cases according to the multiple interface information, and finally automatically executes the interface test cases in the target software system to obtain the interface test results. Since the interface information is obtained according to the log information generated in real time, the interface information has a strong timeliness, so that the interface information can be obtained in time; since the interface information and the interface test cases can be automatically obtained, the interface test cases can also be automatically generated according to the interface information, and then the interface test is automatically completed, so the entire interface testing process can be automatically completed. In this interface testing method, the interface information can be automatically obtained according to the log information, avoiding the process of manually obtaining and inputting the interface information, so that the efficiency of the interface test can be improved and the delay of the interface test can be reduced.
[0008] In a possible implementation of the first aspect, automatically generating an interface test case according to multiple interface information includes:
[0009] Automatically synchronize multiple interface information to the target database;
[0010] Automatically obtain multiple target interface information from a target database, where the multiple target interface information is part of the multiple interface information;
[0011] Automatically generate interface test cases based on multiple target interface information.
[0012] In a possible implementation manner of the first aspect, the multiple interface information corresponds to N interfaces, where N is a positive integer, and the multiple target interface information includes interface information corresponding to each of the N interfaces.
[0013] In a possible implementation of the first aspect, among multiple target interface information: the number of target interface information corresponding to each of the N interfaces is less than or equal to a first preset number; the target interface information corresponding to each of the N interfaces includes: interface information obtained from the multiple interface information in order from late to early according to the interface information collection time.
[0014] In a possible implementation manner of the first aspect, the method further includes: after acquiring all target interface information corresponding to each interface of the N interfaces from the target database, deleting the interface information corresponding to each interface in the target database.
[0015] In a possible implementation manner of the first aspect, each target interface information includes a request parameter and a response status of an interface request of the corresponding interface;
[0016] Automatically generate interface test cases based on multiple target interface information, including:
[0017] Performing a first analysis on the multiple target interface information to obtain an interface set, where the interface set is a collection of attribute information of N interfaces;
[0018] Using the interface set, performing a second analysis on the multiple target interface information to obtain an interface parameter set, wherein each piece of data in the interface parameter set corresponds to a parameter field of an interface, and each piece of data in the interface parameter set includes: multiple successful parameter values and multiple failed parameter values of the corresponding parameter field;
[0019] Generate interface test cases using multiple target interface information, interface sets, interface parameter sets and preset parameter values.
[0020] In a possible implementation of the first aspect, in an interface set: the attribute information of each interface includes a first request parameter of each interface, the first request parameter is a request parameter in the first target interface information, the first target interface information is the target interface information corresponding to each interface: the response status is successful and the collection time is the latest target interface information, the first request parameter includes: at least one parameter field and a parameter value for each parameter field.
[0021] In a possible implementation manner of the first aspect, in the interface parameter set: the parameter field of each piece of data is a parameter field in a first request parameter of the interface corresponding to each piece of data.
[0022] In a possible implementation manner of the first aspect, the request parameters in each target interface information include: at least one parameter field and a parameter value of each parameter field; using the interface set, performing a second analysis on the plurality of target interface information to obtain an interface parameter set, including:
[0023] According to the request parameters and response status in each target interface information in the multiple target interface information, a parameter field set is obtained, where the parameter field set is a collection of multiple parameter field information, each parameter field information includes: a target parameter field, a parameter value and a response status, and the target parameter field is a parameter field in the request parameters in the multiple target interface information;
[0024] An interface parameter set is determined according to the interface set and the parameter field set.
[0025] In a possible implementation of the first aspect, the interface test case includes an interface test case corresponding to each of the N interfaces; the interface test case corresponding to each interface includes: a playback case and a random case; and the interface test case is generated by using multiple target interface information, an interface set, an interface parameter set, and a preset parameter value, including:
[0026] Generate a playback use case for each of the N interfaces using information of multiple target interfaces;
[0027] A random use case of each of the N interfaces is generated according to the interface set, the interface parameter set, and the preset parameter value.
[0028] In a possible implementation manner of the first aspect, in the interface set: the attribute information of each interface also includes execution statistics of the interface test case of each interface; and the method further includes:
[0029] According to the interface test cases and the interface test results, the execution statistics of the interface test cases in the attribute information of each interface in the interface set are updated.
[0030] In a second aspect, an embodiment of the present application provides an interface testing device, which includes: a unit for executing each step of the method described in any implementation manner of the first aspect above.
[0031] In a third aspect, an embodiment of the present application provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, the steps of the method described in any one of the embodiments of the first aspect above are implemented.
[0032] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, in which a computer program or instructions are stored. When a computer reads and executes the computer program or instructions, the computer executes the steps of the method described in any embodiment of the first aspect above.
[0033] In a fifth aspect, an embodiment of the present application provides a computer program product, which, when executed on a server, enables the server to execute the steps of the method described in any one of the embodiments of the first aspect above.
[0034] In a sixth aspect, an embodiment of the present application provides a chip, comprising: a processor, configured to call and run a computer program from a memory, so that a computer device equipped with the chip executes a method as described in any one of the embodiments of the first aspect above.
[0035] It can be understood that the beneficial effects of the second to sixth aspects mentioned above can be found in the relevant description of the first aspect mentioned above, and will not be repeated here. BRIEF DESCRIPTION OF THE DRAWINGS
[0036] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0037] Figure 1 is a flow chart of an interface testing method provided by an embodiment of the present application;
[0038] Figure 2 It is a flowchart of generating an interface test case according to multiple interface information in an interface testing method provided in an embodiment of the present application;
[0039] Figure 3 This is a schematic diagram of the data combing process in the interface testing method provided in one embodiment of the present application;
[0040] Figure 4 is a structural block diagram of an interface testing device provided in an embodiment of the present application;
[0041] Figure 5 It is a schematic diagram of the internal structure of a computer device provided in one embodiment of the present application. DETAILED DESCRIPTION
[0042] In the following description, specific details such as specific system structures, technologies, etc. are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present application. However, it should be clear to those skilled in the art that the present application may also be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to prevent unnecessary details from obstructing the description of the present application.
[0043] It should be understood that when used in the present specification and the appended claims, the term "comprising" indicates the presence of described features, wholes, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, wholes, steps, operations, elements, components and / or combinations thereof.
[0044] It should also be understood that the term “and / or” used in the specification and appended claims refers to any and all possible combinations of one or more of the associated listed items, and includes these combinations.
[0045] As used in the specification and appended claims of this application, the term "if" can be interpreted as "when" or "uponce" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrase "if it is determined" or "if [described condition or event] is detected" can be interpreted as meaning "uponce it is determined" or "in response to determining" or "uponce [described condition or event] is detected" or "in response to detecting [described condition or event]", depending on the context.
[0046] In addition, in the description of the specification of this application and the attached claims, the terms "first", "second", "third", etc. are only used to distinguish the description, and cannot be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, the features defined as "first" or "second" may explicitly or implicitly include one or more of the features. In the description of this application, the meaning of "multiple" is two or more, unless otherwise clearly and specifically defined.
[0047] References to "one embodiment" or "some embodiments" etc. described in the specification of this application mean that one or more embodiments of the present application include specific features, structures or characteristics described in conjunction with the embodiment. Therefore, the statements "in one embodiment", "in some embodiments", "in some other embodiments", "in some other embodiments", etc. that appear in different places in this specification do not necessarily refer to the same embodiment, but mean "one or more but not all embodiments", unless otherwise specifically emphasized in other ways. The terms "including", "comprising", "having" and their variations all mean "including but not limited to", unless otherwise specifically emphasized in other ways.
[0048] In order to make the present application easier to understand, some terms involved in the present application are explained below.
[0049] Interface testing: A test of the interface between software system components. Interface testing is mainly used to detect the interaction points between external systems and between various subsystems within the system. 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.
[0050] ES database: The full name of ES is ElasticSearch. ES database is a highly scalable and open source full-text search and analysis engine that can store, search and analyze massive amounts of data in near real time.
[0051] In the current interface testing process, it is generally necessary to manually obtain interface information, then manually enter the interface information, design interface test cases through platforms or tools, and then use interface test cases to perform interface testing. Interface information includes relevant information about interface access and interface calls generated during the software operation process. If you want to obtain interface information in a timely manner, you need to obtain the relevant information about these interface access or calls in real time, and the amount of data that needs to be processed during the acquisition process is very huge. Therefore, relying on manual completion of interface information acquisition is bound to consume a lot of manpower. However, it is very difficult to allocate enough manpower to obtain interface information in real time. Therefore, when there is sufficient manpower, the acquisition of interface information generally has a certain delay, for example, it may delay the time of a version. Therefore, in the current interface testing method, the inability to obtain interface information in a timely manner leads to technical problems such as large interface test delay and low interface test efficiency.
[0052] In view of the above technical problems, the present application provides an interface testing method, which includes: automatically obtaining multiple interface information according to the log information generated in real time by the target software system in the test phase and / or the production phase, each interface information includes the relevant information of an interface request involved in the test phase and / or the production phase of the target software system; automatically generating interface test cases according to the multiple interface information; automatically executing the interface test cases in the target software system to obtain the interface test results of the target software system. In the interface testing method, the interface information is automatically obtained according to the log information obtained in real time. Since the log information is generated in real time, the interface information automatically obtained according to the log information is also real-time interface information, so the acquisition of the interface information in the interface testing method is very timely. And since the log information and the interface test cases can be automatically obtained and generated, and the interface test cases can also be automatically executed, the entire interface testing process can be completely completed automatically, thereby realizing the automation of the interface test. That is, in the test phase or the production phase of the target software system, after the log information is collected, the interface testing process can be automatically performed, so the interface test of the target software system can be performed very timely, reducing the delay of the interface test and improving the efficiency of the interface test.
[0053] Figure 1 A flowchart of an interface testing method provided in an embodiment of the present application is shown in FIG. Figure 1 As shown, the method may include S110 to S130. It is understandable that the execution subject of the interface test method may be a computer device, or a chip or a device with a program installed. Figure 1 Provide detailed descriptions of each step.
[0054] Step S110: Based on the log information generated in real time by the target software system during the testing phase and / or the production phase, multiple interface information are automatically obtained, each interface information including relevant information of an interface request involved in the testing phase and / or the production phase by the target software system.
[0055] It is understandable that the target software system may be a software system in a testing phase or a software system in a use phase.
[0056] Exemplarily, if the target software system is a software system in a testing phase, the testing phase may be a period of functional testing of the software system. It should be understood that the functional test may be a manual test or an automatic test, and the embodiments of the present application do not specifically limit the form of the functional test.
[0057] In some embodiments, the plurality of interface information is obtained according to the log information, specifically, the plurality of interface information may be obtained by filtering the log information in the target software system.
[0058] Step S120: Automatically generate interface test cases based on multiple interface information.
[0059] It should be understood that a test case can be understood as: a set of test inputs, execution conditions, and expected results compiled for a specific purpose, used to verify whether a certain function of a specific software is normal.
[0060] In an embodiment of the present application, for interface test cases: the test input can be determined by the "request parameters" in the interface information; the execution conditions can be determined by the "request address" in the interface information; and the expected results can be determined by the "response status" in the interface information.
[0061] It is understandable that when generating interface test cases, different test cases can be generated by combining relevant data in multiple interface information.
[0062] Exemplarily, the interface information may include relevant information of the interface request, such as request address, request parameters and response status. An interface test case may be a successful test case, and the interface test case generated by the interface information with a response status of "success" is a successful test case; an interface test case may also be a failed test case, and the interface test case generated by the interface information with a response status of "failure" is a failed test case.
[0063] Step S130: Automatically execute the interface test case in the target software system to obtain the interface test result of the target software system.
[0064] It is understandable that the interface test result may include the interface test results of all interfaces involved in the interface test case. The interface test results of different interfaces are independent of each other, and the interface test results of different interfaces may be the same or different, and this application will not go into details.
[0065] In an embodiment of the present application, the interface test result of an interface can be "passed" or "failed". If the interface test result of an interface is "passed", it means that after the interface test case corresponding to the interface is executed in the target software system, the return content of the target software system is the same as the expected result of the interface test case; if the interface test result of an interface is "failed", it means that after the interface test case corresponding to the interface is executed in the target software system, the return content of the target software system is different from the expected result of the interface test case.
[0066] For example, taking the software system login process as an example, assuming that the input data of an interface test case is: a registered account and an incorrect password, then the "expected result" of the interface test case is "incorrect password". When the interface test case is executed in the software system: if the system returns "incorrect password", since the returned content is the same as the expected result of the interface test case, the test result of the interface test case is passed; if the system returns other information such as "account not registered", since the returned result is different from the expected result of the interface test case, the interface test result of the interface test case is failed.
[0067] It should be understood that for a specific interface, assuming that the specific interface corresponds to multiple interface test cases, when all interface test cases return the same content as the "expected result" in the interface test case, the interface test result of the specific interface is passed; when at least one interface test case returns content that is different from the "expected result" in the interface test case, the interface test result of the specific interface is failed.
[0068] The above interface testing method can automatically complete the entire interface testing process, thereby realizing the automation of interface testing. In the testing phase or production phase of the target software system, after collecting log information, the method can perform the interface testing process, so the interface testing of the target software system can be performed very timely, reducing the latency of the interface testing and improving the efficiency of the interface testing.
[0069] In order to make the method in the present application clearly understood, step S120 is exemplarily described below in conjunction with the figure.
[0070] Figure 1 A flowchart of generating an interface test case according to multiple interface information in an interface test method provided in an embodiment of the present application, such as Figure 2As shown, the process may include S121 to S123. Figure 2 Provide detailed descriptions of each step.
[0071] Step S121: Automatically synchronize multiple interface information to the target database.
[0072] It should be understood that the target database can be used to temporarily store multiple interface information, and can also be used to store multiple interface information for a longer period of time, and this application does not impose any restrictions on this.
[0073] In addition, those skilled in the art may select a suitable database as the target database as needed. For example, the target database may be an ES database, a MySQL database, an Orical database, etc.
[0074] It is understandable that multiple interface information can be synchronized to the target database in any possible manner, for example, the interface information can be synchronized to the target database in real time, or the interface information can be synchronized to the target database at a scheduled time, which are not enumerated here.
[0075] Step S122: automatically obtaining multiple target interface information from the target database, where the multiple target interface information is part of the multiple interface information.
[0076] In an embodiment of the present application, by determining part of the interface information among the multiple interface information stored in the target database as the target interface information, the number of target interface information can be set as needed, thereby avoiding processing too much interface information while meeting the interface testing requirements, thereby avoiding occupying a large amount of computing resources.
[0077] In some embodiments, the multiple interface information corresponds to N interfaces, where N is a positive integer, and the multiple target interface information includes interface information corresponding to each of the N interfaces. That is, the multiple target interface information obtained from the multiple interface information involves all interfaces corresponding to the multiple interface information, thereby implementing testing of all interfaces and avoiding missing interfaces.
[0078] Exemplarily, among the multiple target interface information: the number of target interface information corresponding to each of the N interfaces is less than or equal to the first preset number; the target interface information corresponding to each of the N interfaces includes: the interface information obtained from the multiple interface information in the order of the interface information collection time from late to early. That is, the multiple target interface information are all interface information collected at a later time, wherein the first preset number can be set as needed to ensure execution efficiency; in addition, since the interface information collected at a later time is used, the real-time status of the interface in the recent time period can be better reflected, ensuring the timeliness and accuracy of the test results.
[0079] For example, assuming that the first preset number is 100, that is, the number of target interface information for each interface is at most 100. Assuming that in the interface information stored in the database: the number of interface information corresponding to the first interface is 10,000, and the number of interface information corresponding to the second interface is 50, then when acquiring the target interface information, the target interface information corresponding to the first interface includes the 100 most recent interface information at the time of collection, and the number of target interface information for the first interface is equal to the first preset number of 100; the target interface information corresponding to the second interface includes 50 interface information corresponding to the second interface, and the number of target interface information for the second interface is less than the first preset number of 100.
[0080] In some embodiments, the interface testing method further includes: after all target interface information corresponding to each of the N interfaces is obtained from the target database, the interface information corresponding to each interface in the target database is deleted. By obtaining target interface information for the N interfaces one by one and deleting all interface information of the interfaces that have been processed in the data, the amount of data processing when subsequently obtaining target interface information of other interfaces can be reduced.
[0081] Step S123: Automatically generate interface test cases based on multiple target interface information.
[0082] In the embodiment of the present application, part of the interface information (ie, multiple target interface information) among the multiple interface information is used when generating the interface test case.
[0083] In some embodiments, the interface test case includes an interface test case corresponding to each interface, that is, if multiple target interface information corresponds to N interfaces, then the interface test case includes an interface test case for each of the N interfaces.
[0084] Exemplarily, the interface test cases corresponding to each interface may include playback cases and random cases. For example, the playback case of the first interface is formed directly by using the request parameters and response status in the target interface information corresponding to the first interface; and the random case of the first interface is formed by using a random combination of request parameters and response status in different target interface information in multiple target interface information.
[0085] In the above-mentioned interface testing method, the multiple interface information obtained are automatically synchronized to the target database and stored to improve data security and stability; in addition, since the amount of interface information obtained through log information is very large, only part of the interface information (i.e., multiple target interface information) is used when generating test cases, thereby avoiding the generation of too many test cases and occupying too many computing resources.
[0086] In some embodiments, after the interface test results are obtained, an interface test report is generated according to the interface test results, and the test report is sent to a relevant mailbox by email or the test report is stored in a preset location. In this embodiment, by generating a test report and sending or storing the test report, the test results can be saved for technicians to view, which is convenient for technicians to improve the software system in a targeted manner according to the content of the test report.
[0087] In some embodiments, each target interface information includes request parameters and response status of an interface request of the corresponding interface; step S123 specifically includes the following steps (1) to (3):
[0088] Step (1): Perform a first analysis on multiple target interface information to obtain an interface set, which is a collection of attribute information of N interfaces. The first analysis of multiple target interface information is to filter out attribute information of all interfaces (i.e., N interfaces) involved from the multiple target interface information.
[0089] Step (2): using the interface set, performing a second analysis on the multiple target interface information to obtain an interface parameter set, wherein each piece of data in the interface parameter set corresponds to a parameter field of an interface, and each piece of data in the interface parameter set includes: multiple successful parameter values and multiple failed parameter values of the corresponding parameter field. The second analysis of the multiple target interface information is to filter out multiple successful parameter values and multiple failed parameter values of each parameter field of each interface from the multiple target interface information.
[0090] Step (3): Generate interface test cases using multiple target interface information, interface sets, interface parameter sets and preset parameter values.
[0091] In this implementation, both the first analysis and the second analysis are to filter and form a set of specific information in multiple target interface information, but the specific information and specific methods of filtering will be different. Through the first analysis of multiple target interface information, an interface set is obtained, and the interface set can summarize and list the attribute information of the interface, making the relevant information of the interface clearer and more specific; then the interface set is used to perform a second analysis on the multiple target interface information to obtain an interface parameter set, and the interface parameter set lists the corresponding success parameter value and failure parameter value for each parameter field of each interface. When generating a use case, you only need to select and combine from the interface set, interface parameter set and preset parameters to generate an interface test case. The operation is simple and convenient, which is easy to realize the automation of the interface test case generation process.
[0092] In some embodiments, in an interface set: the attribute information of each interface includes a first request parameter of each interface, the first request parameter is a request parameter in the first target interface information, the first target interface information is the target interface information corresponding to each interface: the response status is successful and the collection time is the latest target interface information, the first request parameter includes: at least one parameter field and a parameter value for each parameter field.
[0093] In this implementation, the attribute information of each interface in the interface set is specifically limited, namely, the request parameters in the target interface information corresponding to each interface, with a response status of success and the latest collection time; the latest collection time can ensure that the target interface parameters can best reflect the current status of the corresponding interface, and a response status of success ensures that the request parameters of the target interface information include all parameter fields to which the interface can successfully respond, thereby ensuring the integrity of the parameter fields in the attribute information stored in the interface set.
[0094] In some embodiments, in the interface parameter set: the parameter field of each piece of data is a parameter field in the first request parameter of the interface corresponding to each piece of data. In this implementation, the source of the parameter field of each piece of data in the interface parameter set is limited, that is, a field in the first request parameter, so that the parameter fields in the interface parameter set come from the target interface information with the latest collection time, and therefore can best reflect the parameter field situation of the interface.
[0095] In some embodiments, the request parameters in each target interface information include: at least one parameter field and a parameter value for each parameter field; using the interface set, a second analysis is performed on multiple target interface information to obtain an interface parameter set, including: obtaining a parameter field set based on the request parameters and response status in each target interface information in the multiple target interface information, the parameter field set is a collection of multiple parameter field information, each parameter field information includes: a target parameter field, a parameter value and a response status, the target parameter field is a parameter field in the request parameters in the multiple target interface information; determining the interface parameter set based on the interface set and the parameter field set.
[0096] In this implementation, when an interface parameter set is generated, a parameter field set is first generated in the process, and the parameter field lists the combination of different parameter fields and parameter values, so that the generation of the interface parameter set is simpler and easier to automate.
[0097] In some embodiments, in the interface set: the attribute information of each interface also includes the execution statistics of the interface test cases of each interface; the method also includes: updating the execution statistics of the interface test cases in the attribute information of each interface in the interface set according to the interface test cases and the interface test results. In this implementation, by updating the interface connection, the interface set can record the latest interface test situation, which is convenient for technicians to view and can also provide material for subsequent report generation.
[0098] In some embodiments, the interface testing process can be divided into stages, specifically, it can be divided into five stages, namely: collecting information, combing data, generating use cases, executing use cases, and generating reports. The process of obtaining multiple interface information based on log information and the process of synchronizing multiple interface information to the target database belong to the "collecting information" stage, and the process of obtaining multiple target interface information from multiple interface information and the data processing process before generating use cases is called the "combing information" stage; the process of generating use cases is the "generating use cases" stage; the process of automatically executing interface test cases in the target software system to obtain interface test results is the "executing use cases" stage; the process of generating test reports based on interface test results is the "generating report" stage. For ease of understanding, the five stages are exemplarily described below in conjunction with the accompanying drawings.
[0099] 1. “Information Collection” Phase
[0100] Exemplarily, the LogFilter class can be set in the target software system, and the method setLogCollectInfo for collecting interface requests can be added to the LogFilter class. The interface-related information in the log information can be collected by using the method setLogCollectInfo for collecting interface requests. In the method setLogCollectInfo, add the collection time period configuration (for example: switch: log.collect.flag, collection time period: log..collect.times). When the switch state is on and in the collection time period, the method setLogCollectInfo starts to collect the interface-related information in the log information and obtains multiple interface information. In addition, the Kafka producer LogCollectKafkaProduce is added to the target software system, and multiple interface information is synchronized to the ES database by sending messages to the ES database by the Kafka producer LogCollectKafkaProduce. In this example, the interface information is synchronized to the target database using the Kafka message queue. The Kafka message queue is an asynchronous process, which can be processed during the service period to avoid affecting the progress of the main service.
[0101] In some embodiments, after synchronizing multiple interface information to the ES database, a sample is formed in the database as shown in Table 1.
[0102] Table 1
[0103]
[0104] The meanings of the various fields of the interface information in Table 1 above are shown in Table 2.
[0105] Table 2
[0106] Fields meaning id Unique ID sysCode System Code requestType Request type: post, get requestDesc Request Description responseTime Request time requestUrl Request address requestParams Request Parameters responseStatus Response Status note Remark created_date Creation Date created_by Founder updated_date Updated Date updated_by Updater isFinish Completed: 1->Yes, 0->No
[0107] In Table 2, one row of data is an interface information, where the unique ID "id" can be the inventory number of the corresponding interface information in the ES database, and this number is unique in the ES database. As shown in Table 2, the unique ID of the interface information in the first row is "48063", and the response status (responseStatus) is "TRUE", indicating that the interface request corresponding to the interface information is successful, that is, the interface connection status is normal. When the response status (responseStatus) is "FALSE", it means that the interface request corresponding to the interface information has failed, that is, the interface connection status is abnormal. Other parts of Table 2 are not repeated here.
[0108] 2. “Data sorting” stage
[0109] Figure 3 FIG. 1 is a schematic diagram of the data combing process in the interface testing method in one embodiment of the present application. Figure 3 As shown, four data sets are generated in the process of "combing data", namely: collection record set, interface set, parameter field set and interface parameter set.
[0110] The following is an exemplary description of four data sets and the process of obtaining the data sets.
[0111] (1) Collection Record Set
[0112] The information included in the "collection record set" is "multiple target interface information", and the multiple target interface information in the collection record set is obtained by obtaining the latest interface information from the ES database. In some embodiments, the form of the data in the collection record set is the same as the data form in Table 1, and will not be repeated here.
[0113] It should be understood that the request address of each interface is unique, so when obtaining the collection record set from the ES database, the interface to which different interface information in different ESs belongs can be distinguished according to the request address.
[0114] Exemplarily, only part of the interface information in the ES database is included in the collection record set, and the latest part of the interface information is obtained for each interface as the target interface information of each interface.
[0115] For example, assuming that you need to obtain up to 100 of the latest interface information for each interface as the target interface information, the specific process is as follows: when obtaining the target interface information of interface A, query the interface information with the same request address as interface A from the ES database; if there are more than 100 interface information with the same request address as interface A, then from the interface information with the same request address as interface A, obtain the 100 interface information with the latest collection time as the target interface information of interface A; if in the ES database, there are less than 100 interface information with the same request address as interface A, then all interface information with the same request address as interface A are determined as the target interface information of interface A.
[0116] In some embodiments, after the target interface information of each interface is acquired, all the interface information corresponding to each interface in the ES database is deleted.
[0117] In some embodiments, when obtaining target interface information, it can be accomplished with the help of an interface set, and the specific steps include step 1a and step 1b, which are as follows:
[0118] Step 1a: First, use the request address of the existing interface in the interface set to search in the ES database, obtain the target interface information of each existing interface, and delete the interface information corresponding to the existing interface in the ES database.
[0119] Step 1b, then process the interface information of the newly added interface (i.e., the interface that has not yet been collected into the interface set). When processing the interface information of the newly added interface, you can use the method of paging through the interface information in the ES database. Assuming that each page includes 10 interface information, take the first page as an example for explanation:
[0120] For the first interface information in the first page: the first interface information corresponds to the newly added interface M1. According to the interface address in the first interface information, all interface information with the interface address is filtered out from the ES database, and the 99 interface information with the latest collection time are taken. The first interface information and 99 interface information in the first page are determined as the 100 target interface information of the newly added interface M1; then the interface information with the interface address in the ES database is deleted.
[0121] For the second interface information in the first page: if the second interface information still exists, it means that the interface address of the second interface information is different from that of the first interface information, so the second interface information corresponds to another newly added interface M2; according to the interface address in the second interface information, all interface information with the interface address is filtered out from the ES database, and the 99 interface information with the latest collection time are taken, and the second interface information and 99 interface information in the first page are determined as the 100 target interface information of the newly added interface M2. If the second interface information is deleted, it means that the interface address of the second interface information is the same as that of the first interface information. And so on, it is determined that the above processing is performed on each interface information in each page until all data in the ES database is deleted.
[0122] (2) Interface Set
[0123] The "interface set" can be written as "tp_api" in the code. The interface set is a collection of all interfaces, and the interface set includes all interfaces involved in the "multiple interface information". Table 3 is an example of the interface set formed in an embodiment of the present application.
[0124] Table 3
[0125]
[0126] The meanings of the various fields in the interface set in Table 3 above are shown in Table 4.
[0127] Table 4
[0128]
[0129]
[0130] As shown in Table 3, in the interface set, each interface corresponds to and only corresponds to one piece of data. Each piece of data includes attribute information of the corresponding interface, for example, the attribute information may include: request address, interface name, and request parameters, etc. For ease of understanding, the request address, interface name, and request parameters are exemplarily described below.
[0131] First, for each interface, the request address is unique. Therefore, the interface corresponding to the target interface information in Table 3 can be determined based on the request address of a target interface information in Table 1. That is, for the same interface, the "request address" in the corresponding target interface information is the same as its "request address" in the interface set.
[0132] Furthermore, it is understandable that for each interface, the interface name should also be unique, so the interface name can be determined based on the request address. For example, the content in the interface address of an interface except the domain name can be determined as the interface name of the interface.
[0133] Finally, the "request parameters" of an interface in the interface set need to include the required parameters for successfully accessing the interface, so the request parameters of each interface in the interface set are obtained from the collection record set. Specifically, the "request parameters" in the target interface information in the collection record set corresponding to the interface, with a "response status" of success and the latest collection time, are used as the "request parameters" of the interface in the interface set.
[0134] It should be understood that after the collection record set is determined, the interface set needs to be updated using the collection record set.
[0135] As shown in Table 3 and Table 4, the "module / application name" in the interface set is derived from the "system code" in the collection record set; the "request type" in the interface set is derived from the "request type" in the collection record set, and the rest is not repeated.
[0136] (3) Parameter field set
[0137] The parameter field set is obtained by parsing the "request parameters" in each target interface information in the collection record set. Each piece of data in the parameter field set includes: target parameter field, parameter value and response status; the combination of parameter field and parameter value in the parameter field set is unique. Table 5 is an example of the parameter field set formed in an embodiment of the present application.
[0138] Table 5
[0139]
[0140] The meaning of each field in the parameter field set in Table 5 above is shown in Table 6.
[0141] Table 6
[0142]
[0143] In the collection record set, the "request parameter" in each target interface information may include one or more parameter fields, and each parameter field corresponds to a parameter value. The parameter field of each data in the parameter field set (i.e., the parameter key / parameter name in Table 6) is a parameter field in a target interface information in the collection, and the parameter value is the parameter value of the parameter field in the target interface information. The "success" column is determined according to the response status in the target interface information.
[0144] (4) Interface parameter set
[0145] Each piece of data in the interface parameter set corresponds to a parameter field of an interface, and the interface parameter set includes each parameter field in the request parameter corresponding to each interface involved in the interface set (i.e., the parameter field in the lastParam column of each interface in Table 3). Table 7 is an example of the interface parameter set formed in an embodiment of the present application.
[0146] Table 7
[0147]
[0148] The meanings of the various fields in the interface parameter set in Table 7 above are shown in Table 8.
[0149] Table 8
[0150] Fields meaning ID Unique ID apiId Interface ID paramName Parameter name successParams Optional success parameter set, separated by semicolons failParams Optional exception parameter set, separated by semicolons describe Parameter Description paramType Parameter Type isNes Required: 1->Yes, 0->No isEn Encryption: 1->Yes, 0->No enType Encryption Type note Remark created_date Creation Date created_by Founder updated_date Updated Date updated_by Updater
[0151] In the interface parameter set: "Interface ID" comes from the "Unique ID" in the interface set; "Parameter name" comes from the "Request parameter" in the interface set, which is a parameter field in the request parameters; "Optional success parameter set" is obtained from the parameter field set, specifically, parameter values from multiple parameter field data with the same "parameter name" that succeed, for example, a total of 5 parameter values from 5 parameter field data can be taken; "Optional failure parameter set" is also obtained from the parameter field set, specifically, parameter values from multiple parameter field data with the same "parameter name" that fail, for example, a total of 5 parameter values from 5 parameter field data can be taken.
[0152] 3. Generate Use Cases
[0153] It should be understood that the interface test case may include an interface test case corresponding to each of the N interfaces; the interface test case corresponding to each interface includes: a playback case and a random case. The process of generating the interface test case may include: first, using the multiple target interface information in the acquisition record set to generate a playback case for each of the N interfaces; and then generating a random case for each of the N interfaces based on the interface set, the interface parameter set and the preset parameter value.
[0154] Exemplarily, when generating a playback use case for each interface: from the collected record set, query the latest 5 successful records (the records are the target interface information) and the latest 5 failed records (the records are the target interface information) in chronological order as the playback use cases of the interface; when the number of successful records and / or failed records corresponding to a certain interface is less than 5, all records are used as playback use cases.
[0155] Exemplarily, when generating a random use case for each interface, the collected interface parameter set and preset parameter values (such as special strings, such as SQL injection strings, XXS attack strings, etc.) are used as parameter value sets, and finally each parameter value is traversed and assembled into interface input parameters to generate a use case.
[0156] For example, an interface has two parameter fields (i.e. parameter names): userId and mobile; the successful parameter values of the parameter fields are:
[0157] The successful parameter values of userId are: userId1, userId2, userId3, userId4, userId5, 1@@, alert('go'), and select now() from dual;
[0158] The successful parameter values for mobile are: mobile1, mobile2, mobile3, mobile4, mobile5, and *((, alert('go').
[0159] Based on the above successful parameter values, 8 random use case input parameters shown in Table 9 are generated.
[0160] Table 9
[0161]
[0162]
[0163] In addition, each parameter field is left blank in turn to generate two empty check use cases as shown in Table 10.
[0164] Table 10
[0165]
[0166] Table 11 is a sample of the interface test case formed in one embodiment of the present application.
[0167] Table 11
[0168]
[0169] The meanings of the various fields in the interface test case sample in Table 11 above are shown in Table 12.
[0170] Table 12
[0171]
[0172]
[0173] As shown in Tables 11 and 12, in the interface test case: "Application Service ID" comes from the "Module / Application Name" in the interface set; "Use Case Name" is randomly generated; "Interface ID" comes from the "Unique ID" in the interface set; "Request Address" comes from the "Request Address" in the interface set; "Parameter Details" are generated using the interface parameter set, preset parameters, and preset rules, for example, it can be any one of the random use case input, playback use case input, or required verification use case input; "Assertion Content" comes from the expected result of the corresponding interface test case. IV. "Execution Use Case" Phase
[0174] In the embodiment of the present application, the execution case stage is an automatic execution process of the interface test cases. For example, all generated interface test cases can be executed in batches.
[0175] Exemplarily, the scheduled execution of the use case can be achieved by setting a scheduled task.
[0176] It should be understood that the interface test method in the embodiment of the present application can be periodic. For example, the interface test can be set to be performed every 24 hours, and each stage of the interface test can be executed regularly.
[0177] The following is an example of a periodic interface test. The specific execution process is as follows:
[0178] (1) At 1 a.m. every day, the interface information collected in the ES database is sorted and updated. Figure 3 The interface set and collection record set shown are parsed to generate parameter field set and interface parameter set. It should be understood that the interface information sorted out at this time is the interface information collected from 1 am the previous day to the current time.
[0179] (2) At 2 a.m. every day, based on the sorted interface set, interface parameters and preset parameter values, interface test cases (for example, including random test cases and playback test cases) are generated for new interfaces or updated interfaces.
[0180] (3) At 3:00 a.m. every day, the generated interface test cases are executed and the execution statistics of each interface test case in the interface set are updated.
[0181] (4) After executing the interface test case, generate an interface test report based on the execution results.
[0182] (5) At 5:00 a.m. every day, the interface test report will be sent to the relevant email address via email.
[0183] Through the above steps (1) to (5), the interface information collected on the previous day is used to complete an interface test and generate an interface test report every day. In this way, the interface test can be performed every day to avoid delays in the interface test.
[0184] It should be understood that the execution cycle of the interface test can be set as needed, for example, the execution cycle can be 12 hours, 36 hours or 48 hours, etc., and this application does not make specific restrictions on this. In addition, the interface test can also be performed without a strict cycle, and steps such as data combing, generating use cases, executing use cases, generating interface test reports, and sending interface test reports by email can be performed when necessary.
[0185] In addition, generating an interface test report and sending the interface test report by email are optional steps. That is, in some cases, you can only use the interface set to count the execution of interface use cases without making an interface test report, or you can make an interface test report but only save it without sending it to other related email addresses.
[0186] It should be understood that the size of the serial numbers of the steps in the above embodiments does not mean the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.
[0187] Corresponding to the interface testing method of the above embodiment, an embodiment of the present application further provides an interface testing device, which includes a unit for executing each step of the interface testing method in any of the above embodiments.
[0188] The interface testing device in the embodiment of the present application is exemplarily described below with reference to the accompanying drawings.
[0189] like Figure 4 FIG. 1 is a block diagram of the interface test device provided in an embodiment of the present application. For the sake of convenience, only the parts related to the embodiment of the present application are shown. Figure 4 The interface testing device 400 comprises: an interface information obtaining unit 401, a test case generating unit 402 and a test case executing unit 403:
[0190] The interface information obtaining unit 401 is used to automatically obtain a plurality of interface information according to the log information generated in real time by the target software system in the test phase and / or the production phase, each interface information including relevant information of an interface request involved in the test phase and / or the production phase by the target software system;
[0191] Test case generation 402, for automatically generating interface test cases according to the plurality of interface information;
[0192] The case execution unit 403 is used to automatically execute the interface test case in the target software system to obtain the interface test result of the target software system.
[0193] Optionally, test case generation 402 automatically generates interface test cases based on multiple interface information, including: automatically synchronizing multiple interface information to a target database; automatically obtaining multiple target interface information from the target database, where the multiple target interface information is part of the multiple interface information; and automatically generating interface test cases based on the multiple target interface information.
[0194] Optionally, the multiple interface information corresponds to N interfaces, where N is a positive integer, and the multiple target interface information includes interface information corresponding to each of the N interfaces.
[0195] Optionally, among multiple target interface information: the number of target interface information corresponding to each of the N interfaces is less than or equal to a first preset number; the target interface information corresponding to each of the N interfaces includes: the interface information obtained from the multiple interface information in order of interface information collection time from late to early.
[0196] Optionally, the interface testing device 400 further includes: a deleting unit, which is used to delete the interface information corresponding to each interface in the target database after obtaining all target interface information corresponding to each interface of the N interfaces from the target database.
[0197] Optionally, each target interface information includes request parameters and response status of an interface request of the corresponding interface; the test case generation 402 automatically generates an interface test case according to multiple target interface information, including: performing a first analysis on the multiple target interface information to obtain an interface set, the interface set is a collection of attribute information of N interfaces, in the interface set: the attribute information of each interface includes a first request parameter of each interface, the first request parameter is the request parameter in the first target interface information, the first target interface information is the target interface information corresponding to each interface: the response status is successful and the collection time is the latest, the first request parameter includes: at least one parameter field and a parameter value of each parameter field; using the interface set, performing a second analysis on the multiple target interface information to obtain an interface parameter set, each data in the interface parameter set corresponds to a parameter field of an interface, each data in the interface parameter set includes: multiple successful parameter values and multiple failed parameter values of the corresponding parameter field; in the interface parameter set: the parameter field of each data is a parameter field in the first request parameter of the interface corresponding to each data; using multiple target interface information, interface sets, interface parameter sets and preset parameter values, generate interface test cases.
[0198] Optionally, the request parameters in each target interface information include: at least one parameter field and a parameter value for each parameter field; the test case generation 402 uses the interface set to perform a second analysis on the multiple target interface information to obtain an interface parameter set, including: obtaining a parameter field set based on the request parameters and response status in each target interface information in the multiple target interface information, the parameter field set being a collection of multiple parameter field information, each parameter field information including: a target parameter field, a parameter value and a response status, the target parameter field being a parameter field in the request parameters in the multiple target interface information; determining the interface parameter set based on the interface set and the parameter field set.
[0199] Optionally, the interface test case includes an interface test case corresponding to each of the N interfaces; the interface test case corresponding to each interface includes: a playback case and a random case; the test case generation 402 generates an interface test case using multiple target interface information, interface sets, interface parameter sets and preset parameter values, including: generating a playback case for each of the N interfaces using multiple target interface information; generating a random case for each of the N interfaces based on the interface set, interface parameter set and preset parameter values.
[0200] Optionally, in the interface set: the attribute information of each interface also includes execution statistics of the interface test cases of each interface; the interface testing device 400 also includes: an update unit, the update unit is used to update the execution statistics of the interface test cases in the attribute information of each interface in the interface set according to the interface test cases and the interface test results.
[0201] It should be understood that the specific process of each unit in the interface testing device 400 executing the above corresponding steps can be found in the description of the interface testing method in the previous text, and will not be repeated here for the sake of brevity.
[0202] An embodiment of the present application also provides a computer device 500. Figure 5 As shown, the computer device 500 of this embodiment includes: a processor 501, a memory 502, and a computer program 504 stored in the memory 502 and executable on the processor 501. The computer program 504 can be executed by the processor 501 to generate instructions 503, and the processor 501 can implement the steps in the above-mentioned various delivery address confirmation method embodiments according to the instructions 503. Alternatively, when the processor 501 executes the computer program 504, the functions of the modules / units in the above-mentioned device embodiments are implemented, such as Figure 4 The functions of the interface information obtaining unit 401 to the use case execution unit 403 are shown.
[0203] Exemplarily, the computer program 504 may be divided into one or more modules / units, one or more modules / units are stored in the memory 502, and are executed by the processor 501 to complete the present application. One or more modules / units may be a series of computer program instruction segments capable of completing specific functions, and the instruction segments are used to describe the execution process of the computer program 504 in the computer device 500.
[0204] Those skilled in the art will understand that Figure 5 This is only an example of the computer device 500 and does not constitute a limitation of the computer device 500. The computer device 500 may include more or fewer components than those shown in the figure, or a combination of certain components, or different components. For example, the computer device 500 may also include input and output devices, network access devices, buses, etc.
[0205] The processor 501 may be a central processing unit (CPU), or other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may be any conventional processor, etc.
[0206] The memory 502 may be an internal storage unit of the computer device 500, such as a hard disk or memory of the computer device 500. The memory 502 may also be an external storage device of the computer device 500, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the computer device 500. Further, the memory 502 may also include both an internal storage unit of the computer device 500 and an external storage device. The memory 502 is used to store computer programs and other programs and data required by the computer device 500. The memory 502 may also be used to temporarily store data that has been output or is to be output.
[0207] The technicians in the relevant field can clearly understand that for the convenience and simplicity of description, only the division of the above-mentioned functional units and modules is used as an example for illustration. In practical applications, the above-mentioned function allocation can be completed by different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above. The functional units and modules in the embodiment can be integrated in a processing unit, or each unit can exist physically separately, or two or more units can be integrated in one unit. The above-mentioned integrated unit can be implemented in the form of hardware or in the form of software functional units. In addition, the specific names of the functional units and modules are only for the convenience of distinguishing each other, and are not used to limit the scope of protection of this application. The specific working process of the units and modules in the above-mentioned system can refer to the corresponding process in the aforementioned method embodiment, which will not be repeated here.
[0208] The embodiment of the present application also provides a computer-readable storage medium, in which a computer program or instruction is stored, and when the computer reads and executes the computer program or instruction, the computer executes the steps in the above-mentioned various method embodiments. The readable medium can be a read-only memory (ROM) or a random access memory (RAM), which is not limited in the embodiment of the present application.
[0209] An embodiment of the present application provides a computer program product. When the computer program product runs on a server, the server can implement the steps in the above-mentioned method embodiments when executing the server.
[0210] The embodiment of the present application also provides a chip, which includes: a processing unit and a communication unit, the processing unit, for example, may be a processor, and the communication unit, for example, may be an input / output interface, a pin or a circuit, etc. The processing unit may execute computer instructions to enable a computer device to execute any of the interface testing methods provided in the embodiment of the present application.
[0211] Optionally, the computer instructions are stored in a storage unit.
[0212] Optionally, the storage unit is a storage unit in the chip, such as a register, a cache, etc. The storage unit can also be a storage unit located outside the chip in the terminal, such as a ROM or other types of static storage devices that can store static information and instructions, random RAM, etc. Among them, the processor mentioned in any of the above can be a CPU, a microprocessor, an ASIC, or one or more integrated circuits for controlling the display of the above-mentioned electronic device and the execution of the program of the control method. The processing unit and the storage unit can be decoupled and respectively set on different physical devices, and connected by wired or wireless means to realize the respective functions of the processing unit and the storage unit, so as to support the system chip to realize the various functions in the above-mentioned embodiments. Alternatively, the processing unit and the memory can also be coupled on the same device.
[0213] It is understandable that the chip provided in the embodiment of the present application can be an integrated circuit for implementing any of the above-mentioned interface testing methods, and the main function of the chip is to execute the steps or processes defined by the interface testing method in the embodiment of the present application, that is, to implement the interface testing method in the embodiment of the present application by hardware. The computer-readable storage medium provided in the embodiment of the present application is mainly used to store a computer program, which, when executed, implements the steps or processes defined by any of the above-mentioned interface testing methods, that is, to implement the interface testing method in the embodiment of the present application in the form of computer software.
[0214] In the above embodiments, the description of each embodiment has its own emphasis. For parts that are not described or recorded in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0215] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, or a combination of computer software and electronic hardware. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this application.
[0216] In the embodiments provided in the present application, it should be understood that the disclosed devices / equipment and methods can be implemented in other ways. For example, the device / equipment embodiments described above are merely schematic, for example, the division of the modules or units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components 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 units, which can be electrical, mechanical or other forms.
[0217] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0218] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0219] If the integrated module / unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the present application implements all or part of the processes in the above-mentioned embodiment method, which can be completed by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium, and the computer program can implement the steps of the above-mentioned various method embodiments when executed by the processor. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form. The computer-readable medium may at least include: any entity or device that can carry the computer program code to the device / server, a recording medium, a computer memory, a read-only memory (ROM, Read-Only Memory), a random access memory (RAM, Random Access Memory), an electric carrier signal, a telecommunication signal, and a software distribution medium. For example, a USB flash drive, a mobile hard disk, a magnetic disk or an optical disk. In some jurisdictions, according to legislation and patent practice, computer-readable media cannot be electric carrier signals and telecommunication signals.
[0220] The embodiments described above are only used to illustrate the technical solutions of the present application, rather than to limit them. Although the present application has been described in detail with reference to the aforementioned embodiments, a person skilled in the art should understand that the technical solutions described in the aforementioned embodiments may still be modified, or some of the technical features may be replaced by equivalents. Such modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present application, and should all be included in the protection scope of the present application.
Claims
1. An interface testing method, characterized in that: include: Automatically obtain multiple interface information based on the log information generated in real time by the target software system during the test phase and / or the production phase, each interface information including relevant information of an interface request involved by the target software system during the test phase and / or the production phase; Automatically generate interface test cases according to the multiple interface information; The interface test case is automatically executed in the target software system to obtain the interface test result of the target software system.
2. The method according to claim 1, characterized in that The automatically generating interface test cases according to the plurality of interface information comprises: Automatically synchronizing the plurality of interface information to a target database; Automatically obtain multiple target interface information from the target database, where the multiple target interface information is part of the multiple interface information; The interface test case is automatically generated according to the multiple target interface information.
3. The method according to claim 2, characterized in that The multiple interface information corresponds to N interfaces, where N is a positive integer, and the multiple target interface information includes interface information corresponding to each of the N interfaces.
4. The method according to claim 3, characterized in that In the plurality of target interface information: the number of target interface information corresponding to each interface of the N interfaces is less than or equal to a first preset number; The target interface information corresponding to each of the N interfaces includes: the interface information acquired from the plurality of interface information in order of the interface information acquisition time from the latest to the earliest.
5. The method according to claim 4, characterized in that The method further comprises: After all target interface information corresponding to each of the N interfaces is acquired from the target database, the interface information corresponding to each interface in the target database is deleted.
6. The method according to any one of claims 3 to 5, characterized in that: Each target interface information includes request parameters and response status of an interface request of the corresponding interface; The automatically generating the interface test case according to the plurality of target interface information comprises: Performing a first analysis on the plurality of target interface information to obtain an interface set, where the interface set is a collection of attribute information of the N interfaces; Using the interface set, performing a second analysis on the multiple target interface information to obtain an interface parameter set, wherein each piece of data in the interface parameter set corresponds to a parameter field of an interface, and each piece of data in the interface parameter set includes: multiple successful parameter values and multiple failed parameter values of the corresponding parameter field; The interface test case is generated by utilizing the multiple target interface information, the interface set, the interface parameter set and the preset parameter value.
7. The method according to claim 6, characterized in that In the interface set: the attribute information of each interface includes the first request parameter of each interface, the first request parameter is the request parameter in the first target interface information, the first target interface information is the target interface information corresponding to each interface: the response status is successful and the collection time is the latest target interface information, the first request parameter includes: at least one parameter field and a parameter value for each parameter field.
8. The method according to claim 7, characterized in that In the interface parameter set: the parameter field of each piece of data is a parameter field in the first request parameter of the interface corresponding to each piece of data.
9. The method according to claim 6, characterized in that The request parameters in each target interface information include: at least one parameter field and a parameter value of each parameter field; the second parsing of the plurality of target interface information using the interface set to obtain an interface parameter set includes: According to the request parameters and response status in each target interface information in the multiple target interface information, a parameter field set is obtained, wherein the parameter field set is a collection of multiple parameter field information, each parameter field information includes: a target parameter field, a parameter value and a response status, and the target parameter field is a parameter field in the request parameters in the multiple target interface information; The interface parameter set is determined according to the interface set and the parameter field set.
10. The method according to claim 6, characterized in that The interface test case includes an interface test case corresponding to each interface of the N interfaces; The interface test cases corresponding to each interface include: playback cases and random cases; the interface test cases are generated by using the multiple target interface information, the interface set, the interface parameter set and the preset parameter value, including: Generate a playback use case for each of the N interfaces using the multiple target interface information; A random use case for each of the N interfaces is generated according to the interface set, the interface parameter set and the preset parameter value.
11. The method according to claim 6, characterized in that In the interface set: the attribute information of each interface also includes execution statistics of interface test cases of each interface; the method further includes: According to the interface test cases and the interface test results, the execution statistics of the interface test cases in the attribute information of each interface in the interface set are updated.
12. An interface testing device, characterized in that: The device comprises means for performing the steps of the method according to any one of claims 1 to 11.
13. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program or instructions. When a computer reads and executes the computer program or instructions, the computer executes the method according to any one of claims 1 to 11.