WO2019085073A1 - Interface test method and apparatus, computer device, and storage medium - Google Patents

Interface test method and apparatus, computer device, and storage medium Download PDF

Info

Publication number
WO2019085073A1
WO2019085073A1 PCT/CN2017/112481 CN2017112481W WO2019085073A1 WO 2019085073 A1 WO2019085073 A1 WO 2019085073A1 CN 2017112481 W CN2017112481 W CN 2017112481W WO 2019085073 A1 WO2019085073 A1 WO 2019085073A1
Authority
WO
WIPO (PCT)
Prior art keywords
interface
test
test case
tested
parameter
Prior art date
Application number
PCT/CN2017/112481
Other languages
French (fr)
Chinese (zh)
Inventor
杨雨晨
Original Assignee
平安科技(深圳)有限公司
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 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2019085073A1 publication Critical patent/WO2019085073A1/en

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

Definitions

  • the present application relates to the field of testing technology, and in particular, to an interface testing method, apparatus, computer device, and storage medium.
  • test tools are mainly divided into commercial test tools, open source test frameworks and lightweight test scripts compiled by testers from the perspective of technical architecture; from a functional point of view
  • the operating platform it is mainly divided into a Windows-based operating system, based on the Unix/Linux operating system, etc., from the perspective of the system under test.
  • Windows-based operating system based on the Unix/Linux operating system, etc.
  • an interface testing method In accordance with various embodiments provided herein, an interface testing method, apparatus, computer device, and storage medium are provided.
  • An interface test method includes:
  • test case generation information Determining test case generation information, test case template, and interface communication parameters from the test case library according to the test case identifier in the test case configuration information;
  • the interface to be tested corresponding to the interface address to be tested in the test case is tested according to the test case and the interface communication parameter.
  • An interface testing device includes:
  • the configuration information obtaining module is configured to obtain test case configuration information.
  • the use case information query module is configured to query the test case generation information, the test case template, and the interface communication parameter from the test case library according to the test case identifier in the test case configuration information;
  • test case generating module configured to generate a test case corresponding to the test case identifier according to the test case generation information and the test case template;
  • the interface test module is configured to test the interface to be tested corresponding to the interface address to be tested in the test case according to the test case and the interface communication parameter.
  • a computer device comprising a memory, a processor, and computer instructions stored on the memory and operative on the processor, the processor executing the computer instructions to:
  • test case generation information Determining test case generation information, test case template, and interface communication parameters from the test case library according to the test case identifier in the test case configuration information;
  • a computer readable storage medium having stored thereon computer instructions, wherein the computer instructions are executed by a processor to implement the following steps:
  • test case generation information Determining test case generation information, test case template, and interface communication parameters from the test case library according to the test case identifier in the test case configuration information;
  • the interface to be tested corresponding to the interface address to be tested in the test case is tested according to the test case and the interface communication parameter.
  • FIG. 1 is an application environment diagram of an interface test method in an embodiment
  • FIG. 2 is a schematic flow chart of an interface testing method in an embodiment
  • FIG. 3 is a schematic flow chart of steps of extracting test case configuration information in an embodiment
  • FIG. 4 is a flow chart showing the steps of testing according to an interface test request in an embodiment
  • FIG. 5 is a schematic flow chart of steps of generating a test report in an embodiment
  • FIG. 6 is a flow chart showing the steps of detecting an asynchronous return parameter in an embodiment
  • FIG. 7 is a structural block diagram of an interface testing device in an embodiment
  • FIG. 8 is a structural block diagram of a configuration information acquiring module in an embodiment
  • FIG. 9 is a structural block diagram of an interface test module in an embodiment
  • FIG. 10 is a structural block diagram of an interface test module to be tested in an embodiment
  • Figure 11 is a block diagram showing the structure of a server in an interface test system in an embodiment.
  • FIG. 1 is an application environment diagram of an interface test method in an embodiment.
  • 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 or a mobile terminal, and the fixed terminal may specifically be at least one of a printer, a scanner, and a monitor, and the mobile terminal may specifically be at least one of a tablet computer, a smart phone, a personal data assistant, and a digital camera. .
  • an interface testing method is provided.
  • This embodiment is exemplified by the method applied to the server 120 in FIG. 1, and the method specifically includes the following content:
  • an interface test configuration page is displayed in the terminal 110.
  • the user can input the test case configuration information in the interface test configuration page, and the user clicks the configuration completion button in the interface test configuration page through the input terminal of the terminal 110.
  • the terminal 110 obtains the test case configuration information input in the interface test configuration page, and generates an interface test command according to the test case configuration information.
  • the test case configuration information is the test case identifier corresponding to the test case to be executed configured during the test process and the dependency relationship information between the test cases.
  • the test case configuration information includes a test case identifier, and the extracted test case identifier may be one or more.
  • test case configuration information includes multiple test case identifiers
  • the test case corresponding to each test case identifier is also included.
  • Dependency information The terminal 110 transmits the generated interface test command to the server 120.
  • Test case ID for identification The unique identifier of the test case.
  • test case generation information Query the test case generation information, the test case template, and the interface communication parameter from the test case library according to the test case identifier in the test case configuration information.
  • the test case library is set in the server 120, and the test case generation information, the test case template, and the interface communication parameters are stored in the test case library.
  • the test case template is a template for generating a test case
  • the interface communication parameter is a communication parameter 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 for storage in the test case library.
  • An interface test configuration page is displayed in the terminal 110, and the user can input the test case generation information, the test case template, and the interface communication parameter in the interface test configuration page by using the input device, and the terminal 110 obtains the test case generation information input in the interface test configuration page.
  • the template of the test case and the interface communication parameter are sent to the server 120 in the obtained test case generation information, the template of the test case, and the interface communication parameter.
  • the test case generation information, the test case template, the interface communication parameters, and the test case identification are stored in the test case library.
  • the server 120 parses the interface test command, extracts the test case configuration information in the interface test command, and extracts the test case identifier from the test case configuration information.
  • 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 in the test case library.
  • test case generation information is stored in the test case library corresponding to the test case identification
  • test case template and the interface communication parameters are stored in the test case library corresponding to the test case generation information.
  • Server 120 extracts the test case identification from the interface test instructions. The server 120 queries the test case generation information corresponding to the extracted test case identifiers in the test case database, and queries the corresponding test case templates and interface communication parameters in the test case library according to the generated test case generation information.
  • the test case generation information is stored in the test case database corresponding to the test case identifier
  • the test case template information includes the test case template identifier
  • the test case template corresponding to the test case template identifier is stored in the test case library, and the test is performed.
  • Use case template includes interface communication parameters The identifier, the interface communication parameter corresponding to the interface communication parameter identifier is stored in the test case.
  • the server 120 extracts the test case identifier from the interface test command, and queries the test case generation information corresponding to the extracted test case identifier in the test case library.
  • the server 120 parses the test case generation information, extracts the test case template identifier in the test case generation information, and queries the test case library for the test case template corresponding to the extracted test case template identifier.
  • the server 120 extracts an interface communication parameter identifier from the queried test case template, and queries an interface communication parameter corresponding to the interface communication parameter identifier in the test case library.
  • test cases corresponding to the test case identifiers according to the test case generation information and the test case template.
  • the test case generation information includes request parameter information, return parameter information, and expected test result
  • the test case template is test scenario information.
  • the server 120 merges the test case generation information and the test case template, and obtains the test case corresponding to the test case identifier by combining.
  • the server 120 adds the test case generation information to the test case template according to the test case generation information and the test case template corresponding to each test case identifier.
  • Each test case identifies the corresponding test case.
  • the server 120 executes the test case, extracts the interface address to be tested in the test case, encapsulates the test information generated by the execution test case according to the interface communication parameter, and sends the encapsulated test information to the extracted test information.
  • the interface to be tested corresponding to the interface address is tested to test the interface to be tested according to the encapsulated test information.
  • the server 120 when the extracted test case identifiers may be multiple, the server 120 respectively determines the interface address to be tested for each test case according to the interface communication parameters and the test cases corresponding to each test case identifier. Test interface for testing.
  • the server 120 identifies that the interfaces to be tested corresponding to the multiple test cases are different, the test instances are synchronously executed according to the corresponding interface communication parameters, and the interfaces to be tested corresponding to the test cases are tested.
  • the server 120 recognizes multiple When the test interface corresponding to the test case is the same, the test case is synchronously executed in a multi-thread manner, and the test interface to be tested is tested according to the test case executed synchronously.
  • test case generation information and test case templates automatically generate test cases for testing the interface to be tested, saving time spent writing test cases.
  • the interface communication parameters it can ensure normal communication with the interface to be tested, thereby ensuring the test success rate of the interface to be tested, and further improving the test efficiency of the interface.
  • S202 specifically includes the step of extracting test case configuration information, and the step specifically includes the following content:
  • the test plan information is input test plan information in the interface test configuration page displayed by the user through the input device of the terminal.
  • the terminal 110 transmits the input test plan information to the server 120.
  • the server 120 can store the test plan information sent by the terminal 110 in a test case library.
  • the test plan information includes a test execution time and a test case identification set, and the test execution time includes a test start time and a test end time; the test case identification set includes at least one test case identifier.
  • the test case information is stored in the test case library of the server 120.
  • the test plan information includes a test execution time, a test cycle number, and a test case identification set.
  • the server 120 acquires 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.
  • 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 test plan information.
  • test case configuration information corresponding to the test start time is extracted from the test plan information.
  • the server 120 when the server 120 detects that the current time is the same as the test start time, The test case identification set is read from the test plan information corresponding to the test start time, and the test case identifier in the test case identification set is extracted. After extracting the test case identifier, the server 120 encapsulates the extracted test case identifier and generates an interface test command by using the package.
  • the interface test command is generated according to the test plan information corresponding to the test start time, and the interface test command is not required to be manually triggered. , reducing manual intervention. According to the test plan information, the corresponding interface test command can be generated, which improves the convenience of generating the interface test command.
  • S208 specifically includes the step of performing testing according to the interface test request, and the step specifically includes the following content:
  • S402. Extract an interface communication protocol type, an interface communication mode, and an interface data transmission format in the interface communication parameter.
  • the interface communication parameters include an interface communication protocol type, an interface communication mode, and an interface data transmission format.
  • the interface communication protocol type is the communication protocol supported by the interface to be tested;
  • the interface communication mode is the communication protocol supported by the interface to be tested;
  • the interface data transmission format is the data transmission format that the interface to be tested can parse and support.
  • 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 by parsing.
  • the server 120 encapsulates the test case according to the extracted interface communication protocol type, the interface communication mode, and the interface data transmission format, and encapsulates the interface test request supported by the interface to be tested.
  • the test case includes the address of the interface to be tested, and the address of the interface to be tested is a unique identifier of the interface to be tested.
  • the server 120 extracts the interface address to be tested from the test case, according to the connection to be tested.
  • the interface address sends an interface test request to the interface to be tested to test the interface to be tested.
  • the test case is not required to be written according to the interface type of the interface to be tested, and the test case is encapsulated according to the interface communication protocol type, the interface communication mode, and the interface data transmission format in the interface communication information, and the interface to be tested is generated.
  • the interface test request guarantees the success rate of the test interface to be tested according to the interface test request.
  • S406 specifically includes the step of generating a test report, and the step specifically includes the following:
  • the server 120 parses the test case and extracts the interface address to be tested and the expected test result from the test case by parsing.
  • the prediction test result is tested according to the test case to be tested, and the test result returned by the interface to be tested is expected.
  • S504 Send the interface test request to the interface to be tested corresponding to the extracted interface address to be tested.
  • the server 120 establishes a communication connection with the interface to be tested according to the extracted interface address to be tested, and after the communication connection is successfully established, sends an interface test request to the interface to be tested through the communication connection.
  • the interface to be tested parses the interface test request and obtains the input parameters in the interface test interface request.
  • the interface to be tested processes the input parameters to generate feedback results, and sends the generated feedback result to the server. 120.
  • the server 120 receives the feedback result returned by the interface to be tested according to the interface test request.
  • the server 120 compares the feedback result with the expected test result, compares and determines the difference between the feedback result and the expected test result, and generates a test report according to the determined difference information.
  • the test report may further include at least one of a test start time, a test end time, and an interface address to be tested.
  • the interface to be tested can be directly returned.
  • the feedback result is compared with the expected test result to generate a test report, and the feedback result returned by the manual test interface is not analyzed, and the test report has been written, which improves the efficiency and accuracy of the test report generation.
  • S506 specifically includes the step of detecting an asynchronous return parameter, and the step specifically includes the following:
  • the asynchronous return parameter is a parameter that is returned multiple times by the interface to be tested, and the interface to be tested needs to further process the asynchronous return parameter to obtain a feedback result.
  • the server 120 detects whether the number of the parameter items of the returned parameter is complete according to the expected test result, and if the number of the parameter items of the returned parameter is detected to be incomplete, The parameter returned by the interface to be tested is detected as an asynchronous return parameter; if it is complete, the parameter returned by the interface to be tested is detected as a feedback result.
  • the server 120 after receiving the parameter data packet returned by the interface to be tested, the server 120 detects whether the parameter data packet includes an asynchronously returned identifier, and if there is an asynchronously returned identifier, the parameter in the parameter data packet is detected as Return parameters asynchronously.
  • the feedback result receiving address in the interface test request is changed to an intercepting interface address, and the asynchronous return parameter is stored according to the intercepting interface address.
  • the server 120 when detecting that the parameter returned by the interface to be tested is an asynchronous return parameter, the server 120 obtains a preset intercepting interface address, and sends the obtained intercepting interface address to the interface to be tested, to notify that the returned result is received.
  • the address is changed to intercept the interface address, and the received asynchronous return parameter is sent to the intercept interface corresponding to the intercept interface address for storage.
  • the interface to be tested After receiving the interception interface address, the interface to be tested sends the asynchronous return parameter returned to the interception interface for storage.
  • the intercept interface address is an address of an intercept interface for storing an asynchronous return parameter.
  • the server 120 uses the parameter returned by the interface to be tested as the feedback result.
  • the intercepting interface when receiving the parameter data packet returned by the interface to be tested, the intercepting interface detects whether the parameter data packet carries the parameter sending identifier, and when the parameter sending identifier is detected, the stored asynchronous return parameter is sent to the Measuring interface.
  • the interface to be tested receives the asynchronous return parameter returned by the intercepting interface, performs subsequent processing on the returned asynchronous return parameter, generates a return result through subsequent processing, and sends the returned result to the server 120 according to the returned result receiving address.
  • the server 120 receives the feedback result from the interface to be tested.
  • the return result receiving address is changed to the intercepting interface address, and the intercepting interface is configured to store the asynchronous return parameter by intercepting the interface address.
  • the intercepting interface sends the stored asynchronous return parameter to the interface to be tested, so that the result to be tested is further processed by the asynchronous return parameter to obtain a feedback result, thereby ensuring the integrity of the test to be tested, and improving The accuracy of the feedback results.
  • an interface testing apparatus 700 is provided.
  • the apparatus specifically includes: a configuration information acquiring module 710 , a use case information querying module 720 , a test case generating module 730 , and an interface testing 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 database according to the test case identifier in the test case configuration information.
  • the test case generation module 730 is configured to generate a test case corresponding to the test case identifier according to the test case generation information and the test case template.
  • the interface test module 740 is configured to test the interface to be tested corresponding to the interface address to be tested in the test case according to the test case and the interface communication parameter.
  • test case generation information and test case templates are automatically generated Test cases for testing the interface to be tested save time in writing test cases. And according to the interface communication parameters, it can ensure normal communication with the interface to be tested, thereby ensuring the test success rate of the interface to be tested, and further improving the test efficiency of the interface.
  • the configuration information acquiring module 710 specifically includes the following: a test plan monitoring module 712 and a configuration information extracting module 714 .
  • the test plan monitoring module 712 is configured to monitor the test start time in the test plan information.
  • the configuration information extraction module 714 is configured to: when the current time is monitored and the test start time is the same, extract the test case configuration information corresponding to the test start time from the test plan information.
  • the current time is equal to the test start time
  • the test case configuration information is obtained according to the test plan information corresponding to the test start time, without manually triggering the interface test. Instructions reduce manual intervention.
  • the interface test module 740 specifically includes the following: a communication parameter extraction module 742 , a test request generation module 744 , and an interface test module 746 to be tested .
  • the communication parameter extraction module 742 is 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 generation 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 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.
  • the test case is not required to be written according to the interface type of the interface to be tested, and the test case is encapsulated according to the interface communication protocol type, the interface communication mode, and the interface data transmission format in the interface communication information, and the interface to be tested is generated.
  • the interface test request guarantees the success rate of the test interface to be tested according to the interface test request.
  • the interface to be tested module 746 specifically includes the following: an interface address extraction module 746a, a test request sending module 746b, a feedback result receiving module 746c, and a test report generating module 746d.
  • the interface address extraction module 746a is configured to extract the interface address to be tested and the expected measurement in the test case. Test results.
  • the test request sending module 746b is configured to send the interface test request to the interface to be tested corresponding to the extracted interface address to be tested.
  • 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.
  • the test report generation module 746d is configured to compare the feedback result with the expected test result to generate a test report.
  • the feedback result returned by the interface to be tested can be directly compared with the expected test result, thereby generating a test report, and the feedback result returned by the manual test interface is not required to be analyzed.
  • Test reports improve the efficiency and accuracy of test report generation.
  • the feedback result receiving module 746c is further configured to detect whether the parameter returned by the interface to be tested is an asynchronous return parameter; and when detecting that the parameter returned by the interface to be tested is an asynchronous return parameter, the feedback result in the interface test request is The receiving address is changed to the intercepting interface address, and the asynchronous return parameter is stored according to the intercepting interface address; the stored asynchronous return parameter is sent to the interface to be tested; and the feedback result returned by the interface to be tested according to the stored asynchronous return parameter is received.
  • the return result receiving address is changed to the intercepting interface address, and the intercepting interface is configured to store the asynchronous return parameter by intercepting the interface address.
  • the intercepting interface sends the stored asynchronous return parameter to the interface to be tested, so that the result to be tested is further processed by the asynchronous return parameter to obtain a feedback result, thereby ensuring the integrity of the test to be tested, and improving The accuracy of the feedback results.
  • Each of the above interface test devices can be implemented in whole or in part by software, hardware, and combinations thereof.
  • the network interface may be an Ethernet or a wireless network card.
  • Each of the above modules may be embedded in or independent of the processor in the server, or may be stored in the memory of the terminal or the server in software, so that the processor invokes the operations corresponding to the above modules.
  • the processor can be a central processing unit (CPU), a microprocessor, a microcontroller, or the like.
  • FIG. 11 is a schematic diagram showing the internal structure of the server 120 in the interface test system of FIG. 1 in an embodiment. Figure.
  • the server 120 includes a processor, a non-volatile storage medium, a memory, and a network interface connected by a system bus.
  • the processor of server 120 is used to provide computing and control capabilities to support the operation of the entire server 120, the memory for storing data, code instructions, etc., and the network interface for network communication with terminal 110.
  • At least one computer instruction is stored on the memory, and the computer instruction can be executed by the processor to implement the interface test method applicable to the server 120 provided in the embodiment of the present application.
  • the memory may include a non-volatile storage medium such as a magnetic disk, an optical disk, or a read-only memory (ROM).
  • the memory includes a non-volatile storage medium and an internal memory; the non-volatile storage medium stores an operating system, a database, and computer instructions, the database is set as a test case library, and the test case library stores the test At least one of use case generation information, a template of a test case, and interface communication parameters executable by the processor to implement the interface test method described above; the internal memory is an operating system and a computer in a non-volatile storage medium Execution instructions provide a cached runtime environment.
  • FIG. 11 is only a schematic diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the server to which the solution of the present application is applied.
  • the specific server may include the ratio. More or fewer components are shown in Figure 11, or some components are combined, or have different component arrangements.
  • the embodiment of the present application provides a computer device, which includes a series of computer instructions stored in a memory.
  • the interface testing method proposed by the embodiments of the present application may be implemented.
  • the particular operations implemented by the various portions of the computer instructions are based.
  • a computer device includes a memory, a processor, and computer instructions stored on the memory and executable on the processor, the processor executing the computer instructions to implement the step of: acquiring a test case Configuration information; query test case generation information, test case template and interface communication parameters from the test case library according to the test case identifier in the test case configuration information; generate a test case identifier corresponding test according to the test case generation information and the test case template Use case; test 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 interface communication parameters.
  • the acquiring the test case configuration information includes: monitoring the test start time in the test plan information; and when the current time is the same as the test start time, extracting the test case configuration corresponding to the test start time from the test plan information information.
  • testing the interface to be tested corresponding to the interface address to be tested in the test case according to the test case and the interface communication parameter including: extracting the interface communication protocol type, the interface communication mode, and the interface data in the interface communication parameter.
  • the transmission format is generated 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 corresponding to the interface address to be tested in the test case is tested according to the interface test request.
  • the interface to be tested corresponding to the interface address to be tested in the test case is tested according to the interface test request, including: extracting the interface address to be tested and the expected test result in the test case; and sending the interface test request to the extraction The interface to be tested corresponding to the interface address to be tested; receiving the feedback result returned by the interface to be tested according to the interface test request; comparing the feedback result with the expected test result to generate a test report.
  • the receiving the 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 tested is an asynchronous return parameter; and detecting that the parameter returned by the interface to be tested is an asynchronous return parameter,
  • the feedback result receiving address in the interface test request is changed to the intercepting interface address, and the asynchronous returning parameter is stored according to the intercepting interface address; the stored asynchronous returning parameter is sent to the interface to be tested; and the receiving interface to be tested is returned according to the stored asynchronous returning parameter. Feedback results.
  • test case generation information and test case templates automatically generate test cases for testing the interface to be tested, saving time spent writing test cases.
  • the interface communication parameters it can ensure normal communication with the interface to be tested, thereby ensuring the test success rate of the interface to be tested, and further improving the test efficiency of the interface.
  • a computer readable storage medium having stored thereon computer instructions, wherein When the computer instruction is executed by the processor, the following steps are performed: obtaining test case configuration information; querying test case generation information, test case template and interface communication parameter from the test case library according to the test case identifier in the test case configuration information; according to the test case The information and the test case template are generated, and the test case corresponding to the test case identifier is generated. The test interface corresponding to the test interface address in the test case is tested according to the test case and the interface communication parameter.
  • the acquiring the test case configuration information includes: monitoring the test start time in the test plan information; and when the current time is the same as the test start time, extracting the test case configuration corresponding to the test start time from the test plan information information.
  • testing the interface to be tested corresponding to the interface address to be tested in the test case according to the test case and the interface communication parameter including: extracting the interface communication protocol type, the interface communication mode, and the interface data in the interface communication parameter.
  • the transmission format is generated 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 corresponding to the interface address to be tested in the test case is tested according to the interface test request.
  • the interface to be tested corresponding to the interface address to be tested in the test case is tested according to the interface test request, including: extracting the interface address to be tested and the expected test result in the test case; and sending the interface test request to the extraction The interface to be tested corresponding to the interface address to be tested; receiving the feedback result returned by the interface to be tested according to the interface test request; comparing the feedback result with the expected test result to generate a test report.
  • the receiving the 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 tested is an asynchronous return parameter; and detecting that the parameter returned by the interface to be tested is an asynchronous return parameter,
  • the feedback result receiving address in the interface test request is changed to the intercepting interface address, and the asynchronous returning parameter is stored according to the intercepting interface address; the stored asynchronous returning parameter is sent to the interface to be tested; and the receiving interface to be tested is returned according to the stored asynchronous returning parameter. Feedback results.
  • test case generation information and test case templates are automatically generated Test cases for testing the interface to be tested save time in writing test cases. And according to the interface communication parameters, it can ensure normal communication with the interface to be tested, thereby ensuring the test success rate of the interface to be tested, and further improving the test efficiency of the interface.
  • all or part of the processes in the foregoing embodiment may be completed by instructing related hardware by computer executable instructions, which may be stored in a computer readable storage medium.
  • the computer executable instructions may be stored in a storage medium of a computer system and executed by at least one processor in the computer system to implement a flow comprising an embodiment of the methods as described above.
  • the storage medium includes, but is not limited to, a magnetic disk, a USB flash drive, an optical disk, a read-only memory (ROM), and the like.

Abstract

An interface test method, comprising: acquiring test case configuration information; according to a test case identifier in the test case configuration information, querying test case generation information, a test case template and an interface communication parameter from a test case library; generating a test case corresponding to the test case identifier according to the test case generation information and the test case template; and testing, according to the test case and the interface communication parameter, an interface to be tested corresponding to an address of the interface to be tested in the test case.

Description

接口测试方法、装置、计算机设备和存储介质Interface test method, device, computer device and storage medium
本申请要求于2017年10月31日提交中国专利局,申请号为2017110473715,发明名称为“接口测试方法、装置、计算机设备和存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese Patent Application, which is filed on Oct. 31, 2017, with the application number of 2017110473715, the title of which is "interface test method, device, computer equipment and storage medium", the entire contents of which are incorporated by reference. In this application.
技术领域Technical field
本申请涉及测试技术领域,特别是涉及接口测试方法、装置、计算机设备和存储介质。The present application relates to the field of testing technology, and in particular, to an interface testing method, apparatus, computer device, and storage medium.
背景技术Background technique
目前,随着计算机技术的日益发展以及不同领域的业务种类的日益丰富(例如金融交易领域),对复杂系统进行自动化测试的需求日益增长。通常的测试方法主要是通过开发测试工具实现的,现有的测试工具从技术架构的角度而言主要分为商用测试工具、开源测试框架和测试人员编制的轻量级测试脚本;从功能的角度而言主要分为功能测试工具、性能测试工具和安全性测试工具等;从运行平台角度而言主要分为基于Windows操作系统、基于Unix/Linux操作系统等;从被测系统角度而言例如分为Web测试工具、报文测试工具等。At present, with the development of computer technology and the growing variety of services in different fields (such as financial transactions), there is an increasing demand for automated testing of complex systems. The usual test methods are mainly realized by developing test tools. The existing test tools are mainly divided into commercial test tools, open source test frameworks and lightweight test scripts compiled by testers from the perspective of technical architecture; from a functional point of view In terms of the operating platform, it is mainly divided into a Windows-based operating system, based on the Unix/Linux operating system, etc., from the perspective of the system under test. For web testing tools, message testing tools, and more.
然而,上述传统的测试工具仅能针对特定的被测接口的特定功能进行测试,每种不同的接口类型,都需要编写不同的测试用例才能对该接口类型的接口进行测试,即一个测试用例只能测试一个接口类型,故使得接口测试效率较低。However, the above-mentioned traditional testing tools can only test specific functions of a specific tested interface. For each different interface type, different test cases need to be written to test the interface type interface, that is, one test case only Can test an interface type, so the interface test efficiency is low.
发明内容Summary of the invention
根据本申请提供的各种实施例,提供一种接口测试方法、装置、计算机设备和存储介质。 In accordance with various embodiments provided herein, an interface testing method, apparatus, computer device, and storage medium are provided.
一种接口测试方法,包括:An interface test method includes:
获取测试用例配置信息;Obtain test case configuration information;
根据所述测试用例配置信息中的测试用例标识,从测试用例库中查询测试用例生成信息、测试用例模板和接口通信参数;Determining test case generation information, test case template, and interface communication parameters from the test case library according to the test case identifier in the test case configuration information;
根据所述测试用例生成信息和所述测试用例模板,生成所述测试用例标识对应的测试用例;及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 to be tested corresponding to the interface address to be tested in the test case is tested according to the test case and the interface communication parameter.
一种接口测试装置,包括:An interface testing device includes:
配置信息获取模块,用于获取测试用例配置信息;The configuration information obtaining module is configured to obtain test case configuration information.
用例信息查询模块,用于根据所述测试用例配置信息中的测试用例标识,从测试用例库中查询测试用例生成信息、测试用例模板和接口通信参数;The use case information query module is configured to query the test case generation information, the test case template, and the interface communication parameter from the test case library according to the test case identifier in the test case configuration information;
测试用例生成模块,用于根据所述测试用例生成信息和所述测试用例模板,生成所述测试用例标识对应的测试用例;及a test case generating module, configured to generate 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 configured to test the interface to be tested corresponding to the interface address to be tested in the test case according to the test case and the interface communication parameter.
一种计算机设备,所述计算机设备包括存储器、处理器及存储在所述存储器上并可在所述处理器上运行的计算机指令,所述处理器执行所述计算机指令时实现以下步骤:A computer device comprising a memory, a processor, and computer instructions stored on the memory and operative on the processor, the processor executing the computer instructions to:
获取测试用例配置信息;Obtain test case configuration information;
根据所述测试用例配置信息中的测试用例标识,从测试用例库中查询测试用例生成信息、测试用例模板和接口通信参数;Determining test case generation information, test case template, and interface communication parameters from the test case library according to the test case identifier in the test case configuration information;
根据所述测试用例生成信息和所述测试用例模板,生成所述测试用例标识对应的测试用例;及Generating a test case corresponding to the test case identifier according to the test case generation information and the test case template; and
根据所述测试用例和所述接口通信参数,对所述测试用例中待测接口地 址所对应的待测接口进行测试。Determining an interface to be tested in the test case according to the test case and the interface communication parameter The interface to be tested corresponding to the address is tested.
一种计算机可读存储介质,其上存储有计算机指令,其特征在于,所述计算机指令被处理器执行时实现以下步骤:A computer readable storage medium having stored thereon computer instructions, wherein the computer instructions are executed by a processor to implement the following steps:
获取测试用例配置信息;Obtain test case configuration information;
根据所述测试用例配置信息中的测试用例标识,从测试用例库中查询测试用例生成信息、测试用例模板和接口通信参数;Determining test case generation information, test case template, and interface communication parameters from the test case library according to the test case identifier in the test case configuration information;
根据所述测试用例生成信息和所述测试用例模板,生成所述测试用例标识对应的测试用例;及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 to be tested corresponding to the interface address to be tested in the test case is tested according to the test case and the interface communication parameter.
本申请的一个或多个实施例的细节在下面的附图和描述中提出。本申请的其它特征、目的和优点将从说明书、附图以及权利要求书变得明显。Details of one or more embodiments of the present application are set forth in the accompanying drawings and description below. Other features, objects, and advantages of the invention will be apparent from the description and appended claims.
附图说明DRAWINGS
为了更清楚地说明本申请实施例中的技术方案,下面将对实施例中所需要使用的附图作简单地介绍,显而易见地,下面描述中的附图仅仅是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其它的附图。In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings to be used in the embodiments will be briefly described below. Obviously, the drawings in the following description are only some embodiments of the present application, Those skilled in the art can also obtain other drawings based on these drawings without any creative work.
图1为一个实施例中接口测试方法的应用环境图;1 is an application environment diagram of an interface test method in an embodiment;
图2为一个实施例中接口测试方法的流程示意图;2 is a schematic flow chart of an interface testing method in an embodiment;
图3为一个实施例中提取测试用例配置信息的步骤的流程示意图;3 is a schematic flow chart of steps of extracting test case configuration information in an embodiment;
图4为一个实施例中根据接口测试请求进行测试的步骤的流程示意图;4 is a flow chart showing the steps of testing according to an interface test request in an embodiment;
图5为一个实施例中生成测试报告的步骤的流程示意图;5 is a schematic flow chart of steps of generating a test report in an embodiment;
图6为一个实施例中检测异步返回参数的步骤的流程示意图;6 is a flow chart showing the steps of detecting an asynchronous return parameter in an embodiment;
图7为一个实施例中接口测试装置的结构框图; 7 is a structural block diagram of an interface testing device in an embodiment;
图8为一个实施例中配置信息获取模块的结构框图;FIG. 8 is a structural block diagram of a configuration information acquiring module in an embodiment; FIG.
图9为一个实施例中接口测试模块的结构框图;9 is a structural block diagram of an interface test module in an embodiment;
图10为一个实施例中待测接口测试模块的结构框图;10 is a structural block diagram of an interface test module to be tested in an embodiment;
图11为一个实施例中接口测试系统中的服务器的结构框图。Figure 11 is a block diagram showing the structure of a server in an interface test system in an embodiment.
具体实施方式Detailed ways
为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处所描述的具体实施例仅仅用以解释本申请,并不用于限定本申请。In order to make the objects, technical solutions, and advantages of the present application more comprehensible, the present application will be further described in detail below with reference to the accompanying drawings and embodiments. It is understood that the specific embodiments described herein are merely illustrative of the application and are not intended to be limiting.
图1为一个实施例中接口测试方法的应用环境图。参照图1,该接口测试方法应用于接口测试系统。接口测试系统包括终端110和服务器120,其中终端110通过网络与服务器120连接。终端110可以是固定终端或移动终端,固定终端具体可以是打印机、扫描仪和监控器中的至少一种,移动终端具体可以是平板电脑、智能手机、个人数据助理和数码相机中的至少一种。FIG. 1 is an application environment diagram of an interface test method in an embodiment. Referring to Figure 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 or a mobile terminal, and the fixed terminal may specifically be at least one of a printer, a scanner, and a monitor, and the mobile terminal may specifically be at least one of a tablet computer, a smart phone, a personal data assistant, and a digital camera. .
如图2所示,在一个实施例中,提供一种接口测试方法,本实施例以该方法应用于图1中的服务器120来举例说明,该方法具体包括以下内容:As shown in FIG. 2, in an embodiment, an interface testing method is provided. This embodiment is exemplified by the method applied to the server 120 in FIG. 1, and the method specifically includes the following content:
S202,获取测试用例配置信息。S202. Acquire test case configuration information.
在一个实施例中,终端110中显示有接口测试配置页面,用户可以在接口测试配置页面中输入测试用例配置信息,用户通过终端110的输入终端点击接口测试配置页面中的配置完成按钮。终端110在检测到接口测试配置页面中的配置完成按钮被点击时,获取接口测试配置页面中输入的测试用例配置信息,根据测试用例配置信息生成接口测试指令。测试用例配置信息为在测试过程中所配置的待执行的测试用例所对应的测试用例标识和各测试用例之间的依赖关系信息。其中,测试用例配置信息包括测试用例标识,提取到的测试用例标识可以是一个或多个;当测试用例配置信息中包括多个测试用例标识时,还包括各测试用例标识对应的测试用例之间的依赖关系信息。终端110将生成的接口测试指令发送至服务器120。测试用例标识为用于标识 测试用例的唯一标识。In an embodiment, an interface test configuration page is displayed in the terminal 110. The user can input the test case configuration information in the interface test configuration page, and the user clicks the configuration completion button in the interface test configuration page through the input terminal of the terminal 110. When detecting that the configuration completion button in the interface test configuration page is clicked, the terminal 110 obtains the test case configuration information input in the interface test configuration page, and generates an interface test command according to the test case configuration information. The test case configuration information is the test case identifier corresponding to the test case to be executed configured during the test process and the dependency relationship information between the test cases. The test case configuration information includes a test case identifier, and the extracted test case identifier may be one or more. When the test case configuration information includes multiple test case identifiers, the test case corresponding to each test case identifier is also included. Dependency information. The terminal 110 transmits the generated interface test command to the server 120. Test case ID for identification The unique identifier of the test case.
S204,根据测试用例配置信息中的测试用例标识,从测试用例库中查询测试用例生成信息、测试用例模板和接口通信参数。S204. Query the test case generation information, the test case template, and the interface communication parameter from the test case library according to the test case identifier in the test case configuration information.
其中,服务器120中设置有测试用例库,测试用例库中存储着测试用例生成信息、测试用例模板和接口通信参数。测试用例模板为生成测试用例的模板,接口通信参数为待测接口对应的通信参数。测试用例库中存储的测试用例生成信息、测试用例的模板和接口通信参数都是终端110发送至服务器120存储到测试用例库中的。终端110中显示有接口测试配置页面,用户通过输入设备可以在接口测试配置页面中输入测试用例生成信息、测试用例的模板和接口通信参数,终端110获取接口测试配置页面中输入的测试用例生成信息、测试用例的模板和接口通信参数,将获取到的测试用例生成信息、测试用例的模板和接口通信参数中发送至服务器120。The test case library is set in the server 120, and the test case generation information, the test case template, and the interface communication parameters are stored in the test case library. The test case template is a template for generating a test case, and the interface communication parameter is a communication parameter 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 for storage in the test case library. An interface test configuration page is displayed in the terminal 110, and the user can input the test case generation information, the test case template, and the interface communication parameter in the interface test configuration page by using the input device, and the terminal 110 obtains the test case generation information input in the interface test configuration page. The template of the test case and the interface communication parameter are sent to the server 120 in the obtained test case generation information, the template of the test case, and the interface communication parameter.
在一个实施例中,测试用例生成信息、测试用例模板、接口通信参数与测试用例标识对应存储在测试用例库中。服务器120接收到终端110发送的接口测试指令后,对接口测试指令进行解析,通过解析提取接口测试指令中的测试用例配置信息,从测试用例配置信息中提取测试用例标识。服务器120在测试用例库中查询与提取到的测试用例标识对应的测试用例生成信息、测试用例模板和接口通信参数。In one embodiment, the test case generation information, the test case template, the interface communication parameters, and the test case identification are stored in the test case library. After receiving the interface test command sent by the terminal 110, the server 120 parses the interface test command, extracts the test case configuration information in the interface test command, and extracts the test case identifier from the test case configuration information. 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 in the test case library.
在一个实施例中,测试用例生成信息对应于测试用例标识存储在测试用例库中,测试用例模板和接口通信参数对应于测试用例生成信息存储在测试用例库中。服务器120从接口测试指令中提取测试用例标识。服务器120在测试用例库查询与提取到的测试用例标识对应的测试用例生成信息,根据查询到的测试用例生成信息,在测试用例库中查询对应的测试用例模板和接口通信参数。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. Server 120 extracts the test case identification from the interface test instructions. The server 120 queries the test case generation information corresponding to the extracted test case identifiers in the test case database, and queries the corresponding test case templates and interface communication parameters in the test case library according to the generated test case generation information.
在一个实施例中,测试用例生成信息对应于测试用例标识存储在测试用例库中,测试用例生成信息中包括测试用例模板标识,测试用例模板对应于测试用例模板标识存储在测试用例库中,测试用例模板中包括接口通信参数 标识,接口通信参数对应于接口通信参数标识存储在测试用例中。服务器120从接口测试指令中提取测试用例标识,在测试用例库中查询与提取到的测试用例标识对应的测试用例生成信息。服务器120对测试用例生成信息进行解析,提取测试用例生成信息中的测试用例模板标识,在测试用例库中查询与提取到的测试用例模板标识对应的测试用例模板。服务器120从查询到的测试用例模板中提取接口通信参数标识,在测试用例库中查询与接口通信参数标识对应的接口通信参数。In one embodiment, the test case generation information is stored in the test case database corresponding to the test case identifier, and the test case template information includes the test case template identifier, and the test case template corresponding to the test case template identifier is stored in the test case library, and the test is performed. Use case template includes interface communication parameters The identifier, the interface communication parameter corresponding to the interface communication parameter identifier is stored in the test case. The server 120 extracts the test case identifier from the interface test command, and queries the test case generation information corresponding to the extracted test case identifier in the test case library. The server 120 parses the test case generation information, extracts the test case template identifier in the test case generation information, and queries the test case library for the test case template corresponding to the extracted test case template identifier. The server 120 extracts an interface communication parameter identifier from the queried test case template, and queries an interface communication parameter corresponding to the interface communication parameter identifier in the test case library.
S206,根据测试用例生成信息和测试用例模板,生成测试用例标识对应的测试用例。S206. Generate test cases corresponding to the test case identifiers according to the test case generation information and the test case template.
在一个实施例中,测试用例生成信息中包括请求参数信息、返回参数信息和预期测试结果,测试用例模板为测试场景信息。服务器120根据测试用例生成信息和测试用例模板进行合并,通过合并得到测试用例标识对应的测试用例。In an embodiment, the test case generation information includes request parameter information, return parameter information, and expected test result, and the test case template is test scenario information. The server 120 merges the test case generation information and the test case template, and obtains the test case corresponding to the test case identifier by combining.
在一个实施例中,当提取到的测试用例标识可以是多个时,服务器120根据每个测试用例标识对应的测试用例生成信息和测试用例模板,将测试用例生成信息添加到测试用例模板中生成每个测试用例标识对应的测试用例。In an embodiment, when the extracted test case identifiers may be multiple, the server 120 adds the test case generation information to the test case template according to the test case generation information and the test case template corresponding to each test case identifier. Each test case identifies the corresponding test case.
S208,根据测试用例和接口通信参数,对测试用例中待测接口地址所对应的待测接口进行测试。S208: Test the interface to be tested corresponding to the interface address to be tested in the test case according to the test case and the interface communication parameter.
在一个实施例中,服务器120执行测试用例,并提取测试用例中的待测接口地址,根据接口通信参数对执行测试用例生成的测试信息进行封装,将封装后的测试信息发送至提取到的待测接口地址所对应的待测接口,以根据封装后的测试信息对待测接口进行测试。In one embodiment, the server 120 executes the test case, extracts the interface address to be tested in the test case, encapsulates the test information generated by the execution test case according to the interface communication parameter, and sends the encapsulated test information to the extracted test information. The interface to be tested corresponding to the interface address is tested to test the interface to be tested according to the encapsulated test information.
在一个实施例中,当提取到的测试用例标识可以是多个时,服务器120分别根据每个测试用例标识对应的接口通信参数和测试用例,对每个测试用例待测接口地址所对应的待测接口进行测试。其中,服务器120识别到多个测试用例对应的待测接口不同时,根据相应的接口通信参数同步执行各测试用例,对各测试用例分别对应的待测接口进行测试。服务器120识别到多个 测试用例对应的待测接口相同时,采用多线程的方式同步执行测试用例,根据同步执行的测试用例对待测接口进行测试。In an embodiment, when the extracted test case identifiers may be multiple, the server 120 respectively determines the interface address to be tested for each test case according to the interface communication parameters and the test cases corresponding to each test case identifier. Test interface for testing. When the server 120 identifies that the interfaces to be tested corresponding to the multiple test cases are different, the test instances are synchronously executed according to the corresponding interface communication parameters, and the interfaces to be tested corresponding to the test cases are tested. The server 120 recognizes multiple When the test interface corresponding to the test case is the same, the test case is synchronously executed in a multi-thread manner, and the test interface to be tested is tested according to the test case executed synchronously.
本实施例中,无需考虑待测接口的接口类型,也无需对待测接口编写固定的测试用例,只需要从测试用例库中查询相应的测试用例生成信息、测试用例模板和接口通信参数,根据测试用例生成信息和测试用例模板自动生成用于对待测接口进行测试的测试用例,节省了编写测试用例所耗费的时间。且根据接口通信参数保证可以与待测接口进行正常通信,从而保证对待测接口的测试成功率,进一步提高了接口的测试效率。In this embodiment, it is not necessary to consider the interface type of the interface to be tested, and it is not necessary to write a fixed test case for the interface to be tested, and only need to query the corresponding test case generation information, test case template and interface communication parameters from the test case library, according to the test. Use case generation information and test case templates automatically generate test cases for testing the interface to be tested, saving time spent writing test cases. And according to the interface communication parameters, it can ensure normal communication with the interface to be tested, thereby ensuring the test success rate of the interface to be tested, and further improving the test efficiency of the interface.
如图3所示,在一个实施例中,S202具体还包括提取测试用例配置信息的步骤,该步骤具体包括以下内容:As shown in FIG. 3, in an embodiment, S202 specifically includes the step of extracting test case configuration information, and the step specifically includes the following content:
S302,监测测试计划信息中的测试开始时间。S302. Monitor the test start time in the test plan information.
其中,测试计划信息为用户通过终端的输入设备,在终端110显示的接口测试配置页面中的输入的测试计划信息。终端110将输入的测试计划信息发送至服务器120。服务器120可以将终端110发送的测试计划信息存储在测试用例库中。测试计划信息包括测试执行时间和测试用例标识集合,测试执行时间包括测试开始时间和测试结束时间;测试用例标识集合中包括至少一个测试用例标识。The test plan information is input test plan information in the interface test configuration page displayed by the user through the input device of the terminal. The terminal 110 transmits the input test plan information to the server 120. The server 120 can store the test plan information sent by the terminal 110 in a test case library. The test plan information includes a test execution time and a test case identification set, and the test execution time includes a test start time and a test end time; the test case identification set includes at least one test case identifier.
在一个实施例中,服务器120的测试用例库中存储着测试计划信息,测试计划信息中包括测试执行时间、测试循环次数和测试用例标识集合。服务器120获取测试计划信息中的测试执行时间,从测试执行时间中提取测试开始时间,监测当前时间是否等于测试开始时间。In one embodiment, the test case information is stored in the test case library of the server 120. The test plan information includes a test execution time, a test cycle number, and a test case identification set. The server 120 acquires 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.
在一个实施例中,测试用例中包括多个测试计划信息。服务器120定期获取当前时间,将获取到的当前时间与每个测试计划信息中的测试开始时间进行比较。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 test plan information.
S304,当监测到当前时间与测试开始时间相同时,从测试计划信息中提取测试开始时间对应的测试用例配置信息。S304. When it is detected that the current time is the same as the test start time, the test case configuration information corresponding to the test start time is extracted from the test plan information.
在一个实施例中,服务器120监测到将当前时间与测试开始时间相同时, 从该测试开始时间对应的测试计划信息中读取测试用例标识集合,提取测试用例标识集合中的测试用例标识。服务器120在提取到测试用例标识后,对提取到的测试用例标识进行封装,通过封装生成接口测试指令。In one embodiment, when the server 120 detects that the current time is the same as the test start time, The test case identification set is read from the test plan information corresponding to the test start time, and the test case identifier in the test case identification set is extracted. After extracting the test case identifier, the server 120 encapsulates the extracted test case identifier and generates an interface test command by using the package.
本实施例中,通过对各测试计划信息中的测试开始时间的监测,在监测到当前时间等于测试开始时间,根据该测试开始时间对应的测试计划信息生成接口测试指令,无需手动触发接口测试指令,减少了人工操作的干预。根据测试计划信息即可生成相应的接口测试指令,提高了生成接口测试指令的便利性。In this embodiment, by monitoring the test start time in each test plan information, when the current time is equal to the test start time, the interface test command is generated according to the test plan information corresponding to the test start time, and the interface test command is not required to be manually triggered. , reducing manual intervention. According to the test plan information, the corresponding interface test command can be generated, which improves the convenience of generating the interface test command.
如图4所示,在一个实施例中,S208具体包括根据接口测试请求进行测试的步骤,该步骤具体包括以下内容:As shown in FIG. 4, in an embodiment, S208 specifically includes the step of performing testing according to the interface test request, and the step specifically includes the following content:
S402,提取接口通信参数中的接口通信协议类型、接口通信模式和接口数据传输格式。S402. Extract an interface communication protocol type, an interface communication mode, and an interface data transmission format in the interface communication parameter.
其中,接口通信参数中包括接口通信协议类型、接口通信模式和接口数据传输格式。接口通信协议类型为待测试接口所支持的通信协议;接口通信模式为待测试接口所支持的通信协议;接口数据传输格式为待测试接口可以解析并支持的数据传输格式。The interface communication parameters include an interface communication protocol type, an interface communication mode, and an interface data transmission format. The interface communication protocol type is the communication protocol supported by the interface to be tested; the interface communication mode is the communication protocol supported by the interface to be tested; the interface data transmission format is the data transmission format that the interface to be tested can parse and support.
在一个实施例中,服务器120对接口通信参数进行解析,通过解析从接口通信参数中提取接口通信协议类型、接口通信模式和接口数据传输格式。In one embodiment, 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 by parsing.
S404,根据接口通信协议类型、接口通信模式、接口数据传输格式和测试用例生成接口测试请求。S404. 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.
在一个实施例中,服务器120将测试用例按照提取到的接口通信协议类型、接口通信模式和接口数据传输格式进行封装,封装得到待测接口所支持的接口测试请求。In one embodiment, the server 120 encapsulates the test case according to the extracted interface communication protocol type, the interface communication mode, and the interface data transmission format, and encapsulates the interface test request supported by the interface to be tested.
S406,根据接口测试请求对测试用例中待测接口地址所对应的待测接口进行测试。S406: Test the interface to be tested corresponding to the interface address to be tested in the test case according to the interface test request.
在一个实施例中,测试用例中包括待测接口地址,待测接口地址为待测接口的唯一标识。服务器120从测试用例中提取待测接口地址,根据待测接 口地址将接口测试请求发送至待测接口,以对待测接口进行测试。In one embodiment, the test case includes the address of the interface to be tested, and the address of the interface to be tested is a unique identifier of the interface to be tested. The server 120 extracts the interface address to be tested from the test case, according to the connection to be tested. The interface address sends an interface test request to the interface to be tested to test the interface to be tested.
本实施例中,无需考虑根据待测接口的接口类型编写测试用例,直接根据接口通信信息中的接口通信协议类型、接口通信模式和接口数据传输格式进行封装对测试用例封装,生成待测试接口支持的接口测试请求,保证了根据接口测试请求对待测接口测试的成功率。In this embodiment, the test case is not required to be written according to the interface type of the interface to be tested, and the test case is encapsulated according to the interface communication protocol type, the interface communication mode, and the interface data transmission format in the interface communication information, and the interface to be tested is generated. The interface test request guarantees the success rate of the test interface to be tested according to the interface test request.
如图5所示,在一个实施例中,S406具体包括生成测试报告的步骤,该步骤具体包括以下内容:As shown in FIG. 5, in an embodiment, S406 specifically includes the step of generating a test report, and the step specifically includes the following:
S502,提取测试用例中的待测接口地址和预期测试结果。S502. Extract the interface address to be tested and the expected test result in the test case.
在一个实施例中,服务器120对测试用例进行解析,通过解析从测试用例中提取到待测接口地址和预期测试结果。其中,预测测试结果为根据测试用例对待测接口进行测试,预期待测接口所返回的测试结果。In one embodiment, the server 120 parses the test case and extracts the interface address to be tested and the expected test result from the test case by parsing. The prediction test result is tested according to the test case to be tested, and the test result returned by the interface to be tested is expected.
S504,将接口测试请求发送至提取到的待测接口地址对应的待测接口。S504: Send the interface test request to the interface to be tested corresponding to the extracted interface address to be tested.
在一个实施例中,服务器120根据提取到的待测接口地址与待测接口建立通信连接,在建立通信连接成功后,通过通信连接向待测接口发送接口测试请求。In one embodiment, the server 120 establishes a communication connection with the interface to be tested according to the extracted interface address to be tested, and after the communication connection is successfully established, sends an interface test request to the interface to be tested through the communication connection.
S506,接收待测接口根据接口测试请求返回的反馈结果。S506. Receive a feedback result returned by the interface to be tested according to the interface test request.
在一个实施例中,接口测试请求中有输入参数。待测接口接收到接口测试请求后,待测接口对接口测试请求进行解析,获取接口测试接口请求中的输入参数,待测接口对输入参数进行处理生成反馈结果,将生成的反馈结果发送至服务器120。服务器120接收待测接口根据接口测试请求返回的反馈结果。In one embodiment, there are input parameters in the interface test request. After receiving the interface test request, the interface to be tested parses the interface test request and obtains the input parameters in the interface test interface request. The interface to be tested processes the input parameters to generate feedback results, and sends the generated feedback result to the server. 120. The server 120 receives the feedback result returned by the interface to be tested according to the interface test request.
S508,将反馈结果与预期测试结果进行比较生成测试报告。S508, comparing the feedback result with the expected test result to generate a test report.
在一个实施例中,服务器120在接收到待测接口返回的反馈结果后,将反馈结果与预期测试结果相比较,通过比较确定反馈结果与预期测试结果区别信息,根据确定的区别信息生成测试报告。测试报告中还可以包括测试开始时间、测试结束时间和待测接口地址中的至少一种信息。In an embodiment, after receiving the feedback result returned by the interface to be tested, the server 120 compares the feedback result with the expected test result, compares and determines the difference between the feedback result and the expected test result, and generates a test report according to the determined difference information. . The test report may further include at least one of a test start time, a test end time, and an interface address to be tested.
本实施例中,在对待测接口进行测试过程中,直接可将待测接口返回的 反馈结果与预期测试结果进行比较,从而生成测试报告,无需人工对待测接口返回的反馈结果进行分析,已撰写测试报告,提高了测试报告的生成效率和准确率。In this embodiment, during the testing process of the interface to be tested, the interface to be tested can be directly returned. The feedback result is compared with the expected test result to generate a test report, and the feedback result returned by the manual test interface is not analyzed, and the test report has been written, which improves the efficiency and accuracy of the test report generation.
如图6所示,在一个实时例中,S506具体还包括检测异步返回参数的步骤,该步骤具体包括以下内容:As shown in FIG. 6, in a real-time example, S506 specifically includes the step of detecting an asynchronous return parameter, and the step specifically includes the following:
S602,检测待测接口返回的参数是否为异步返回参数。S602. Detect whether the parameter returned by the interface to be tested is an asynchronous return parameter.
其中,异步返回参数为待测接口分多次返回的参数,待测接口需要对异步返回参数进一步处理才能得到反馈结果。The asynchronous return parameter is a parameter that is returned multiple times by the interface to be tested, and the interface to be tested needs to further process the asynchronous return parameter to obtain a feedback result.
在一个实施例中,服务器120在接口到待测接口返回的参数时,根据预期测试结果检测返回的参数的参数项的数量是否完整,若检测到返回的参数的参数项的数量不完整,则检测到待测接口返回的参数为异步返回参数;若完整,在检测到待测接口返回的参数为反馈结果。In an embodiment, when the interface returns to the parameter returned by the interface to be tested, the server 120 detects whether the number of the parameter items of the returned parameter is complete according to the expected test result, and if the number of the parameter items of the returned parameter is detected to be incomplete, The parameter returned by the interface to be tested is detected as an asynchronous return parameter; if it is complete, the parameter returned by the interface to be tested is detected as a feedback result.
在一个实施例中,服务器120在接收到待测接口返回的参数数据包后,检测参数数据包中是否包括异步返回的标识,若有异步返回的标识,则检测到参数数据包中的参数为异步返回参数。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 asynchronously returned identifier, and if there is an asynchronously returned identifier, the parameter in the parameter data packet is detected as Return parameters asynchronously.
S604,在检测到待测接口返回的参数为异步返回参数时,将接口测试请求中的反馈结果接收地址更改为拦截接口地址,并根据拦截接口地址对异步返回参数进行存储。S604. When detecting that the parameter returned by the interface to be tested is an asynchronous return parameter, the feedback result receiving address in the interface test request is changed to an intercepting interface address, and the asynchronous return parameter is stored according to the intercepting interface address.
在一个实施例中,服务器120在检测到待测接口返回的参数为异步返回参数时,获取预设的拦截接口地址,将获取到的拦截接口地址发送至待测接口,以通知将返回结果接收地址更改为拦截接口地址,同时将接收到的异步返回参数发送至拦截接口地址对应的拦截接口进行存储。待测接口接收到拦截接口地址后,将后续返回的异步返回参数发送至拦截接口以存储。其中,拦截接口地址为用于对异步返回参数进行存储的拦截接口的地址。In an embodiment, when detecting that the parameter returned by the interface to be tested is an asynchronous return parameter, the server 120 obtains a preset intercepting interface address, and sends the obtained intercepting interface address to the interface to be tested, to notify that the returned result is received. The address is changed to intercept the interface address, and the received asynchronous return parameter is sent to the intercept interface corresponding to the intercept interface address for storage. After receiving the interception interface address, the interface to be tested sends the asynchronous return parameter returned to the interception interface for storage. The intercept interface address is an address of an intercept interface for storing an asynchronous return parameter.
在一个实施例中,服务器120在未检测到待测接口返回的参数为异步返回参数时,以待测接口返回的参数为反馈结果。In an embodiment, when the parameter returned by the interface to be tested is not the asynchronous return parameter, the server 120 uses the parameter returned by the interface to be tested as the feedback result.
S606,将存储的异步返回参数发送至待测接口。 S606. Send the stored asynchronous return parameter to the interface to be tested.
在一个实施例中,拦截接口在接收到待测接口后续返回的参数数据包时,检测参数数据包中是否携带有参数发送标识,在检测到参数发送标识,将存储的异步返回参数发送至待测接口。In an embodiment, when receiving the parameter data packet returned by the interface to be tested, the intercepting interface detects whether the parameter data packet carries the parameter sending identifier, and when the parameter sending identifier is detected, the stored asynchronous return parameter is sent to the Measuring interface.
S608,接收待测接口根据存储的异步返回参数返回的反馈结果。S608. Receive a feedback result returned by the interface to be tested according to the stored asynchronous return parameter.
在一个实施例中,待测接口接收到拦截接口返回的异步返回参数,对返回的异步返回参数进行后续处理,通过后续处理生成返回结果,根据返回结果接收地址将返回结果发送至服务器120。服务器120接收待测接口返回反馈结果。In an embodiment, the interface to be tested receives the asynchronous return parameter returned by the intercepting interface, performs subsequent processing on the returned asynchronous return parameter, generates a return result through subsequent processing, and sends the returned result to the server 120 according to the returned result receiving address. The server 120 receives the feedback result from 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 the intercepting interface address, and the intercepting interface is configured to store the asynchronous return parameter by intercepting the interface address. When the stored asynchronous return parameter satisfies the sending condition, the intercepting interface sends the stored asynchronous return parameter to the interface to be tested, so that the result to be tested is further processed by the asynchronous return parameter to obtain a feedback result, thereby ensuring the integrity of the test to be tested, and improving The accuracy of the feedback results.
如图7所示,在一个实施例中,提供一种接口测试装置700,该装置具体包括:配置信息获取模块710、用例信息查询模块720、测试用例生成模块730和接口测试模块740。As shown in FIG. 7 , in an embodiment, an interface testing apparatus 700 is provided. The apparatus specifically includes: a configuration information acquiring module 710 , a use case information querying module 720 , a test case generating module 730 , and an interface testing module 740 .
配置信息获取模块710,用于获取测试用例配置信息。The configuration information obtaining module 710 is configured to obtain test case configuration information.
用例信息查询模块720,用于根据测试用例配置信息中的测试用例标识,从测试用例库中查询测试用例生成信息、测试用例模板和接口通信参数。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 database according to the test case identifier in the test case configuration information.
测试用例生成模块730,用于根据测试用例生成信息和测试用例模板,生成测试用例标识对应的测试用例。The test case generation module 730 is configured to generate a test case corresponding to the test case identifier according to the test case generation information and the test case template.
接口测试模块740,用于根据测试用例和接口通信参数,对测试用例中待测接口地址所对应的待测接口进行测试。The interface test module 740 is configured to test the interface to be tested corresponding to the interface address to be tested in the test case according to the test case and the interface communication parameter.
本实施例中,无需考虑待测接口的接口类型,也无需对待测接口编写固定的测试用例,只需要从测试用例库中查询相应的测试用例生成信息、测试用例模板和接口通信参数,根据测试用例生成信息和测试用例模板自动生成 用于对待测接口进行测试的测试用例,节省了编写测试用例所耗费的时间。且根据接口通信参数保证可以与待测接口进行正常通信,从而保证对待测接口的测试成功率,进一步提高了接口的测试效率。In this embodiment, it is not necessary to consider the interface type of the interface to be tested, and it is not necessary to write a fixed test case for the interface to be tested, and only need to query the corresponding test case generation information, test case template and interface communication parameters from the test case library, according to the test. Use case generation information and test case templates are automatically generated Test cases for testing the interface to be tested save time in writing test cases. And according to the interface communication parameters, it can ensure normal communication with the interface to be tested, thereby ensuring the test success rate of the interface to be tested, and further improving the test efficiency of the interface.
如图8所示,在一个实施例中,配置信息获取模块710具体包括以下内容:测试计划监测模块712和配置信息提取模块714。As shown in FIG. 8 , in one embodiment, the configuration information acquiring module 710 specifically includes the following: a test plan monitoring module 712 and a configuration information extracting module 714 .
测试计划监测模块712,用于监测测试计划信息中的测试开始时间。The test plan monitoring module 712 is configured to monitor the test start time in the test plan information.
配置信息提取模块714,用于当监测到当前时间与测试开始时间相同时,从测试计划信息中提取测试开始时间对应的测试用例配置信息The configuration information extraction module 714 is configured to: when the current time is monitored and the test start time is the same, extract the test case configuration information corresponding to the test start time from the test plan information.
本实施例中,通过对各测试计划信息中的测试开始时间的监测,在监测到当前时间等于测试开始时间,根据该测试开始时间对应的测试计划信息获取测试用例配置信息,无需手动触发接口测试指令,减少了人工操作的干预。In this embodiment, by monitoring the test start time in each test plan information, the current time is equal to the test start time, and the test case configuration information is obtained according to the test plan information corresponding to the test start time, without manually triggering the interface test. Instructions reduce manual intervention.
如图9所示,在一个实施例中,接口测试模块740具体包括以下内容:通信参数提取模块742、测试请求生成模块744和待测接口测试模块746。As shown in FIG. 9 , in one embodiment, the interface test module 740 specifically includes the following: a communication parameter extraction module 742 , a test request generation module 744 , and an interface test module 746 to be tested .
通信参数提取模块742,用于提取接口通信参数中的接口通信协议类型、接口通信模式和接口数据传输格式。The communication parameter extraction module 742 is configured to extract an interface communication protocol type, an interface communication mode, and an interface data transmission format in the interface communication parameters.
测试请求生成模块744,用于根据接口通信协议类型、接口通信模式、接口数据传输格式和测试用例生成接口测试请求。The test request generation 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.
待测接口测试模块746,用于根据接口测试请求对测试用例中待测接口地址所对应的待测接口进行测试。The interface to be tested 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 this embodiment, the test case is not required to be written according to the interface type of the interface to be tested, and the test case is encapsulated according to the interface communication protocol type, the interface communication mode, and the interface data transmission format in the interface communication information, and the interface to be tested is generated. The interface test request guarantees the success rate of the test interface to be tested according to the interface test request.
如图10所示,在一个实施例中,待测接口测试模块746具体还包括以下内容:接口地址提取模块746a、测试请求发送模块746b、反馈结果接收模块746c和测试报告生成模块746d。As shown in FIG. 10, in one embodiment, the interface to be tested module 746 specifically includes the following: an interface address extraction module 746a, a test request sending module 746b, a feedback result receiving module 746c, and a test report generating module 746d.
接口地址提取模块746a,用于提取测试用例中的待测接口地址和预期测 试结果。The interface address extraction module 746a is configured to extract the interface address to be tested and the expected measurement in the test case. Test results.
测试请求发送模块746b,用于将接口测试请求发送至提取到的待测接口地址对应的待测接口。The test request sending module 746b is configured to send the interface test request to the interface to be tested corresponding to the extracted interface address to be tested.
反馈结果接收模块746c,用于接收待测接口根据接口测试请求返回的反馈结果。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.
测试报告生成模块746d,用于将反馈结果与预期测试结果进行比较生成测试报告。The test report generation module 746d is configured to compare the feedback result with the expected test result to generate a test report.
本实施例中,在对待测接口进行测试过程中,直接可将待测接口返回的反馈结果与预期测试结果进行比较,从而生成测试报告,无需人工对待测接口返回的反馈结果进行分析,已撰写测试报告,提高了测试报告的生成效率和准确率。In this embodiment, during the testing process of the interface to be tested, the feedback result returned by the interface to be tested can be directly compared with the expected test result, thereby generating a test report, and the feedback result returned by the manual test interface is not required to be analyzed. Test reports improve the efficiency and accuracy of test report generation.
在一个实施例中,反馈结果接收模块746c还用于检测待测接口返回的参数是否为异步返回参数;在检测到待测接口返回的参数为异步返回参数时,将接口测试请求中的反馈结果接收地址更改为拦截接口地址,并根据拦截接口地址对异步返回参数进行存储;将存储的异步返回参数发送至待测接口;接收待测接口根据存储的异步返回参数返回的反馈结果。In an embodiment, the feedback result receiving module 746c is further configured to detect whether the parameter returned by the interface to be tested is an asynchronous return parameter; and when detecting that the parameter returned by the interface to be tested is an asynchronous return parameter, the feedback result in the interface test request is The receiving address is changed to the intercepting interface address, and the asynchronous return parameter is stored according to the intercepting interface address; the stored asynchronous return parameter is sent to the interface to be tested; and the feedback result returned by the interface to be tested according to the stored asynchronous return parameter is received.
本实施例中,在检测到待测接口返回的参数为异步返回参数时,对返回结果接收地址更改为拦截接口地址,通过拦截接口地址使拦截接口对异步返回参数进行存储。当存储的异步返回参数满足发送条件时,拦截接口将存储的异步返回参数发送至待测接口,使待测结果对异步返回参数进一步处理得到反馈结果,保证对待测接口进行测试的完整性,提高了反馈结果的准确性。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 the intercepting interface address, and the intercepting interface is configured to store the asynchronous return parameter by intercepting the interface address. When the stored asynchronous return parameter satisfies the sending condition, the intercepting interface sends the stored asynchronous return parameter to the interface to be tested, so that the result to be tested is further processed by the asynchronous return parameter to obtain a feedback result, thereby ensuring the integrity of the test to be tested, and improving The accuracy of the feedback results.
上述接口测试装置中的各个模块可全部或部分通过软件、硬件及其组合来实现。其中,网络接口可以是以太网或无线网卡等。上述各模块可以硬件形式内嵌于或独立于服务器中的处理器中,也可以以软件形式存储于终端或服务器的存储器中,以便于处理器调用执行以上各个模块对应的操作。该处理器可以为中央处理单元(CPU)、微处理器、单片机等。Each of the above interface test devices can be implemented in whole or in part by software, hardware, and combinations thereof. The network interface may be an Ethernet or a wireless network card. Each of the above modules may be embedded in or independent of the processor in the server, or may be stored in the memory of the terminal or the server in software, so that the processor invokes the operations corresponding to the above modules. The processor can be a central processing unit (CPU), a microprocessor, a microcontroller, or the like.
图11为一个实施例中图1接口测试系统中的服务器120的内部结构示意 图。如图11所示,该服务器120包括通过系统总线连接的处理器、非易失性存储介质、存储器和网络接口。服务器120的处理器用于提供计算和控制能力,支撑整个服务器120的运行,存储器用于存储数据、代码指令等,网络接口用于与终端110进行网络通信。存储器上存储有至少一个计算机指令,该计算机指令可被处理器执行,以实现本申请实施例中提供的适用于服务器120的接口测试方法。存储器可包括磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)等非易失性存储介质。例如,在一个实施例中,存储器包括非易失性存储介质及内存储器;非易失性存储介质存储有操作系统、数据库和计算机指令,数据库设置为测试用例库,测试用例库中存储着测试用例生成信息、测试用例的模板和接口通信参数中的至少一种,该计算机指令可被处理器执行以实现上述的接口测试方法;内存储器为非易失性存储介质中的操作系统及计算机可执行指令提供高速缓存的运行环境。FIG. 11 is a schematic diagram showing the internal structure of the server 120 in the interface test system of FIG. 1 in an embodiment. Figure. As shown in FIG. 11, the server 120 includes a processor, a non-volatile storage medium, a memory, and a network interface connected by a system bus. The processor of server 120 is used to provide computing and control capabilities to support the operation of the entire server 120, the memory for storing data, code instructions, etc., and the network interface for network communication with terminal 110. At least one computer instruction is stored on the memory, and the computer instruction can be executed by the processor to implement the interface test method applicable to the server 120 provided in the embodiment of the present application. The memory may include a non-volatile storage medium such as a magnetic disk, an optical disk, or a read-only memory (ROM). For example, in one embodiment, the memory includes a non-volatile storage medium and an internal memory; the non-volatile storage medium stores an operating system, a database, and computer instructions, the database is set as a test case library, and the test case library stores the test At least one of use case generation information, a template of a test case, and interface communication parameters executable by the processor to implement the interface test method described above; the internal memory is an operating system and a computer in a non-volatile storage medium Execution instructions provide a cached runtime environment.
本领域技术人员可以理解,图11中示出的结构,仅仅是与本申请方案相关的部分结构的示意图,并不构成对本申请方案所应用于其上的服务器的限定,具体的服务器可以包括比图11中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。Those skilled in the art can understand that the structure shown in FIG. 11 is only a schematic diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the server to which the solution of the present application is applied. The specific server may include the ratio. More or fewer components are shown in Figure 11, or some components are combined, or have different component arrangements.
本申请实施例提出了一种计算机设备,该计算机设备包括一系列存储于存储器上的计算机指令,当该计算机指令被处理器执行时,可以实现本申请各实施例提出的接口测试方法。在一些实施例中,基于该计算机指令各部分所实现的特定的操作。The embodiment of the present application provides a computer device, which includes a series of computer instructions stored in a memory. When the computer instruction is executed by the processor, the interface testing method proposed by the embodiments of the present application may be implemented. In some embodiments, the particular operations implemented by the various portions of the computer instructions are based.
在一个实施例中,计算机设备包括存储器、处理器及存储在所述存储器上并可在所述处理器上运行的计算机指令,所述处理器执行所述计算机指令时实现以下步骤:获取测试用例配置信息;根据测试用例配置信息中的测试用例标识,从测试用例库中查询测试用例生成信息、测试用例模板和接口通信参数;根据测试用例生成信息和测试用例模板,生成测试用例标识对应的测试用例;根据测试用例和接口通信参数,对测试用例中待测接口地址所对应的待测接口进行测试。 In one embodiment, a computer device includes a memory, a processor, and computer instructions stored on the memory and executable on the processor, the processor executing the computer instructions to implement the step of: acquiring a test case Configuration information; query test case generation information, test case template and interface communication parameters from the test case library according to the test case identifier in the test case configuration information; generate a test case identifier corresponding test according to the test case generation information and the test case template Use case; test 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 interface communication parameters.
在一个实施例中,获取测试用例配置信息,包括:监测测试计划信息中的测试开始时间;当监测到当前时间与测试开始时间相同时,从测试计划信息中提取测试开始时间对应的测试用例配置信息。In one embodiment, the acquiring the test case configuration information includes: monitoring the test start time in the test plan information; and when the current time is the same as the test start time, extracting the test case configuration corresponding to the test start time from the test plan information information.
在一个实施例中,根据测试用例和接口通信参数,对测试用例中待测接口地址所对应的待测接口进行测试,包括:提取接口通信参数中的接口通信协议类型、接口通信模式和接口数据传输格式;根据接口通信协议类型、接口通信模式、接口数据传输格式和测试用例生成接口测试请求;根据接口测试请求对测试用例中待测接口地址所对应的待测接口进行测试。In an embodiment, testing the interface to be tested corresponding to the interface address to be tested in the test case according to the test case and the interface communication parameter, including: extracting the interface communication protocol type, the interface communication mode, and the interface data in the interface communication parameter. The transmission format is generated 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 corresponding to the interface address to be tested in the test case is tested according to the interface test request.
在一个实施例中,根据接口测试请求对测试用例中待测接口地址所对应的待测接口进行测试,包括:提取测试用例中的待测接口地址和预期测试结果;将接口测试请求发送至提取到的待测接口地址对应的待测接口;接收待测接口根据接口测试请求返回的反馈结果;将反馈结果与预期测试结果进行比较生成测试报告。In an embodiment, the interface to be tested corresponding to the interface address to be tested in the test case is tested according to the interface test request, including: extracting the interface address to be tested and the expected test result in the test case; and sending the interface test request to the extraction The interface to be tested corresponding to the interface address to be tested; receiving the feedback result returned by the interface to be tested according to the interface test request; comparing the feedback result with the expected test result to generate a test report.
在一个实施例中,接收待测接口根据接口测试请求返回的反馈结果,包括:检测待测接口返回的参数是否为异步返回参数;在检测到待测接口返回的参数为异步返回参数时,将接口测试请求中的反馈结果接收地址更改为拦截接口地址,并根据拦截接口地址对异步返回参数进行存储;将存储的异步返回参数发送至待测接口;接收待测接口根据存储的异步返回参数返回的反馈结果。In an embodiment, the receiving the 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 tested is an asynchronous return parameter; and detecting that the parameter returned by the interface to be tested is an asynchronous return parameter, The feedback result receiving address in the interface test request is changed to the intercepting interface address, and the asynchronous returning parameter is stored according to the intercepting interface address; the stored asynchronous returning parameter is sent to the interface to be tested; and the receiving interface to be tested is returned according to the stored asynchronous returning parameter. Feedback results.
本实施例中,无需考虑待测接口的接口类型,也无需对待测接口编写固定的测试用例,只需要从测试用例库中查询相应的测试用例生成信息、测试用例模板和接口通信参数,根据测试用例生成信息和测试用例模板自动生成用于对待测接口进行测试的测试用例,节省了编写测试用例所耗费的时间。且根据接口通信参数保证可以与待测接口进行正常通信,从而保证对待测接口的测试成功率,进一步提高了接口的测试效率。In this embodiment, it is not necessary to consider the interface type of the interface to be tested, and it is not necessary to write a fixed test case for the interface to be tested, and only need to query the corresponding test case generation information, test case template and interface communication parameters from the test case library, according to the test. Use case generation information and test case templates automatically generate test cases for testing the interface to be tested, saving time spent writing test cases. And according to the interface communication parameters, it can ensure normal communication with the interface to be tested, thereby ensuring the test success rate of the interface to be tested, and further improving the test efficiency of the interface.
一种计算机可读存储介质,其上存储有计算机指令,其特征在于,所述 计算机指令被处理器执行时实现以下步骤:获取测试用例配置信息;根据测试用例配置信息中的测试用例标识,从测试用例库中查询测试用例生成信息、测试用例模板和接口通信参数;根据测试用例生成信息和测试用例模板,生成测试用例标识对应的测试用例;根据测试用例和接口通信参数,对测试用例中待测接口地址所对应的待测接口进行测试。A computer readable storage medium having stored thereon computer instructions, wherein When the computer instruction is executed by the processor, the following steps are performed: obtaining test case configuration information; querying test case generation information, test case template and interface communication parameter from the test case library according to the test case identifier in the test case configuration information; according to the test case The information and the test case template are generated, and the test case corresponding to the test case identifier is generated. The test interface corresponding to the test interface address in the test case is tested according to the test case and the interface communication parameter.
在一个实施例中,获取测试用例配置信息,包括:监测测试计划信息中的测试开始时间;当监测到当前时间与测试开始时间相同时,从测试计划信息中提取测试开始时间对应的测试用例配置信息。In one embodiment, the acquiring the test case configuration information includes: monitoring the test start time in the test plan information; and when the current time is the same as the test start time, extracting the test case configuration corresponding to the test start time from the test plan information information.
在一个实施例中,根据测试用例和接口通信参数,对测试用例中待测接口地址所对应的待测接口进行测试,包括:提取接口通信参数中的接口通信协议类型、接口通信模式和接口数据传输格式;根据接口通信协议类型、接口通信模式、接口数据传输格式和测试用例生成接口测试请求;根据接口测试请求对测试用例中待测接口地址所对应的待测接口进行测试。In an embodiment, testing the interface to be tested corresponding to the interface address to be tested in the test case according to the test case and the interface communication parameter, including: extracting the interface communication protocol type, the interface communication mode, and the interface data in the interface communication parameter. The transmission format is generated 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 corresponding to the interface address to be tested in the test case is tested according to the interface test request.
在一个实施例中,根据接口测试请求对测试用例中待测接口地址所对应的待测接口进行测试,包括:提取测试用例中的待测接口地址和预期测试结果;将接口测试请求发送至提取到的待测接口地址对应的待测接口;接收待测接口根据接口测试请求返回的反馈结果;将反馈结果与预期测试结果进行比较生成测试报告。In an embodiment, the interface to be tested corresponding to the interface address to be tested in the test case is tested according to the interface test request, including: extracting the interface address to be tested and the expected test result in the test case; and sending the interface test request to the extraction The interface to be tested corresponding to the interface address to be tested; receiving the feedback result returned by the interface to be tested according to the interface test request; comparing the feedback result with the expected test result to generate a test report.
在一个实施例中,接收待测接口根据接口测试请求返回的反馈结果,包括:检测待测接口返回的参数是否为异步返回参数;在检测到待测接口返回的参数为异步返回参数时,将接口测试请求中的反馈结果接收地址更改为拦截接口地址,并根据拦截接口地址对异步返回参数进行存储;将存储的异步返回参数发送至待测接口;接收待测接口根据存储的异步返回参数返回的反馈结果。In an embodiment, the receiving the 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 tested is an asynchronous return parameter; and detecting that the parameter returned by the interface to be tested is an asynchronous return parameter, The feedback result receiving address in the interface test request is changed to the intercepting interface address, and the asynchronous returning parameter is stored according to the intercepting interface address; the stored asynchronous returning parameter is sent to the interface to be tested; and the receiving interface to be tested is returned according to the stored asynchronous returning parameter. Feedback results.
本实施例中,无需考虑待测接口的接口类型,也无需对待测接口编写固定的测试用例,只需要从测试用例库中查询相应的测试用例生成信息、测试用例模板和接口通信参数,根据测试用例生成信息和测试用例模板自动生成 用于对待测接口进行测试的测试用例,节省了编写测试用例所耗费的时间。且根据接口通信参数保证可以与待测接口进行正常通信,从而保证对待测接口的测试成功率,进一步提高了接口的测试效率。In this embodiment, it is not necessary to consider the interface type of the interface to be tested, and it is not necessary to write a fixed test case for the interface to be tested, and only need to query the corresponding test case generation information, test case template and interface communication parameters from the test case library, according to the test. Use case generation information and test case templates are automatically generated Test cases for testing the interface to be tested save time in writing test cases. And according to the interface communication parameters, it can ensure normal communication with the interface to be tested, thereby ensuring the test success rate of the interface to be tested, and further improving the test efficiency of the interface.
根据本实施例的一个示例,上述实施例方法中的全部或部分流程,可以通过计算机可执行指令来指令相关的硬件来完成,所述计算机可执行指令可存储于一计算机可读取存储介质中,如本申请实施例中,该计算机可执行指令可存储于计算机系统的存储介质中,并被该计算机系统中的至少一个处理器执行,以实现包括如上述各方法的实施例的流程。该存储介质包括但不限于磁碟、优盘、光盘、只读存储记忆体(Read-Only Memory,ROM)等。According to an example of the embodiment, all or part of the processes in the foregoing embodiment may be completed by instructing related hardware by computer executable instructions, which may be stored in a computer readable storage medium. As in the embodiment of the present application, the computer executable instructions may be stored in a storage medium of a computer system and executed by at least one processor in the computer system to implement a flow comprising an embodiment of the methods as described above. The storage medium includes, but is not limited to, a magnetic disk, a USB flash drive, an optical disk, a read-only memory (ROM), and the like.
以上所述实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围。The technical features of the above-described embodiments may be arbitrarily combined. For the sake of brevity of description, all possible combinations of the technical features in the above embodiments are not described. However, as long as there is no contradiction between the combinations of these technical features, All should be considered as the scope of this manual.
以上所述实施例仅表达了本申请的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对发明专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干变形和改进,这些都属于本申请的保护范围。因此,本申请专利的保护范围应以所附权利要求为准。 The above-mentioned embodiments are merely illustrative of several embodiments of the present application, and the description thereof is more specific and detailed, but is not to be construed as limiting the scope of the invention. It should be noted that a number of variations and modifications may be made by those skilled in the art without departing from the spirit and scope of the present application. Therefore, the scope of the invention should be determined by the appended claims.

