Interface testing method, device, electronic equipment and storage medium
By acquiring and processing interface information to improve interface test coverage and efficiency, the problem of incomplete existing interface test data is solved, and more efficient and stable interface testing is achieved.
Patent Information
- Application Number
- CN202310324598.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-03-29
- Publication Date
- 2024-12-03
- Estimated Expiration
- 2043-03-29
AI Technical Summary
The existing interface testing methods have incomplete test data, resulting in low coverage of test scenarios and low testing efficiency and long-term consumption.
By obtaining the information of the interface to be tested, determining the information of the interface to be tested and its target interface, performing information data processing, and performing interface testing based on the processing results, improving test coverage and efficiency.
Improve the efficiency and scenario coverage of interface testing, and enhance the effectiveness and stability of interfaces.
Smart Images

Figure CN116303071B_ABST
Abstract
Description
Technical Field
[0001] The embodiments of the present invention relate to the field of computer technology, and in particular to an interface testing method, device, electronic equipment and storage medium. Background Art
[0002] In an existing software system, multiple interfaces may be included, such as a login interface or a search interface, etc., and each interface may perform different functions. After the software system is developed, it is usually necessary to test each interface in the software system to determine whether the interface functions normally through the response data fed back by the interface.
[0003] However, existing interface testing usually generates test case scripts using algorithms such as equivalence classes, boundary values, or error guessing, or testers manually write test case scripts to test interfaces through test case scripts. However, the above methods often result in incomplete test data, that is, missing test scenarios, resulting in low test scenario coverage, and the test process takes a long time, resulting in low test efficiency. Summary of the invention
[0004] The embodiments of the present invention provide an interface testing method, device, electronic device and storage medium, which can improve the test efficiency of the interface test and the coverage of the test scenarios, thereby improving the effectiveness and stability of the interface.
[0005] According to one aspect of the present invention, there is provided an interface testing method, comprising:
[0006] Acquire information of the interface to be tested, and determine the interface to be tested according to the information of the interface to be tested;
[0007] Determine the target interface information corresponding to the interface to be tested according to the interface information to be tested, and perform information data processing on the target interface information;
[0008] An interface test is performed on the interface to be tested according to the information data processing result.
[0009] According to another aspect of the present invention, there is provided an interface testing device, comprising:
[0010] The interface to be tested determining module is used to obtain the interface to be tested information and determine the interface to be tested according to the interface to be tested information;
[0011] An information data processing module, used to determine the target interface information corresponding to the interface to be tested according to the interface information to be tested, and perform information data processing on the target interface information;
[0012] The interface testing module is used to perform interface testing on the interface to be tested according to the information data processing results.
[0013] According to another aspect of the present invention, an electronic device is provided, the electronic device comprising:
[0014] at least one processor; and
[0015] a memory communicatively connected to the at least one processor; wherein,
[0016] 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.
[0017] According to another aspect of the present invention, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the interface testing method described in any embodiment of the present invention when executed.
[0018] The technical solution of the embodiment of the present invention obtains the interface information to be tested, and determines the interface to be tested according to the interface information to be tested, so as to determine the target interface information corresponding to the interface to be tested according to the interface information to be tested, and performs information data processing on the target interface information, so as to perform interface testing on the interface to be tested according to the information data processing result, thereby solving the problems of low test scenario coverage and low test efficiency caused by incomplete test data and long test time in the prior art, and can improve the test efficiency of interface testing and the coverage of test scenarios, thereby improving the effectiveness and stability of the interface.
[0019] 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
[0020] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the description of the embodiments will be briefly introduced below. 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.
[0021] Figure 1 is a flow chart of an interface testing method provided by Embodiment 1 of the present invention;
[0022] Figure 2 is a flow chart of an interface testing method provided by Embodiment 2 of the present invention;
[0023] Figure 3is an example flow chart of an interface testing method provided by Embodiment 2 of the present invention;
[0024] Figure 4 is a schematic diagram of an interface test interface provided by Embodiment 2 of the present invention;
[0025] Figure 5 is a schematic diagram of another interface test interface provided by Embodiment 2 of the present invention;
[0026] Figure 6 is a schematic diagram of an interface testing device provided in Embodiment 3 of the present invention;
[0027] 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
[0028] 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.
[0029] It should be noted that the terms "including" and "having" and any variations thereof in the specification and claims of the present invention and the above-mentioned drawings are intended to cover non-exclusive inclusions. For example, a process, method, system, product or apparatus 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 apparatus.
[0030] Embodiment 1
[0031] Figure 1 This is a flowchart of an interface testing method provided in the first embodiment of the present invention. This embodiment is applicable to improving the test efficiency of interface testing and the coverage of test scenarios. The method can be executed by an interface testing device, which can be implemented by software and / or hardware, and can generally be directly integrated in an electronic device that executes this method. The electronic device can be a terminal device or a server device. The embodiment of the present invention does not limit the type of electronic device that executes the interface testing method. Specifically, Figure 1 As shown, the interface testing method may specifically include the following steps:
[0032] S110: Acquire information of interfaces to be tested, and determine interfaces to be tested according to the information of interfaces to be tested.
[0033] The interface to be tested may be any interface to be tested. The interface information to be tested may be any information of the interface to be tested, such as interface name information of the interface to be tested, interface request address information of the interface to be tested, interface request method information of the interface to be tested, or interface request parameter information of the interface to be tested, etc., which is not limited in the embodiment of the present invention.
[0034] In the embodiment of the present invention, the interface information to be tested is obtained to determine the interface to be tested according to the interface information to be tested. It is understandable that after the development of the software system is completed, all interfaces in the software system need to be tested, and the software system can be put online only after all interfaces pass the test. Moreover, after the software system is put online, that is, during the application process of the software system, any interface in the software system can also be tested to ensure the normal operation of the software system.
[0035] S120: Determine target interface information corresponding to the interface to be tested according to the interface information to be tested, and perform information data processing on the target interface information.
[0036] The target interface information may be the target information in the interface information to be tested corresponding to the interface to be tested. The information data processing may be data processing of the target interface information, for example, data parsing of the target interface information, data replacement of the target interface information, or data modification of the target interface information, etc., which is not limited in the embodiment of the present invention.
[0037] In the embodiment of the present invention, after determining the interface to be tested according to the interface information to be tested, the target interface information corresponding to the interface to be tested can be further determined according to the interface information to be tested, so as to perform information data processing on the target interface information. It can be understood that the target interface information can be one or more of the interface information to be tested, and the embodiment of the present invention does not limit this. It can also be understood that different target interface information can correspond to different information data processing.
[0038] S130: Performing interface testing on the interface to be tested according to the information data processing result.
[0039] The information data processing result may be a result obtained by information data processing.
[0040] In an embodiment of the present invention, after information data processing is performed on the target interface information, an interface test can be further performed on the interface to be tested according to the information data processing result. Optionally, the interface test is performed on the interface to be tested according to the information data processing result, and an interface test case corresponding to the interface to be tested can be determined according to the information data processing result, so as to make an interface request to the interface to be tested through the interface test case, thereby determining whether the function of the interface to be tested is normal according to the feedback data of the interface request.
[0041] The technical solution of this embodiment obtains the interface information to be tested, and determines the interface to be tested according to the interface information to be tested, determines the target interface information corresponding to the interface to be tested according to the interface information to be tested, and performs information data processing on the target interface information, thereby performing interface testing on the interface to be tested according to the information data processing result, which solves the problems of low test scenario coverage and low test efficiency caused by incomplete test data and long test time in the prior art, can improve the test efficiency of interface testing and the coverage of test scenarios, thereby improving the effectiveness and stability of the interface.
[0042] Embodiment 2
[0043] Figure 2 This is a flowchart of an interface testing method provided in the second embodiment of the present invention. This embodiment is a further refinement of the above-mentioned technical solutions, and provides a variety of specific optional implementation methods for obtaining the interface information to be tested, performing information data processing on the target interface information, and performing interface testing on the interface to be tested based on the information data processing results. The technical solution in this embodiment can be combined with the various optional solutions in one or more of the above-mentioned embodiments. Figure 2 As shown, the method may include the following steps:
[0044] S210: Determine the interface to be stored, and obtain the interface information to be stored corresponding to the interface to be stored.
[0045] S220: Store the interface information to be stored in an interface information document according to a preset rule.
[0046] Among them, the interface to be stored can be any interface waiting for the storage of interface information, for example, it can be an interface that has not stored interface information, or it can be an interface that has stored interface information but needs to update the interface information, or it can be an interface that has stored interface information but needs to add new interface information, etc., and the embodiment of the present invention does not limit this. The interface information to be stored can be any interface information corresponding to the interface to be stored, for example, it can be newly added interface information, or it can be updated interface information, etc., and the embodiment of the present invention does not limit this. The preset rule can be a pre-set rule for storing interface information, for example, it can be a pre-set data type rule for storing interface information, or it can be a pre-set order rule for storing interface information, etc., and the embodiment of the present invention does not limit this. The interface information document can be a document for storing the interface information to be stored, for example, it can be a txt document, or it can be an excel document, etc., and the embodiment of the present invention does not limit this.
[0047] In an embodiment of the present invention, the interface to be stored is determined to obtain the interface information to be stored corresponding to the interface to be stored, so as to store the interface information to be stored in the interface information document according to a preset rule. It is understandable that after the software system is developed, any interface in the software system can be determined as the interface to be stored, so as to store the interface information to be stored of the interface to be stored in the interface information document.
[0048] S230: Acquire the interface information to be tested in the interface information document, and determine the interface to be tested according to the interface information to be tested.
[0049] In the embodiment of the present invention, after the interface information to be stored is stored in the interface information document according to the preset rule, the interface information to be tested in the interface information document may be further acquired to determine the interface to be tested according to the interface information to be tested.
[0050] S240: Determine the interface information to be modified corresponding to the interface to be tested according to the interface information to be tested, and modify the interface information to be modified.
[0051] The interface information to be modified may be any interface information of the interface to be tested that is to be modified, such as interface request method information, regular extraction information, or request data information, etc., which is not limited in the embodiment of the present invention. The interface information modification may be to modify the interface information to be modified.
[0052] In the embodiment of the present invention, after determining the interface to be tested according to the interface information to be tested, the interface information to be modified corresponding to the interface to be tested can be further determined according to the interface information to be tested, so as to modify the interface information to be modified. It can be understood that the interface information to be modified can be modified according to the test requirements, or according to the interface information type, etc., and the embodiment of the present invention does not limit this.
[0053] S250: Determine the request parameter to be replaced corresponding to the interface to be tested according to the interface information to be tested, and replace parameter data of the request parameter to be replaced.
[0054] The request parameter to be replaced may be any request parameter of the interface to be tested that is to be replaced. For example, assuming that the interface to be tested is a login interface, the request parameter to be replaced may be a user name or password, etc. Parameter data replacement may be replacing parameter data of the request parameter to be replaced.
[0055] In the embodiment of the present invention, after determining the interface to be tested according to the interface to be tested information, the request parameter to be replaced corresponding to the interface to be tested may be further determined according to the interface to be tested information to replace parameter data of the request parameter to be replaced.
[0056] Optionally, performing parameter data replacement on the request parameter to be replaced may include: determining a request parameter value to be replaced corresponding to the request parameter to be replaced, and a request parameter variable corresponding to the request parameter to be replaced; replacing the request parameter value to be replaced with the request parameter variable, and determining a variable value set corresponding to the request parameter variable; and performing variable value replacement on the request parameter variable according to the variable value set.
[0057] Among them, the request parameter value to be replaced may be the parameter value corresponding to the request parameter to be replaced. Exemplarily, assuming that the request parameter to be replaced is a user name, the request parameter value to be replaced may be the name used by the user when registering. The request parameter variable may be the variable corresponding to the request parameter to be replaced. Exemplarily, the request parameter variable corresponding to the request parameter user name to be replaced may be variable a, and the request parameter variable corresponding to the request parameter password to be replaced may be variable b. The variable value set may be a set consisting of the values corresponding to the request parameter variables. Exemplarily, assuming that the request parameter variable corresponding to the request parameter user name to be replaced is variable a, the variable value set of variable a may be {user name 1, user name 2, user name 3}. Variable value replacement may be to replace the value of the request parameter variable.
[0058] Specifically, after determining the request parameters to be replaced corresponding to the interface to be tested based on the interface information to be tested, the request parameter values to be replaced corresponding to the request parameters to be replaced and the request parameter variables to be replaced can be further determined to replace the request parameter values to be replaced with the request parameter variables, and then determine the variable value set corresponding to the request parameter variables, so as to replace the variable values of the request parameter variables according to the variable value set.
[0059] For example, assuming that the request parameter to be replaced is the username, and the request parameter value to be replaced is username A, that is, "user name is username A", and the request parameter variable is variable a, then replace the request parameter value to be replaced with the request parameter variable, and you can get "user name is variable a", and then determine the variable value set of variable a {you, me, him}, then replace the request parameter variable according to the variable value, and you can get "user name is you", "user name is me", "user name is him".
[0060] Optionally, replacing variable values of request parameter variables according to a variable value set may include: obtaining an algorithm selection instruction, and determining a value replacement algorithm according to the algorithm selection instruction; wherein the value replacement algorithm is an orthogonal test algorithm or a Cartesian product algorithm; and replacing variable values of request parameter variables according to the value replacement algorithm and the variable value set.
[0061] The algorithm selection instruction may be an instruction for selecting a value replacement algorithm. It is understandable that the algorithm selection instruction may be determined by a user according to test requirements. The value replacement algorithm may be an algorithm for replacing the value of a request parameter variable, such as an orthogonal test algorithm or a Cartesian product algorithm, which is not limited in the embodiment of the present invention.
[0062] Specifically, after determining the variable value set corresponding to the request parameter variable, an algorithm selection instruction can be further obtained to determine the value replacement algorithm according to the algorithm selection instruction, so as to replace the variable value of the request parameter variable according to the value replacement algorithm and the variable value set.
[0063] Exemplarily, assuming that the request parameters to be replaced include parameter 1 and parameter 2, the request parameter variable corresponding to parameter 1 is variable 1, the request parameter variable corresponding to parameter 2 is variable 2, and the variable value set of variable 1 is {a, b}, and the variable value set of variable 2 is {c, d}, then the variable values of the request parameter variables are replaced according to the value replacement algorithm and the variable value set, and the variable value replacement results can be obtained: "parameter 1 is a and parameter 2 is c", "parameter 1 is a and parameter 2 is d", "parameter 1 is b and parameter 2 is c", "parameter 1 is b and parameter 2 is c", "parameter 1 is b and parameter 2 is d".
[0064] It should be noted that the embodiment of the present invention does not limit the order of S240 and S250, that is, S240 and S250 can be performed simultaneously.
[0065] S260: Perform interface testing on the interface to be tested according to the information data processing result.
[0066] Optionally, the method may also include: obtaining an environment selection instruction, and determining a target test environment based on the environment selection instruction; determining a request address corresponding to the interface to be tested based on the target test environment; accordingly, performing an interface test on the interface to be tested based on the information data processing result, which may include: performing an interface test on the interface to be tested based on the information data processing result and the request address.
[0067] Among them, the environment selection instruction can be an instruction for selecting a test environment. It is understandable that the environment selection instruction can be determined by the user according to the test requirements. The test environment can be an environment for testing the interface in the software system before the software system goes online, or it can be an environment for testing the interface in the software system after the software system goes online, that is, during the application of the software system. The target test environment can be a target environment in multiple test environments. It is understandable that different test environments can correspond to different request addresses.
[0068] Specifically, an environment selection instruction is obtained to determine a target test environment according to the environment selection instruction, thereby determining a request address corresponding to the interface to be tested according to the target test environment, and then performing an interface test on the interface to be tested according to the information data processing result and the request address.
[0069] Optionally, when the target interface information includes interface information to be modified, performing an interface test on the interface to be tested according to the information data processing result may include: performing an interface single test on the interface to be tested according to the interface information modification result.
[0070] The interface information modification result may be a result obtained by modifying the interface information to be modified. The interface single test may be a single test of the interface to be tested. Specifically, when the target interface information includes the interface information to be modified, after the interface information to be modified is modified, the interface single test may be further performed on the interface to be tested according to the interface information modification result.
[0071] Optionally, when the target interface information includes request parameters to be replaced, performing an interface test on the interface to be tested according to the information data processing result may include: performing interface batch testing on the interface to be tested according to the parameter data replacement result.
[0072] The parameter data replacement result may be a result obtained by replacing the parameter data of the request parameter to be replaced. The interface batch test may be a batch test of the interface to be tested. Specifically, when the target interface information includes the request parameter to be replaced, after the parameter data of the request parameter to be replaced is replaced, the interface batch test may be further performed on the interface to be tested according to the parameter data replacement result.
[0073] Optionally, interface batch testing is performed on the interface to be tested according to the parameter data replacement result, and at least two interface test cases corresponding to the interface to be tested can be generated according to the parameter data replacement result, so as to perform interface batch testing on the interface to be tested according to each interface test case.
[0074] In a specific example of an embodiment of the present invention, Figure 3 is an example flow chart of an interface testing method provided by Embodiment 2 of the present invention. Figure 3 As shown, the method may specifically include: (1) obtaining an interface information document (such as a document in Excel format), and reading the interface information to be tested (such as name, URL, method, parameters, return parameters, etc.) in the interface information document to determine the interface to be tested. (2) selecting a test environment, that is, determining the target test environment according to the environment selection instruction. (3) performing a single test on the interface to be tested, or generating request parameters in batches, that is, performing batch tests on the interface to be tested by replacing the parameter data results. (4) saving the test case.
[0075] For example, Figure 4 is a schematic diagram of an interface test interface provided by the second embodiment of the present invention. After determining the interface information document, the interface information to be tested in the interface information document can be obtained, such as Figure 4 The interface name, use case title, URL, request method, regular extraction, assertion, request parameters (also known as Body) in Figure 4 The interface name, use case title, request method, regular extraction, assertion, and request parameters in the interface are determined as the interface information to be modified. After the interface information to be modified is modified, the "Single Debug" button can be used to perform a single interface test on the interface to be tested.
[0076] For example, Figure 5 is a schematic diagram of another interface test interface provided by the second embodiment of the present invention, such as Figure 5As shown, the variable value set can be placed at the "template" position, the replacement result of "replace the request parameter value to be replaced with the request parameter variable" can be placed at the request parameter (i.e. Body) position, and the value replacement algorithm (orthogonal test or Cartesian product algorithm) is selected, that is, the value replacement algorithm is determined according to the algorithm selection instruction, and the "Get Data" button can be clicked to replace the variable value of the request parameter variable according to the value replacement algorithm and the variable value set.
[0077] The technical solution of this embodiment determines the interface to be stored, obtains the interface information to be stored corresponding to the interface to be stored, stores the interface information to be stored in the interface information document according to preset rules, obtains the interface information to be tested in the interface information document, and determines the interface to be tested according to the interface information to be tested, determines the interface information to be modified corresponding to the interface to be tested according to the interface information to be tested, modifies the interface information to be modified, determines the request parameters to be replaced corresponding to the interface to be tested according to the interface information to be tested, replaces the parameter data for the request parameters to be replaced, and thus performs interface testing on the interface to be tested according to the interface information modification result or the parameter data replacement result, which solves the problems of low test scenario coverage and low test efficiency caused by incomplete test data and long test time in the prior art, can improve the test efficiency of interface testing and the coverage of test scenarios, thereby improving the effectiveness and stability of the interface.
[0078] Embodiment 3
[0079] Figure 6 is a schematic diagram of an interface testing device provided in Embodiment 3 of the present invention, such as Figure 6 As shown, the device includes: a to-be-tested interface determination module 610, an information data processing module 620, and an interface testing module 630, wherein:
[0080] The interface to be tested determining module 610 is used to obtain the interface to be tested information and determine the interface to be tested according to the interface to be tested information;
[0081] The information data processing module 620 is used to determine the target interface information corresponding to the interface to be tested according to the interface information to be tested, and perform information data processing on the target interface information;
[0082] The interface testing module 630 is used to perform interface testing on the interface to be tested according to the information data processing result.
[0083] The technical solution of this embodiment obtains the interface information to be tested, and determines the interface to be tested according to the interface information to be tested, determines the target interface information corresponding to the interface to be tested according to the interface information to be tested, and performs information data processing on the target interface information, thereby performing interface testing on the interface to be tested according to the information data processing result, which solves the problems of low test scenario coverage and low test efficiency caused by incomplete test data and long test time in the prior art, can improve the test efficiency of interface testing and the coverage of test scenarios, thereby improving the effectiveness and stability of the interface.
[0084] Optionally, the device can also be specifically used to: obtain an environment selection instruction, and determine a target test environment based on the environment selection instruction; determine a request address corresponding to the interface to be tested based on the target test environment; accordingly, the interface test module 630 can be specifically used to: perform an interface test on the interface to be tested based on the information data processing results and the request address.
[0085] Optionally, the interface to be tested determination module 610 can be specifically used to: determine the interface to be stored, and obtain the interface information to be stored corresponding to the interface to be stored; store the interface information to be stored in an interface information document according to preset rules; and obtain the interface information to be tested in the interface information document.
[0086] Optionally, the target interface information may include interface information to be modified; accordingly, the information data processing module 620 may be specifically used to: modify the interface information to be modified; accordingly, the interface testing module 630 may be specifically used to: perform a single interface test on the interface to be tested according to the interface information modification result.
[0087] Optionally, the target interface information may include request parameters to be replaced; accordingly, the information data processing module 620 may be specifically used to: replace parameter data of the request parameters to be replaced; accordingly, the interface testing module 630 may be specifically used to: perform interface batch testing on the interfaces to be tested according to the parameter data replacement results.
[0088] Optionally, the information data processing module 620 can be further used to: determine the request parameter value to be replaced corresponding to the request parameter to be replaced, and the request parameter variable corresponding to the request parameter to be replaced; replace the request parameter value to be replaced with the request parameter variable, and determine the variable value set corresponding to the request parameter variable; replace the variable value of the request parameter variable according to the variable value set.
[0089] Optionally, the information data processing module 620 can be further used to: obtain an algorithm selection instruction, and determine a value replacement algorithm based on the algorithm selection instruction; wherein the value replacement algorithm is an orthogonal test algorithm or a Cartesian product algorithm; and replace variable values of request parameter variables based on the value replacement algorithm and the variable value set.
[0090] 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.
[0091] Embodiment 4
[0092] Figure 7 A schematic diagram of the structure of an electronic device 10 that can be used to implement an embodiment of the present invention is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workstations, 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, wearable devices (such as helmets, glasses, watches, etc.) 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.
[0093] 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.
[0094] 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.
[0095] 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.
[0096] 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).
[0097] 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.
[0098] 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 programmable data processing 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.
[0099] 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.
[0100] 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).
[0101] 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.
[0102] 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.
[0103] 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.
[0104] 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, It is characterized in that include: Acquire information of the interface to be tested, and determine the interface to be tested according to the information of the interface to be tested; The interface information to be tested is interface name information of the interface to be tested, interface request address information of the interface to be tested, interface request method information of the interface to be tested, or interface request parameter information of the interface to be tested; Determine the target interface information corresponding to the interface to be tested according to the interface information to be tested, and perform information data processing on the target interface information; wherein different target interface information corresponds to different information data processing; Performing interface testing on the interface to be tested according to the information data processing result; Wherein, the target interface information includes the interface information to be modified; The performing information data processing on the target interface information includes: Modifying the interface information to be modified; The performing interface test on the interface to be tested according to the information data processing result includes: Performing a single interface test on the interface to be tested according to the interface information modification result; Wherein, the target interface information also includes request parameters to be replaced; The information data processing of the target interface information further includes: Replacing the parameter data of the request parameter to be replaced; The performing interface test on the interface to be tested according to the information data processing result also includes: Performing batch interface testing on the interfaces to be tested according to the parameter data replacement result; The performing interface test on the interface to be tested according to the information data processing result also includes: Determine the interface test case corresponding to the interface to be tested according to the information data processing result; Performing an interface request on the interface to be tested through the interface test case, and determining whether the function of the interface to be tested is normal according to feedback data of the interface request; Obtaining an environment selection instruction, and determining a target test environment according to the environment selection instruction; the environment selection instruction is determined by the user according to the test requirements, and is an environment for testing the interface in the software system before the software system goes online, or an environment for testing the interface in the software system after the software system goes online, that is, during the application of the software system; the target test environment is a target environment among multiple test environments; Determine the request address corresponding to the interface to be tested according to the target test environment; The performing interface test on the interface to be tested according to the information data processing result includes: Performing an interface test on the interface to be tested according to the information data processing result and the request address; The performing batch interface testing on the interfaces to be tested according to the parameter data replacement result includes: Generating the parameter data replacement results in batches, generating at least two interface test cases corresponding to the interface to be tested according to the parameter data replacement results, and performing interface batch testing on the interface to be tested according to the at least two interface test cases; Before obtaining the interface information to be tested, the method further includes: Determine the interface to be stored, and obtain the interface information to be stored corresponding to the interface to be stored; The interface information to be stored is stored in the interface information document according to a preset rule; the preset rule is a preset order rule for storing the interface information; The obtaining of the interface information to be tested includes: Obtaining the interface information to be tested in the interface information document; The step of replacing parameter data of the request parameter to be replaced includes: Determine a request parameter value to be replaced corresponding to the request parameter to be replaced, and a request parameter variable corresponding to the request parameter to be replaced; Replacing the request parameter value to be replaced with the request parameter variable, and determining a variable value set corresponding to the request parameter variable; Replacing the variable value of the request parameter variable according to the variable value set; The step of replacing the variable value of the request parameter variable according to the variable value set includes: Obtaining an algorithm selection instruction, and determining a value replacement algorithm according to the algorithm selection instruction; wherein the value replacement algorithm is an orthogonal test algorithm or a Cartesian product algorithm; According to the value replacement algorithm and the variable value set, the variable value of the request parameter variable is replaced.
2. An interface testing device, It is characterized in that include: The interface to be tested determining module is used to obtain the interface to be tested information and determine the interface to be tested according to the interface to be tested information; The interface information to be tested is interface name information of the interface to be tested, interface request address information of the interface to be tested, interface request method information of the interface to be tested, or interface request parameter information of the interface to be tested; Before obtaining the interface information to be tested, the method further includes: Determine the interface to be stored, and obtain the interface information to be stored corresponding to the interface to be stored; The interface information to be stored is stored in the interface information document according to a preset rule; the preset rule is a preset order rule for storing the interface information; The obtaining of the interface information to be tested includes: Obtaining the interface information to be tested in the interface information document; An information data processing module, used to determine the target interface information corresponding to the interface to be tested according to the interface information to be tested, and perform information data processing on the target interface information; wherein different target interface information corresponds to different information data processing; An interface testing module, used for performing an interface test on the interface to be tested according to the information data processing result; Wherein, the target interface information includes the interface information to be modified; accordingly, the information data processing module is specifically used to modify the interface information to be modified; accordingly, the interface testing module is specifically used to perform a single interface test on the interface to be tested according to the interface information modification result; Wherein, the target interface information also includes request parameters to be replaced; accordingly, the information data processing module is specifically used to replace parameter data of the request parameters to be replaced; accordingly, the interface testing module is also used to perform interface batch testing on the interface to be tested according to the parameter data replacement result; The step of replacing parameter data of the request parameter to be replaced includes: Determine a request parameter value to be replaced corresponding to the request parameter to be replaced, and a request parameter variable corresponding to the request parameter to be replaced; Replacing the request parameter value to be replaced with the request parameter variable, and determining a variable value set corresponding to the request parameter variable; Replacing the variable value of the request parameter variable according to the variable value set; The step of replacing the variable value of the request parameter variable according to the variable value set includes: Obtaining an algorithm selection instruction, and determining a value replacement algorithm according to the algorithm selection instruction; wherein the value replacement algorithm is an orthogonal test algorithm or a Cartesian product algorithm; According to the value replacement algorithm and the variable value set, the variable value of the request parameter variable is replaced; The interface test module is specifically used to determine the interface test case corresponding to the interface to be tested according to the information data processing result; make an interface request to the interface to be tested through the interface test case, and determine whether the function of the interface to be tested is normal according to the feedback data of the interface request; Obtain an environment selection instruction, and determine a target test environment according to the environment selection instruction; determine a request address corresponding to the interface to be tested according to the target test environment; the environment selection instruction is determined by the user according to the test requirements, and is an environment for testing the interface in the software system before the software system goes online, or an environment for testing the interface in the software system after the software system goes online, that is, during the application of the software system; the target test environment is a target environment among multiple test environments; The interface testing module is specifically used to perform an interface test on the interface to be tested according to the information data processing result and the request address; The information data processing module is specifically used to batch generate the parameter data replacement results, generate at least two interface test cases corresponding to the interface to be tested according to the parameter data replacement results, and perform interface batch testing on the interface to be tested according to the at least two interface test cases.
3. An electronic device, It is 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 claim 1.
4. A computer-readable storage medium, It is characterized in that The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a processor to implement the interface testing method of claim 1 when executed.
