Interface testing method and device, medium and program product
By automatically constructing interface test data, combining the test-related information input by users and interface design information, the problem of low interface testing efficiency in the existing technology is solved, and efficient and flexible interface testing is achieved.
Patent Information
- Application Number
- CN202411881998.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-19
- Publication Date
- 2025-03-21
AI Technical Summary
The testing efficiency of interface testing methods in the prior art is low, mainly due to the low efficiency of manually constructing test data.
By determining the interface design information based on the code of the interface to be tested, the initial test data is automatically constructed based on the test-related information entered by the user, and the user is supported to adjust the initial test data to generate the final test data.
It realizes automatic construction of test data, improves the efficiency of interface testing, supports the flexibility of user needs, and improves the flexibility and accuracy of interface testing.
Smart Images

Figure CN119669095A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of big data technology, and in particular to an interface testing method, equipment, medium and program product. Background Art
[0002] In the process of software development, testing of software interfaces is very important.
[0003] When performing interface testing in related technologies, it is necessary to manually learn relevant information of the interface to be tested, construct test data, and test the interface based on the test data.
[0004] However, in the above process, the efficiency of manually constructing test data is low, resulting in low efficiency of interface testing. Summary of the invention
[0005] The present invention provides an interface testing method, equipment, medium and program product to solve the technical problem of low testing efficiency of the interface testing method in the related art.
[0006] According to one aspect of the present invention, there is provided an interface testing method, the method comprising:
[0007] Determine the interface design information of the current interface to be tested according to the code of the current interface to be tested;
[0008] Determining initial test data according to the interface design information and test related information input by the user;
[0009] If an adjustment instruction of the user for the initial test data is received, the initial test data is adjusted according to the adjustment instruction to obtain first test data;
[0010] According to the first test data, the current interface to be tested is run to obtain first return data of the current interface to be tested;
[0011] A first test result of the current interface to be tested is determined according to the first returned data.
[0012] According to another aspect of the present invention, there is provided an interface testing device, the device comprising:
[0013] A first determining module, used to determine the interface design information of the current interface to be tested according to the code of the current interface to be tested;
[0014] A second determination module, used to determine initial test data according to the interface design information and test related information input by the user;
[0015] an adjustment module, configured to adjust the initial test data according to the adjustment instruction to obtain first test data if an adjustment instruction for the initial test data is received from the user;
[0016] A third determination module is used to run the current interface to be tested according to the first test data to obtain first return data of the current interface to be tested;
[0017] The fourth determining module is used to determine a first test result of the current interface to be tested according to the first returned data.
[0018] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0019] at least one processor; and
[0020] a memory communicatively connected to the at least one processor; wherein,
[0021] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can execute the interface testing method described in any embodiment of the present invention.
[0022] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, wherein the computer program is used to enable a processor to implement the interface testing method described in any embodiment of the present invention when executed.
[0023] According to another aspect of the present invention, a computer program product is provided, comprising a computer program, wherein when the computer program is executed by a processor, the interface testing method according to any embodiment of the present invention is implemented.
[0024] The technical solution of the embodiment of the present invention includes: determining the interface design information of the current interface to be tested according to the code of the current interface to be tested; determining the initial test data according to the interface design information and the test related information input by the user; if the user receives an adjustment instruction for the initial test data, adjusting the initial test data according to the adjustment instruction to obtain the first test data; running the current interface to be tested according to the first test data to obtain the first return data of the current interface to be tested; determining the first test result of the current interface to be tested according to the first return data. It has the following technical effects: on the one hand, the initial test data can be jointly constructed according to the interface design information and the test related information input by the user, realizing the automatic construction of test data, and improving the efficiency of interface testing compared with the method of manually constructing test data; on the other hand, it supports the user to adjust the initial test data to obtain the first test data for the final test, so that the first test data can meet the user's needs and improve the flexibility of interface testing.
[0025] It should be understood that the contents described in this section are not intended to identify the key or important features of the embodiments of the present invention, nor are they intended to limit the scope of the present invention. Other features of the present invention will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0026] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the description of the embodiments. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0027] Figure 1 is a flow chart of an interface testing method provided by an embodiment of the present invention;
[0028] Figure 2 is a flow chart of another interface testing method provided by an embodiment of the present invention;
[0029] Figure 3 is a schematic diagram of a user interface provided by an embodiment of the present invention;
[0030] Figure 4 is a schematic diagram of another user interface provided by an embodiment of the present invention;
[0031] Figure 5 is a flow chart of another interface testing method provided by an embodiment of the present invention;
[0032] Figure 6 is a structural schematic diagram of an interface testing device provided by an embodiment of the present invention;
[0033] Figure 7 It is a structural schematic diagram of an electronic device for implementing the interface testing method of an embodiment of the present invention. DETAILED DESCRIPTION
[0034] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0035] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the term "comprising" and any variation thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices. The acquisition, storage, use, processing, etc. of data in the embodiments of the present invention all comply with the relevant provisions of national laws and regulations.
[0036] Figure 1 This is a flow chart of an interface testing method provided by an embodiment of the present invention. This embodiment can be applied to the scenario of testing the interface of software. The method can be executed by an interface testing device, which can be implemented in the form of hardware and / or software. The interface testing device can be configured in an electronic device, for example, a computer device or a server. Figure 1 As shown, the method includes the following steps 101 to 105.
[0037] Step 101: Determine the interface design information of the current interface to be tested according to the code of the current interface to be tested.
[0038] The interface to be tested in this embodiment is an application programming interface (API) of a certain software. Through the interface, the software can obtain data from an external system or service to achieve communication and interaction between different software.
[0039] Optionally, in the field of financial technology, the current test interface in this embodiment can be: an interface for implementing user login, an interface for implementing user transactions, or an interface for implementing user authentication, etc.
[0040] In one implementation, the code of the current interface to be tested may be input into a code analysis tool to obtain interface design information of the current interface to be tested.
[0041] In another implementation, the code of the current interface to be tested may be input into a pre-trained interface learning model to obtain interface design information output by the interface learning model.
[0042] The interface design information in this embodiment is used to characterize information such as the interface function, interface definition, input and output field description, and interface processing logic of the interface to be tested.
[0043] In this embodiment, by directly identifying the code of the current interface to be tested to obtain interface design information, the accuracy of the obtained interface design information can be improved, so that the initial test data constructed subsequently has pertinence.
[0044] Optionally, a possible interface design information includes the following:
[0045] (1) Interface function: Type: New; Interface: / taskExecution; Function: Send a task execution request based on the task number.
[0046] (2) Interface definition: Request path: / taskExecution; Request method: Submit (POST); Encoding format: Unicode Transformation Format—8-bit (UTF-8); Request data type: JavaScript Object Notation (JSON); Response data type: JSON; Whether to authenticate: No.
[0047] (3) Description of input and output fields: Request example: http: / / api.example.com / taskExecution; description of request fields (i.e., input parameters) is shown in Table 1; description of return fields (i.e., output parameters) is shown in Table 2; format of input parameters and output parameters.
[0048] Table 1 Request field description
[0049]
[0050]
[0051] Example of the JSON format of input parameters: {task_id: "XXX"}.
[0052] Table 2 Return Field Description
[0053]
[0054] An example of the JSON format of the returned field: {success:1,message:"Call successful"}.
[0055] (4) Interface processing logic: 1. After receiving the request, the interface obtains task_id from the request parameters; 2. Query the pre-set task management table according to task_id to confirm whether the task exists; 3. If the task does not exist, return an error message, indicating that the corresponding task cannot be found; 4. If the task exists, update the task status (status) to 3 (successful application sending); 5. Call the execution interface ( / taskStart interface), pass in the task number, and send the execution application; 6. Get the return result of the / taskStart interface. If it contains "success", it is considered that the application sending is successful, and the task status is updated to 3; otherwise, the task status is updated to 4 (failure); 7. The / taskStart interface returns the application sending result to the interface; 8. The interface outputs the return field according to the received application sending result.
[0056] Step 102: Determine initial test data according to the interface design information and the test related information input by the user.
[0057] In this embodiment, when determining the initial test data, in addition to according to the interface design information, it can also be determined according to the test related information input by the user, so that the test process meets the needs of the user and improves the flexibility of the interface test.
[0058] In this embodiment, the test-related information input by the user may include at least one of the following: a test scenario required by the user, a test target required by the user, and a verification scenario required by the user.
[0059] In one implementation, the implementation process of step 102 may include: receiving test-related information input by a user through a pre-trained data construction model, wherein the test-related information is a natural language; determining initial test data through the data construction model according to interface design information and test-related information.
[0060] In another implementation, the implementation process of step 102 may include: presetting a mapping relationship between interface design information and test-related information and test data; determining initial test data based on the mapping relationship, the interface design information obtained in step 101, and the test-related information input by the user in step 102.
[0061] Optionally, assuming that the current interface to be tested is an interface for implementing user login, the initial test data may include: a correct username and password combination; an incorrect username and password combination; an empty username or password field, etc.
[0062] It should be noted that the data format of the first test data in this embodiment needs to be the same as the data format of the input parameters of the current interface to be tested included in the interface design information. The data format in this embodiment can be JSON or eXtensible Markup Language (XML).
[0063] Step 103: If an adjustment instruction for the initial test data is received from the user, the initial test data is adjusted according to the adjustment instruction to obtain first test data.
[0064] In some scenarios, the initial test data cannot fully meet the test requirements or user requirements. In this embodiment, the user is allowed to adjust the initial test data so that the test process meets the user's requirements.
[0065] The adjustment instruction in this embodiment may include at least one of the following: an instruction to add test data to the initial test data, an instruction to delete test data from the initial test data, and an instruction to adjust certain test data in the initial test data. Correspondingly, adjusting the initial test data according to the adjustment instruction may include at least one of the following: adding the test data indicated in the adjustment instruction to the initial test data, deleting the test data indicated in the adjustment instruction from the initial test data, and adjusting the test data indicated by the adjustment instruction in the initial test data.
[0066] Continuing with the example in step 102, assuming that the current interface to be tested is an interface for implementing user login, the initial test data includes: a correct username and password combination; an incorrect username and password combination; an empty username or password field, etc. Then the adjustment instruction in step 103 can be a username and password with special characters and non-standard characters added. Based on this example, the first test data includes: a correct username and password combination; an incorrect username and password combination; an empty username or password field; a username and password with special characters and non-standard characters.
[0067] Optionally, if no adjustment instruction to the initial test data is received from the user, the initial test data is directly used as the first test data.
[0068] Step 104: According to the first test data, the current interface to be tested is run to obtain the first return data of the current interface to be tested.
[0069] In this embodiment, running the current interface to be tested according to the first test data refers to inputting the first test data into the current interface to be tested and running the current interface to be tested. After the current interface to be tested is run, first return data output based on the first test data is obtained.
[0070] Optionally, assuming that the current interface to be tested is an interface for implementing user login, the first returned data in this embodiment may include at least one of the following: successful login, failed login, output character format prompt information, etc.
[0071] Step 105: Determine a first test result of the current interface to be tested according to the first returned data.
[0072] The first test result in this embodiment is used to indicate that the current interface to be tested has passed the test or that the current interface to be tested has failed the test.
[0073] In one implementation, the first returned data may be verified according to a preset verification rule corresponding to the interface to determine a first test result.
[0074] When the first returned data matches the preset verification rule, it is determined that the current interface to be tested has passed the test. When the first returned data does not match the preset verification rule, it is determined that the current interface to be tested has failed the test.
[0075] In another implementation, in order to improve the accuracy and flexibility of the test, the interface testing method provided in this embodiment further includes the following steps: determining a first verification rule according to the interface design information; and obtaining a second verification rule input by the user. Correspondingly, the implementation process of step 105 may be: verifying the first return data according to the first verification rule and the second verification rule, and determining the first test result of the current interface to be tested.
[0076] In this embodiment, the first validation rule can be summarized based on the interface function, interface definition, input and output field description, interface processing logic, etc. in the interface design information. The second validation rule in this embodiment is a validation rule determined by the user according to business requirements.
[0077] When the first returned data matches both the first verification rule and the second verification rule, it is determined that the current interface to be tested has passed the test. When the first returned data does not match both the first verification rule and the second verification rule, it is determined that the current interface to be tested has failed the test.
[0078] Optionally, assuming that the current interface to be tested is an interface for implementing user login, the first verification rule in this embodiment can be: a correct username and password combination must return a successful login, an incorrect username and password combination must return a failed login, and an empty username or password field must return a failed login. The second verification rule for user input can be: usernames and passwords with special characters and non-standard characters must return character format prompt information.
[0079] In this implementation, the first return data is verified in combination with the first verification rule determined by the interface design information and the second verification rule input by the user to obtain a first test result, thereby realizing verification of the first return data in combination with the two verification rules, thereby improving the accuracy and flexibility of the test.
[0080] The interface testing method provided in this embodiment can realize automatic construction of the first test data, is simple to implement, has low implementation cost, high efficiency, and can also realize version management of the interface.
[0081] Furthermore, the interface testing method provided in this embodiment also includes the following steps: if the first test result of the current interface to be tested is that the current interface to be tested fails the test, then the code modification suggestions for the current interface to be tested are determined based on the code of the current interface to be tested, the first test data and the first test result.
[0082] Optionally, the code of the current interface to be tested, the first test data, and the first test result may be input into a pre-trained code modification suggestion model to obtain the code modification suggestion of the current interface to be tested output by the model.
[0083] Exemplarily, the code modification suggestion for the current interface to be tested in this embodiment may include at least one of the following: the location of the problem code and the modification method of the problem code, the location of the potential problem code and the modification method of the potential problem code.
[0084] When the test of the current interface to be tested fails, this implementation method can determine code modification suggestions for the current interface to be tested based on relevant information during the test process, thereby further determining code modification suggestions for the current interface to be tested and expanding the application scenarios of the interface testing method.
[0085] The interface testing method provided in this embodiment includes: determining the interface design information of the current interface to be tested according to the code of the current interface to be tested; determining the initial test data according to the interface design information and the test related information input by the user; if receiving the user's adjustment instruction for the initial test data, adjusting the initial test data according to the adjustment instruction to obtain the first test data; running the current interface to be tested according to the first test data to obtain the first return data of the current interface to be tested; determining the first test result of the current interface to be tested according to the first return data. It has the following technical effects: on the one hand, the initial test data can be jointly constructed according to the interface design information and the test related information input by the user, realizing the automatic construction of test data, and improving the efficiency of interface testing compared with the method of manually constructing test data; on the other hand, it supports the user to adjust the initial test data to obtain the first test data that finally implements the test, so that the first test data can meet the user's needs and improve the flexibility of interface testing.
[0086] Figure 2 is a flow chart of another interface testing method provided by an embodiment of the present invention. The interface testing method provided by this embodiment, Figure 1 Based on the illustrated embodiment and various optional implementations, the specific implementations of step 101, step 102, step 103 and step 105 and the implementation after obtaining the first test result are described in detail. Figure 2 As shown, the interface testing method provided in this embodiment includes the following steps 201 to 208.
[0087] Step 201: Input the code of the current interface to be tested into a pre-trained interface learning model to obtain interface design information output by the interface learning model.
[0088] The difference between step 201 and step 101 is that in step 201, an interface learning model trained with big data is used to intelligently learn the interface design information of the current interface to be tested based on the code of the current interface to be tested. During the testing process, the big data model's ability to interpret the code is relied upon to improve the accuracy of the output interface design information while reducing the user's learning cost.
[0089] In this embodiment, the process of determining the initial test data according to the interface design information and the test related information input by the user is implemented through the following steps 202 and 203.
[0090] Step 202: Receive test-related information input by the user through a pre-trained data construction model.
[0091] The test related information is in natural language.
[0092] The data construction model in step 202 can support users to input test-related information through natural language, thereby lowering the threshold for inputting test-related information and further improving test efficiency.
[0093] Step 203: construct a model through data, and determine initial test data according to interface design information and test related information.
[0094] The difference between step 202 and step 203 and step 102 is that in step 202 and step 203, a data construction model trained with big data is used to receive test related information input by a user, and the data construction model is used to determine initial test data according to interface design information and test related information. The initial test data is constructed using the reasoning ability of the big data model, thereby improving the accuracy of the initial test data.
[0095] Step 204: Receive adjustment instructions input by the user through the pre-trained data optimization model.
[0096] The adjustment instruction is a natural language.
[0097] In this embodiment, the adjustment instructions described in natural language input by the user can be received based on the data optimization model trained with big data, which lowers the threshold for inputting adjustment instructions and further improves the testing efficiency.
[0098] Optionally, in order to ensure the adjustment effect of the user on the first test data, in step 204, the adjustment instructions input by the user through the pre-trained data optimization model can be received through multiple rounds of dialogue.
[0099] Optionally, before step 204, the interface testing method provided in this embodiment further includes the following steps: constructing a model through data and outputting prompt information, wherein the prompt information is used to instruct the user to input test related information.
[0100] The data construction model in this embodiment can also automatically prompt the user to enter test-related information to reduce the user's learning cost for the testing process, simplify the process of entering test-related information, reduce the difficulty of entering test-related information, and further improve testing efficiency.
[0101] Figure 3 is a schematic diagram of a user interface provided by an embodiment of the present invention. Figure 3 As shown, in the user interface 301, the data construction model output information "Please input the test scenario" is displayed. In the user interface 301, the user inputs "the processing of invalid input by the verification interface".
[0102] Step 205: Using the data optimization model, the initial test data is adjusted according to the adjustment instruction to obtain first test data.
[0103] In step 205, a data optimization model based on big data training can be implemented to adjust the initial test data according to the adjustment instruction to obtain the first test data, thereby improving the accuracy of the obtained first test data.
[0104] Step 206: According to the first test data, the current interface to be tested is run to obtain the first return data of the current interface to be tested.
[0105] In one implementation, step 206 can also be implemented by running the current interface to be tested according to the first test data through a pre-trained running model to obtain the first return data of the current interface to be tested.
[0106] In another implementation, step 206 may be implemented based on a data optimization model.
[0107] In yet another implementation, step 206 may be implemented based on the result verification model.
[0108] Step 207: Determine the first test result of the current interface to be tested according to the first returned data through the pre-trained result verification model.
[0109] In step 207, a result verification model based on big data training can be implemented to determine the first test result of the current interface to be tested according to the first returned data, thereby improving the accuracy of the first test result.
[0110] The interface learning model, data construction model, data optimization model, and result verification model involved in this embodiment refer to artificial intelligence models formed by training and optimization through a large amount of data and algorithms. Each model in this embodiment can be a model formed by a machine learning algorithm. More specifically, each model can be a model formed by a deep learning algorithm.
[0111] Furthermore, the interface learning model, data construction model, data optimization model, and result verification model involved in this embodiment can be a large model. The large model in this embodiment refers to a model with a very large number of parameters and a very large calculation scale in the field of artificial intelligence, especially machine learning and deep learning. The number of parameters of a large model often reaches hundreds of millions or even hundreds of billions.
[0112] In this embodiment, after obtaining the first test result, in order to further meet the user's needs, the following steps 208 to 210 may be included. It should be noted that: Figure 1 The interface testing method provided by the illustrated embodiment and various optional implementations may also include the following steps 208 to 210.
[0113] Step 208: If a test-continue instruction input by the user is received, second test data is constructed according to the test requirements input by the user.
[0114] After obtaining the first test result, if the user is not satisfied with the test process or wants to perform a supplementary test, the user may input a continue test instruction.
[0115] Optionally, the continue test instruction in this embodiment may include a test requirement. Alternatively, the continue test instruction and the test requirement are information input by the user respectively. The test requirement in this embodiment includes at least one of the following: a test scenario required by the user, a test target required by the user, and a verification scenario required by the user.
[0116] Optionally, step 208 may construct second test data according to the test requirements input by the user through a data optimization model.
[0117] Figure 4 is a schematic diagram of another user interface provided by an embodiment of the present invention. Figure 4 As shown, in the user interface 401, the test requirement input by the user is "I want to create some invalid inputs to determine whether the interface can handle exceptions." The information fed back by the data optimization module is "OK, three invalid data groups have been generated for you and displayed in the data display area on the left." In the data display area 402 on the left, three invalid data groups are displayed.
[0118] Step 209: According to the second test data, the current interface to be tested is run to obtain second return data of the current interface to be tested.
[0119] Step 210: Determine a second test result of the current interface to be tested according to the second returned data.
[0120] The implementation process and technical principle of step 209 and step 104, and step 210 and step 105 are similar, and will not be repeated here.
[0121] The interface testing method provided in this embodiment, on the one hand, realizes obtaining interface design information, determining initial test data, obtaining first test data, and obtaining first test results by using a model trained with big data, thereby improving the accuracy of interface testing and further improving the test efficiency. On the other hand, after obtaining the first test result, the user controls whether to continue the test, and when continuing the test, the second test data is constructed according to the test requirements input by the user to implement the test, so that the test process further meets user needs and further improves the flexibility of the interface test. At the same time, continued testing can improve the test accuracy and comprehensiveness of the current interface to be tested.
[0122] Figure 5is a flowchart of another interface testing method provided by an embodiment of the present invention. The interface testing method provided by this embodiment, Figure 1 Based on the illustrated embodiment and various optional implementations, a detailed description is given of the implementation of automatically determining the current interface to be detected. Figure 5 As shown, the interface testing method provided in this embodiment includes the following steps 501 to 508.
[0123] Step 501: Determine a sequence of interfaces to be tested and the code of each interface to be tested in the sequence of interfaces to be tested according to the code of the software to be tested.
[0124] Optionally, the software to be tested in this embodiment may be software in the field of financial technology. Of course, the software to be tested may also be software in other fields. The software to be tested includes multiple interfaces to be tested. The interface testing method provided in this embodiment can realize automatic testing of all interfaces to be tested in the software to be tested.
[0125] The interface sequence to be tested in this embodiment includes multiple interfaces to be tested, and the multiple interfaces to be tested are arranged according to a certain preset rule.
[0126] In one implementation, the code of the software to be tested may be input into a code analysis tool to obtain a sequence of interfaces to be tested and the code of each interface to be tested in the sequence of interfaces to be tested.
[0127] In another implementation method, a code analysis model that is pre-trained with the code of the software to be tested can be used to obtain a sequence of interfaces to be tested and the code of each interface to be tested in the sequence of interfaces to be tested, thereby utilizing the code interpretation capability of the big data model to improve the accuracy of the obtained sequence of interfaces to be tested and the code of each interface to be tested in the sequence of interfaces to be tested.
[0128] Step 502: Determine the i-th test interface in the sequence of interfaces to be tested as the current interface to be tested.
[0129] In the first iteration, i is 1.
[0130] In each iteration process, the i-th test interface in the sequence of interfaces to be tested is selected as the current interface to be tested.
[0131] Step 503: Determine the interface design information of the current interface to be tested according to the code of the current interface to be tested.
[0132] Step 504: Determine initial test data according to the interface design information and the test related information input by the user.
[0133] Step 505: If an adjustment instruction for the initial test data is received from the user, the initial test data is adjusted according to the adjustment instruction to obtain first test data.
[0134] Step 506: According to the first test data, the current interface to be tested is run to obtain the first return data of the current interface to be tested.
[0135] Step 507: Determine a first test result of the current interface to be tested according to the first returned data.
[0136] The implementation process and technical principle of step 503 and step 101, step 504 and step 102, step 505 and step 103, step 506 and step 104, and step 507 and step 105 are similar, and will not be repeated here.
[0137] Step 508: If it is determined that the test of the current test interface is completed, the value of i plus 1 is used as the new i, and the process returns to step 502 until the new i is greater than the number of interfaces to be tested in the sequence of interfaces to be tested.
[0138] In step 508, if the new i is less than or equal to the number of interfaces to be tested in the interface sequence to be tested, the process returns to step 502. If the new i is greater than the number of interfaces to be tested in the interface sequence to be tested, the iteration is stopped.
[0139] In one implementation, the number of tests for the current test interface may be pre-specified. If the number of tests for the current test interface does not reach the number of tests, it is determined that the current test interface test is not completed, and the execution returns to step 502, at which time the value of i is not updated. If the number of tests for the current test interface reaches the number of tests, it is determined that the current test interface test is completed, and the value of i is updated and the execution returns to step 502.
[0140] In another implementation, whether the current test interface test is completed may be determined based on a user instruction.
[0141] The interface testing method provided in this embodiment can identify the code of the software to be tested, determine the code of each interface to be tested in each interface sequence to be tested, and realize automatic testing of each interface to be tested, thereby further improving the testing efficiency and thus improving the delivery efficiency of the software to be tested.
[0142] Figure 6 1 is a schematic diagram of the structure of an interface testing device provided by an embodiment of the present invention. The device is arranged in an electronic device. Figure 6 As shown, the interface testing device provided in this embodiment includes the following modules: a first determining module 61 , a second determining module 62 , an adjusting module 63 , a third determining module 64 and a fourth determining module 65 .
[0143] The first determining module 61 is used to determine the interface design information of the current interface to be tested according to the code of the current interface to be tested.
[0144] The second determining module 62 is used to determine initial test data according to the interface design information and the test related information input by the user.
[0145] The adjustment module 63 is configured to adjust the initial test data according to the adjustment instruction to obtain first test data if an adjustment instruction for the initial test data is received from the user.
[0146] The third determining module 64 is used to run the current interface to be tested according to the first test data to obtain first return data of the current interface to be tested.
[0147] The fourth determining module 65 is used to determine a first test result of the current interface to be tested according to the first returned data.
[0148] In one embodiment, the device further includes: a fifth determining module and a first acquiring module.
[0149] The fifth determination module is used to determine the first verification rule according to the interface design information. The first acquisition module is used to acquire the second verification rule input by the user. The fourth determination module 65 is specifically used to: verify the first return data according to the first verification rule and the second verification rule, and determine the first test result of the current interface to be tested.
[0150] In one embodiment, the first test result is used to indicate that the current interface to be tested has passed this test or that the current interface to be tested has failed this test. The device also includes: a sixth determination module, which is used to determine code modification suggestions for the current interface to be tested based on the code of the current interface to be tested, the first test data, and the first test result if the first test result of the current interface to be tested is that the current interface to be tested has failed this test.
[0151] In one embodiment, the device further includes: a second acquisition module, a seventh determination module and an eighth determination module.
[0152] The second acquisition module is used to acquire the test requirements input by the user and construct the second test data if a test continuation instruction input by the user is received.
[0153] The seventh determination module is used to run the current interface to be tested according to the second test data to obtain second return data of the current interface to be tested.
[0154] An eighth determination module is used to determine a second test result of the current interface to be tested according to the second returned data.
[0155] In one embodiment, the first determination module 61 is specifically used to: input the code of the current interface to be tested into a pre-trained interface learning model to obtain the interface design information output by the interface learning model.
[0156] In one embodiment, the second determination module 62 is specifically used to: receive test-related information input by a user through a pre-trained data construction model, wherein the test-related information is a natural language; and determine the initial test data through the data construction model according to the interface design information and the test-related information.
[0157] In one embodiment, the adjustment module 63 is specifically used to: receive adjustment instructions input by a user through a pre-trained data optimization model, wherein the adjustment instructions are natural language; and adjust the initial test data according to the adjustment instructions through the data optimization model to obtain first test data.
[0158] In one embodiment, the fourth determination module 65 is specifically used to determine the first test result of the current interface to be tested according to the first returned data through a pre-trained result verification model.
[0159] In one embodiment, the device further comprises an output module, which is used to construct a model through the data and output prompt information, wherein the prompt information is used to instruct the user to input the test related information.
[0160] In one embodiment, the device further includes a ninth determining module, a tenth determining module and a return execution module.
[0161] The ninth determination module is used to determine the interface sequence to be tested and the code of each interface to be tested in the interface sequence to be tested according to the code of the software to be tested.
[0162] The tenth determining module is used to determine the i-th test interface in the sequence of interfaces to be tested as the current interface to be tested, wherein i is 1 in the first iteration.
[0163] The return execution module is used to, if it is determined that the test of the current test interface is completed, take the value of i plus 1 as the new i, and return to execute the steps executed by the tenth determination module until the new i is greater than the number of interfaces to be tested in the sequence of interfaces to be tested.
[0164] The interface testing device provided in the embodiment of the present invention can execute the interface testing method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.
[0165] Figure 7 1 is a schematic diagram of the structure of an electronic device that implements the interface testing method of an embodiment of the present invention. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present invention described and / or required herein.
[0166] like Figure 7 As shown, the electronic device 10 includes at least one processor 11, and a memory connected to the at least one processor 11, such as a read-only memory (ROM) 12, a random access memory (RAM) 13, etc., wherein the memory stores a computer program that can be executed by at least one processor, and the processor 11 can perform various appropriate actions and processes according to the computer program stored in the read-only memory (ROM) 12 or the computer program loaded from the storage unit 18 to the random access memory (RAM) 13. In the RAM 13, various programs and data required for the operation of the electronic device 10 can also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other through a bus 14. An input / output (I / O) interface 15 is also connected to the bus 14.
[0167] A number of components in the electronic device 10 are connected to the I / O interface 15, including: an input unit 16, such as a keyboard, a mouse, etc.; an output unit 17, such as various types of displays, speakers, etc.; a storage unit 18, such as a disk, an optical disk, etc.; and a communication unit 19, such as a network card, a modem, a wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information / data with other devices through a computer network such as the Internet and / or various telecommunication networks.
[0168] The processor 11 may be a variety of general and / or special processing components with processing and computing capabilities. Some examples of the processor 11 include, but are not limited to, a central processing unit (CPU), a graphics processing unit (GPU), various special artificial intelligence (AI) computing chips, various processors running machine learning model algorithms, a digital signal processor (DSP), and any appropriate processor, controller, microcontroller, etc. The processor 11 executes the various methods and processes described above, such as the interface testing method.
[0169] In some embodiments, the interface testing method may be implemented as a computer program, which is tangibly contained in a computer-readable storage medium, such as a storage unit 18. In some embodiments, part or all of the computer program may be loaded and / or installed on the electronic device 10 via the ROM 12 and / or the communication unit 19. When the computer program is loaded into the RAM 13 and executed by the processor 11, one or more steps of the interface testing method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the interface testing method in any other appropriate manner (e.g., by means of firmware).
[0170] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations can include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0171] Computer programs for implementing the methods of the present invention may be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general-purpose computer, a special-purpose computer, or other device, so that when the computer program is executed by the processor, the functions / operations specified in the flow chart and / or block diagram are implemented. The computer program may be executed entirely on the machine, partially on the machine, partially on the machine and partially on a remote machine as a stand-alone software package, or entirely on a remote machine or server.
[0172] In the context of the present invention, a computer-readable storage medium may be a tangible medium that may contain or store a computer program for use by or in combination with an instruction execution system, device or equipment. A computer-readable storage medium may include, but is not limited to, electronic, magnetic, optical, electromagnetic, infrared, or semiconductor systems, devices or equipment, or any suitable combination of the foregoing. Alternatively, a computer-readable storage medium may be a machine-readable signal medium. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0173] To provide interaction with a user, the systems and techniques described herein may be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and a pointing device (e.g., a mouse or trackball) through which the user can provide input to the electronic device. Other types of devices may also be used to provide interaction with the user; for example, the feedback provided to the user may be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form (including acoustic input, voice input, or tactile input).
[0174] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), a blockchain network, and the Internet.
[0175] A computing system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The client and server relationship is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services.
[0176] An embodiment of the present invention further provides a computer program product, including a computer program, which, when executed by a processor, implements the interface testing method provided by any embodiment of the present invention.
[0177] In the process of implementation, the computer program product can be written in one or more programming languages or a combination thereof to perform the computer program code of the present invention, including object-oriented programming languages, such as Java, Smalltalk, C++, and conventional procedural programming languages, such as "C" language or similar programming languages. The program code can be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (for example, using an Internet service provider to connect through the Internet).
[0178] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps described in the present invention can be executed in parallel, sequentially or in different orders, as long as the desired results of the technical solution of the present invention can be achieved, and this document does not limit this.
[0179] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims
1. An interface testing method, characterized in that: The method comprises: Determine the interface design information of the current interface to be tested according to the code of the current interface to be tested; Determining initial test data according to the interface design information and test related information input by the user; If an adjustment instruction of the user for the initial test data is received, the initial test data is adjusted according to the adjustment instruction to obtain first test data; According to the first test data, the current interface to be tested is run to obtain first return data of the current interface to be tested; A first test result of the current interface to be tested is determined according to the first returned data.
2. The method according to claim 1, characterized in that The method further comprises: Determining a first verification rule according to the interface design information; Obtaining a second verification rule input by the user; The step of determining a first test result of the current interface to be tested according to the first returned data includes: The first returned data is verified according to the first verification rule and the second verification rule to determine a first test result of the current interface to be tested.
3. The method according to claim 1, characterized in that The first test result is used to indicate that the current interface to be tested has passed the test or that the current interface to be tested has failed the test; The method further comprises: If the first test result of the current interface to be tested is that the current interface to be tested fails the test, a code modification suggestion for the current interface to be tested is determined according to the code of the current interface to be tested, the first test data and the first test result.
4. The method according to claim 1, characterized in that: After determining the first test result of the current interface to be tested according to the first returned data, the method further includes: If a test continuing instruction input by the user is received, obtaining the test requirement according to the user input and constructing second test data; According to the second test data, running the current interface to be tested, and obtaining second return data of the current interface to be tested; A second test result of the current interface to be tested is determined according to the second returned data.
5. The method according to any one of claims 1 to 4, characterized in that: The step of determining the interface design information of the current interface to be tested according to the code of the current interface to be tested includes: Inputting the code of the current interface to be tested into a pre-trained interface learning model to obtain interface design information output by the interface learning model; The determining of initial test data according to the interface design information and the test related information input by the user comprises: Receiving test related information input by a user through a pre-trained data construction model, wherein the test related information is in natural language; determining the initial test data through the data construction model according to the interface design information and the test related information; The step of adjusting the initial test data according to the adjustment instruction to obtain first test data includes: Receiving an adjustment instruction input by a user through a pre-trained data optimization model, wherein the adjustment instruction is in natural language; adjusting the initial test data according to the adjustment instruction through the data optimization model to obtain first test data; The step of determining a first test result of the current interface to be tested according to the first returned data includes: The first test result of the current interface to be tested is determined according to the first returned data through a pre-trained result verification model.
6. The method according to claim 5, characterized in that Before receiving the test related information input by the user through the pre-trained data construction model, the method further includes: The model is constructed by the data, and prompt information is output; wherein the prompt information is used to instruct the user to input the test related information.
7. The method according to any one of claims 1 to 4, characterized in that: Before determining the interface design information of the current interface to be tested according to the code of the current interface to be tested, the method further includes: Determine the interface sequence to be tested and the code of each interface to be tested in the interface sequence to be tested according to the code of the software to be tested; Determine the i-th test interface in the sequence of interfaces to be tested as the current interface to be tested; wherein i is 1 in the first iteration; After determining the first test result of the current interface to be tested according to the first returned data, the method further includes: If it is determined that the test of the current test interface is completed, the value of i plus 1 is used as the new i, and the step of "determining the i-th test interface in the sequence of interfaces to be tested as the current interface to be tested" is returned until the new i is greater than the number of interfaces to be tested in the sequence of interfaces to be tested.
8. An electronic device, characterized in that: The electronic device comprises: at least one processor; and a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor so that the at least one processor can perform the interface testing method according to any one of claims 1 to 7.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and the computer program is used to enable a processor to implement the interface testing method according to any one of claims 1 to 7 when executed.
10. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the computer program implements the interface testing method according to any one of claims 1 to 7.