Claims (20)

  1. 一种接口测试方法,包括:An interface test method includes:
    获取测试用例配置信息;Obtain test case configuration information;
    根据所述测试用例配置信息中的测试用例标识,从测试用例库中查询测试用例生成信息、测试用例模板和接口通信参数;Determining test case generation information, test case template, and interface communication parameters from the test case library according to the test case identifier in the test case configuration information;
    根据所述测试用例生成信息和所述测试用例模板,生成所述测试用例标识对应的测试用例;及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 to be tested corresponding to the interface address to be tested in the test case is tested according to the test case and the interface communication parameter.
  2. 根据权利要求1所述的方法,其特征在于,所述获取测试用例配置信息,包括:The method of claim 1, wherein the obtaining test case configuration information comprises:
    监测测试计划信息中的测试开始时间;及Monitor the test start time in the test plan information; and
    当监测到当前时间与所述测试开始时间相同时,从所述测试计划信息中提取所述测试开始时间对应的测试用例配置信息。When it is detected that the current time is the same as the test start time, the test case configuration information corresponding to the test start time is extracted from the test plan information.
  3. 根据权利要求1所述的方法,其特征在于,所述根据所述测试用例和所述接口通信参数,对所述测试用例中待测接口地址所对应的待测接口进行测试,包括:The method according to claim 1, wherein the testing of the interface to be tested corresponding to the interface address to be tested in the test case is performed according to the test case and the interface communication parameter, including:
    提取所述接口通信参数中的接口通信协议类型、接口通信模式和接口数据传输格式;Extracting an interface communication protocol type, an interface communication mode, and an interface data transmission format in the interface communication parameter;
    根据所述接口通信协议类型、接口通信模式、接口数据传输格式和所述测试用例生成接口测试请求;及Generating an interface test request according to the interface communication protocol type, interface communication mode, 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.
  4. 根据权利要求3所述的方法,其特征在于,所述根据所述接口测试请求对所述测试用例中待测接口地址所对应的待测接口进行测试,包括:The method according to claim 3, 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 comprises:
    提取所述测试用例中的待测接口地址和预期测试结果;Extracting an interface address 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
    将所述反馈结果与所述预期测试结果进行比较生成测试报告。The feedback result is compared with the expected test result to generate a test report.
  5. 根据权利要求4所述的方法,其特征在于,所述接收所述待测接口根据所述接口测试请求返回的反馈结果,包括:The method according to claim 4, 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 tested is an asynchronous return parameter;
    在检测到所述待测接口返回的参数为异步返回参数时,将所述接口测试请求中的反馈结果接收地址更改为拦截接口地址,并根据所述拦截接口地址对异步返回参数进行存储;When it is detected that the parameter returned by the interface to be tested is an asynchronous return parameter, the feedback result receiving address in the interface test request is changed to an intercepting interface address, and the asynchronous return parameter is stored according to the intercepting interface address;
    将存储的异步返回参数发送至所述待测接口;及Sending the stored asynchronous return parameter 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.
  6. 一种接口测试装置,包括:An interface testing device includes:
    配置信息获取模块,用于获取测试用例配置信息;The configuration information obtaining module is configured to obtain test case configuration information.
    用例信息查询模块,用于根据所述测试用例配置信息中的测试用例标识,从测试用例库中查询测试用例生成信息、测试用例模板和接口通信参数;The use case information query module is configured to query the test case generation information, the test case template, and the interface communication parameter from the test case library according to the test case identifier in the test case configuration information;
    测试用例生成模块,用于根据所述测试用例生成信息和所述测试用例模板,生成所述测试用例标识对应的测试用例;及a test case generating module, configured to generate 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 configured to test the interface to be tested corresponding to the interface address to be tested in the test case according to the test case and the interface communication parameter.
  7. 根据权利要求6所述的装置,其特征在于,所述配置信息获取模块,包括:The device according to claim 6, wherein the configuration information acquiring module comprises:
    测试计划监测模块,用于监测测试计划信息中的测试开始时间;及a test plan monitoring module for monitoring test start time in test plan information; and
    配置信息提取模块,用于当监测到当前时间与所述测试开始时间相同时,从所述测试计划信息中提取所述测试开始时间对应的测试用例配置信息测试用例配置信息。The configuration information extraction module is configured to extract test case configuration information test case configuration information corresponding to the test start time from the test plan information when the current time is the same as the test start time.
  8. 根据权利要求6所述的装置,其特征在于,所述接口测试模块,包括: The device according to claim 6, wherein the interface test module comprises:
    通信参数提取模块,用于提取所述接口通信参数中的接口通信协议类型、接口通信模式和接口数据传输格式;a communication parameter extraction module, configured to extract an interface communication protocol type, an interface communication mode, and an interface data transmission format in the interface communication parameter;
    测试请求生成模块,用于根据所述接口通信协议类型、接口通信模式、接口数据传输格式和所述测试用例生成接口测试请求;及a test request generating module, configured to generate an interface test request according to the interface communication protocol type, an interface communication mode, an interface data transmission format, and the test case; and
    待测接口测试模块,用于根据所述接口测试请求对所述测试用例中待测接口地址所对应的待测接口进行测试。The interface test module to be tested 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.
  9. 根据权利要求8所述的装置,其特征在于,所述待测接口测试模块包括:The device according to claim 8, wherein the interface module to be tested comprises:
    接口地址提取模块,用于提取所述测试用例中的待测接口地址和预期测试结果;An interface address extraction module, configured to extract an interface address to be tested and an expected test result in the test case;
    测试请求发送模块,用于将所述接口测试请求发送至提取到的待测接口地址对应的待测接口;a test request sending module, configured to send the interface test request to the interface to be tested corresponding to the extracted interface address to be tested;
    反馈结果接收模块,用于接收所述待测接口根据所述接口测试请求返回的反馈结果;及a feedback result receiving module, configured to receive a feedback result returned by the interface to be tested according to the interface test request; and
    测试报告生成模块,用于将所述反馈结果与所述预期测试结果进行比较生成测试报告。And a test report generating module, configured to compare the feedback result with the expected test result to generate a test report.
  10. 根据权利要求9所述的方法,其特征在于反馈结果接收模块还用于检测所述待测接口返回的参数是否为异步返回参数;在检测到所述待测接口返回的参数为异步返回参数时,将所述接口测试请求中的反馈结果接收地址更改为拦截接口地址,并根据所述拦截接口地址对异步返回参数进行存储;将存储的异步返回参数发送至所述待测接口;及接收所述待测接口根据所述存储的异步返回参数返回的反馈结果。The method according to claim 9, wherein the feedback result receiving module is further configured to: detect whether the parameter returned by the interface to be tested is an asynchronous return parameter; and when detecting that the parameter returned by the interface to be tested is an asynchronous return parameter Transmitting the feedback result receiving address in the interface test request to the intercepting interface address, and storing the asynchronous returning parameter according to the intercepting interface address; sending the stored asynchronous returning parameter to the interface to be tested; and receiving the receiving The feedback result returned by the interface to be tested according to the stored asynchronous return parameter.
  11. 一种计算机设备,所述计算机设备包括存储器、处理器及存储在所述存储器上并可在所述处理器上运行的计算机指令,所述处理器执行所述计算机指令时实现以下步骤:A computer device comprising a memory, a processor, and computer instructions stored on the memory and operative on the processor, the processor executing the computer instructions to:
    获取测试用例配置信息; Obtain test case configuration information;
    根据所述测试用例配置信息中的测试用例标识,从测试用例库中查询测试用例生成信息、测试用例模板和接口通信参数;Determining test case generation information, test case template, and interface communication parameters from the test case library according to the test case identifier in the test case configuration information;
    根据所述测试用例生成信息和所述测试用例模板,生成所述测试用例标识对应的测试用例;及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 to be tested corresponding to the interface address to be tested in the test case is tested according to the test case and the interface communication parameter.
  12. 根据权利要求1所述的计算机设备,其特征在于,所述获取测试用例配置信息,包括:The computer device according to claim 1, wherein the obtaining test case configuration information comprises:
    监测测试计划信息中的测试开始时间;及Monitor the test start time in the test plan information; and
    当监测到当前时间与所述测试开始时间相同时,从所述测试计划信息中提取所述测试开始时间对应的测试用例配置信息。When it is detected that the current time is the same as the test start time, the test case configuration information corresponding to the test start time is extracted from the test plan information.
  13. 根据权利要求11所述的计算机设备,其特征在于,所述根据所述测试用例和所述接口通信参数,对所述测试用例中待测接口地址所对应的待测接口进行测试,包括:The computer device according to claim 11, wherein the testing of the interface to be tested corresponding to the interface address to be tested in the test case according to the test case and the interface communication parameter comprises:
    提取所述接口通信参数中的接口通信协议类型、接口通信模式和接口数据传输格式;Extracting an interface communication protocol type, an interface communication mode, and an interface data transmission format in the interface communication parameter;
    根据所述接口通信协议类型、接口通信模式、接口数据传输格式和所述测试用例生成接口测试请求;及Generating an interface test request according to the interface communication protocol type, interface communication mode, 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.
  14. 根据权利要求13所述的计算机设备,其特征在于,所述根据所述接口测试请求对所述测试用例中待测接口地址所对应的待测接口进行测试,包括:The computer device according to claim 13, wherein the testing of the interface to be tested corresponding to the interface address to be tested in the test case according to the interface test request comprises:
    提取所述测试用例中的待测接口地址和预期测试结果;Extracting an interface address 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
    将所述反馈结果与所述预期测试结果进行比较生成测试报告。 The feedback result is compared with the expected test result to generate a test report.
  15. 根据权利要求14所述的计算机设备,其特征在于,所述接收所述待测接口根据所述接口测试请求返回的反馈结果,包括:The computer device according to claim 14, 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 tested is an asynchronous return parameter;
    在检测到所述待测接口返回的参数为异步返回参数时,将所述接口测试请求中的反馈结果接收地址更改为拦截接口地址,并根据所述拦截接口地址对异步返回参数进行存储;When it is detected that the parameter returned by the interface to be tested is an asynchronous return parameter, the feedback result receiving address in the interface test request is changed to an intercepting interface address, and the asynchronous return parameter is stored according to the intercepting interface address;
    将存储的异步返回参数发送至所述待测接口;及Sending the stored asynchronous return parameter 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.
  16. 一种计算机可读存储介质,其上存储有计算机指令,其特征在于,所述计算机指令被处理器执行时实现以下步骤:A computer readable storage medium having stored thereon computer instructions, wherein the computer instructions are executed by a processor to implement the following steps:
    获取测试用例配置信息;Obtain test case configuration information;
    根据所述测试用例配置信息中的测试用例标识,从测试用例库中查询测试用例生成信息、测试用例模板和接口通信参数;Determining test case generation information, test case template, and interface communication parameters from the test case library according to the test case identifier in the test case configuration information;
    根据所述测试用例生成信息和所述测试用例模板,生成所述测试用例标识对应的测试用例;及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 to be tested corresponding to the interface address to be tested in the test case is tested according to the test case and the interface communication parameter.
  17. 根据权利要求16所述的存储介质,其特征在于,所述获取测试用例配置信息,包括:The storage medium according to claim 16, wherein the obtaining test case configuration information comprises:
    监测测试计划信息中的测试开始时间;及Monitor the test start time in the test plan information; and
    当监测到当前时间与所述测试开始时间相同时,从所述测试计划信息中提取所述测试开始时间对应的测试用例配置信息。When it is detected that the current time is the same as the test start time, the test case configuration information corresponding to the test start time is extracted from the test plan information.
  18. 根据权利要求16所述的存储介质,其特征在于,所述根据所述测试用例和所述接口通信参数,对所述测试用例中待测接口地址所对应的待测接口进行测试,包括:The storage medium according to claim 16, wherein the testing the interface to be tested corresponding to the interface address to be tested in the test case according to the test case and the interface communication parameter comprises:
    提取所述接口通信参数中的接口通信协议类型、接口通信模式和接口数 据传输格式;Extracting interface communication protocol type, interface communication mode, and number of interfaces in the interface communication parameter According to the transmission format;
    根据所述接口通信协议类型、接口通信模式、接口数据传输格式和所述测试用例生成接口测试请求;及Generating an interface test request according to the interface communication protocol type, interface communication mode, 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.
  19. 根据权利要求18所述的存储介质,其特征在于,所述根据所述接口测试请求对所述测试用例中待测接口地址所对应的待测接口进行测试,包括:The storage medium according to claim 18, wherein the testing of the interface to be tested corresponding to the interface address to be tested in the test case according to the interface test request comprises:
    提取所述测试用例中的待测接口地址和预期测试结果;Extracting an interface address 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
    将所述反馈结果与所述预期测试结果进行比较生成测试报告。The feedback result is compared with the expected test result to generate a test report.
  20. 根据权利要求19所述的存储介质,其特征在于,所述接收所述待测接口根据所述接口测试请求返回的反馈结果,包括:The storage medium according to claim 19, 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 tested is an asynchronous return parameter;
    在检测到所述待测接口返回的参数为异步返回参数时,将所述接口测试请求中的反馈结果接收地址更改为拦截接口地址,并根据所述拦截接口地址对异步返回参数进行存储;When it is detected that the parameter returned by the interface to be tested is an asynchronous return parameter, the feedback result receiving address in the interface test request is changed to an intercepting interface address, and the asynchronous return parameter is stored according to the intercepting interface address;
    将存储的异步返回参数发送至所述待测接口;及Sending the stored asynchronous return parameter 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.
PCT/CN2017/112481 2017-10-31 2017-11-23 Interface test method and apparatus, computer device, and storage medium WO2019085073A1 (en)

Applications Claiming Priority (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
CN201711047371.5 2017-10-31

Publications (1)

Publication Number Publication Date
WO2019085073A1 true WO2019085073A1 (en) 2019-05-09

Family

ID=61270248

Family Applications (1)

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

Country Status (2)

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

Families Citing this family (25)

* 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
CN108733573A (en) * 2018-05-30 2018-11-02 湖南鑫蜀山网络科技有限公司 The interface testing equipment that application interface test method is tested
CN108984387A (en) * 2018-05-30 2018-12-11 湖南鑫蜀山网络科技有限公司 Interface test device applied to computer
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
CN109783350A (en) * 2018-12-13 2019-05-21 重庆金融资产交易所有限责任公司 Interface test method, device and computer readable 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
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 (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101212357A (en) * 2006-12-31 2008-07-02 亿阳信通股份有限公司 Interface testing method and device
CN102096631A (en) * 2009-12-11 2011-06-15 华为技术有限公司 Interface testing method and device
CN105005532A (en) * 2015-08-05 2015-10-28 广东欧珀移动通信有限公司 System for automatically testing stability of application program interface and method
US20160342501A1 (en) * 2015-05-18 2016-11-24 Hcl Technologies Limited Accelerating Automated Testing
CN106933745A (en) * 2017-03-30 2017-07-07 携程计算机技术(上海)有限公司 WEB automatic interface testing methods and system

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103198009B (en) * 2012-01-04 2016-09-07 中国移动通信集团公司 A kind of universal testing method, system and related device
CN106021090A (en) * 2016-05-04 2016-10-12 上海瀚银信息技术有限公司 Software interface test system and method
CN106991040B (en) * 2016-07-20 2020-05-05 平安科技(深圳)有限公司 Data interface testing method and device
CN106951364B (en) * 2017-02-08 2020-05-12 深圳国泰安教育技术有限公司 Test method and device

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101212357A (en) * 2006-12-31 2008-07-02 亿阳信通股份有限公司 Interface testing method and device
CN102096631A (en) * 2009-12-11 2011-06-15 华为技术有限公司 Interface testing method and device
US20160342501A1 (en) * 2015-05-18 2016-11-24 Hcl Technologies Limited Accelerating Automated Testing
CN105005532A (en) * 2015-08-05 2015-10-28 广东欧珀移动通信有限公司 System for automatically testing stability of application program interface and method
CN106933745A (en) * 2017-03-30 2017-07-07 携程计算机技术(上海)有限公司 WEB automatic interface testing methods and system

Also Published As

Publication number Publication date
CN107766190B (en) 2020-06-12
CN107766190A (en) 2018-03-06

Similar Documents

Publication Publication Date Title
WO2019085073A1 (en) Interface test method and apparatus, computer device, and storage medium
WO2019085079A1 (en) Interface test method and apparatus, computer device and storage medium
CN107665233B (en) Database data processing method and device, computer equipment and storage medium
CN108984388B (en) Method and terminal equipment for generating automatic test case
CN111026645B (en) User interface automatic test method and device, storage medium and electronic equipment
WO2018036273A1 (en) Simulation test method, server, device, and computer-readable storage medium
CN111124702B (en) Performance data acquisition method, device and computer readable storage medium
WO2019161619A1 (en) Automatic interface test method and apparatus, and device and computer-readable storage medium
CN106484611B (en) Fuzzy test method and device based on automatic protocol adaptation
WO2019169757A1 (en) Test control and test execution device and method, and computer storage medium
WO2019218513A1 (en) Apparatus and method for monitoring testing process, and computer-readable storage medium
WO2018192432A1 (en) Working information processing method and apparatus, computer device, and storage medium
US10721154B2 (en) Virtual probes
WO2019214109A1 (en) Monitoring device and method for testing process, and computer readable storage medium
WO2019019670A1 (en) Application accessing method and device, computer apparatus, and storage medium
WO2020232871A1 (en) Method and device for microservice dependency analysis
US20220012165A1 (en) Method and apparatus for debugging device
CN112035363A (en) Automatic interface testing method and device
WO2018177202A1 (en) Test result generation method, device, computer apparatus, and storage medium
CN109408376B (en) Configuration data generation method, device, equipment and storage medium
WO2018233365A1 (en) Information query method, terminal, device and storage medium
CN115334178A (en) Application layer data analysis method and device, electronic equipment and storage medium
CN111930625B (en) Log acquisition method, device and system based on cloud service platform
CN114428747A (en) User interface testing method, device, server and storage medium
US10257037B2 (en) Method and device for implementing seamless switching between northbound Corba interface specifications

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 17930759

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

32PN Ep: public notification in the ep bulletin as address of the adressee cannot be established

Free format text: NOTING OF LOSS OF RIGHTS PURSUANT TO RULE 112(1) EPC (EPO FORM 1205A DATED 23.09.2020)

122 Ep: pct application non-entry in european phase

Ref document number: 17930759

Country of ref document: EP

Kind code of ref document: A1