WO2019085079A1 - 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
WO2019085079A1
WO2019085079A1 PCT/CN2017/112618 CN2017112618W WO2019085079A1 WO 2019085079 A1 WO2019085079 A1 WO 2019085079A1 CN 2017112618 W CN2017112618 W CN 2017112618W WO 2019085079 A1 WO2019085079 A1 WO 2019085079A1
Authority
WO
WIPO (PCT)
Prior art keywords
interface
test
tested
test case
information
Prior art date
Application number
PCT/CN2017/112618
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 WO2019085079A1 publication Critical patent/WO2019085079A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites

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, apparatus, and computer are provided Equipment and storage media.
  • An interface test method includes:
  • test case template to be tested and a communication parameter of the interface to be tested corresponding to the test case identifier from the test case library
  • the interface to be tested corresponding to the interface address to be tested in the test case of the interface to be tested is tested according to the test interface of the interface to be tested and the communication parameter of the interface to be tested.
  • An interface testing device includes:
  • test instruction acquisition module configured to acquire an interface test instruction
  • a pre-condition query module configured to query pre-condition information associated with the test case identifier in the interface test instruction
  • a parameter information obtaining module configured to acquire, according to the pre-condition information, the parameter information of the test case corresponding to the test case identifier
  • a use case module acquiring module configured to obtain, from the test case library, the test case template and the interface communication parameter to be tested corresponding to the test case identifier;
  • test case generating module configured to generate a test case for testing the interface according to the test case parameter information and the test case template
  • 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 of the interface to be tested, according to the test case of the interface to be tested and the communication parameter of the interface to be tested.
  • 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 template to be tested and a communication parameter of the interface to be tested corresponding to the test case identifier from the test case library
  • the interface to be tested corresponding to the interface address to be tested in the test case of the interface to be tested is tested according to the test interface of the interface to be tested and the communication parameter of the interface to be tested.
  • a computer readable storage medium having stored thereon computer instructions that, when executed by a processor, implement the following steps:
  • test case template to be tested and a communication parameter of the interface to be tested corresponding to the test case identifier from the test case library
  • the interface to be tested corresponding to the interface address to be tested in the test case of the interface to be tested is tested according to the test interface of the interface to be tested and the communication parameter of the interface to be tested.
  • 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 flow chart showing the steps of generating an interface test command in an embodiment
  • FIG. 4 is a flow chart showing the steps of executing a pre-test case in one embodiment
  • FIG. 5 is a schematic flowchart of a step of obtaining parameter information of a use case to be tested in an embodiment
  • FIG. 6 is a schematic flow chart of steps of testing an interface to be tested 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 test instruction acquisition module in an embodiment
  • FIG. 9 is a structural block diagram of a parameter information acquiring module in an embodiment
  • Figure 10 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 Specifically, it may be at least one of a tablet, 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 device 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 includes a test case identifier, and the extracted test case identifier may be one or more.
  • the terminal 110 transmits the generated interface test command to the server 120.
  • S204 Query pre-condition information associated with the test case identifier in the interface test instruction.
  • the test case library is set in the server 120, and the test case template, the interface communication parameter, and the precondition information are stored in the test case library.
  • the test case template is a template for generating a test case; the communication parameter corresponding to the interface communication parameter to be tested may specifically include at least one of an interface communication protocol type, an interface communication mode, and a data transmission format; the precondition information is to perform the current test. Information or parameters required before the use case.
  • the user can configure the associated precondition information for the test case identification in the interface test configuration page through the input device of the terminal 110.
  • the server 120 may store the test case identifier corresponding to the pre-condition identifier of the associated pre-condition information in the test case.
  • the server 120 parses the interface test instruction, parses and extracts the test case identifier in the interface test instruction, and queries whether the query case exists in the test case database according to the extracted test case identifier. Associated precondition information.
  • the server 120 queries the query for the presence of the pre-condition identifier corresponding to the extracted test case identifier. If the pre-condition identifier corresponding to the extracted test identifier is queried, it indicates that the association exists. If the precondition ID corresponding to the extracted test case identifier is not found, it means that there is no associated precondition information.
  • the pre-condition information is included in the detected use case parameter information corresponding to the extracted test case identifier.
  • the server 120 queries the pre-condition information corresponding to the extracted test case identifier, the pre-condition is parsed, and the test case parameter information of the test case identifier is extracted.
  • the server 120 queries the pre-condition identifier corresponding to the extracted test case identifier, and identifies the pre-condition information of the query according to the pre-conditions of the query, and extracts the data query condition in the pre-strip information.
  • the data query conditions include data identification and database address.
  • the server 120 establishes a database connection according to the database address in the data query condition, and queries the data corresponding to the data identifier from the database according to the database connection, and uses the queried data as the test case parameter information corresponding to the test case identifier.
  • test case template to be tested and a communication parameter of the interface to be tested corresponding to the test case identifier from the test case database.
  • the server 120 after extracting the test case identifier from the interface test command, the server 120 queries the test case database and the test interface communication parameter corresponding to the extracted test case identifier in the test case database.
  • the server 120 queries the test case template corresponding to the extracted test case identifier in the test use case library, extracts the communication parameter identifier from the test case template, and queries the test case according to the extracted communication parameter identifier. Interface communication parameters.
  • S210 Generate a test case for the interface to be tested according to the parameter information of the use case to be tested and the template for the use case to be tested.
  • the interface test case to be tested is a test case for testing the interface to be tested.
  • the test case parameter information includes request parameter information, return parameter information, and expected test result
  • the test case template is test scenario information.
  • the server 120 combines the test case parameter information and the test case template to be tested, and obtains a test case corresponding to the test case identifier by combining.
  • the server 120 when there are multiple test case identifiers, the server 120 obtains the test case parameter information according to the precondition information associated with each test case identifier, and obtains each test case identifier from the test case library. Corresponding test case template, according to each test case identification pair The test case parameters to be tested and the test case template to be tested are combined to generate the test case of the interface to be tested corresponding to each test case identifier.
  • S212 Test the interface to be tested corresponding to the interface address to be tested in the test instance of the interface to be tested, according to the test case of the interface to be tested and the communication parameter of the interface to be tested.
  • the server 120 extracts the test information and the interface address to be tested in the test instance of the interface to be tested, encapsulates the extracted test information according to the communication parameters of the interface to be tested, and sends the encapsulated test information to the extracted test information.
  • the interface to be tested corresponding to the interface address to be tested is tested according to the tested test information.
  • the server 120 extracts the test information and the interface address to be tested in the test instance of the interface to be tested, generates a test request for the interface to be tested according to the communication parameters of the interface to be tested and the extracted test information, and sends the test interface request to be tested. Test the interface to be tested to the interface to be tested corresponding to the extracted interface address to be tested.
  • the parameter information of the test case is obtained according to the pre-condition information, and is generated according to the obtained test case parameter information and the test case template to be tested.
  • the step of generating an interface test instruction includes the following:
  • 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 110 at the terminal 110.
  • 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 ID.
  • 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 library includes a plurality of test plan information.
  • the server 120 periodically acquires the current time, compares the acquired current time with the test start time in each test plan information to monitor whether the current time is the same as the test start time.
  • test case identifier corresponding to the test start time is extracted from the test plan information.
  • the test case identifier set is read from the test plan information corresponding to the test start time, and the test case identifier in the test case identifier set is extracted.
  • the server 120 after extracting the test case identifier, the server 120 encapsulates the extracted test case identifier and generates an interface test command to be tested through 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.
  • S206 specifically includes the step of executing a pre-test case, and the step specifically includes the following:
  • the pre-use case generation information, the pre-use case template, the pre-interface communication parameters, and the pre-strip condition information are stored in the test case library.
  • Server 120 is querying and extracting After the test case identifier corresponding to the pre-condition information, the pre-use case generation information, the pre-use case template, and the pre-interface communication parameters corresponding to the pre-condition information are queried from the test case library.
  • the server 120 extracts the pre-use case generation information and the pre-use case template identifier from the pre-condition information, and queries the test-case database with the pre-use case template corresponding to the extracted pre-use case template identifier.
  • the interface parameter identifier is extracted from the pre-use case template, and the pre-interface communication parameters corresponding to the interface parameter identifier are queried in the test case library.
  • S404 Generate a pre-test case according to the pre-use case generation information and the pre-use case template.
  • the pre-use case generation information includes pre-request parameter information, pre-return parameter information, and pre-expected test result
  • the pre-use case template is pre-scene information.
  • the server 120 merges the pre-use case generation information and the pre-use case template, and obtains the pre-test case by merging.
  • S406 Perform a pre-test case according to the communication parameters of the pre-interface, and obtain parameter information of the test case corresponding to the test case identifier.
  • the server 120 extracts the pre-interface address in the pre-test case, encapsulates the pre-test case according to the pre-interface communication parameters, and sends the encapsulated pre-test case to the front according to the pre-interface address.
  • the interface is configured to execute the pre-test test case and generate the test case parameter information corresponding to the test case identifier according to the pre-test case.
  • the parameter of the test case to be tested returned by the front interface of the server 120 interface.
  • a pre-test case is generated according to the pre-condition information, and the pre-interface is tested according to the generated pre-test case, and the pre-interface is obtained according to the pre-test case.
  • the returned test case identifier corresponds to the parameter information of the test case to be tested, and the accuracy of the test case parameter is guaranteed.
  • S406 specifically includes the step of obtaining the use case parameter information, and the step specifically includes the following content:
  • S502 Test the front interface corresponding to the address of the front interface in the pre-test case according to the communication parameters of the pre-test and the pre-interface, and obtain the parameter information returned by the pre-interface.
  • the server 120 extracts the pre-interface address in the pre-test case.
  • the interface communication protocol type, the interface communication mode, and the interface data transmission format in the communication parameters of the front interface are obtained, and the pre-test case is encapsulated according to the extracted interface communication protocol type, the interface communication mode, and the interface data transmission format, and the front interface is obtained.
  • Test request The server 120 sends the pre-interface test request to the pre-interface address, and the interface pre-interface returns the parameter information according to the pre-interface test request.
  • the data query conditions include a database address, a data identification, and a data query statement. Data query conditions may also be included in the precondition information.
  • the server 120 determines whether there is a data query condition by using the data query identifier in the pre-strip information.
  • the server 120 extracts data query conditions from the pre-condition information when it detects that there is a data query condition in the pre-condition information.
  • the server 120 establishes a connection with the database according to the database address in the data query condition, and queries the data corresponding to the data identifier from the database through the connection according to the data query statement.
  • the obtained parameter information and the queried data are used as the test case parameter information corresponding to the test case identifier.
  • the server 120 after obtaining the parameter information returned by the pre-interface and the data from the database, merges the obtained parameter information and the queried data into the test case parameter information corresponding to the test case identifier.
  • the data may be queried from the database according to the data query condition in the pre-condition information, and the test case identifier is generated according to the obtained parameter information and the queried data.
  • the corresponding parameter information of the test case to be tested improves the acquisition efficiency of the parameter information of the test case to be tested.
  • S212 specifically includes the step of testing an interface to be tested, and the step specifically includes the following:
  • the interface communication parameters to be tested 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 to be tested, 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 interface test case to be tested according to the extracted interface communication protocol type, the interface communication mode, and the interface data transmission format, and encapsulates the test interface test request supported by the interface to be tested.
  • S606 Test the interface to be tested corresponding to the interface address to be tested in the test instance of the interface to be tested according to the test of the interface to be tested.
  • the test interface of the interface to be tested includes the address of the interface to be tested, and the address of the interface to be tested is the unique identifier of the interface to be tested.
  • the server 120 extracts the interface address to be tested from the interface test case to be tested, and sends the test interface test request to the interface to be tested according to the interface address to be tested, and tests the interface to be tested.
  • the test case of the interface to be tested is prepared according to the interface type of the interface to be tested, and the test case for the interface to be tested is directly encapsulated according to the interface communication protocol type, the interface communication mode, and the interface data transmission format in the communication parameters of the interface to be tested.
  • the encapsulation generates a test request for the interface to be tested supported by the interface to be tested, and ensures the success rate of the test to be tested according to the test request of the interface to be tested.
  • an interface testing apparatus 700 is provided.
  • the apparatus specifically includes the following: a test instruction acquiring module 702, a precondition querying module 704, a parameter information acquiring module 706, and a use case module acquiring module. 708, the test case generation module 710 and the interface to be tested Test module 712.
  • the test instruction acquisition module 702 is configured to obtain an interface test instruction.
  • the pre-condition query module 704 is configured to query pre-condition information associated with the test case identifier in the interface test instruction.
  • the parameter information obtaining module 706 is configured to obtain the test case parameter information corresponding to the test case identifier according to the pre-condition information.
  • the use case module obtaining module 708 is configured to obtain the test case template and the interface communication parameter to be tested corresponding to the test case identifier from the test case database.
  • the test case generation module 710 is configured to generate a test case for the interface to be tested according to the test case parameter information and the test case template to be tested.
  • the interface to be tested 712 is configured to test the interface to be tested corresponding to the interface address to be tested in the test instance to be tested according to the test case of the interface to be tested and the communication parameters of the interface to be tested.
  • the parameter information of the test case is obtained according to the pre-condition information, and is generated according to the obtained test case parameter information and the test case template to be tested.
  • the test case database includes a plurality of test plan information
  • the test instruction acquisition module 702 specifically includes the following contents: a test plan monitoring module 714, a use case identification extraction module 716, and a test instruction generation module. 718.
  • the test plan monitoring module 714 is configured to monitor the test start time in the test plan information.
  • the use case identification extraction module 716 is configured to extract the test case identifier corresponding to the test start time from the test plan information when the current time is monitored and the test start time is the same.
  • the test instruction generating module 718 is configured to generate an interface test instruction to be tested according to the extracted test case identifier.
  • 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.
  • the parameter information obtaining module 706 specifically includes the following: a pre-information query module 706a, a pre-use case generation module 706b, and a use case parameter obtaining module 706c.
  • the pre-information query module 706a is configured to obtain, from the test case library, the pre-use case generation information, the pre-use case template, and the pre-interface communication parameters corresponding to the pre-condition information.
  • the pre-use case generation module 706b is configured to generate a pre-test case based on the pre-use case generation information and the pre-use case template.
  • the use case parameter obtaining module 706c is configured to execute the pre-test case according to the pre-interface communication parameter, and obtain the test case parameter information corresponding to the test case identifier.
  • a pre-test case is generated according to the pre-condition information, and the pre-interface is tested according to the generated pre-test case, and the pre-interface is obtained according to the pre-test case.
  • the returned test case identifier corresponds to the parameter information of the test case to be tested, and the accuracy of the test case parameter is guaranteed.
  • the use case parameter obtaining module 706c further tests the pre-interface corresponding to the pre-interface address in the pre-test case according to the pre-test case and the pre-interface communication parameters, and obtains the return of the pre-interface.
  • Parameter information; whether there is a data query condition in the pre-condition information; if a data query condition exists in the pre-condition information, the data is queried from the database according to the data query condition; and the obtained parameter information and the queried data are The test case parameter information corresponding to the test case identifier.
  • the data may be queried from the database according to the data query condition in the pre-condition information, and the test case identifier is generated according to the obtained parameter information and the queried data.
  • Corresponding test case parameter information improves the test case The efficiency of the acquisition of several information.
  • the interface to be tested module 712 is further configured to extract an interface communication protocol type, an interface communication mode, and an interface data transmission format in the communication parameter of the interface to be tested; according to the interface communication protocol type, the interface communication mode, and the interface data transmission.
  • the format and the test instance of the interface to be tested are generated to test the interface to be tested.
  • the test interface to be tested in the test instance of the interface to be tested is tested according to the interface to be tested.
  • the test case of the interface to be tested is prepared according to the interface type of the interface to be tested, and the test case for the interface to be tested is directly encapsulated according to the interface communication protocol type, the interface communication mode, and the interface data transmission format in the communication parameters of the interface to be tested.
  • the encapsulation generates a test request for the interface to be tested supported by the interface to be tested, and ensures the success rate of the test to be tested according to the test request of the interface to be tested.
  • 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.
  • a computer device which may be a server or a mobile terminal.
  • the computer device includes a processor, memory, and network interface coupled by a system bus.
  • the processor of the computer device is used to provide computing and control capabilities.
  • the memory of the computer device includes a non-volatile storage medium, an internal memory.
  • the non-volatile storage medium stores an operating system and a computer program.
  • the internal memory provides an environment for operation of an operating system and computer programs in a non-volatile storage medium.
  • the network interface of the computer device is used to communicate with an external terminal via a network connection.
  • the computer program is executed by the processor to implement an interface test method.
  • FIG. 10 is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation of the computer device to which the solution of the present application is applied.
  • the specific computer device may It includes more or fewer components than those shown in the figures, 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: perform an interface test And querying the pre-condition information associated with the test case identifier in the interface test command; obtaining the test case parameter information corresponding to the test case identifier according to the pre-condition information; and obtaining the test corresponding to the test case identifier from the test case database
  • Use case template and communication parameters of the interface to be tested generate test cases for the interface to be tested according to the parameter information of the test case and the test case template to be tested; and the interface address to be tested in the test case to be tested according to the test case of the interface to be tested and the communication parameters of the interface to be tested The corresponding interface to be tested is tested.
  • the test case library includes a plurality of test plan information.
  • the processor executes the computer step to: perform monitoring the test start time in the test plan information; When the current time is the same as the test start time, the test case identifier corresponding to the test start time is extracted from the test plan information; and the test interface test command is generated according to the extracted test case identifier.
  • the parameter information of the test case corresponding to the test case identifier is obtained according to the pre-condition information, and the pre-use case generation information corresponding to the pre-condition information, the pre-use case template, and the front are obtained from the test case library.
  • the interface communication parameters are set; the pre-test case is generated according to the pre-use case generation information and the pre-use case template; the pre-test case is executed according to the pre-interface communication parameters, and the test case parameter information corresponding to the test case identifier is obtained.
  • the pre-test use case is executed according to the pre-interface communication parameter, and the test case parameter information corresponding to the test case identifier is obtained, including: according to the pre-test case and the pre-interface communication parameter, in the pre-test case
  • the pre-interface corresponding to the address of the pre-interface is tested to obtain the parameter information returned by the pre-interface; whether the data query condition exists in the pre-condition information is detected; if the data query condition exists in the pre-condition information, according to the data query condition Query from the database Data; the obtained parameter information and the queried data are used as the test case parameter information corresponding to the test case identifier.
  • the interface to be tested corresponding to the interface address to be tested in the test interface to be tested is tested according to the interface test case to be tested and the communication parameter of the interface to be tested, including: extracting interface communication in the communication parameter of the interface to be tested. Protocol type, interface communication mode, and interface data transmission format; generate test interface test request according to interface communication protocol type, interface communication mode, interface data transmission format, and test interface to be tested; test interface test case to be tested according to test interface to be tested Test the interface to be tested corresponding to the address of the interface to be tested.
  • the parameter information of the test case is obtained according to the pre-condition information, and is generated according to the obtained test case parameter information and the test case template to be tested.
  • a computer readable storage medium having stored thereon computer instructions that, when executed by a processor, implement the steps of: obtaining an interface test instruction; querying precondition information associated with the test case identification in the interface test instruction; Obtaining the test case parameter information corresponding to the test case identifier according to the precondition information; obtaining the test case template and the interface communication parameter corresponding to the test case identifier from the test case database; and according to the test case parameter information and the test case to be tested
  • the template generates a test case for the interface to be tested.
  • the interface to be tested in the test interface of the interface to be tested is tested according to the test case of the interface to be tested and the communication parameters of the interface to be tested.
  • the test case library includes a plurality of test plan information.
  • the processor Before acquiring the interface test command, the processor further performs the following steps: monitoring the test start time in the test plan information; when monitoring the current time and the test start time At the same time, the test case identifier corresponding to the test start time is extracted from the test plan information; and the test interface to be tested is generated according to the extracted test case identifier make.
  • the parameter information of the test case corresponding to the test case identifier is obtained according to the pre-condition information, and the pre-use case generation information corresponding to the pre-condition information, the pre-use case template, and the front are obtained from the test case library.
  • the interface communication parameters are set; the pre-test case is generated according to the pre-use case generation information and the pre-use case template; the pre-test case is executed according to the pre-interface communication parameters, and the test case parameter information corresponding to the test case identifier is obtained.
  • the pre-test use case is executed according to the pre-interface communication parameter, and the test case parameter information corresponding to the test case identifier is obtained, including: according to the pre-test case and the pre-interface communication parameter, in the pre-test case
  • the pre-interface corresponding to the address of the pre-interface is tested to obtain the parameter information returned by the pre-interface; whether the data query condition exists in the pre-condition information is detected; if the data query condition exists in the pre-condition information, according to the data query condition
  • the data is queried from the database; the obtained parameter information and the queried data are used as the test case parameter information corresponding to the test case identifier.
  • the interface to be tested corresponding to the interface address to be tested in the test interface to be tested is tested according to the interface test case to be tested and the communication parameter of the interface to be tested, including: extracting interface communication in the communication parameter of the interface to be tested. Protocol type, interface communication mode, and interface data transmission format; generate test interface test request according to interface communication protocol type, interface communication mode, interface data transmission format, and test interface to be tested; test interface test case to be tested according to test interface to be tested Test the interface to be tested corresponding to the address of the interface to be tested.
  • the parameter information of the test case is obtained according to the pre-condition information, and is generated according to the obtained test case parameter information and the test case template to be tested.
  • the computer-executable instructions can be stored in a computer readable storage medium, as in the embodiment of the present application, the computer executable instructions can be stored in a storage of the computer system.
  • the medium is executed by at least one processor in the computer system to implement a process 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.

Landscapes

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

Abstract

An interface test method, comprising: acquiring an interface test instruction (S202); querying precondition information associated with a test case identifier in the interface test instruction (S204); acquiring, according to the precondition information, test case parameter information corresponding to the test case identifier (S206); acquiring, from a test case library, a test case template and a communication parameter of an interface to be tested, which template and parameter correspond to the test case identifier (S208); according to the test case parameter information and the test case template, generating a test case of the interface to be tested (S210); and testing, according to the test case of the interface to be tested and the communication parameter of the interface to be tested, the interface to be tested, which corresponds to the address of the interface to be tested in the test case of the interface to be tested (S212).

Description

接口测试方法、装置、计算机设备和存储介质Interface test method, device, computer device and storage medium
本申请要求于2017年10月31日提交中国专利局,申请号为2017110441875,发明名称为“接口测试方法、装置、计算机设备和存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。The present application claims to be filed on October 31, 2017, the Chinese Patent Office, the application number is 2017110441875, the priority of the invention is the Chinese patent application of the "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, during the test, sometimes when testing an interface, you need to obtain the parameters of the associated interface. The interface can be tested according to the obtained parameters. Therefore, when testing the test case of the interface, you need to test the associated interface. The use case content is written to the test case content of the interface. In this way, it is easy to cause some test case contents to be repeatedly sucked into different test cases, which makes writing test cases take more time, thereby reducing the efficiency of interface test.
发明内容Summary of the invention
根据本申请提供的各种实施例,提供一种接口测试方法、装置、计算机 设备和存储介质。According to various embodiments provided by the present application, an interface testing method, apparatus, and computer are provided Equipment and storage media.
一种接口测试方法,包括:An interface test method includes:
获取接口测试指令;Obtain an interface test instruction;
查询与所述接口测试指令中的测试用例标识关联的前置条件信息;Querying precondition information associated with the test case identifier in the interface test command;
根据所述前置条件信息获取所述测试用例标识对应的待测用例参数信息;Acquiring the test case parameter information corresponding to the test case identifier according to the precondition information;
从测试用例库中获取与所述测试用例标识对应的待测用例模板和待测接口通信参数;Obtaining a test case template to be tested and a communication parameter of the interface to be tested corresponding to the test case identifier from the test case library;
根据所述待测用例参数信息和所述待测用例模板生成待测接口测试用例;及Generating a test case for the interface to be tested according to the test case parameter information and the test case template; and
根据所述待测接口测试用例和所述待测接口通信参数,对所述待测接口测试用例中待测接口地址所对应的待测接口进行测试。The interface to be tested corresponding to the interface address to be tested in the test case of the interface to be tested is tested according to the test interface of the interface to be tested and the communication parameter of the interface to be tested.
一种接口测试装置,包括:An interface testing device includes:
测试指令获取模块,用于获取接口测试指令;a test instruction acquisition module, configured to acquire an interface test instruction;
前置条件查询模块,用于查询与所述接口测试指令中的测试用例标识关联的前置条件信息;a pre-condition query module, configured to query pre-condition information associated with the test case identifier in the interface test instruction;
参数信息获取模块,用于根据所述前置条件信息获取所述测试用例标识对应的待测用例参数信息;a parameter information obtaining module, configured to acquire, according to the pre-condition information, the parameter information of the test case corresponding to the test case identifier;
用例模块获取模块,用于从测试用例库中获取与所述测试用例标识对应的待测用例模板和待测接口通信参数;a use case module acquiring module, configured to obtain, from the test case library, the test case template and the interface communication parameter to be tested corresponding to the test case identifier;
测试用例生成模块,用于根据所述待测用例参数信息和所述待测用例模板生成待测接口测试用例;及a test case generating module, configured to generate a test case for testing the interface according to the test case parameter information and the test case template; 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 of the interface to be tested, according to the test case of the interface to be tested and the communication parameter of the interface to be tested.
一种计算机设备,所述计算机设备包括存储器、处理器及存储在所述存储器上并可在所述处理器上运行的计算机指令,所述处理器执行所述计算机指令时实现以下步骤: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 an interface test instruction;
查询与所述接口测试指令中的测试用例标识关联的前置条件信息;Querying precondition information associated with the test case identifier in the interface test command;
根据所述前置条件信息获取所述测试用例标识对应的待测用例参数信息;Acquiring the test case parameter information corresponding to the test case identifier according to the precondition information;
从测试用例库中获取与所述测试用例标识对应的待测用例模板和待测接口通信参数;Obtaining a test case template to be tested and a communication parameter of the interface to be tested corresponding to the test case identifier from the test case library;
根据所述待测用例参数信息和所述待测用例模板生成待测接口测试用例;及Generating a test case for the interface to be tested according to the test case parameter information and the test case template; and
根据所述待测接口测试用例和所述待测接口通信参数,对所述待测接口测试用例中待测接口地址所对应的待测接口进行测试。The interface to be tested corresponding to the interface address to be tested in the test case of the interface to be tested is tested according to the test interface of the interface to be tested and the communication parameter of the interface to be tested.
一种计算机可读存储介质,其上存储有计算机指令,所述计算机指令被处理器执行时实现以下步骤:A computer readable storage medium having stored thereon computer instructions that, when executed by a processor, implement the following steps:
获取接口测试指令;Obtain an interface test instruction;
查询与所述接口测试指令中的测试用例标识关联的前置条件信息;Querying precondition information associated with the test case identifier in the interface test command;
根据所述前置条件信息获取所述测试用例标识对应的待测用例参数信息;Acquiring the test case parameter information corresponding to the test case identifier according to the precondition information;
从测试用例库中获取与所述测试用例标识对应的待测用例模板和待测接口通信参数;Obtaining a test case template to be tested and a communication parameter of the interface to be tested corresponding to the test case identifier from the test case library;
根据所述待测用例参数信息和所述待测用例模板生成待测接口测试用例;及Generating a test case for the interface to be tested according to the test case parameter information and the test case template; and
根据所述待测接口测试用例和所述待测接口通信参数,对所述待测接口测试用例中待测接口地址所对应的待测接口进行测试。 The interface to be tested corresponding to the interface address to be tested in the test case of the interface to be tested is tested according to the test interface of the interface to be tested and the communication parameter of the interface to be tested.
本申请的一个或多个实施例的细节在下面的附图和描述中提出。本申请的其它特征、目的和优点将从说明书、附图以及权利要求书变得明显。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 flow chart showing the steps of generating an interface test command in an embodiment;
图4为一个实施例中执行前置测试用例的步骤的流程示意图;4 is a flow chart showing the steps of executing a pre-test case in one embodiment;
图5为一个实施例中获得待测用例参数信息的步骤的流程示意图;FIG. 5 is a schematic flowchart of a step of obtaining parameter information of a use case to be tested in an embodiment;
图6为一个实施例中测试待测接口的步骤的流程示意图;6 is a schematic flow chart of steps of testing an interface to be tested in an embodiment;
图7为一个实施例中接口测试装置的结构框图;7 is a structural block diagram of an interface testing device in an embodiment;
图8为一个实施例中测试指令获取模块的结构框图;8 is a structural block diagram of a test instruction acquisition module in an embodiment;
图9为一个实施例中参数信息获取模块的结构框图;9 is a structural block diagram of a parameter information acquiring module in an embodiment;
图10为一个实施例中接口测试系统中的服务器的结构框图。Figure 10 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 Specifically, it may be at least one of a tablet, 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 an interface test instruction.
在一个实施例中,终端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 device 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 includes a test case identifier, and the extracted test case identifier may be one or more. The terminal 110 transmits the generated interface test command to the server 120.
S204,查询与接口测试指令中的测试用例标识关联的前置条件信息。S204: Query pre-condition information associated with the test case identifier in the interface test instruction.
其中,服务器120中设置有测试用例库,测试用例库中存储有测试用例模板、接口通信参数和前置条件信息。测试用例模板为生成测试用例的模板;接口通信参数待测接口对应的通信参数,具体可以包括接口通信协议类型、接口通信模式和数据传输格式中的至少一种;前置条件信息为执行当前测试用例之前需要的信息或参数。用户通过终端110的输入设备可以在接口测试配置页面中为测试用例标识配置关联的前置条件信息。服务器120可以将测试用例标识与其关联的前置条件信息的前置条件标识对应存储在测试用例中。The test case library is set in the server 120, and the test case template, the interface communication parameter, and the precondition information are stored in the test case library. The test case template is a template for generating a test case; the communication parameter corresponding to the interface communication parameter to be tested may specifically include at least one of an interface communication protocol type, an interface communication mode, and a data transmission format; the precondition information is to perform the current test. Information or parameters required before the use case. The user can configure the associated precondition information for the test case identification in the interface test configuration page through the input device of the terminal 110. The server 120 may store the test case identifier corresponding to the pre-condition identifier of the associated pre-condition information in the test case.
在一个实施例中,服务器120在获取到接口测试指令后,对接口测试指令进行解析,通过解析提取接口测试指令中的测试用例标识,根据提取到的测试用例标识在测试用例库中查询是否存在关联的前置条件信息。In an embodiment, after obtaining the interface test instruction, the server 120 parses the interface test instruction, parses and extracts the test case identifier in the interface test instruction, and queries whether the query case exists in the test case database according to the extracted test case identifier. Associated precondition information.
在一个实施例中,服务器120会查询查询是否存在与提取到的测试用例标识对应的前置条件标识,若查询到与提取到的测试用标识对应的前置条件标识,则表示存在关联的前置条件信息;若未查询到与提取到的测试用例标识对应的前置条件标识,则表示不存在关联的前置条件信息。 In an embodiment, the server 120 queries the query for the presence of the pre-condition identifier corresponding to the extracted test case identifier. If the pre-condition identifier corresponding to the extracted test identifier is queried, it indicates that the association exists. If the precondition ID corresponding to the extracted test case identifier is not found, it means that there is no associated precondition information.
S206,根据前置条件信息获取测试用例标识对应的待测用例参数信息。S206. Acquire, according to the precondition information, the parameter information of the test case corresponding to the test case identifier.
在一个实施例中,前置条件信息中包括于提取到的测试用例标识对应的待测用例参数信息。服务器120在查询到与提取到的测试用例标识对应的前置条件信息时,对前置条件进行解析,提取与测试用例标识对饮的待测用例参数信息。In an embodiment, the pre-condition information is included in the detected use case parameter information corresponding to the extracted test case identifier. When the server 120 queries the pre-condition information corresponding to the extracted test case identifier, the pre-condition is parsed, and the test case parameter information of the test case identifier is extracted.
在一个实施例中,服务器120在查询到与提取到的测试用例标识对应的前置条件标识,根据查询到的前置条件标识查询前置条件信息,提取前置条案信息中的数据查询条件。其中,数据查询条件包括数据标识和数据库地址。服务器120根据数据查询条件中的数据库地址建立数据库连接,根据数据库连接从数据库中查询数据标识对应的数据,以查询到的数据作为与测试用例标识对应的待测用例参数信息。In an embodiment, the server 120 queries the pre-condition identifier corresponding to the extracted test case identifier, and identifies the pre-condition information of the query according to the pre-conditions of the query, and extracts the data query condition in the pre-strip information. . Among them, the data query conditions include data identification and database address. The server 120 establishes a database connection according to the database address in the data query condition, and queries the data corresponding to the data identifier from the database according to the database connection, and uses the queried data as the test case parameter information corresponding to the test case identifier.
S208,从测试用例库中获取与测试用例标识对应的待测用例模板和待测接口通信参数。S208. Obtain a test case template to be tested and a communication parameter of the interface to be tested corresponding to the test case identifier from the test case database.
在一个实施例中,服务器120在从接口测试指令中提取测试用例标识后,在测试用例库中查询与提取到的测试用例标识对应的待测用例模板和待测接口通信参数。In an embodiment, after extracting the test case identifier from the interface test command, the server 120 queries the test case database and the test interface communication parameter corresponding to the extracted test case identifier in the test case database.
在一个实施例中,服务器120在测试用例库中查询与提取到的测试用例标识对应的待测用例模板,从待测用例模板中提取通信参数标识,根据提取的通信参数标识在测试用例中查询接口通信参数。In an embodiment, the server 120 queries the test case template corresponding to the extracted test case identifier in the test use case library, extracts the communication parameter identifier from the test case template, and queries the test case according to the extracted communication parameter identifier. Interface communication parameters.
S210,根据待测用例参数信息和待测用例模板生成待测接口测试用例。S210: Generate a test case for the interface to be tested according to the parameter information of the use case to be tested and the template for the use case to be tested.
在一个实施例中,待测接口测试用例为用于对待测接口进行测试的测试用例。待测用例参数信息中包括请求参数信息、返回参数信息和预期测试结果,待测用例模板为测试场景信息。服务器120根据待测用例参数信息和待测用例模板进行合并,通过合并得到测试用例标识对应的测试用例。In one embodiment, the interface test case to be tested is a test case for testing the interface to be tested. The test case parameter information includes request parameter information, return parameter information, and expected test result, and the test case template is test scenario information. The server 120 combines the test case parameter information and the test case template to be tested, and obtains a test case corresponding to the test case identifier by combining.
在一个实施例中,提取到的测试用例标识有多个时,服务器120根据每个测试用例标识关联的前置条件信息获取待测用例参数信息,并从测试用例库中获取每个测试用例标识对应的待测用例模板,根据每个测试用例标识对 应的待测用例参数和待测用例模板合并生成各测试用例标识分别对应的待测接口测试用例。In an embodiment, when there are multiple test case identifiers, the server 120 obtains the test case parameter information according to the precondition information associated with each test case identifier, and obtains each test case identifier from the test case library. Corresponding test case template, according to each test case identification pair The test case parameters to be tested and the test case template to be tested are combined to generate the test case of the interface to be tested corresponding to each test case identifier.
S212,根据待测接口测试用例和待测接口通信参数,对待测接口测试用例中待测接口地址所对应的待测接口进行测试。S212: Test the interface to be tested corresponding to the interface address to be tested in the test instance of the interface to be tested, according to the test case of the interface to be tested and the communication parameter of the interface to be tested.
在一个实施例中,服务器120提取待测接口测试用例中的测试信息和待测接口地址,根据待测接口通信参数对提取到的测试信息进行封装,将封装后的测试信息发送至提取到的待测接口地址所对应的待测接口,以根据封装后的测试信息对待测接口进行测试。In an embodiment, the server 120 extracts the test information and the interface address to be tested in the test instance of the interface to be tested, encapsulates the extracted test information according to the communication parameters of the interface to be tested, and sends the encapsulated test information to the extracted test information. The interface to be tested corresponding to the interface address to be tested is tested according to the tested test information.
在一个实施例中,服务器120提取待测接口测试用例中的测试信息和待测接口地址,根据待测接口通信参数和提取到的测试信息生成待测接口测试请求,将待测接口测试请求发送至提取到的待测接口地址对应的待测接口,对待测接口进行测试。In one embodiment, the server 120 extracts the test information and the interface address to be tested in the test instance of the interface to be tested, generates a test request for the interface to be tested according to the communication parameters of the interface to be tested and the extracted test information, and sends the test interface request to be tested. Test the interface to be tested to the interface to be tested corresponding to the extracted interface address to be tested.
本实施例中,在接口测试过程中,在执行测试用例标识对应的测试用例之前,根据前置条件信息获取待测用例参数信息,根据获取到的待测用例参数信息和待测用例模板生成待测接口测试用例,并根据待测接口测试用例和待测接口通信参数,对待测接口测试。无需将与待测接口相关联的其他接口的测试用例内容写到待测接口测试用例中,只需通过测试用例标识与前置条件信息关联即可,节省了重复编写测试用例内容所耗费的时间,从而提高了根据测试用例对待测接口进行自动化测试的测试效率。In this embodiment, in the interface test process, before the test case corresponding to the test case identifier is executed, the parameter information of the test case is obtained according to the pre-condition information, and is generated according to the obtained test case parameter information and the test case template to be tested. Test the interface test case and test the interface according to the test case to be tested and the communication parameters of the interface to be tested. It is not necessary to write the test case content of other interfaces associated with the interface to be tested to the interface test case to be tested, and only need to associate the test case identifier with the pre-condition information, thereby saving the time spent repeatedly writing the test case content. , thereby improving the test efficiency of automated testing according to the test case interface to be tested.
如图3所示,在一个实施例中,S202之前具体包括生成接口测试指令的步骤,该步骤具体包括以下内容:As shown in FIG. 3, in an embodiment, before S202, specifically, the step of generating an interface test instruction includes the following:
S302,监测测试计划信息中的测试开始时间。S302. Monitor the test start time in the test plan information.
其中,测试计划信息为用户通过终端110的输入设备,在终端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 110 at the terminal 110. 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 ID.
在一个实施例中,服务器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 library includes a plurality of test plan information. The server 120 periodically acquires the current time, compares the acquired current time with the test start time in each test plan information to monitor whether the current time is the same as the test start time.
S304,当监测到当前时间与测试开始时间相同时,从测试计划信息中提取测试开始时间对应的测试用例标识。S304. When the current time is monitored and the test start time is the same, the test case identifier corresponding to the test start time is extracted from the test plan information.
在一个实施例中,服务器120监测到将当前时间与测试开始时间相同时,从该测试开始时间对应的测试计划信息中读取测试用例标识集合,提取测试用例标识集合中的测试用例标识。In one embodiment, when the server 120 monitors that the current time is the same as the test start time, the test case identifier set is read from the test plan information corresponding to the test start time, and the test case identifier in the test case identifier set is extracted.
S306,根据提取到的测试用例标识生成待测接口测试指令。S306. Generate an interface test instruction to be tested according to the extracted test case identifier.
在一个实施例中,服务器120在提取到测试用例标识后,对提取到的测试用例标识进行封装,通过封装生成待测接口测试指令。In an embodiment, after extracting the test case identifier, the server 120 encapsulates the extracted test case identifier and generates an interface test command to be tested through 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所示,在一个实施例中,S206具体包括执行前置测试用例的步骤,该步骤具体包括以下内容:As shown in FIG. 4, in an embodiment, S206 specifically includes the step of executing a pre-test case, and the step specifically includes the following:
S402,从测试用例库中获取与前置条件信息对应的前置用例生成信息、前置用例模板和前置接口通信参数。S402. Obtain pre-use case generation information, a pre-use case template, and a pre-interface communication parameter corresponding to the pre-condition information from the test case library.
在一个实施例中,前置用例生成信息、前置用例模板、前置接口通信参数与前置条条件信息对应存储在测试用例库中。服务器120在查询到与提取 到的测试用例标识对应的前置条件信息后,从测试用例库中查询与前置条件信息对应的前置用例生成信息、前置用例模板和前置接口通信参数。In one embodiment, the pre-use case generation information, the pre-use case template, the pre-interface communication parameters, and the pre-strip condition information are stored in the test case library. Server 120 is querying and extracting After the test case identifier corresponding to the pre-condition information, the pre-use case generation information, the pre-use case template, and the pre-interface communication parameters corresponding to the pre-condition information are queried from the test case library.
在一个实施例中,服务器120从前置条件信息中提取前置用例生成信息和前置用例模板标识,在测试用例库中查询与提取到的前置用例模板标识对应的前置用例模板,从前置用例模板中提取接口参数标识,在测试用例库中查询与接口参数标识对应的前置接口通信参数。In an embodiment, the server 120 extracts the pre-use case generation information and the pre-use case template identifier from the pre-condition information, and queries the test-case database with the pre-use case template corresponding to the extracted pre-use case template identifier. The interface parameter identifier is extracted from the pre-use case template, and the pre-interface communication parameters corresponding to the interface parameter identifier are queried in the test case library.
S404,根据前置用例生成信息和前置用例模板生成前置测试用例。S404: Generate a pre-test case according to the pre-use case generation information and the pre-use case template.
在一个实施例中,前置用例生成信息中包括前置请求参数信息、前置返回参数信息和前置预期测试结果,前置用例模板为前置场景信息。服务器120根据前置用例生成信息和前置用例模板进行合并,通过合并得到前置测试用例。In an embodiment, the pre-use case generation information includes pre-request parameter information, pre-return parameter information, and pre-expected test result, and the pre-use case template is pre-scene information. The server 120 merges the pre-use case generation information and the pre-use case template, and obtains the pre-test case by merging.
S406,根据前置接口通信参数执行前置测试用例,得到测试用例标识对应的待测用例参数信息。S406: Perform a pre-test case according to the communication parameters of the pre-interface, and obtain parameter information of the test case corresponding to the test case identifier.
在一个实施例中,服务器120提取前置测试用例中的前置接口地址,按照前置接口通信参数对前置测试用例进行封装,根据前置接口地址将封装后的前置测试用例发送至前置接口,使前置接口执行前置测试用例,并根据前置测试用例生成与测试用例标识对应的待测用例参数信息。服务器120接口前置接口返回的待测用例参数信息。In one embodiment, the server 120 extracts the pre-interface address in the pre-test case, encapsulates the pre-test case according to the pre-interface communication parameters, and sends the encapsulated pre-test case to the front according to the pre-interface address. The interface is configured to execute the pre-test test case and generate the test case parameter information corresponding to the test case identifier according to the pre-test case. The parameter of the test case to be tested returned by the front interface of the server 120 interface.
本实施例中,在查询到关联的前置条件信息时,根据前置条件信息生成前置测试用例,根据生成的前置测试用例对前置接口进行测试,获取前置接口根据前置测试用例返回的测试用例标识对应待测用例参数信息,保证了待测用例参数的准确性。In this embodiment, when the associated precondition information is queried, a pre-test case is generated according to the pre-condition information, and the pre-interface is tested according to the generated pre-test case, and the pre-interface is obtained according to the pre-test case. The returned test case identifier corresponds to the parameter information of the test case to be tested, and the accuracy of the test case parameter is guaranteed.
如图5所示,在一个实施例中,S406具体包括获得待测用例参数信息的步骤,该步骤具体包括以下内容:As shown in FIG. 5, in an embodiment, S406 specifically includes the step of obtaining the use case parameter information, and the step specifically includes the following content:
S502,根据前置测试用例和前置接口通信参数,对前置测试用例中前置接口地址对应的前置接口进行测试,获取前置接口返回的参数信息。S502: Test the front interface corresponding to the address of the front interface in the pre-test case according to the communication parameters of the pre-test and the pre-interface, and obtain the parameter information returned by the pre-interface.
在一个实施例中,服务器120提取前置测试用例中的前置接口地址,提 取前置接口通信参数中的接口通信协议类型、接口通信模式和接口数据传输格式,根据提取到的接口通信协议类型、接口通信模式和接口数据传输格式对前置测试用例封装,得到前置接口测试请求。服务器120将前置接口测试请求发送至前置接口地址,接口前置接口根据前置接口测试请求返回的参数信息。In one embodiment, the server 120 extracts the pre-interface address in the pre-test case. The interface communication protocol type, the interface communication mode, and the interface data transmission format in the communication parameters of the front interface are obtained, and the pre-test case is encapsulated according to the extracted interface communication protocol type, the interface communication mode, and the interface data transmission format, and the front interface is obtained. Test request. The server 120 sends the pre-interface test request to the pre-interface address, and the interface pre-interface returns the parameter information according to the pre-interface test request.
S504,检测前置条件信息中是否存在数据查询条件。S504. Detect whether there is a data query condition in the precondition information.
在一个实施例中,数据查询条件包括数据库地址、数据标识和数据查询语句。前置条件信息中还可包括数据查询条件。服务器120通过前置条案信息中的数据查询标识确定是否存在数据查询条件。In one embodiment, the data query conditions include a database address, a data identification, and a data query statement. Data query conditions may also be included in the precondition information. The server 120 determines whether there is a data query condition by using the data query identifier in the pre-strip information.
S506,若检测到前置条件信息中存在数据查询条件,根据数据查询条件从数据库中查询数据。S506: If a data query condition exists in the precondition information, the data is queried from the database according to the data query condition.
在一个实施例中,服务器120在检测到前置条件信息中存在数据查询条件时,从前置条件信息中提取数据查询条件。服务器120根据数据查询条件中的数据库地址与数据库建立连接,根据数据查询语句通过连接从数据库中查询与数据标识对应的数据。In one embodiment, the server 120 extracts data query conditions from the pre-condition information when it detects that there is a data query condition in the pre-condition information. The server 120 establishes a connection with the database according to the database address in the data query condition, and queries the data corresponding to the data identifier from the database through the connection according to the data query statement.
S508,以获取到的参数信息和查询到的数据,作为测试用例标识对应的待测用例参数信息。S508. The obtained parameter information and the queried data are used as the test case parameter information corresponding to the test case identifier.
在一个实施例中,服务器120获取前置接口返回的参数信息和从数据库中查询到数据后,将获取到的参数信息和查询到的数据合并为测试用例标识对应的待测用例参数信息。In one embodiment, after obtaining the parameter information returned by the pre-interface and the data from the database, the server 120 merges the obtained parameter information and the queried data into the test case parameter information corresponding to the test case identifier.
本实施例中,在获取到前置接口返回的参数信息学后,可以根据前置条件信息中的数据查询条件从数据库中查询数据,根据获取到的参数信息和查询到的数据生成测试用例标识对应的待测用例参数信息,提高了待测用例参数信息的获取效率。In this embodiment, after obtaining the parameter information returned by the pre-interface, the data may be queried from the database according to the data query condition in the pre-condition information, and the test case identifier is generated according to the obtained parameter information and the queried data. The corresponding parameter information of the test case to be tested improves the acquisition efficiency of the parameter information of the test case to be tested.
如图6所示,在一个实施例中,S212具体包括测试待测接口的步骤,该步骤具体包括以下内容:As shown in FIG. 6, in an embodiment, S212 specifically includes the step of testing an interface to be tested, and the step specifically includes the following:
S602,提取待测接口通信参数中的接口通信协议类型、接口通信模式和 接口数据传输格式。S602. Extract an interface communication protocol type, an interface communication mode, and an interface communication parameter of the interface to be tested. Interface data transmission format.
其中,待测接口通信参数中包括接口通信协议类型、接口通信模式和接口数据传输格式。接口通信协议类型为待测试接口所支持的通信协议;接口通信模式为待测试接口所支持的通信协议;接口数据传输格式为待测试接口可以解析并支持的数据传输格式。The interface communication parameters to be tested 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 to be tested, and extracts the interface communication protocol type, the interface communication mode, and the interface data transmission format from the interface communication parameters by parsing.
S604,根据接口通信协议类型、接口通信模式、接口数据传输格式和待测接口测试用例生成待测接口测试请求。S604. Generate a test request for testing the interface according to the interface communication protocol type, the interface communication mode, the interface data transmission format, and the test instance to be tested.
在一个实施例中,服务器120将待测接口测试用例按照提取到的接口通信协议类型、接口通信模式和接口数据传输格式进行封装,封装得到待测接口所支持的待测接口测试请求。In one embodiment, the server 120 encapsulates the interface test case to be tested according to the extracted interface communication protocol type, the interface communication mode, and the interface data transmission format, and encapsulates the test interface test request supported by the interface to be tested.
S606,根据待测接口测试请求对待测接口测试用例中待测接口地址所对应的待测接口进行测试。S606: Test the interface to be tested corresponding to the interface address to be tested in the test instance of the interface to be tested according to the test of the interface to be tested.
在一个实施例中,待测接口测试用例中包括待测接口地址,待测接口地址为待测接口的唯一标识。服务器120从待测接口测试用例中提取待测接口地址,根据待测接口地址将待测接口测试请求发送至待测接口,以对待测接口进行测试。In an embodiment, the test interface of the interface to be tested includes the address of the interface to be tested, and the address of the interface to be tested is the unique identifier of the interface to be tested. The server 120 extracts the interface address to be tested from the interface test case to be tested, and sends the test interface test request to the interface to be tested according to the interface address to be tested, and tests the interface to be tested.
本实施例中,无需考虑根据待测接口的接口类型编写待测接口测试用例,直接根据待测接口通信参数中的接口通信协议类型、接口通信模式和接口数据传输格式进行封装对待测接口测试用例封装,生成待测试接口支持的待测接口测试请求,保证了根据待测接口测试请求对待测接口测试的成功率。In this embodiment, the test case of the interface to be tested is prepared according to the interface type of the interface to be tested, and the test case for the interface to be tested is directly encapsulated according to the interface communication protocol type, the interface communication mode, and the interface data transmission format in the communication parameters of the interface to be tested. The encapsulation generates a test request for the interface to be tested supported by the interface to be tested, and ensures the success rate of the test to be tested according to the test request of the interface to be tested.
如图7所示,在一个实施例中,提供一种接口测试装置700,该装置具体包括以下内容:测试指令获取模块702、前置条件查询模块704、参数信息获取模块706、用例模块获取模块708、测试用例生成模块710和待测接口测 试模块712。As shown in FIG. 7, in an embodiment, an interface testing apparatus 700 is provided. The apparatus specifically includes the following: a test instruction acquiring module 702, a precondition querying module 704, a parameter information acquiring module 706, and a use case module acquiring module. 708, the test case generation module 710 and the interface to be tested Test module 712.
测试指令获取模块702,用于获取接口测试指令。The test instruction acquisition module 702 is configured to obtain an interface test instruction.
前置条件查询模块704,用于查询与接口测试指令中的测试用例标识关联的前置条件信息。The pre-condition query module 704 is configured to query pre-condition information associated with the test case identifier in the interface test instruction.
参数信息获取模块706,用于根据前置条件信息获取测试用例标识对应的待测用例参数信息。The parameter information obtaining module 706 is configured to obtain the test case parameter information corresponding to the test case identifier according to the pre-condition information.
用例模块获取模块708,用于从测试用例库中获取与测试用例标识对应的待测用例模板和待测接口通信参数。The use case module obtaining module 708 is configured to obtain the test case template and the interface communication parameter to be tested corresponding to the test case identifier from the test case database.
测试用例生成模块710,用于根据待测用例参数信息和待测用例模板生成待测接口测试用例。The test case generation module 710 is configured to generate a test case for the interface to be tested according to the test case parameter information and the test case template to be tested.
待测接口测试模块712,用于根据待测接口测试用例和待测接口通信参数,对待测接口测试用例中待测接口地址所对应的待测接口进行测试。The interface to be tested 712 is configured to test the interface to be tested corresponding to the interface address to be tested in the test instance to be tested according to the test case of the interface to be tested and the communication parameters of the interface to be tested.
本实施例中,在接口测试过程中,在执行测试用例标识对应的测试用例之前,根据前置条件信息获取待测用例参数信息,根据获取到的待测用例参数信息和待测用例模板生成待测接口测试用例,并根据待测接口测试用例和待测接口通信参数,对待测接口测试。无需将与待测接口相关联的其他接口的测试用例内容写到待测接口测试用例中,只需通过测试用例标识与前置条件信息关联即可,节省了重复编写测试用例内容所耗费的时间,从而提高了根据测试用例对待测接口进行自动化测试的测试效率。In this embodiment, in the interface test process, before the test case corresponding to the test case identifier is executed, the parameter information of the test case is obtained according to the pre-condition information, and is generated according to the obtained test case parameter information and the test case template to be tested. Test the interface test case and test the interface according to the test case to be tested and the communication parameters of the interface to be tested. It is not necessary to write the test case content of other interfaces associated with the interface to be tested to the interface test case to be tested, and only need to associate the test case identifier with the pre-condition information, thereby saving the time spent repeatedly writing the test case content. , thereby improving the test efficiency of automated testing according to the test case interface to be tested.
如图8所示,在一个实施例中,测试用例库中包括多个测试计划信息,测试指令获取模块702之前具体包括以下内容:测试计划监测模块714、用例标识提取模块716和测试指令生成模块718。As shown in FIG. 8 , in one embodiment, the test case database includes a plurality of test plan information, and the test instruction acquisition module 702 specifically includes the following contents: a test plan monitoring module 714, a use case identification extraction module 716, and a test instruction generation module. 718.
测试计划监测模块714,用于监测测试计划信息中的测试开始时间。The test plan monitoring module 714 is configured to monitor the test start time in the test plan information.
用例标识提取模块716,用于当监测到当前时间与测试开始时间相同时,从测试计划信息中提取测试开始时间对应的测试用例标识。The use case identification extraction module 716 is configured to extract the test case identifier corresponding to the test start time from the test plan information when the current time is monitored and the test start time is the same.
测试指令生成模块718,用于根据提取到的测试用例标识生成待测接口测试指令。 The test instruction generating module 718 is configured to generate an interface test instruction to be tested according to the extracted test case identifier.
本实施例中,通过对各测试计划信息中的测试开始时间的监测,在监测到当前时间等于测试开始时间,根据该测试开始时间对应的测试计划信息生成接口测试指令,无需手动触发接口测试指令,减少了人工操作的干预。根据测试计划信息即可生成相应的接口测试指令,提高了生成接口测试指令的便利性。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.
如图9所示,在一个实施例中,参数信息获取模块706具体包括以下内容:前置信息查询模块706a、前置用例生成模块706b和用例参数获得模块706c。As shown in FIG. 9, in one embodiment, the parameter information obtaining module 706 specifically includes the following: a pre-information query module 706a, a pre-use case generation module 706b, and a use case parameter obtaining module 706c.
前置信息查询模块706a,用于从测试用例库中获取与前置条件信息对应的前置用例生成信息、前置用例模板和前置接口通信参数。The pre-information query module 706a is configured to obtain, from the test case library, the pre-use case generation information, the pre-use case template, and the pre-interface communication parameters corresponding to the pre-condition information.
前置用例生成模块706b,用于根据前置用例生成信息和前置用例模板生成前置测试用例。The pre-use case generation module 706b is configured to generate a pre-test case based on the pre-use case generation information and the pre-use case template.
用例参数获得模块706c,用于根据前置接口通信参数执行前置测试用例,得到测试用例标识对应的待测用例参数信息。The use case parameter obtaining module 706c is configured to execute the pre-test case according to the pre-interface communication parameter, and obtain the test case parameter information corresponding to the test case identifier.
本实施例中,在查询到关联的前置条件信息时,根据前置条件信息生成前置测试用例,根据生成的前置测试用例对前置接口进行测试,获取前置接口根据前置测试用例返回的测试用例标识对应待测用例参数信息,保证了待测用例参数的准确性。In this embodiment, when the associated precondition information is queried, a pre-test case is generated according to the pre-condition information, and the pre-interface is tested according to the generated pre-test case, and the pre-interface is obtained according to the pre-test case. The returned test case identifier corresponds to the parameter information of the test case to be tested, and the accuracy of the test case parameter is guaranteed.
在一个实施例中,用例参数获得模块706c还有于根据前置测试用例和前置接口通信参数,对前置测试用例中前置接口地址对应的前置接口进行测试,获取前置接口返回的参数信息;检测前置条件信息中是否存在数据查询条件;若检测到前置条件信息中存在数据查询条件,根据数据查询条件从数据库中查询数据;以获取到的参数信息和查询到的数据,作为测试用例标识对应的待测用例参数信息。In an embodiment, the use case parameter obtaining module 706c further tests the pre-interface corresponding to the pre-interface address in the pre-test case according to the pre-test case and the pre-interface communication parameters, and obtains the return of the pre-interface. Parameter information; whether there is a data query condition in the pre-condition information; if a data query condition exists in the pre-condition information, the data is queried from the database according to the data query condition; and the obtained parameter information and the queried data are The test case parameter information corresponding to the test case identifier.
本实施例中,在获取到前置接口返回的参数信息学后,可以根据前置条件信息中的数据查询条件从数据库中查询数据,根据获取到的参数信息和查询到的数据生成测试用例标识对应的待测用例参数信息,提高了待测用例参 数信息的获取效率。In this embodiment, after obtaining the parameter information returned by the pre-interface, the data may be queried from the database according to the data query condition in the pre-condition information, and the test case identifier is generated according to the obtained parameter information and the queried data. Corresponding test case parameter information improves the test case The efficiency of the acquisition of several information.
在一个实施例中,待测接口测试模块712还用于提取待测接口通信参数中的接口通信协议类型、接口通信模式和接口数据传输格式;根据接口通信协议类型、接口通信模式、接口数据传输格式和待测接口测试用例生成待测接口测试请求;根据待测接口测试请求对待测接口测试用例中待测接口地址所对应的待测接口进行测试。In an embodiment, the interface to be tested module 712 is further configured to extract an interface communication protocol type, an interface communication mode, and an interface data transmission format in the communication parameter of the interface to be tested; according to the interface communication protocol type, the interface communication mode, and the interface data transmission. The format and the test instance of the interface to be tested are generated to test the interface to be tested. The test interface to be tested in the test instance of the interface to be tested is tested according to the interface to be tested.
本实施例中,无需考虑根据待测接口的接口类型编写待测接口测试用例,直接根据待测接口通信参数中的接口通信协议类型、接口通信模式和接口数据传输格式进行封装对待测接口测试用例封装,生成待测试接口支持的待测接口测试请求,保证了根据待测接口测试请求对待测接口测试的成功率。In this embodiment, the test case of the interface to be tested is prepared according to the interface type of the interface to be tested, and the test case for the interface to be tested is directly encapsulated according to the interface communication protocol type, the interface communication mode, and the interface data transmission format in the communication parameters of the interface to be tested. The encapsulation generates a test request for the interface to be tested supported by the interface to be tested, and ensures the success rate of the test to be tested according to the test request of the interface to be tested.
上述接口测试装置中的各个模块可全部或部分通过软件、硬件及其组合来实现。其中,网络接口可以是以太网或无线网卡等。上述各模块可以硬件形式内嵌于或独立于服务器中的处理器中,也可以以软件形式存储于终端或服务器的存储器中,以便于处理器调用执行以上各个模块对应的操作。该处理器可以为中央处理单元(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.
在一个实施例中,提供了一种计算机设备,该计算机设备可以是服务器,也可以是移动终端。当该计算机设备为服务器时,其内部结构图可以如图10所示。该计算机设备包括通过系统总线连接的处理器、存储器和网络接口。其中,该计算机设备的处理器用于提供计算和控制能力。该计算机设备的存储器包括非易失性存储介质、内存储器。该非易失性存储介质存储有操作系统和计算机程序。该内存储器为非易失性存储介质中的操作系统和计算机程序的运行提供环境。该计算机设备的网络接口用于与外部的终端通过网络连接通信。该计算机程序被处理器执行时以实现一种接口测试方法。本领域技术人员可以理解,图10中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的计算机设备的限定,具体的计算机设备可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。 In one embodiment, a computer device is provided, which may be a server or a mobile terminal. When the computer device is a server, its internal structure diagram can be as shown in FIG. The computer device includes a processor, memory, and network interface coupled by a system bus. The processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes a non-volatile storage medium, an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for operation of an operating system and computer programs in a non-volatile storage medium. The network interface of the computer device is used to communicate with an external terminal via a network connection. The computer program is executed by the processor to implement an interface test method. It will be understood by those skilled in the art that the structure shown in FIG. 10 is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation of the computer device to which the solution of the present application is applied. The specific computer device may It includes more or fewer components than those shown in the figures, 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: perform an interface test And querying the pre-condition information associated with the test case identifier in the interface test command; obtaining the test case parameter information corresponding to the test case identifier according to the pre-condition information; and obtaining the test corresponding to the test case identifier from the test case database Use case template and communication parameters of the interface to be tested; generate test cases for the interface to be tested according to the parameter information of the test case and the test case template to be tested; and the interface address to be tested in the test case to be tested according to the test case of the interface to be tested and the communication parameters of the interface to be tested The corresponding interface to be tested is tested.
在一个实施例中,测试用例库中包括多个测试计划信息,获取接口测试指令之前,所述处理器执行所述计算机指令时实现以下步骤:监测测试计划信息中的测试开始时间;当监测到当前时间与测试开始时间相同时,从测试计划信息中提取测试开始时间对应的测试用例标识;根据提取到的测试用例标识生成待测接口测试指令。In one embodiment, the test case library includes a plurality of test plan information. Before the interface test instruction is acquired, the processor executes the computer step to: perform monitoring the test start time in the test plan information; When the current time is the same as the test start time, the test case identifier corresponding to the test start time is extracted from the test plan information; and the test interface test command is generated according to the extracted test case identifier.
在一个实施例中,根据前置条件信息获取测试用例标识对应的待测用例参数信息,包括:从测试用例库中获取与前置条件信息对应的前置用例生成信息、前置用例模板和前置接口通信参数;根据前置用例生成信息和前置用例模板生成前置测试用例;根据前置接口通信参数执行前置测试用例,得到测试用例标识对应的待测用例参数信息。In an embodiment, the parameter information of the test case corresponding to the test case identifier is obtained according to the pre-condition information, and the pre-use case generation information corresponding to the pre-condition information, the pre-use case template, and the front are obtained from the test case library. The interface communication parameters are set; the pre-test case is generated according to the pre-use case generation information and the pre-use case template; the pre-test case is executed according to the pre-interface communication parameters, and the test case parameter information corresponding to the test case identifier is obtained.
在一个实施例中,根据前置接口通信参数执行前置测试用例,得到测试用例标识对应的待测用例参数信息,包括:根据前置测试用例和前置接口通信参数,对前置测试用例中前置接口地址对应的前置接口进行测试,获取前置接口返回的参数信息;检测前置条件信息中是否存在数据查询条件;若检测到前置条件信息中存在数据查询条件,根据数据查询条件从数据库中查询 数据;以获取到的参数信息和查询到的数据,作为测试用例标识对应的待测用例参数信息。In an embodiment, the pre-test use case is executed according to the pre-interface communication parameter, and the test case parameter information corresponding to the test case identifier is obtained, including: according to the pre-test case and the pre-interface communication parameter, in the pre-test case The pre-interface corresponding to the address of the pre-interface is tested to obtain the parameter information returned by the pre-interface; whether the data query condition exists in the pre-condition information is detected; if the data query condition exists in the pre-condition information, according to the data query condition Query from the database Data; the obtained parameter information and the queried data are used as the test case parameter information corresponding to the test case identifier.
在一个实施例中,根据待测接口测试用例和待测接口通信参数,对待测接口测试用例中待测接口地址所对应的待测接口进行测试,包括:提取待测接口通信参数中的接口通信协议类型、接口通信模式和接口数据传输格式;根据接口通信协议类型、接口通信模式、接口数据传输格式和待测接口测试用例生成待测接口测试请求;根据待测接口测试请求对待测接口测试用例中待测接口地址所对应的待测接口进行测试。In an embodiment, the interface to be tested corresponding to the interface address to be tested in the test interface to be tested is tested according to the interface test case to be tested and the communication parameter of the interface to be tested, including: extracting interface communication in the communication parameter of the interface to be tested. Protocol type, interface communication mode, and interface data transmission format; generate test interface test request according to interface communication protocol type, interface communication mode, interface data transmission format, and test interface to be tested; test interface test case to be tested according to test interface to be tested Test the interface to be tested corresponding to the address of the interface to be tested.
本实施例中,在接口测试过程中,在执行测试用例标识对应的测试用例之前,根据前置条件信息获取待测用例参数信息,根据获取到的待测用例参数信息和待测用例模板生成待测接口测试用例,并根据待测接口测试用例和待测接口通信参数,对待测接口测试。无需将与待测接口相关联的其他接口的测试用例内容写到待测接口测试用例中,只需通过测试用例标识与前置条件信息关联即可,节省了重复编写测试用例内容所耗费的时间,从而提高了根据测试用例对待测接口进行自动化测试的测试效率。In this embodiment, in the interface test process, before the test case corresponding to the test case identifier is executed, the parameter information of the test case is obtained according to the pre-condition information, and is generated according to the obtained test case parameter information and the test case template to be tested. Test the interface test case and test the interface according to the test case to be tested and the communication parameters of the interface to be tested. It is not necessary to write the test case content of other interfaces associated with the interface to be tested to the interface test case to be tested, and only need to associate the test case identifier with the pre-condition information, thereby saving the time spent repeatedly writing the test case content. , thereby improving the test efficiency of automated testing according to the test case interface to be tested.
一种计算机可读存储介质,其上存储有计算机指令,所述计算机指令被处理器执行时实现以下步骤:获取接口测试指令;查询与接口测试指令中的测试用例标识关联的前置条件信息;根据前置条件信息获取测试用例标识对应的待测用例参数信息;从测试用例库中获取与测试用例标识对应的待测用例模板和待测接口通信参数;根据待测用例参数信息和待测用例模板生成待测接口测试用例;根据待测接口测试用例和待测接口通信参数,对待测接口测试用例中待测接口地址所对应的待测接口进行测试。A computer readable storage medium having stored thereon computer instructions that, when executed by a processor, implement the steps of: obtaining an interface test instruction; querying precondition information associated with the test case identification in the interface test instruction; Obtaining the test case parameter information corresponding to the test case identifier according to the precondition information; obtaining the test case template and the interface communication parameter corresponding to the test case identifier from the test case database; and according to the test case parameter information and the test case to be tested The template generates a test case for the interface to be tested. The interface to be tested in the test interface of the interface to be tested is tested according to the test case of the interface to be tested and the communication parameters of the interface to be tested.
在一个实施例中,测试用例库中包括多个测试计划信息,获取接口测试指令之前,处理器还执行以下步骤:监测测试计划信息中的测试开始时间;当监测到当前时间与测试开始时间相同时,从测试计划信息中提取测试开始时间对应的测试用例标识;根据提取到的测试用例标识生成待测接口测试指 令。In one embodiment, the test case library includes a plurality of test plan information. Before acquiring the interface test command, the processor further performs the following steps: monitoring the test start time in the test plan information; when monitoring the current time and the test start time At the same time, the test case identifier corresponding to the test start time is extracted from the test plan information; and the test interface to be tested is generated according to the extracted test case identifier make.
在一个实施例中,根据前置条件信息获取测试用例标识对应的待测用例参数信息,包括:从测试用例库中获取与前置条件信息对应的前置用例生成信息、前置用例模板和前置接口通信参数;根据前置用例生成信息和前置用例模板生成前置测试用例;根据前置接口通信参数执行前置测试用例,得到测试用例标识对应的待测用例参数信息。In an embodiment, the parameter information of the test case corresponding to the test case identifier is obtained according to the pre-condition information, and the pre-use case generation information corresponding to the pre-condition information, the pre-use case template, and the front are obtained from the test case library. The interface communication parameters are set; the pre-test case is generated according to the pre-use case generation information and the pre-use case template; the pre-test case is executed according to the pre-interface communication parameters, and the test case parameter information corresponding to the test case identifier is obtained.
在一个实施例中,根据前置接口通信参数执行前置测试用例,得到测试用例标识对应的待测用例参数信息,包括:根据前置测试用例和前置接口通信参数,对前置测试用例中前置接口地址对应的前置接口进行测试,获取前置接口返回的参数信息;检测前置条件信息中是否存在数据查询条件;若检测到前置条件信息中存在数据查询条件,根据数据查询条件从数据库中查询数据;以获取到的参数信息和查询到的数据,作为测试用例标识对应的待测用例参数信息。In an embodiment, the pre-test use case is executed according to the pre-interface communication parameter, and the test case parameter information corresponding to the test case identifier is obtained, including: according to the pre-test case and the pre-interface communication parameter, in the pre-test case The pre-interface corresponding to the address of the pre-interface is tested to obtain the parameter information returned by the pre-interface; whether the data query condition exists in the pre-condition information is detected; if the data query condition exists in the pre-condition information, according to the data query condition The data is queried from the database; the obtained parameter information and the queried data are used as the test case parameter information corresponding to the test case identifier.
在一个实施例中,根据待测接口测试用例和待测接口通信参数,对待测接口测试用例中待测接口地址所对应的待测接口进行测试,包括:提取待测接口通信参数中的接口通信协议类型、接口通信模式和接口数据传输格式;根据接口通信协议类型、接口通信模式、接口数据传输格式和待测接口测试用例生成待测接口测试请求;根据待测接口测试请求对待测接口测试用例中待测接口地址所对应的待测接口进行测试。In an embodiment, the interface to be tested corresponding to the interface address to be tested in the test interface to be tested is tested according to the interface test case to be tested and the communication parameter of the interface to be tested, including: extracting interface communication in the communication parameter of the interface to be tested. Protocol type, interface communication mode, and interface data transmission format; generate test interface test request according to interface communication protocol type, interface communication mode, interface data transmission format, and test interface to be tested; test interface test case to be tested according to test interface to be tested Test the interface to be tested corresponding to the address of the interface to be tested.
本实施例中,在接口测试过程中,在执行测试用例标识对应的测试用例之前,根据前置条件信息获取待测用例参数信息,根据获取到的待测用例参数信息和待测用例模板生成待测接口测试用例,并根据待测接口测试用例和待测接口通信参数,对待测接口测试。无需将与待测接口相关联的其他接口的测试用例内容写到待测接口测试用例中,只需通过测试用例标识与前置条件信息关联即可,节省了重复编写测试用例内容所耗费的时间,从而提高了根据测试用例对待测接口进行自动化测试的测试效率。In this embodiment, in the interface test process, before the test case corresponding to the test case identifier is executed, the parameter information of the test case is obtained according to the pre-condition information, and is generated according to the obtained test case parameter information and the test case template to be tested. Test the interface test case and test the interface according to the test case to be tested and the communication parameters of the interface to be tested. It is not necessary to write the test case content of other interfaces associated with the interface to be tested to the interface test case to be tested, and only need to associate the test case identifier with the pre-condition information, thereby saving the time spent repeatedly writing the test case content. , thereby improving the test efficiency of automated testing according to the test case interface to be tested.
根据本实施例的一个示例,上述实施例方法中的全部或部分流程,可以 通过计算机可执行指令来指令相关的硬件来完成,所述计算机可执行指令可存储于一计算机可读取存储介质中,如本申请实施例中,该计算机可执行指令可存储于计算机系统的存储介质中,并被该计算机系统中的至少一个处理器执行,以实现包括如上述各方法的实施例的流程。该存储介质包括但不限于磁碟、优盘、光盘、只读存储记忆体(Read-Only Memory,ROM)等。According to an example of the embodiment, all or part of the processes in the foregoing embodiment may be The computer-executable instructions can be stored in a computer readable storage medium, as in the embodiment of the present application, the computer executable instructions can be stored in a storage of the computer system. The medium is executed by at least one processor in the computer system to implement a process 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 an interface test instruction;
    查询与所述接口测试指令中的测试用例标识关联的前置条件信息;Querying precondition information associated with the test case identifier in the interface test command;
    根据所述前置条件信息获取所述测试用例标识对应的待测用例参数信息;Acquiring the test case parameter information corresponding to the test case identifier according to the precondition information;
    从测试用例库中获取与所述测试用例标识对应的待测用例模板和待测接口通信参数;Obtaining a test case template to be tested and a communication parameter of the interface to be tested corresponding to the test case identifier from the test case library;
    根据所述待测用例参数信息和所述待测用例模板生成待测接口测试用例;及Generating a test case for the interface to be tested according to the test case parameter information and the test case template; and
    根据所述待测接口测试用例和所述待测接口通信参数,对所述待测接口测试用例中待测接口地址所对应的待测接口进行测试。The interface to be tested corresponding to the interface address to be tested in the test case of the interface to be tested is tested according to the test interface of the interface to be tested and the communication parameter of the interface to be tested.
  2. 根据权利要求1所述的方法,其特征在于,测试用例库中包括多个测试计划信息;The method of claim 1 wherein the test case library includes a plurality of test plan information;
    在所述获取接口测试指令之前,所述方法还包括:Before the obtaining the interface test command, the method further includes:
    监测所述测试计划信息中的测试开始时间;Monitoring a test start time in the test plan information;
    当监测到当前时间与所述测试开始时间相同时,从所述测试计划信息中提取所述测试开始时间对应的测试用例标识;及When the current time is monitored to be the same as the test start time, the test case identifier corresponding to the test start time is extracted from the test plan information; and
    根据提取到的测试用例标识生成待测接口测试指令。The test interface test command to be tested is generated according to the extracted test case identifier.
  3. 根据权利要求1所述的方法,其特征在于,所述根据所述前置条件信息获取所述测试用例标识对应的待测用例参数信息,包括:The method according to claim 1, wherein the obtaining the test case parameter information corresponding to the test case identifier according to the pre-condition information includes:
    从测试用例库中获取与所述前置条件信息对应的前置用例生成信息、前置用例模板和前置接口通信参数;Obtaining pre-use case generation information, pre-use case template, and pre-interface communication parameters corresponding to the pre-condition information from the test case library;
    根据所述前置用例生成信息和所述前置用例模板生成前置测试用例;及Generating a pre-test case according to the pre-use case generation information and the pre-use case template; and
    根据所述前置接口通信参数执行所述前置测试用例,得到所述测试用例标识对应的待测用例参数信息。The pre-test case is executed according to the pre-interface communication parameter, and the test case parameter information corresponding to the test case identifier is obtained.
  4. 根据权利要求3所述的方法,其特征在于,所述根据所述前置接口通 信参数执行所述前置测试用例,得到所述测试用例标识对应的待测用例参数信息,包括:The method according to claim 3, wherein said according to said pre-interface The parameter of the test uses the pre-test case to obtain the test case parameter information corresponding to the test case identifier, including:
    根据所述前置测试用例和所述前置接口通信参数,对所述前置测试用例中前置接口地址对应的前置接口进行测试,获取所述前置接口返回的参数信息;And performing a test on the pre-interface corresponding to the pre-interface address in the pre-test case, and obtaining the parameter information returned by the pre-interface according to the pre-test case and the pre-interface communication parameter;
    检测所述前置条件信息中是否存在数据查询条件;Detecting whether there is a data query condition in the precondition information;
    若检测到所述前置条件信息中存在数据查询条件,根据所述数据查询条件从数据库中查询数据;及If the data query condition exists in the precondition information, the data is queried from the database according to the data query condition; and
    以获取到的参数信息和查询到的数据,作为测试用例标识对应的待测用例参数信息。The obtained parameter information and the queried data are used as the test case parameter information corresponding to the test case identifier.
  5. 根据权利要求1所述的方法,其特征在于,所述根据所述待测接口测试用例和所述待测接口通信参数,对所述待测接口测试用例中待测接口地址所对应的待测接口进行测试,包括:The method according to claim 1, wherein the test interface of the interface to be tested and the communication parameter of the interface to be tested are tested according to the address of the interface to be tested in the test case of the interface to be tested. The interface is tested, including:
    提取所述待测接口通信参数中的接口通信协议类型、接口通信模式和接口数据传输格式;Extracting an interface communication protocol type, an interface communication mode, and an interface data transmission format in the communication parameter of the interface to be tested;
    根据所述接口通信协议类型、接口通信模式、接口数据传输格式和所述待测接口测试用例生成待测接口测试请求;及Generating an interface test request to be tested according to the interface communication protocol type, the interface communication mode, the interface data transmission format, and the test instance to be tested; and
    根据所述待测接口测试请求对所述待测接口测试用例中待测接口地址所对应的待测接口进行测试。Testing the interface to be tested corresponding to the interface address to be tested in the test instance of the interface to be tested according to the test request of the interface to be tested.
  6. 一种接口测试装置,包括:An interface testing device includes:
    测试指令获取模块,用于获取接口测试指令;a test instruction acquisition module, configured to acquire an interface test instruction;
    前置条件查询模块,用于查询与所述接口测试指令中的测试用例标识关联的前置条件信息;a pre-condition query module, configured to query pre-condition information associated with the test case identifier in the interface test instruction;
    参数信息获取模块,用于根据所述前置条件信息获取所述测试用例标识对应的待测用例参数信息;a parameter information obtaining module, configured to acquire, according to the pre-condition information, the parameter information of the test case corresponding to the test case identifier;
    用例模块获取模块,用于从测试用例库中获取与所述测试用例标识对应 的待测用例模板和待测接口通信参数;a use case module obtaining module, configured to obtain, from the test case library, corresponding to the test case identifier The test case template to be tested and the communication parameters of the interface to be tested;
    测试用例生成模块,用于根据所述待测用例参数信息和所述待测用例模板生成待测接口测试用例;及a test case generating module, configured to generate a test case for testing the interface according to the test case parameter information and the test case template; 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 of the interface to be tested, according to the test case of the interface to be tested and the communication parameter of the interface to be tested.
  7. 根据权利要求6所述的装置,其特征在于,测试用例库中包括多个测试计划信息;接口测试装置还包括:The device according to claim 6, wherein the test case library includes a plurality of test plan information; the interface test device further comprises:
    测试计划监测模块,用于监测所述测试计划信息中的测试开始时间;a test plan monitoring module for monitoring a test start time in the test plan information;
    用例标识提取模块,用于当监测到当前时间与所述测试开始时间相同时,从所述测试计划信息中提取所述测试开始时间对应的测试用例标识;及a use case identifier extraction module, configured to extract, from the test plan information, a test case identifier corresponding to the test start time when the current time is detected to be the same as the test start time; and
    测试指令生成模块,用于根据提取到的测试用例标识生成待测接口测试指令。The test instruction generating module is configured to generate an interface test instruction to be tested according to the extracted test case identifier.
  8. 根据权利要求6所述的装置,其特征在于,所述参数信息获取模块,包括:The device according to claim 6, wherein the parameter information obtaining module comprises:
    前置信息查询模块,用于在查询到存在关联的前置条件信息时,从测试用例库中获取与所述前置条件信息对应的前置用例生成信息、前置用例模板和前置接口通信参数;The pre-information query module is configured to obtain pre-use case generation information, pre-use case template and pre-interface communication corresponding to the pre-condition information from the test case library when the pre-condition information associated with the existence is queried parameter;
    前置用例生成模块,用于根据所述前置用例生成信息和所述前置用例模板生成前置测试用例;及a pre-use case generating module, configured to generate a pre-test case according to the pre-use case generation information and the pre-use case template; and
    用例参数获得模块,用于根据所述前置接口通信参数执行所述前置测试用例,得到所述测试用例标识对应的待测用例参数信息。The use case parameter obtaining module is configured to execute the pre-test case according to the pre-interface communication parameter, and obtain the test case parameter information corresponding to the test case identifier.
  9. 根据权利要求8所述的装置,其特征在于,所述用例参数获得模块还有于根据所述前置测试用例和所述前置接口通信参数,对所述前置测试用例中前置接口地址对应的前置接口进行测试,获取所述前置接口返回的参数信息;检测所述前置条件信息中是否存在数据查询条件;若检测到所述前置条件信息中存在数据查询条件,根据所述数据查询条件从数据库中查询数据; 以获取到的参数信息和查询到的数据,作为测试用例标识对应的待测用例参数信息。The device according to claim 8, wherein the use case parameter obtaining module further comprises a pre-interface address in the pre-test case according to the pre-test case and the pre-interface communication parameter. The corresponding pre-interface is tested to obtain the parameter information returned by the pre-interface; and the data query condition is detected in the pre-condition information; if the data query condition exists in the pre-condition information, The data query condition queries the data from the database; The obtained parameter information and the queried data are used as the test case parameter information corresponding to the test case identifier.
  10. 根据权利要求6所述的装置,其特征在于,所述待测接口测试模块还用于提取所述待测接口通信参数中的接口通信协议类型、接口通信模式和接口数据传输格式;根据所述接口通信协议类型、接口通信模式、接口数据传输格式和所述待测接口测试用例生成待测接口测试请求;及根据所述待测接口测试请求对所述待测接口测试用例中待测接口地址所对应的待测接口进行测试。The apparatus according to claim 6, wherein the interface to be tested is further configured to extract an interface communication protocol type, an interface communication mode, and an interface data transmission format in the communication parameter of the interface to be tested; The interface communication protocol type, the interface communication mode, the interface data transmission format, and the test interface to be tested to generate a test interface request to be tested; and the interface address to be tested in the test case of the interface to be tested according to the test request of the interface to be tested The corresponding interface to be tested is tested.
  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 an interface test instruction;
    查询与所述接口测试指令中的测试用例标识关联的前置条件信息;Querying precondition information associated with the test case identifier in the interface test command;
    根据所述前置条件信息获取所述测试用例标识对应的待测用例参数信息;Acquiring the test case parameter information corresponding to the test case identifier according to the precondition information;
    从测试用例库中获取与所述测试用例标识对应的待测用例模板和待测接口通信参数;Obtaining a test case template to be tested and a communication parameter of the interface to be tested corresponding to the test case identifier from the test case library;
    根据所述待测用例参数信息和所述待测用例模板生成待测接口测试用例;及Generating a test case for the interface to be tested according to the test case parameter information and the test case template; and
    根据所述待测接口测试用例和所述待测接口通信参数,对所述待测接口测试用例中待测接口地址所对应的待测接口进行测试。The interface to be tested corresponding to the interface address to be tested in the test case of the interface to be tested is tested according to the test interface of the interface to be tested and the communication parameter of the interface to be tested.
  12. 根据权利要求11所述的计算机设备,其特征在于,测试用例库中包括多个测试计划信息;在所述获取接口测试指令之前,所述处理器执行所述计算机指令时还实现以下步骤:The computer device according to claim 11, wherein the test case library includes a plurality of test plan information; and before the obtaining the interface test command, the processor further implements the following steps when the computer command is executed:
    监测所述测试计划信息中的测试开始时间;Monitoring a test start time in the test plan information;
    当监测到当前时间与所述测试开始时间相同时,从所述测试计划信息中 提取所述测试开始时间对应的测试用例标识;及When the current time is monitored to be the same as the test start time, from the test plan information Extracting a test case identifier corresponding to the test start time; and
    根据提取到的测试用例标识生成待测接口测试指令。The test interface test command to be tested is generated according to the extracted test case identifier.
  13. 根据权利要求11所述的计算机设备,其特征在于,所述根据所述前置条件信息获取所述测试用例标识对应的待测用例参数信息,包括:The computer device according to claim 11, wherein the obtaining the test case parameter information corresponding to the test case identifier according to the pre-condition information includes:
    从测试用例库中获取与所述前置条件信息对应的前置用例生成信息、前置用例模板和前置接口通信参数;Obtaining pre-use case generation information, pre-use case template, and pre-interface communication parameters corresponding to the pre-condition information from the test case library;
    根据所述前置用例生成信息和所述前置用例模板生成前置测试用例;及Generating a pre-test case according to the pre-use case generation information and the pre-use case template; and
    根据所述前置接口通信参数执行所述前置测试用例,得到所述测试用例标识对应的待测用例参数信息。The pre-test case is executed according to the pre-interface communication parameter, and the test case parameter information corresponding to the test case identifier is obtained.
  14. 根据权利要求13所述的计算机设备,其特征在于,所述根据所述前置接口通信参数执行所述前置测试用例,得到所述测试用例标识对应的待测用例参数信息,包括:The computer device according to claim 13, wherein the performing the pre-test use case according to the pre-interface communication parameter, and obtaining the test case parameter information corresponding to the test case identifier, comprising:
    根据所述前置测试用例和所述前置接口通信参数,对所述前置测试用例中前置接口地址对应的前置接口进行测试,获取所述前置接口返回的参数信息;And performing a test on the pre-interface corresponding to the pre-interface address in the pre-test case, and obtaining the parameter information returned by the pre-interface according to the pre-test case and the pre-interface communication parameter;
    检测所述前置条件信息中是否存在数据查询条件;Detecting whether there is a data query condition in the precondition information;
    若检测到所述前置条件信息中存在数据查询条件,根据所述数据查询条件从数据库中查询数据;及If the data query condition exists in the precondition information, the data is queried from the database according to the data query condition; and
    以获取到的参数信息和查询到的数据,作为测试用例标识对应的待测用例参数信息。The obtained parameter information and the queried data are used as the test case parameter information corresponding to the test case identifier.
  15. 根据权利要求11所述的计算机设备,其特征在于,所述根据所述待测接口测试用例和所述待测接口通信参数,对所述待测接口测试用例中待测接口地址所对应的待测接口进行测试,包括:The computer device according to claim 11, wherein the device corresponding to the interface to be tested in the test case of the interface to be tested is corresponding to the test interface of the interface to be tested and the communication parameter of the interface to be tested. Test interface to test, including:
    提取所述待测接口通信参数中的接口通信协议类型、接口通信模式和接口数据传输格式;Extracting an interface communication protocol type, an interface communication mode, and an interface data transmission format in the communication parameter of the interface to be tested;
    根据所述接口通信协议类型、接口通信模式、接口数据传输格式和所述待测接口测试用例生成待测接口测试请求;及 Generating an interface test request to be tested according to the interface communication protocol type, the interface communication mode, the interface data transmission format, and the test instance to be tested; and
    根据所述待测接口测试请求对所述待测接口测试用例中待测接口地址所对应的待测接口进行测试。Testing the interface to be tested corresponding to the interface address to be tested in the test instance of the interface to be tested according to the test request of the interface to be tested.
  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 an interface test instruction;
    查询与所述接口测试指令中的测试用例标识关联的前置条件信息;Querying precondition information associated with the test case identifier in the interface test command;
    根据所述前置条件信息获取所述测试用例标识对应的待测用例参数信息;Acquiring the test case parameter information corresponding to the test case identifier according to the precondition information;
    从测试用例库中获取与所述测试用例标识对应的待测用例模板和待测接口通信参数;Obtaining a test case template to be tested and a communication parameter of the interface to be tested corresponding to the test case identifier from the test case library;
    根据所述待测用例参数信息和所述待测用例模板生成待测接口测试用例;及Generating a test case for the interface to be tested according to the test case parameter information and the test case template; and
    根据所述待测接口测试用例和所述待测接口通信参数,对所述待测接口测试用例中待测接口地址所对应的待测接口进行测试。The interface to be tested corresponding to the interface address to be tested in the test case of the interface to be tested is tested according to the test interface of the interface to be tested and the communication parameter of the interface to be tested.
  17. 根据权利要求16所述的存储介质,其特征在于,测试用例库中包括多个测试计划信息;在所述获取接口测试指令之前,所述计算机指令被处理器执行时还实现以下步骤:The storage medium according to claim 16, wherein the test case library includes a plurality of test plan information; and the computer instructions are further executed by the processor before the obtaining the interface test command:
    监测所述测试计划信息中的测试开始时间;Monitoring a test start time in the test plan information;
    当监测到当前时间与所述测试开始时间相同时,从所述测试计划信息中提取所述测试开始时间对应的测试用例标识;及When the current time is monitored to be the same as the test start time, the test case identifier corresponding to the test start time is extracted from the test plan information; and
    根据提取到的测试用例标识生成待测接口测试指令。The test interface test command to be tested is generated according to the extracted test case identifier.
  18. 根据权利要求16所述的存储介质,其特征在于,所述根据所述前置条件信息获取所述测试用例标识对应的待测用例参数信息,包括:The storage medium according to claim 16, wherein the obtaining the test case parameter information corresponding to the test case identifier according to the pre-condition information includes:
    从测试用例库中获取与所述前置条件信息对应的前置用例生成信息、前置用例模板和前置接口通信参数;Obtaining pre-use case generation information, pre-use case template, and pre-interface communication parameters corresponding to the pre-condition information from the test case library;
    根据所述前置用例生成信息和所述前置用例模板生成前置测试用例;及 Generating a pre-test case according to the pre-use case generation information and the pre-use case template; and
    根据所述前置接口通信参数执行所述前置测试用例,得到所述测试用例标识对应的待测用例参数信息。The pre-test case is executed according to the pre-interface communication parameter, and the test case parameter information corresponding to the test case identifier is obtained.
  19. 根据权利要求18所述的存储介质,其特征在于,所述根据所述前置接口通信参数执行所述前置测试用例,得到所述测试用例标识对应的待测用例参数信息,包括:The storage medium according to claim 18, wherein the performing the pre-test use case according to the pre-interface communication parameter, and obtaining the test case parameter information corresponding to the test case identifier, comprising:
    根据所述前置测试用例和所述前置接口通信参数,对所述前置测试用例中前置接口地址对应的前置接口进行测试,获取所述前置接口返回的参数信息;And performing a test on the pre-interface corresponding to the pre-interface address in the pre-test case, and obtaining the parameter information returned by the pre-interface according to the pre-test case and the pre-interface communication parameter;
    检测所述前置条件信息中是否存在数据查询条件;Detecting whether there is a data query condition in the precondition information;
    若检测到所述前置条件信息中存在数据查询条件,根据所述数据查询条件从数据库中查询数据;及If the data query condition exists in the precondition information, the data is queried from the database according to the data query condition; and
    以获取到的参数信息和查询到的数据,作为测试用例标识对应的待测用例参数信息。The obtained parameter information and the queried data are used as the test case parameter information corresponding to the test case identifier.
  20. 根据权利要求16所述的存储介质,其特征在于,所述根据所述待测接口测试用例和所述待测接口通信参数,对所述待测接口测试用例中待测接口地址所对应的待测接口进行测试,包括:The storage medium according to claim 16, wherein the interface corresponding to the interface to be tested in the test case of the interface to be tested is determined according to the test case of the interface to be tested and the communication parameter of the interface to be tested. Test interface to test, including:
    提取所述待测接口通信参数中的接口通信协议类型、接口通信模式和接口数据传输格式;Extracting an interface communication protocol type, an interface communication mode, and an interface data transmission format in the communication parameter of the interface to be tested;
    根据所述接口通信协议类型、接口通信模式、接口数据传输格式和所述待测接口测试用例生成待测接口测试请求;及Generating an interface test request to be tested according to the interface communication protocol type, the interface communication mode, the interface data transmission format, and the test instance to be tested; and
    根据所述待测接口测试请求对所述待测接口测试用例中待测接口地址所对应的待测接口进行测试。 Testing the interface to be tested corresponding to the interface address to be tested in the test instance of the interface to be tested according to the test request of the interface to be tested.
PCT/CN2017/112618 2017-10-31 2017-11-23 Interface test method and apparatus, computer device and storage medium WO2019085079A1 (en)

Applications Claiming Priority (2)

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

Publications (1)

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

Family

ID=61681160

Family Applications (1)

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

Country Status (2)

Country Link
CN (1) CN107844421B (en)
WO (1) WO2019085079A1 (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111427790A (en) * 2020-03-26 2020-07-17 中国建设银行股份有限公司 Test method, test device, terminal equipment and storage medium

Families Citing this family (31)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109726105B (en) * 2018-05-15 2023-11-28 深圳市易行网数字科技有限公司 Test data construction method, device, equipment and storage medium
CN108984387A (en) * 2018-05-30 2018-12-11 湖南鑫蜀山网络科技有限公司 Interface test device applied to computer
CN108733573A (en) * 2018-05-30 2018-11-02 湖南鑫蜀山网络科技有限公司 The interface testing equipment that application interface test method is tested
CN109086199B (en) * 2018-06-22 2022-06-07 网宿科技股份有限公司 Method, terminal and storage medium for automatically generating test script
CN109254920A (en) * 2018-09-06 2019-01-22 上海精数信息科技有限公司 Interface testing case generation method, device, electronic equipment, storage medium
CN109446068B (en) * 2018-09-26 2024-04-05 平安健康保险股份有限公司 Interface test method, device, computer equipment and storage medium
CN109446071A (en) * 2018-09-26 2019-03-08 深圳壹账通智能科技有限公司 Interface test method, interface test device, electronic equipment and storage medium
CN109522218A (en) * 2018-10-19 2019-03-26 平安科技(深圳)有限公司 Interface test method, device, computer equipment and storage medium
CN111090575B (en) * 2018-10-23 2021-07-30 亿度慧达教育科技(北京)有限公司 Test method
CN109474488B (en) * 2018-10-31 2020-10-27 中国银行股份有限公司 Interface testing method and device and computer equipment
CN109710532A (en) * 2018-12-28 2019-05-03 北京金山安全软件有限公司 Test case management method and device and electronic equipment
CN109871314A (en) * 2019-01-02 2019-06-11 石化盈科信息技术有限责任公司 The automatic generation method of test script
CN109815144A (en) * 2019-01-16 2019-05-28 深圳壹账通智能科技有限公司 Service application test method, device, computer equipment and storage medium
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
CN110134583B (en) * 2019-04-11 2023-06-16 口碑(上海)信息技术有限公司 Software testing and data processing method and device
CN110147319B (en) * 2019-04-19 2022-09-20 平安普惠企业管理有限公司 Database testing method and device and computer equipment
CN110569198A (en) * 2019-09-18 2019-12-13 北京搜狐新媒体信息技术有限公司 Method and device for automatically testing service function
CN112988555B (en) * 2019-12-13 2024-05-24 中移信息技术有限公司 Interface testing method, device, equipment and storage medium
CN113297056A (en) * 2020-02-24 2021-08-24 阿里巴巴集团控股有限公司 Test data setting method, test data application method, device and related equipment
CN111459794B (en) * 2020-02-25 2024-03-15 西安广和通无线软件有限公司 Communication network testing method, device, computer equipment and storage medium
CN111538659B (en) * 2020-04-21 2024-03-01 上海携程商务有限公司 Interface testing method, system, electronic equipment and storage medium of business scene
CN111611174B (en) * 2020-05-28 2023-08-11 北京火山引擎科技有限公司 Method and device for constructing test data, computer equipment and storage medium
CN114077540A (en) * 2020-08-21 2022-02-22 北京金山云网络技术有限公司 Interface test system and interface test method
CN114205273B (en) * 2020-08-26 2023-09-15 腾讯科技(深圳)有限公司 System test method, device and equipment and computer storage medium
CN112162915B (en) * 2020-08-27 2024-06-25 杭州大搜车汽车服务有限公司 Test data generation method, device, equipment and storage medium
CN112231209B (en) * 2020-10-10 2024-09-06 金医慧通科技有限公司 Parameter acquisition method, device, computer equipment and storage medium
CN112256571A (en) * 2020-10-20 2021-01-22 苏州市软件评测中心有限公司 Test case generation method and device and storage medium
CN112699020A (en) * 2020-12-11 2021-04-23 浙江中控技术股份有限公司 Industrial real-time database API (application program interface) interface testing method
CN112559356B (en) * 2020-12-18 2024-07-12 杭州兑吧网络科技有限公司 Automatic software testing method and system
CN113220595B (en) * 2021-06-11 2023-10-03 中国农业银行股份有限公司 Test method and test equipment

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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
CN106250310A (en) * 2016-07-25 2016-12-21 微梦创科网络科技(中国)有限公司 A kind of method for generating test case and device
CN106354634A (en) * 2016-08-25 2017-01-25 青岛海信传媒网络技术有限公司 Interface testing method and device
CN106933745A (en) * 2017-03-30 2017-07-07 携程计算机技术(上海)有限公司 WEB automatic interface testing methods and system

Family Cites Families (20)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US5390325A (en) * 1992-12-23 1995-02-14 Taligent, Inc. Automated testing system
US5881219A (en) * 1996-12-26 1999-03-09 International Business Machines Corporation Random reliability engine for testing distributed environments
US6823507B1 (en) * 2000-06-06 2004-11-23 International Business Machines Corporation Detection of memory-related errors in computer programs
US7844951B2 (en) * 2005-12-30 2010-11-30 Microsoft Corporation Specification generation from implementations
US8683446B2 (en) * 2007-07-09 2014-03-25 International Business Machines Corporation Generation of test cases for functional testing of applications
CN102096631B (en) * 2009-12-11 2013-09-25 华为技术有限公司 Interface testing method and device
CN102831052B (en) * 2011-06-16 2016-03-09 中国银联股份有限公司 Test exemple automation generating apparatus and method
CN103617114B (en) * 2013-10-23 2016-03-02 江苏大学 Based on third party's component vulnerability test method of condition and parameter variation
CN104331366A (en) * 2014-10-30 2015-02-04 北京思特奇信息技术股份有限公司 Test case design efficiency promotion method and system
CN105630667A (en) * 2014-11-28 2016-06-01 阿里巴巴集团控股有限公司 Test method and terminal equipment
CN105183633A (en) * 2015-07-21 2015-12-23 浪潮电子信息产业股份有限公司 Method and system for generating test case
US9501389B1 (en) * 2015-08-20 2016-11-22 International Business Machines Corporation Test machine management
CN105224461B (en) * 2015-10-23 2018-01-26 网易(杭州)网络有限公司 A kind of generation method and device of integration testing use-case
CN105630685A (en) * 2016-01-29 2016-06-01 广州酷狗计算机科技有限公司 Method and device for testing program interface
CN106227667B (en) * 2016-07-28 2019-03-19 南京大学 A kind of method for generating test case of the mobile application of the IFML based on extension
CN106294162B (en) * 2016-08-12 2019-03-05 江苏大学 A kind of third party's component method for testing security based on data mining
CN106776307A (en) * 2016-12-05 2017-05-31 广州唯品会信息科技有限公司 Method for testing software and system
CN106708739A (en) * 2016-12-30 2017-05-24 桂林电子科技大学 Extended finite state machine (EFSM) model-based Web service case generation method and system
CN106997322B (en) * 2017-02-15 2022-04-26 网易宝有限公司 Method and apparatus for automated testing
CN107193740A (en) * 2017-05-23 2017-09-22 郑州云海信息技术有限公司 The software test case test system and method for a kind of Reuse-Oriented

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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
CN106250310A (en) * 2016-07-25 2016-12-21 微梦创科网络科技(中国)有限公司 A kind of method for generating test case and device
CN106354634A (en) * 2016-08-25 2017-01-25 青岛海信传媒网络技术有限公司 Interface testing method and device
CN106933745A (en) * 2017-03-30 2017-07-07 携程计算机技术(上海)有限公司 WEB automatic interface testing methods and system

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111427790A (en) * 2020-03-26 2020-07-17 中国建设银行股份有限公司 Test method, test device, terminal equipment and storage medium

Also Published As

Publication number Publication date
CN107844421B (en) 2020-08-14
CN107844421A (en) 2018-03-27

Similar Documents

Publication Publication Date Title
WO2019085079A1 (en) Interface test method and apparatus, computer device and storage medium
WO2019085073A1 (en) Interface test method and apparatus, computer device, and storage medium
CN107665233B (en) Database data processing method and device, computer equipment and storage medium
WO2019091217A1 (en) Script debugging method and device, and computer storage medium
CN108521353B (en) Processing method and device for positioning performance bottleneck and readable storage medium
WO2019161619A1 (en) Automatic interface test method and apparatus, and device and computer-readable storage medium
WO2018036273A1 (en) Simulation test method, server, device, and computer-readable storage medium
CN106484611B (en) Fuzzy test method and device based on automatic protocol adaptation
CN107241315B (en) Access method and device of bank gateway interface and computer readable storage medium
WO2019214109A1 (en) Monitoring device and method for testing process, and computer readable storage medium
CN108459850B (en) Method, device and system for generating test script
WO2019218513A1 (en) Apparatus and method for monitoring testing process, and computer-readable storage medium
WO2018184361A1 (en) Application test method, server, terminal, and storage media
CN113032244B (en) Interface test method, device, computer system and computer readable storage medium
CN104516732A (en) Application crash report method and system
WO2016202000A1 (en) Differential rollback upgrading method and apparatus
CN111831542B (en) API application debugging method and device and storage medium
CN113138757B (en) Front-end code automatic generation method, device, server, system and medium
CN111858375A (en) Software testing method, device, electronic equipment and medium
WO2009076827A1 (en) An automated testing method, system and a testing device
CN111666563B (en) Method and device for verifying application running state
WO2020177519A1 (en) Debugging method executed on smart terminal and software debugging device
WO2023060978A1 (en) Autosar software verification method and apparatus, device, and storage medium
CN110543429A (en) Test case debugging method and device and storage medium
CN115276844B (en) Communication module testing method and device, storage medium and electronic equipment

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: 17930982

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 24.09.2020)

122 Ep: pct application non-entry in european phase

Ref document number: 17930982

Country of ref document: EP

Kind code of ref document: A1