CN107766190B - Interface testing method and device, computer equipment and storage medium - Google Patents

Interface testing method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN107766190B
CN107766190B CN201711047371.5A CN201711047371A CN107766190B CN 107766190 B CN107766190 B CN 107766190B CN 201711047371 A CN201711047371 A CN 201711047371A CN 107766190 B CN107766190 B CN 107766190B
Authority
CN
China
Prior art keywords
interface
test
test case
tested
testing
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201711047371.5A
Other languages
Chinese (zh)
Other versions
CN107766190A (en
Inventor
杨雨晨
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN201711047371.5A priority Critical patent/CN107766190B/en
Priority to PCT/CN2017/112481 priority patent/WO2019085073A1/en
Publication of CN107766190A publication Critical patent/CN107766190A/en
Application granted granted Critical
Publication of CN107766190B publication Critical patent/CN107766190B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/22Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing
    • G06F11/2205Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing using arrangements specific to the hardware being tested
    • G06F11/221Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing using arrangements specific to the hardware being tested to test buses, lines or interfaces, e.g. stuck-at or open line faults
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/22Detection or location of defective computer hardware by testing during standby operation or during idle time, e.g. start-up testing
    • G06F11/2273Test methods

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention relates to an interface testing method, an interface testing device, computer equipment and a storage medium, wherein the method comprises the following steps: acquiring test case configuration information; according to the test case identification in the test case configuration information, inquiring test case generation information, a test case template and interface communication parameters from a test case library; generating a test case corresponding to the test case identification according to the test case generation information and the test case template; and testing the interface to be tested corresponding to the address of the interface to be tested in the test case according to the test case and the interface communication parameters. In the whole test process, the test case for testing the interface to be tested is automatically generated according to the test case generation information and the test case template, so that the time consumed for compiling the test case is saved, and the normal communication with the interface to be tested is ensured according to the interface communication parameters, thereby ensuring the test success rate of the interface to be tested and further improving the test efficiency of the interface.

Description

Interface testing method and device, computer equipment and storage medium
Technical Field
The present invention relates to the field of test technologies, and in particular, to an interface test method and apparatus, a computer device, and a storage medium.
Background
At present, with the development of computer technology and the enrichment of services in different fields (such as financial transaction field), the demand for automated testing of complex systems is increasing. The general test method is mainly realized by developing a test tool, and the existing test tool is mainly divided into a commercial test tool, an open source test framework and a lightweight test script compiled by a tester from the technical architecture; from the functional point of view, the test system is mainly divided into a function test tool, a performance test tool, a safety test tool and the like; from the viewpoint of an operation platform, the operation platform is mainly divided into a Windows-based operation system, a Unix/Linux-based operation system and the like; from the perspective of the system under test, for example, the system under test is classified into a Web test tool, a message test tool, and the like.
However, the conventional test tool can only test specific functions of a specific tested interface, and each different interface type needs to write a different test case to test the interface of the interface type, that is, one test case can only test one interface type, so that the interface test efficiency is low.
Disclosure of Invention
In view of the above, it is necessary to provide an interface testing method, an interface testing apparatus, a computer device, and a storage medium, for solving the problem of inefficient interface testing.
An interface testing method, the method comprising:
acquiring test case configuration information;
according to the test case identification in the test case configuration information, inquiring test case generation information, a test case template and interface communication parameters from a test case library;
generating a test case corresponding to the test case identification according to the test case generation information and the test case template;
and testing the interface to be tested corresponding to the address of the interface to be tested in the test case according to the test case and the interface communication parameters.
An interface test apparatus, the apparatus comprising:
the configuration information acquisition module is used for acquiring the configuration information of the test case;
the case information query module is used for querying test case generation information, a test case template and interface communication parameters from the test case library according to the test case identifiers in the test case configuration information;
the test case generation module is used for generating a test case corresponding to the test case identifier according to the test case generation information and the test case template;
and the interface test module is used for testing the interface to be tested corresponding to the address of the interface to be tested in the test case according to the test case and the interface communication parameters.
A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the steps of the policy delivery task assignment method provided in any embodiment of the invention when executing the computer program.
A computer-readable storage medium on which a computer program is stored, the computer program, when being executed by a processor, implementing the steps of a policy delivery task assignment method provided in any embodiment of the present invention.
According to the interface testing method, the interface testing device, the computer equipment and the storage medium, interface types of the interfaces to be tested do not need to be considered, fixed test cases do not need to be compiled for the interfaces to be tested, only corresponding test case generation information, test case templates and interface communication parameters need to be inquired from the test case library, and the test cases for testing the interfaces to be tested are automatically generated according to the test case generation information and the test case templates, so that time consumed for compiling the test cases is saved. And normal communication with the interface to be tested is ensured according to the interface communication parameters, so that the test success rate of the interface to be tested is ensured, and the test efficiency of the interface is further improved.
Drawings
FIG. 1 is a diagram of an application environment of a method for interface testing in one embodiment;
FIG. 2 is a flow chart illustrating a method for testing an interface according to an embodiment;
FIG. 3 is a flowchart illustrating steps for extracting test case configuration information in one embodiment;
FIG. 4 is a flowchart illustrating steps of performing a test according to an interface test request in one embodiment;
FIG. 5 is a flowchart illustrating the steps of generating a test report in one embodiment;
FIG. 6 is a flowchart illustrating the steps of detecting an asynchronous return parameter in one embodiment;
FIG. 7 is a block diagram showing the structure of an interface test apparatus according to an embodiment;
FIG. 8 is a block diagram of a configuration information obtaining module in one embodiment;
FIG. 9 is a block diagram of an interface test module according to one embodiment;
FIG. 10 is a block diagram illustrating an exemplary test module for a test interface;
FIG. 11 is a block diagram of a server in the interface test system in one embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
FIG. 1 is a diagram of an exemplary implementation of a method for testing an interface. Referring to fig. 1, the interface test method is applied to an interface test system. The interface test system includes a terminal 110 and a server 120, wherein the terminal 110 is connected to the server 120 through a network. The terminal 110 may be a fixed terminal, which may specifically be at least one of a printer, a scanner, and a monitor, or a mobile terminal, which may specifically be at least one of a tablet, a smartphone, a personal data assistant, and a digital camera.
As shown in fig. 2, in an embodiment, an interface testing method is provided, which is exemplified by applying the method to the server 120 in fig. 1, and the method specifically includes the following steps:
s202, test case configuration information is obtained.
Specifically, an interface test configuration page is displayed in the terminal 110, a user can input test case configuration information in the interface test configuration page, and the user clicks a configuration completion button in the interface test configuration page through an input terminal of the terminal 110. When detecting that the configuration completion button in the interface test configuration page is clicked, the terminal 110 acquires the test case configuration information input in the interface test configuration page, and generates an interface test instruction according to the test case configuration information. The test case configuration information is the test case identification corresponding to the test case to be executed and configured in the test process and the dependency relationship information among the test cases. The test case configuration information comprises test case identifications, and one or more extracted test case identifications can be extracted; when the test case configuration information includes a plurality of test case identifications, the test case configuration information also includes dependency relationship information between the test cases corresponding to the test case identifications. The terminal 110 transmits the generated interface test instruction to the server 120. The test case identification is a unique identification used for identifying the test case.
S204, according to the test case identification in the test case configuration information, the test case generation information, the test case template and the interface communication parameters are inquired from the test case library.
The server 120 is provided with a test case library, and the test case library stores test case generation information, a test case template, and interface communication parameters. The test case template is a template for generating a test case, and the interface communication parameters are communication parameters corresponding to the interface to be tested. The test case generation information, the test case template, and the interface communication parameters stored in the test case library are all sent by the terminal 110 to the server 120 and stored in the test case library. An interface test configuration page is displayed in the terminal 110, a user can input test case generation information, a test case template and interface communication parameters in the interface test configuration page through input equipment, the terminal 110 acquires the test case generation information, the test case template and the interface communication parameters input in the interface test configuration page, and sends the acquired test case generation information, the test case template and the interface communication parameters to the server 120.
Specifically, the test case generation information, the test case template, the interface communication parameters and the test case identifiers are correspondingly stored in the test case library. After receiving the interface test instruction sent by the terminal 110, the server 120 parses the interface test instruction, and extracts the test case identifier from the test case configuration information by parsing and extracting the test case configuration information in the interface test instruction. The server 120 queries the test case generation information, the test case template, and the interface communication parameters corresponding to the extracted test case identifier from the test case library.
In one embodiment, the test case generation information is stored in the test case library corresponding to the test case identification, and the test case template and the interface communication parameters are stored in the test case library corresponding to the test case generation information. The server 120 extracts the test case identification from the interface test instruction. The server 120 queries test case generation information corresponding to the extracted test case identifier in the test case library, and queries a corresponding test case template and interface communication parameters in the test case library according to the queried test case generation information.
In one embodiment, the test case generation information is stored in the test case library corresponding to the test case identifier, the test case generation information includes a test case template identifier, the test case template is stored in the test case library corresponding to the test case template identifier, the test case template includes an interface communication parameter identifier, and the interface communication parameter is stored in the test case corresponding to the interface communication parameter identifier. The server 120 extracts the test case identifier from the interface test instruction, and queries the test case generation information corresponding to the extracted test case identifier in the test case library. The server 120 analyzes the test case generation information, extracts the test case template identifier in the test case generation information, and queries the test case template corresponding to the extracted test case template identifier in the test case library. The server 120 extracts the interface communication parameter identifier from the queried test case template, and queries the interface communication parameter corresponding to the interface communication parameter identifier in the test case library.
And S206, generating a test case corresponding to the test case identifier according to the test case generation information and the test case template.
Specifically, the test case generation information includes request parameter information, return parameter information, and an expected test result, and the test case template is test scenario information. And the server 120 merges the test case generation information and the test case template to obtain the test case corresponding to the test case identifier.
In an embodiment, when the extracted test case identifications may be multiple, the server 120 adds the test case generation information to the test case template to generate the test case corresponding to each test case identification according to the test case generation information and the test case template corresponding to each test case identification.
And S208, testing the interface to be tested corresponding to the address of the interface to be tested in the test case according to the test case and the interface communication parameters.
Specifically, the server 120 executes the test case, extracts an address of the interface to be tested in the test case, encapsulates test information generated by executing the test case according to the interface communication parameters, and sends the encapsulated test information to the interface to be tested corresponding to the extracted address of the interface to be tested, so as to test the interface to be tested according to the encapsulated test information.
In an embodiment, when the extracted test case identifiers may be multiple, the server 120 tests the interface to be tested corresponding to the interface to be tested address of each test case according to the interface communication parameter and the test case corresponding to each test case identifier. When the server 120 recognizes that the interfaces to be tested corresponding to the multiple test cases are different, the server synchronously executes each test case according to the corresponding interface communication parameters, and tests the interfaces to be tested corresponding to each test case. When recognizing that the interfaces to be tested corresponding to the multiple test cases are the same, the server 120 synchronously executes the test cases in a multithreading manner, and tests the interfaces to be tested according to the synchronously executed test cases.
In the embodiment, the interface type of the interface to be tested does not need to be considered, a fixed test case does not need to be compiled for the interface to be tested, only corresponding test case generation information, a test case template and interface communication parameters need to be inquired from the test case library, and the test case for testing the interface to be tested is automatically generated according to the test case generation information and the test case template, so that the time consumed for compiling the test case is saved. And normal communication with the interface to be tested is ensured according to the interface communication parameters, so that the test success rate of the interface to be tested is ensured, and the test efficiency of the interface is further improved.
As shown in fig. 3, in an embodiment, S202 further includes a step of extracting test case configuration information, where the step includes the following steps:
s302, the test starting time in the test plan information is monitored.
The test plan information is input test plan information in an interface test configuration page displayed by the terminal 110 through an input device of the terminal by a user. The terminal 110 transmits the input test plan information to the server 120. The server 120 may store the test plan information transmitted by the terminal 110 in a test case library. The test plan information comprises test execution time and a test case identification set, wherein the test execution time comprises test starting time and test ending time; the test case identification set comprises at least one test case identification.
Specifically, the test case library of the server 120 stores test plan information, where the test plan information includes test execution time, test cycle number, and a test case identifier set. The server 120 obtains the test execution time in the test plan information, extracts the test start time from the test execution time, and monitors whether the current time is equal to the test start time.
In one embodiment, the test case includes a plurality of test plan information. The server 120 periodically acquires the current time, and compares the acquired current time with the test start time in each piece of test plan information.
S304, when the current time is the same as the test starting time, extracting the test case configuration information corresponding to the test starting time from the test plan information.
Specifically, when monitoring that the current time is the same as the test start time, the server 120 reads the test case identifier set from the test plan information corresponding to the test start time, and extracts the test case identifiers in the test case identifier set. After extracting the test case identifier, the server 120 encapsulates the extracted test case identifier, and generates an interface test instruction through encapsulation.
In the embodiment, by monitoring the test starting time in each piece of test plan information, when the current time is monitored to be equal to the test starting time, the interface test instruction is generated according to the test plan information corresponding to the test starting time, the interface test instruction does not need to be triggered manually, and the intervention of manual operation is reduced. And the corresponding interface test instruction can be generated according to the test plan information, so that the convenience of generating the interface test instruction is improved.
As shown in fig. 4, in an embodiment, the step S208 specifically includes a step of performing a test according to the interface test request, where the step specifically includes the following steps:
s402, extracting the interface communication protocol type, the interface communication mode and the interface data transmission format in the interface communication parameters.
The interface communication parameters comprise interface communication protocol types, interface communication modes and interface data transmission formats. The interface communication protocol type is a communication protocol supported by the interface to be tested; the interface communication mode is a communication protocol supported by the interface to be tested; the interface data transmission format is a data transmission format which can be analyzed and supported by the interface to be tested.
Specifically, the server 120 parses the interface communication parameters, and extracts the interface communication protocol type, the interface communication mode, and the interface data transmission format from the interface communication parameters through parsing.
S404, generating an interface test request according to the interface communication protocol type, the interface communication mode, the interface data transmission format and the test case.
Specifically, the server 120 encapsulates the test case according to the extracted interface communication protocol type, interface communication mode, and interface data transmission format, and encapsulates the test case to obtain an interface test request supported by the interface to be tested.
S406, testing the interface to be tested corresponding to the interface address to be tested in the test case according to the interface test request.
Specifically, the test case includes an address of the interface to be tested, and the address of the interface to be tested is the unique identifier of the interface to be tested. The server 120 extracts the address of the interface to be tested from the test case, and sends the interface test request to the interface to be tested according to the address of the interface to be tested, so as to test the interface to be tested.
In the embodiment, the test case is not required to be compiled according to the interface type of the interface to be tested, the test case is directly packaged according to the interface communication protocol type, the interface communication mode and the interface data transmission format in the interface communication information, the interface test request supported by the interface to be tested is generated, and the success rate of testing the interface to be tested according to the interface test request is ensured.
As shown in fig. 5, in an embodiment, the step S406 specifically includes a step of generating a test report, where the step specifically includes the following steps:
s502, extracting the address of the interface to be tested and the expected test result in the test case.
Specifically, the server 120 parses the test case, and extracts the interface address to be tested and the expected test result from the test case through parsing. And predicting the test result, wherein the test result is a test result returned by the expected interface to be tested by testing the interface to be tested according to the test case.
S504, the interface test request is sent to the interface to be tested corresponding to the extracted interface address to be tested.
Specifically, the server 120 establishes a communication connection with the interface to be tested according to the extracted address of the interface to be tested, and sends an interface test request to the interface to be tested through the communication connection after the communication connection is successfully established.
And S506, receiving a feedback result returned by the interface to be tested according to the interface test request.
Specifically, the interface test request has input parameters. After the interface to be tested receives the interface test request, the interface to be tested analyzes the interface test request to obtain the input parameters in the interface test interface request, the interface to be tested processes the input parameters to generate a feedback result, and the generated feedback result is sent to the server 120. The server 120 receives a feedback result returned by the interface to be tested according to the interface test request.
And S508, comparing the feedback result with the expected test result to generate a test report.
Specifically, after receiving the feedback result returned by the interface to be tested, the server 120 compares the feedback result with the expected test result, determines the difference information between the feedback result and the expected test result through comparison, and generates the test report according to the determined difference information. The test report may further include at least one of test start time, test end time, and an address of the interface to be tested.
In this embodiment, in the process of testing the interface to be tested, the feedback result returned by the interface to be tested can be directly compared with the expected test result, so as to generate the test report, the feedback result returned by the interface to be tested does not need to be manually analyzed, the test report is written, and the generation efficiency and the accuracy of the test report are improved.
As shown in fig. 6, in a real-time example, S506 further includes a step of detecting an asynchronous return parameter, where the step includes the following steps:
s602, detecting whether the parameter returned by the interface to be detected is an asynchronous return parameter.
The asynchronous return parameter is a parameter returned by the interface to be tested for multiple times, and the interface to be tested needs to further process the asynchronous return parameter to obtain a feedback result.
Specifically, when the server 120 interfaces to the parameter returned by the interface to be tested, it detects whether the number of the parameter items of the returned parameter is complete according to the expected test result, and if it detects that the number of the parameter items of the returned parameter is incomplete, it detects that the parameter returned by the interface to be tested is an asynchronous return parameter; and if the detected result is complete, the parameter returned by the interface to be detected is detected as a feedback result.
In an embodiment, after receiving the parameter data packet returned by the interface to be tested, the server 120 detects whether the parameter data packet includes an asynchronous return identifier, and if the asynchronous return identifier exists, detects that the parameter in the parameter data packet is an asynchronous return parameter.
S604, when the parameter returned by the interface to be tested is detected to be an asynchronous return parameter, the feedback result receiving address in the interface test request is changed into an interception interface address, and the asynchronous return parameter is stored according to the interception interface address.
Specifically, when detecting that the parameter returned by the interface to be detected is an asynchronous return parameter, the server 120 obtains a preset interception interface address, sends the obtained interception interface address to the interface to be detected, so as to notify that the return result receiving address is changed into the interception interface address, and sends the received asynchronous return parameter to the interception interface corresponding to the interception interface address for storage. And after receiving the interception interface address, the interface to be tested sends the subsequently returned asynchronous return parameters to the interception interface for storage. The interception interface address is an address of an interception interface used for storing the asynchronous return parameter.
In one embodiment, when the server 120 does not detect that the parameter returned by the interface to be tested is the asynchronous return parameter, the parameter returned by the interface to be tested is taken as the feedback result.
And S606, sending the stored asynchronous return parameters to the interface to be tested.
Specifically, when receiving a parameter data packet subsequently returned by the interface to be tested, the interception interface detects whether the parameter data packet carries a parameter sending identifier, and when detecting the parameter sending identifier, sends the stored asynchronous return parameter to the interface to be tested.
And S608, receiving a feedback result returned by the interface to be tested according to the stored asynchronous return parameter.
Specifically, the interface to be tested receives the asynchronous return parameter returned by the interception interface, performs subsequent processing on the returned asynchronous return parameter, generates a return result through the subsequent processing, and sends the return result to the server 120 according to the return result receiving address. The server 120 receives the feedback result returned by the interface to be tested.
In this embodiment, when detecting that the parameter returned by the interface to be tested is an asynchronous return parameter, the return result receiving address is changed to an interception interface address, and the interception interface stores the asynchronous return parameter through the interception interface address. When the stored asynchronous return parameters meet the sending conditions, the interception interface sends the stored asynchronous return parameters to the interface to be tested, so that the asynchronous return parameters are further processed by the result to be tested to obtain a feedback result, the integrity of testing the interface to be tested is ensured, and the accuracy of the feedback result is improved.
As shown in fig. 7, in one embodiment, an interface testing apparatus 700 is provided, which specifically includes: a configuration information acquisition module 710, a case information query module 720, a test case generation module 730 and an interface test module 740.
The configuration information obtaining module 710 is configured to obtain test case configuration information.
The use case information query module 720 is configured to query the test case generation information, the test case template, and the interface communication parameters from the test case library according to the test case identifier in the test case configuration information.
The test case generating module 730 is configured to generate a test case corresponding to the test case identifier according to the test case generating information and the test case template.
The interface test module 740 is configured to test, according to the test case and the interface communication parameters, an interface to be tested corresponding to an interface address to be tested in the test case.
In the embodiment, the interface type of the interface to be tested does not need to be considered, a fixed test case does not need to be compiled for the interface to be tested, only corresponding test case generation information, a test case template and interface communication parameters need to be inquired from the test case library, and the test case for testing the interface to be tested is automatically generated according to the test case generation information and the test case template, so that the time consumed for compiling the test case is saved. And normal communication with the interface to be tested is ensured according to the interface communication parameters, so that the test success rate of the interface to be tested is ensured, and the test efficiency of the interface is further improved.
As shown in fig. 8, in an embodiment, the configuration information obtaining module 710 specifically includes the following contents: a test plan monitoring module 712 and a configuration information extraction module 714.
And a test plan monitoring module 712, configured to monitor a test start time in the test plan information.
A configuration information extracting module 714, configured to, when it is monitored that the current time is the same as the test start time, extract test case configuration information corresponding to the test start time from the test plan information
In the embodiment, by monitoring the test starting time in each piece of test plan information, when the current time is monitored to be equal to the test starting time, the test case configuration information is acquired according to the test plan information corresponding to the test starting time, an interface test instruction does not need to be triggered manually, and the intervention of manual operation is reduced.
As shown in fig. 9, in an embodiment, the interface test module 740 specifically includes the following: a communication parameter extraction module 742, a test request generation module 744, and a test interface module 746 to be tested.
A communication parameter extracting module 742, configured to extract an interface communication protocol type, an interface communication mode, and an interface data transmission format in the interface communication parameters.
The test request generating module 744 is configured to generate an interface test request according to the interface communication protocol type, the interface communication mode, the interface data transmission format, and the test case.
The interface to be tested test module 746 is configured to test the interface to be tested corresponding to the interface address to be tested in the test case according to the interface test request.
In the embodiment, the test case is not required to be compiled according to the interface type of the interface to be tested, the test case is directly packaged according to the interface communication protocol type, the interface communication mode and the interface data transmission format in the interface communication information, the interface test request supported by the interface to be tested is generated, and the success rate of testing the interface to be tested according to the interface test request is ensured.
As shown in fig. 10, in an embodiment, the interface test module 746 to be tested specifically further includes the following contents: an interface address extracting module 746a, a test request transmitting module 746b, a feedback result receiving module 746c, and a test report generating module 746 d.
The interface address extracting module 746a is configured to extract an interface address to be tested and an expected test result in the test case.
The test request sending module 746b is configured to send the interface test request to the to-be-tested interface corresponding to the extracted to-be-tested interface address.
And the feedback result receiving module 746c is configured to receive a feedback result returned by the interface to be tested according to the interface test request.
And a test report generating module 746d for comparing the feedback result with the expected test result to generate a test report.
In this embodiment, in the process of testing the interface to be tested, the feedback result returned by the interface to be tested can be directly compared with the expected test result, so as to generate the test report, the feedback result returned by the interface to be tested does not need to be manually analyzed, the test report is written, and the generation efficiency and the accuracy of the test report are improved.
In one embodiment, the feedback result receiving module 746c is further configured to detect whether a parameter returned by the interface to be tested is an asynchronous return parameter; when detecting that the parameter returned by the interface to be tested is an asynchronous return parameter, changing a feedback result receiving address in the interface test request into an interception interface address, and storing the asynchronous return parameter according to the interception interface address; sending the stored asynchronous return parameters to an interface to be tested; and receiving a feedback result returned by the interface to be tested according to the stored asynchronous return parameters.
In this embodiment, when detecting that the parameter returned by the interface to be tested is an asynchronous return parameter, the return result receiving address is changed to an interception interface address, and the interception interface stores the asynchronous return parameter through the interception interface address. When the stored asynchronous return parameters meet the sending conditions, the interception interface sends the stored asynchronous return parameters to the interface to be tested, so that the asynchronous return parameters are further processed by the result to be tested to obtain a feedback result, the integrity of testing the interface to be tested is ensured, and the accuracy of the feedback result is improved.
Fig. 11 is a schematic diagram illustrating an internal structure of the server 120 in the interface test system of fig. 1 according to an embodiment. As shown in fig. 11, the server 120 includes a processor, a non-volatile storage medium, a memory, and a network interface connected through a system bus. The processor of the server 120 is used to provide computing and control capabilities, to support the operation of the entire server 120, the memory is used to store data, code instructions, etc., and the network interface is used to communicate with the terminal 110 over a network. The memory has at least one computer program stored thereon, which can be executed by the processor to implement the interface testing method provided in the embodiment of the present application and applied to the server 120. The Memory may include non-volatile storage media such as magnetic disks, optical disks, Read-Only memories (ROMs), and the like. For example, in one embodiment, the memory includes a non-volatile storage medium and an internal memory; the nonvolatile storage medium stores an operating system, a database and a computer program, the database is set as a test case library, at least one of test case generation information, a test case template and an interface communication parameter is stored in the test case library, and the computer program can be executed by a processor to realize the interface test method; the internal memory provides a cached execution environment for the operating system and computer-executable instructions in the non-volatile storage medium.
Embodiments of the present invention provide a computer device, which includes a series of computer programs stored in a memory, and when the computer programs are executed by a processor, the interface testing method provided in the embodiments of the present invention can be implemented. In some embodiments, based on the particular operations implemented by the various parts of the computer program.
In one embodiment, a computer device includes a memory, a processor, and a computer program stored on the memory and executable on the processor, the processor implementing the following steps when executing the computer program: acquiring test case configuration information; according to the test case identification in the test case configuration information, inquiring test case generation information, a test case template and interface communication parameters from a test case library; generating a test case corresponding to the test case identification according to the test case generation information and the test case template; and testing the interface to be tested corresponding to the address of the interface to be tested in the test case according to the test case and the interface communication parameters.
In one embodiment, obtaining test case configuration information includes: monitoring the test starting time in the test plan information; and when the current time is the same as the test starting time, extracting test case configuration information corresponding to the test starting time from the test plan information.
In one embodiment, testing an interface to be tested corresponding to an interface address to be tested in a test case according to the test case and an interface communication parameter includes: extracting an interface communication protocol type, an interface communication mode and an interface data transmission format in the interface communication parameters; generating an interface test request according to the interface communication protocol type, the interface communication mode, the interface data transmission format and the test case; and testing the interface to be tested corresponding to the interface address to be tested in the test case according to the interface test request.
In one embodiment, the testing the interface to be tested corresponding to the interface address to be tested in the test case according to the interface test request includes: extracting an address of an interface to be tested and an expected test result in the test case; sending the interface test request to the interface to be tested corresponding to the extracted interface address to be tested; receiving a feedback result returned by the interface to be tested according to the interface test request; and comparing the feedback result with the expected test result to generate a test report.
In one embodiment, receiving a feedback result returned by the interface to be tested according to the interface test request includes: detecting whether the parameter returned by the interface to be detected is an asynchronous return parameter; when detecting that the parameter returned by the interface to be tested is an asynchronous return parameter, changing a feedback result receiving address in the interface test request into an interception interface address, and storing the asynchronous return parameter according to the interception interface address; sending the stored asynchronous return parameters to an interface to be tested; and receiving a feedback result returned by the interface to be tested according to the stored asynchronous return parameters.
In the embodiment, the interface type of the interface to be tested does not need to be considered, a fixed test case does not need to be compiled for the interface to be tested, only corresponding test case generation information, a test case template and interface communication parameters need to be inquired from the test case library, and the test case for testing the interface to be tested is automatically generated according to the test case generation information and the test case template, so that the time consumed for compiling the test case is saved. And normal communication with the interface to be tested is ensured according to the interface communication parameters, so that the test success rate of the interface to be tested is ensured, and the test efficiency of the interface is further improved.
A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of: acquiring test case configuration information; according to the test case identification in the test case configuration information, inquiring test case generation information, a test case template and interface communication parameters from a test case library; generating a test case corresponding to the test case identification according to the test case generation information and the test case template; and testing the interface to be tested corresponding to the address of the interface to be tested in the test case according to the test case and the interface communication parameters.
In one embodiment, obtaining test case configuration information includes: monitoring the test starting time in the test plan information; and when the current time is the same as the test starting time, extracting test case configuration information corresponding to the test starting time from the test plan information.
In one embodiment, testing an interface to be tested corresponding to an interface address to be tested in a test case according to the test case and an interface communication parameter includes: extracting an interface communication protocol type, an interface communication mode and an interface data transmission format in the interface communication parameters; generating an interface test request according to the interface communication protocol type, the interface communication mode, the interface data transmission format and the test case; and testing the interface to be tested corresponding to the interface address to be tested in the test case according to the interface test request.
In one embodiment, the testing the interface to be tested corresponding to the interface address to be tested in the test case according to the interface test request includes: extracting an address of an interface to be tested and an expected test result in the test case; sending the interface test request to the interface to be tested corresponding to the extracted interface address to be tested; receiving a feedback result returned by the interface to be tested according to the interface test request; and comparing the feedback result with the expected test result to generate a test report.
In one embodiment, receiving a feedback result returned by the interface to be tested according to the interface test request includes: detecting whether the parameter returned by the interface to be detected is an asynchronous return parameter; when detecting that the parameter returned by the interface to be tested is an asynchronous return parameter, changing a feedback result receiving address in the interface test request into an interception interface address, and storing the asynchronous return parameter according to the interception interface address; sending the stored asynchronous return parameters to an interface to be tested; and receiving a feedback result returned by the interface to be tested according to the stored asynchronous return parameters.
In the embodiment, the interface type of the interface to be tested does not need to be considered, a fixed test case does not need to be compiled for the interface to be tested, only corresponding test case generation information, a test case template and interface communication parameters need to be inquired from the test case library, and the test case for testing the interface to be tested is automatically generated according to the test case generation information and the test case template, so that the time consumed for compiling the test case is saved. And normal communication with the interface to be tested is ensured according to the interface communication parameters, so that the test success rate of the interface to be tested is ensured, and the test efficiency of the interface is further improved.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium, and can include the processes of the embodiments of the methods described above when the computer program is executed. The storage medium may be a non-volatile storage medium such as a magnetic disk, an optical disk, or a Read-Only Memory (ROM).
The technical features of the embodiments described above may be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the embodiments described above are not described, but should be considered as being within the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present invention, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the inventive concept, which falls within the scope of the present invention. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (8)

1. An interface testing method, the method comprising:
acquiring test case configuration information;
according to the test case identification in the test case configuration information, inquiring test case generation information, a test case template and interface communication parameters from a test case library;
generating a test case corresponding to the test case identification according to the test case generation information and the test case template;
testing the interfaces to be tested corresponding to the addresses of the interfaces to be tested in the test cases according to the test cases and the interface communication parameters, and if the test cases are multiple, if the interfaces to be tested corresponding to the test cases are different, synchronously executing the test cases according to the interface communication parameters to test the interfaces to be tested corresponding to the test cases; if the to-be-tested interfaces corresponding to the plurality of test cases are identified to be the same, synchronously executing each test case in a multithreading mode, and testing the to-be-tested interfaces according to each test case which is synchronously executed;
the obtaining of the test case configuration information includes:
monitoring the test starting time in test plan information, wherein the test plan information is stored in the test case library;
and when the current time is the same as the test starting time, extracting test case configuration information corresponding to the test starting time from the test plan information.
2. The method according to claim 1, wherein the testing the interface to be tested corresponding to the address of the interface to be tested in the test case according to the test case and the interface communication parameters comprises:
extracting an interface communication protocol type, an interface communication mode and an interface data transmission format in the interface communication parameters;
generating an interface test request according to the interface communication protocol type, the interface communication mode, the interface data transmission format and the test case;
and testing the interface to be tested corresponding to the interface address to be tested in the test case according to the interface test request.
3. The method according to claim 2, wherein the testing the interface to be tested corresponding to the interface address to be tested in the test case according to the interface test request includes:
extracting the address of the interface to be tested and an expected test result in the test case;
sending the interface test request to the interface to be tested corresponding to the extracted interface address to be tested;
receiving a feedback result returned by the interface to be tested according to the interface test request;
and comparing the feedback result with the expected test result to generate a test report.
4. The method according to claim 3, wherein the receiving the feedback result returned by the interface to be tested according to the interface test request comprises:
detecting whether the parameter returned by the interface to be detected is an asynchronous return parameter;
when detecting that the parameter returned by the interface to be tested is an asynchronous return parameter, changing a feedback result receiving address in the interface test request into an interception interface address, and storing the asynchronous return parameter according to the interception interface address;
sending the stored asynchronous return parameters to the interface to be tested;
and receiving a feedback result returned by the interface to be tested according to the stored asynchronous return parameter.
5. An interface testing apparatus, the apparatus comprising:
the configuration information acquisition module is used for acquiring the configuration information of the test case;
the case information query module is used for querying test case generation information, a test case template and interface communication parameters from the test case library according to the test case identifiers in the test case configuration information;
the test case generation module is used for generating a test case corresponding to the test case identifier according to the test case generation information and the test case template;
the interface testing module is used for testing the interface to be tested corresponding to the interface address to be tested in the test case according to the test cases and the interface communication parameters, and when a plurality of test cases exist, if the interfaces to be tested corresponding to the test cases are different, the interface testing module synchronously executes each test case according to the interface communication parameters to test the interface to be tested corresponding to each test case; if the to-be-tested interfaces corresponding to the plurality of test cases are identified to be the same, synchronously executing each test case in a multithreading mode, and testing the to-be-tested interfaces according to each test case which is synchronously executed;
the configuration information obtaining module comprises:
the test plan monitoring module is used for monitoring the test starting time in test plan information, and the test plan information is stored in the test case library;
and the configuration information extraction module is used for extracting test case configuration information corresponding to the test starting time from the test plan information when the current time is monitored to be the same as the test starting time.
6. The apparatus of claim 5, wherein the interface test module comprises:
the communication parameter extraction module is used for extracting the interface communication protocol type, the interface communication mode and the interface data transmission format in the interface communication parameters;
the test request generating module is used for generating an interface test request according to the interface communication protocol type, the interface communication mode, the interface data transmission format and the test case;
and the interface to be tested test module is used for testing the interface to be tested corresponding to the interface address to be tested in the test case according to the interface test request.
7. A computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the steps of the method of any one of claims 1 to 4 when executing the computer program.
8. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 4.
CN201711047371.5A 2017-10-31 2017-10-31 Interface testing method and device, computer equipment and storage medium Active CN107766190B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201711047371.5A CN107766190B (en) 2017-10-31 2017-10-31 Interface testing method and device, computer equipment and storage medium
PCT/CN2017/112481 WO2019085073A1 (en) 2017-10-31 2017-11-23 Interface test method and apparatus, computer device, and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201711047371.5A CN107766190B (en) 2017-10-31 2017-10-31 Interface testing method and device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN107766190A CN107766190A (en) 2018-03-06
CN107766190B true CN107766190B (en) 2020-06-12

Family

ID=61270248

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201711047371.5A Active CN107766190B (en) 2017-10-31 2017-10-31 Interface testing method and device, computer equipment and storage medium

Country Status (2)

Country Link
CN (1) CN107766190B (en)
WO (1) WO2019085073A1 (en)

Families Citing this family (29)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109726105B (en) * 2018-05-15 2023-11-28 深圳市易行网数字科技有限公司 Test data construction method, device, equipment and storage medium
CN108984387A (en) * 2018-05-30 2018-12-11 湖南鑫蜀山网络科技有限公司 Interface test device applied to computer
CN108733573A (en) * 2018-05-30 2018-11-02 湖南鑫蜀山网络科技有限公司 The interface testing equipment that application interface test method is tested
CN108984388B (en) * 2018-06-01 2023-10-27 平安壹钱包电子商务有限公司 Method and terminal equipment for generating automatic test case
CN108845905B (en) * 2018-06-27 2021-09-10 北京计算机技术及应用研究所 Communication protocol rapid parallel testing method suitable for large system
CN110674023B (en) * 2018-07-02 2022-11-04 北京奇虎科技有限公司 Interface testing method and device
CN109186666A (en) * 2018-08-27 2019-01-11 日立楼宇技术(广州)有限公司 Detection method, device, computer equipment and the storage medium of equipment
CN109062809B (en) * 2018-09-20 2022-01-21 北京奇艺世纪科技有限公司 Online test case generation method and device and electronic equipment
CN109614310A (en) * 2018-10-22 2019-04-12 中国平安财产保险股份有限公司 Management method, device, computer equipment and the storage medium of test interface
CN109783350A (en) * 2018-12-13 2019-05-21 重庆金融资产交易所有限责任公司 Interface test method, device and computer readable storage medium
CN109815139A (en) * 2019-01-03 2019-05-28 深圳壹账通智能科技有限公司 Interface test method, device, computer equipment and storage medium
CN110046088A (en) * 2019-02-19 2019-07-23 阿里巴巴集团控股有限公司 A kind of interface test method, device and equipment
CN109947646A (en) * 2019-03-13 2019-06-28 平安信托有限责任公司 Interface test method, device, computer equipment and storage medium
CN109992508A (en) * 2019-03-22 2019-07-09 恒生电子股份有限公司 Test exemple automation generation method, device and electronic equipment
CN109933534B (en) * 2019-03-26 2023-02-24 上海上湖信息技术有限公司 Method and device for determining financial test object
CN110389296A (en) * 2019-06-21 2019-10-29 深圳米飞泰克科技有限公司 Integrated circuit product handling system method, apparatus and terminal device
CN110716870B (en) * 2019-09-23 2023-01-31 中国建设银行股份有限公司 Automatic service testing method and device
CN110647471B (en) * 2019-09-26 2023-05-23 招商局金融科技有限公司 Interface test case generation method, electronic device and storage medium
CN111488285B (en) * 2020-04-15 2023-05-12 抖音视界有限公司 Interface testing method, device, electronic equipment and computer readable storage medium
CN111581083B (en) * 2020-04-26 2024-02-09 抖音视界有限公司 Interface testing method and device, electronic equipment and storage medium
CN111651365B (en) * 2020-07-01 2024-04-19 中国银行股份有限公司 Automatic interface testing method and device
CN113760697B (en) * 2020-07-15 2024-09-20 北京沃东天骏信息技术有限公司 Interface testing method, device, electronic equipment and storage medium
CN112115058B (en) * 2020-09-25 2024-03-29 建信金融科技有限责任公司 Test method and device, test case generation method and device and test system
CN112362360B (en) * 2020-11-10 2023-03-31 广州小鹏汽车科技有限公司 Vehicle component testing method, device and system, test board card and storage medium
CN112527630B (en) * 2020-11-18 2023-07-07 平安消费金融有限公司 Test case generation method, device, computer equipment and storage medium
CN112699033B (en) * 2020-12-29 2023-05-23 中国航空工业集团公司西安飞机设计研究所 Multi-partition airborne software test case multistage synchronous loading method
CN113392002B (en) * 2021-06-15 2024-04-12 北京京东振世信息技术有限公司 Test system construction method, device, equipment and storage medium
CN113282476B (en) * 2021-06-24 2023-01-20 深圳市商汤科技有限公司 Interface performance testing method and device and electronic equipment
CN113342689A (en) * 2021-07-01 2021-09-03 中诚信征信有限公司 Automatic testing method and device for interface, electronic equipment and storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103198009A (en) * 2012-01-04 2013-07-10 中国移动通信集团公司 Universal testing method, system and corresponding device
CN106021090A (en) * 2016-05-04 2016-10-12 上海瀚银信息技术有限公司 Software interface test system and method
CN106951364A (en) * 2017-02-08 2017-07-14 深圳国泰安教育技术股份有限公司 Method of testing and device
CN106991040A (en) * 2016-07-20 2017-07-28 平安科技(深圳)有限公司 Data-interface method of testing and device

Family Cites Families (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101212357B (en) * 2006-12-31 2010-09-15 亿阳信通股份有限公司 Interface testing method and device
CN102096631B (en) * 2009-12-11 2013-09-25 华为技术有限公司 Interface testing method and device
IN2015DE01395A (en) * 2015-05-18 2015-06-26 Hcl Technologies Ltd
CN105005532B (en) * 2015-08-05 2017-11-24 广东欧珀移动通信有限公司 A kind of system and method for automatic test application programming interfaces stability
CN106933745A (en) * 2017-03-30 2017-07-07 携程计算机技术(上海)有限公司 WEB automatic interface testing methods and system

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103198009A (en) * 2012-01-04 2013-07-10 中国移动通信集团公司 Universal testing method, system and corresponding device
CN106021090A (en) * 2016-05-04 2016-10-12 上海瀚银信息技术有限公司 Software interface test system and method
CN106991040A (en) * 2016-07-20 2017-07-28 平安科技(深圳)有限公司 Data-interface method of testing and device
CN106951364A (en) * 2017-02-08 2017-07-14 深圳国泰安教育技术股份有限公司 Method of testing and device

Also Published As

Publication number Publication date
WO2019085073A1 (en) 2019-05-09
CN107766190A (en) 2018-03-06

Similar Documents

Publication Publication Date Title
CN107766190B (en) Interface testing method and device, computer equipment and storage medium
CN107844421B (en) Interface testing method and device, computer equipment and storage medium
CN107665233B (en) Database data processing method and device, computer equipment and storage medium
CN106991040B (en) Data interface testing method and device
CN109474578B (en) Message checking method, device, computer equipment and storage medium
CN106484611B (en) Fuzzy test method and device based on automatic protocol adaptation
CN107547299B (en) Test method and system
CN111045952A (en) Software testing method, flow playback device, terminal equipment and readable storage medium
CN109726134B (en) Interface test method and system
CN108400978B (en) Vulnerability detection method and device, computer equipment and storage medium
CN111683066A (en) Heterogeneous system integration method and device, computer equipment and storage medium
CN113360301B (en) Message transmission system and method
CN107818107B (en) Method and device for controlling page jump
CN108255700B (en) Test result generation method and device
CN109802842B (en) Application topology generation method and related equipment
CN111625342B (en) Data tracing method, device and server
CN110362478B (en) Application upgrade test method and device, computer equipment and storage medium
CN106972983B (en) Automatic testing device and method for network interface
CN111107064A (en) Terminal equipment identification method, device, equipment and readable storage medium
CN110505177B (en) Information collection system, terminal equipment and remote host
CN113938412A (en) Protocol stack testing method and device, testing system and computer readable storage medium
CN112835856A (en) Log data query method and device, equipment and medium
CN111061637B (en) Interface testing method, interface testing device and storage medium
CN110704218B (en) Data processing method, data processing device, computer equipment and storage medium
CN109086145B (en) Data generation method and device and computer storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant