WO2022095518A1 - Automatic interface test method and apparatus, and computer device and storage medium - Google Patents

Automatic interface test method and apparatus, and computer device and storage medium Download PDF

Info

Publication number
WO2022095518A1
WO2022095518A1 PCT/CN2021/109474 CN2021109474W WO2022095518A1 WO 2022095518 A1 WO2022095518 A1 WO 2022095518A1 CN 2021109474 W CN2021109474 W CN 2021109474W WO 2022095518 A1 WO2022095518 A1 WO 2022095518A1
Authority
WO
WIPO (PCT)
Prior art keywords
interface
execution
test
strategy
layer
Prior art date
Application number
PCT/CN2021/109474
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 WO2022095518A1 publication Critical patent/WO2022095518A1/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
    • 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/3692Test management for test results analysis

Definitions

  • the present application relates to the technical field of testing, and in particular, to a method, device, computer equipment and storage medium for automated testing of interfaces.
  • the inventor realizes that, at present, most of the common interface invocation test solutions directly write the interface parameters into the test strategy of the test case layer. When the interface parameters are changed, the parameter content in the corresponding test strategy needs to be modified. As the types of projects increase, this approach leads to low reusability of test strategies, and the defects of low test efficiency are gradually revealed.
  • the purpose of the embodiments of the present application is to provide an interface automated testing method, device, computer equipment and storage medium, which effectively improves the reusability of test cases and improves the test efficiency.
  • the embodiment of the present application provides an interface automatic testing method, which adopts the following technical solutions:
  • An interface automated testing method comprising the following steps:
  • the execution strategy corresponding to the test purpose in the preset API layer is invoked to execute the interface request to complete the interface test.
  • the embodiment of the present application also provides an interface automatic testing device, which adopts the following technical solutions:
  • An interface automated testing device comprising:
  • the parameter generation module is used to determine the test purpose corresponding to the test command when receiving the test command sent by the user, call the preset dto layer based on the test case layer, and generate an interface through the dto layer based on the test purpose input;
  • a request sending module configured to obtain the interface input parameters based on the test case layer, and generate an interface request based on the interface input parameters, where the interface request carries the test purpose;
  • the request execution module is configured to, based on the test purpose, invoke the execution strategy corresponding to the test purpose in the preset API layer to execute the interface request to complete the interface test.
  • the embodiment of the present application also provides a computer device, which adopts the following technical solutions:
  • a computer device comprising a memory and a processor, wherein computer-readable instructions are stored in the memory, and when the processor executes the computer-readable instructions, the steps of the interface automated testing method described below are implemented:
  • the execution strategy corresponding to the test purpose in the preset API layer is invoked to execute the interface request to complete the interface test.
  • the embodiments of the present application also provide a computer-readable storage medium, which adopts the following technical solutions:
  • a computer-readable storage medium on which computer-readable instructions are stored, and when the computer-readable instructions are executed by a processor, the steps of the interface automated testing method described below are implemented:
  • the execution strategy corresponding to the test purpose in the preset API layer is invoked to execute the interface request to complete the interface test.
  • the independent generation of interface input parameters is achieved through a separately set dto layer, and then the generated interface input parameters are transmitted to the test case layer, which avoids the need to modify the test strategy every time the parameters of the interface change, resulting in low test strategy reusability Case.
  • the application only needs to modify the generation method of the interface input parameters in the dto layer, and does not need to modify the test case layer, which effectively improves the reusability of the test strategy in the test case layer and improves the test efficiency.
  • the present application calls different execution strategies in the API layer in the execution process according to different testing purposes. It improves the simplicity and understandability of the overall test process, and realizes the rapid execution of the test process.
  • FIG. 1 is an exemplary system architecture diagram to which the present application can be applied;
  • Fig. 2 is a flow chart of an embodiment of an interface automated testing method according to the present application.
  • FIG. 3 is a schematic structural diagram of an embodiment of an interface automated testing device according to the present application.
  • FIG. 4 is a schematic structural diagram of an embodiment of a computer device according to the present application.
  • the system architecture 100 may include terminal devices 101 , 102 , and 103 , a network 104 and a server 105 .
  • the network 104 is a medium used to provide a communication link between the terminal devices 101 , 102 , 103 and the server 105 .
  • the network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
  • the user can use the terminal devices 101, 102, 103 to interact with the server 105 through the network 104 to receive or send messages and the like.
  • Various communication client applications may be installed on the terminal devices 101 , 102 and 103 , such as web browser applications, shopping applications, search applications, instant messaging tools, email clients, social platform software, and the like.
  • the terminal devices 101, 102, and 103 can be various electronic devices that have a display screen and support web browsing, including but not limited to smart phones, tablet computers, e-book readers, MP3 players (Moving Picture Experts Group Audio Layer III, dynamic Picture Experts Compression Standard Audio Layer 3), MP4 (Moving Picture Experts Group Audio Layer IV, Moving Picture Experts Compression Standard Audio Layer 4) Players, Laptops and Desktops, etc.
  • MP3 players Moving Picture Experts Group Audio Layer III, dynamic Picture Experts Compression Standard Audio Layer 3
  • MP4 Moving Picture Experts Group Audio Layer IV, Moving Picture Experts Compression Standard Audio Layer 4
  • the server 105 may be a server that provides various services, such as a background server that provides support for the pages displayed on the terminal devices 101 , 102 , and 103 .
  • the automated interface testing method provided by the embodiments of the present application is generally performed by a server/terminal device, and accordingly, an automated interface testing apparatus is generally set in the server/terminal device.
  • terminal devices, networks and servers in FIG. 1 are merely illustrative. There can be any number of terminal devices, networks and servers according to implementation needs.
  • the interface automated testing method includes the following steps:
  • the test purpose is included in the test strategy of the test case layer, and the corresponding test purpose in the test case layer is determined according to the test instruction.
  • DTO Data Transfer Object, data transfer object
  • This application combines the dto layer with the test case layer, and generates the interface input parameters and other information contained in the test strategy (that is, the case method) in the original test case layer through the dto layer, so that different test strategies can be reused.
  • the dto layer can be combined with different test strategies in the test case layer to meet the needs of different test strategies to generate different types of parameters.
  • changes in parameters may occur, which in turn lead to changes in the test strategy in the test case layer.
  • a required parameter needs to be added to an interface.
  • the interface has 50 parameters, the interface has at least 51 test strategies (ie case methods), including 1 entry and 50 test strategies.
  • Parameter validation test strategy ie case method.
  • the parameter section of the 51 test strategies needs to be modified.
  • the electronic device (for example, the server/terminal device shown in FIG. 1 ) on which the interface automated testing method runs may receive the test purpose through a wired connection or a wireless connection.
  • the above wireless connection methods may include but are not limited to 3G/4G connection, WiFi connection, Bluetooth connection, WiMAX connection, Zigbee connection, UWB (ultra wideband) connection, and other wireless connection methods currently known or developed in the future .
  • the dto layer includes different dto classes, and the dto classes have different parameter generation strategies.
  • the test purpose corresponding to the test command is determined, based on the test case
  • the layer calls the preset dto layer, and the steps of generating interface input parameters through the dto layer based on the test purpose include:
  • the corresponding dto class is selected based on the test target user, wherein the test target user and the dto class are in a one-to-one correspondence;
  • the parameter generation strategy and the test purpose are in a one-to-one correspondence.
  • the Dto layer includes different dto classes, and different test target users correspond to different dto classes, for example, a bank can correspond to one dto class.
  • Different parameter generation strategies ie dto generation methods
  • different test purposes correspond to different dto generation methods. This setting is convenient for unified maintenance and management. When the project requirements change and the interface parameters change, you only need to find the corresponding dto class and maintain the dto generation method of the corresponding interface under this class.
  • Different dto classes meet the needs of different test strategies to generate different types of parameters.
  • the dto class will be generated according to the received key and value. corresponding parameters.
  • the incoming key is the request serial number (applyNo), and the value is null (null), and further generates a test case for parameter validation where the request serial number parameter is null.
  • the A interface has 1, 2, and 3 parameters, which become 2, 3, and 4 parameters, then only the method for generating the parameters of the A interface needs to be modified at the dto layer.
  • the parameters are 2, 3, 4.
  • the 1-parameter verification method of the A interface is removed from the test case layer, and a 4-parameter verification method can be added.
  • the parameter generation strategy includes an assembly strategy
  • the step of generating interface input parameters through the parameter generation strategy includes:
  • the corresponding parameter generation strategy in the dto class determined based on the test purpose is an assembly strategy
  • obtain preset interface parameters based on the test purpose assemble the interface parameters through the dto layer, and generate an interface input Ref.
  • the computer when a fixed parameter needs to be tested, the computer receives and sets the interface parameter, calls the dto layer through the test case layer to assemble the interface parameter, and generates the interface input parameter. If you do not need fixed parameters, but in the case of random testing, you can directly generate the interface input parameters through the dto layer according to the requirements.
  • the parameter generation strategy includes a random generation strategy
  • the step of generating interface input parameters through the parameter generation strategy includes:
  • the preset interface parameters are acquired based on the test purpose, and the preset interface parameters in the tool layer are called through the dto layer. Random number generator;
  • the Dto layer invokes a random number generating tool in the tool layer (util layer) to generate random numbers, wherein the random number generating tool may use a pre-packaged random number generating function.
  • the design of the Dto layer is convenient for decoupling from the test case layer, and the Dto layer is set separately to generate interface input parameters to meet the requirement that the parameters can be reused.
  • the dto layer can generate parameters randomly. For example, in loan application, it is generally required that the same user cannot apply for the same loan product repeatedly. Then, during the interface testing process, the user's identity information, such as mobile phone number, ID number, bank card number, etc., cannot be reused. Therefore, random numbers can be randomly generated through timestamps, so that parameters are not repeatedly generated, and various test cases can be executed repeatedly.
  • S2 Obtain the interface input parameters based on the test case layer, and generate an interface request based on the interface input parameters, where the interface request carries the test purpose.
  • the test case layer that is, the Case layer
  • the Case layer is used to define a test strategy (case method), including two kinds of process test strategy and parameter verification test strategy. Because the interface input parameters are generated through the dto layer alone, the code template of the test strategy defined by the test case layer of the present application is more unified, clear and simple, and it is easy to quickly copy to other projects. The learning of relevant personnel and the maintenance cost of the test strategy are all lower.
  • the test case layer sends corresponding interface requests to the API layer according to different test purposes, and the API layer is used to define the API to be called.
  • different execution strategies are preset in the calling API layer, and different execution strategies are selected according to different test purposes, so as to facilitate the rapid progress of automated testing.
  • the API layer includes a first interface and a second interface
  • the first interface is encapsulated with different main execution strategies
  • the second interface is encapsulated with different secondary execution strategies
  • the For the test purpose call the execution strategy corresponding to the test purpose in the preset API layer to execute the interface request
  • the steps to complete the interface test include:
  • the main execution strategy corresponding to the first interface is invoked, and at least one sub-execution strategy corresponding to the second interface is invoked through the main execution strategy to execute the interface request to obtain the final execution result ;
  • the assertion tool in the preset tool layer is invoked through the test case layer, the final execution result is asserted, and the assertion result is obtained to complete the interface test.
  • different main execution policies are encapsulated in the first interface (FlowBaseAPI).
  • Different secondary execution strategies are encapsulated in the second interface (BaseAPI), wherein there is a one-to-one and one-to-many correspondence between the primary execution strategy and the secondary execution strategy.
  • the main execution strategy invokes multiple sub-execution strategies
  • the sub-execution strategies execute corresponding operations in sequence, that is, after the execution of one sub-execution strategy is completed, the result is returned to the first interface, and when the continuation returned by the first interface is received
  • the instruction is executed, it continues to execute the next sub-execution strategy.
  • different primary execution strategies in the first interface and different secondary execution strategies in the second interface are invoked.
  • the automated testing can be carried out in an orderly manner.
  • the test case layer will only accept the final execution result (that is, the final processing result) returned by the first interface.
  • the assertion tool is used to assert the final execution result.
  • the commonly used assertion tool is JsonAssertion, which compares the final execution result with the pre-conceived result. Compare, and output consistency or inconsistency as the assertion result.
  • the step of invoking at least one corresponding secondary execution policy in the second interface to execute the interface request through the primary execution policy, and obtaining a final execution result includes:
  • the secondary execution strategies are executed in sequence, wherein each secondary execution strategy is executed, an intermediate execution result is obtained, and the intermediate execution result is returned to the The first interface, when receiving the continuing execution instruction returned by the first interface, executes the next sub-execution strategy until all sub-execution strategies called by the current main execution strategy are executed, and the final execution result is obtained.
  • the test case layer only accepts the final execution result (ie, the final processing result) returned by the first interface.
  • the second interface may perform multiple operations, and each step returns an intermediate execution result to the first interface, and the entire process is processed in the API layer.
  • the orderly execution of different interface tests is realized, and the intermediate execution result is returned to the first interface, which ensures that the entire operation process is in the API layer, and the first interface receives the intermediate execution result.
  • the next sub-execution strategy is called, and the final execution result is not returned to the test case layer until the final execution result is received, which ensures that the test case layer does not need to care about the intermediate execution process, and only receives the final execution result. Test confusion.
  • the first interface includes a first primary execution strategy, a second primary execution strategy and a third primary execution strategy
  • the second interface includes a first secondary execution strategy, a second secondary execution strategy and a third secondary execution strategy , based on the test purpose, call the corresponding main execution strategy in the first interface, and invoke at least one sub-execution strategy corresponding to the second interface through the main execution strategy to execute the interface request, and obtain the final execution
  • the resulting steps include:
  • test purpose is parameter encryption
  • first main execution strategy in the first interface is called, and the first sub-execution strategy in the second interface is invoked through the first main execution strategy to perform parameter encryption, and obtain final execution result
  • the second primary execution strategy in the first interface is invoked, and the first secondary execution strategy and the second secondary execution strategy in the second interface are invoked through the second primary execution strategy, Execute parameter encryption and log comparison in turn to obtain intermediate execution results and final execution results;
  • the third main execution strategy in the first interface is invoked, and the first sub-execution strategy and the second sub-execution strategy in the second interface are invoked through the third main execution strategy.
  • the sub-execution strategy and the third sub-execution strategy execute parameter encryption, log comparison, and notification log comparison in sequence to obtain intermediate execution results and final execution results.
  • the result returned by parameter encryption belongs to the final execution result.
  • the test purpose is log comparison
  • the result returned by parameter encryption belongs to the intermediate execution result
  • the result returned by log comparison belongs to the final execution result.
  • the results returned by parameter encryption operations and log comparison operations belong to the intermediate execution results.
  • the result returned by the notification class log comparison operation is the final execution result.
  • One or more sub-execution strategies are invoked by the main execution strategy, which realizes the control of the sub-execution strategy by the main execution strategy in the API layer, and ensures that the test process can be carried out in an orderly manner according to the control of the main execution strategy.
  • the first interface includes three different main execution strategies (ie methods): 1) getAPIResult method: interface request sending. 2) getCompareLogResult method: interface request sending, interface log comparison. 3) getCompareNoticeLogResult method: interface request sending, interface log comparison, notification interface log comparison.
  • the second interface includes three different sub-execution strategies: 1) getAPIResult method: encrypt the message and send a post request. 2) compareLog method: compare the input parameters of the interface and the interface input of the log call related party, specifically: according to the keyword, extract the interface parameters of the request related party in the log, and compare them with the interface input parameters. The comparison content is based on the interface For the same key, compare the value. 3) compareNoticeLog method: compares the interface input parameters with the parameters in the notification class log.
  • the step of parameter encryption is executed in the test purpose of parameter encryption, log comparison and notification type log comparison.
  • the steps of log comparison are performed in both log comparison and notification log comparison for test purposes.
  • the steps of notification class log comparison are performed only when the test purpose is notification class log comparison.
  • the steps of invoking the second main execution strategy, the first sub-execution strategy, and the second sub-execution strategy to perform the parameter encryption operation and the log comparison operation include:
  • the second main execution strategy is invoked to send a log comparison request to the second interface
  • the general application system will print a log for the convenience of checking the running situation and analyzing the cause of the problem when encountering a failure.
  • the log records the program execution process, execution information, etc.
  • the application sends an interface request to the application system under test at the beginning of the test, it cannot directly obtain the request information sent by the system under test when it calls the associated party. It can only be obtained through the log information printed by the server under test. It is necessary to extract the log first to obtain the call association
  • the request parameters of the party under test are compared with the interface input parameters generated by the dto layer to confirm that the request parameters in the request information of the related party under test are correct, wherein the request parameters in the request information of the related party under test are called Indicates the interface input parameters obtained through transparent transmission.
  • the request serial number (applyNo) of the request from the system under test to the related party is unique, the request serial number (applyNo) can be used as the interface log print mark, and at the same time as the extraction log keyword, to accurately extract the interface log of the log file.
  • the step of obtaining the parameters for calling the related party interface in the interface log, comparing the parameters for calling the related party interface and the interface input parameters, and obtaining the log comparison result includes:
  • the regular expression uses a single character string to describe and match a series of character strings conforming to a certain syntax rule.
  • a preset regular expression is used to match the log file of the related party, and the request parameters of the interface related party are obtained, wherein the related party may include the bank party or the platform party.
  • the present application can encapsulate the parameter extraction method as a log extraction API, which is directly invoked during parameter extraction, specifically including: reading the log file printed by the system under test, following up the log print information of the system under test, and extracting the request parameters of the associated party.
  • the step of executing the parameter encryption includes: 1) invoking the first main execution policy in the first interface (FlowBaseAPI) to send a post request to the second interface (BaseAPI), where the post request carries the interface entry. parameter; 2) parameter encryption is performed on the interface input parameter by the Http tool tool in the tool layer called by the first sub-execution policy in the second interface, and an encrypted message is generated; 3) based on the encrypted message, by The first secondary execution strategy in the second interface calls the Http tool tool to initiate an interface admission request, and generates a response result; 4) transmit the response result to the first interface; 5) the first interface transfers all The response result is transmitted to the test case layer; 6) The test case layer invokes an assertion tool to assert the response result, generates an assertion result, and completes the interface test.
  • the application system generally encrypts the request information. Therefore, during the test process, the application also needs to encrypt the request parameters first, then initiate the request, and determine whether the response result meets the expectation through assertion. Wherein, the present application also includes comparing the encrypted message with the expected result to determine whether they are consistent, and if they are consistent, the parameter encryption test is correct.
  • the step of executing the log comparison includes: 1) invoking the second primary execution strategy in the first interface to send a log comparison request to the second interface; 2) through the second secondary execution strategy in the second interface Call the log extraction tool class (GetLogUnits) in the tool layer to perform log query to obtain the interface log; 3) obtain the parameters of the calling related party interface in the interface log, and compare the parameters of the calling related party interface with the interface Enter the parameters to obtain the log comparison result; 4) Return the log comparison result to the first interface; 5) The first interface transmits the log comparison result to the test case layer; 6) The test The use case layer invokes an assertion tool to assert the log comparison result, generates an assertion result, and completes the interface test.
  • GetLogUnits log extraction tool class
  • the request information sent when the system under test calls the related party cannot be directly obtained. It can only be obtained through the log information printed by the server under test. It is necessary to extract the log first to obtain the request parameters of the calling related party. Then, it is compared with the interface input parameters generated by the dto layer to confirm that the request parameters in the request information of the related party under test call are correct, wherein the request parameters in the request information of the related party under test call are obtained through transparent transmission interface input parameters.
  • the step of executing the notification class log comparison includes: 1) invoking the third main execution policy of the first interface to initiate a notification interface log comparison request to the second interface; 2) through the third interface in the second interface
  • the log extraction tool class (GetLogUnits) in the sub-execution strategy calling tool layer traverses the notification log collection to obtain the corresponding notification log; 3) extracts and compares the notification interface parameters corresponding to different related parties in the notification log, and obtains Notification class log comparison result; 4) Return the notification class log comparison result to the first interface; 5)
  • the first interface transmits the notification class log comparison result to the test case layer; 6) All
  • All The test case layer invokes an assertion tool (JsonAssertion) to assert the log comparison result, generates an assertion result, and completes the interface test.
  • JsonAssertion an assertion tool
  • tool classes in this application are all deployed in the tool layer (util), and the tool layer (util) includes different tool classes, such as Http tool class (Http tool), log extraction tool class (GetLogUnits), Assertion tool class (JsonAssertion), parameter type conversion tool class, random data generation tool class, such as random generation of mobile phone numbers, bank card numbers, ID numbers, etc., log platform reading tool class, configuration file reading tool class, and request sending tools etc.
  • Http tool class Http tool
  • log extraction tool class GetLogUnits
  • Assertion tool class JobAssertion
  • parameter type conversion tool class random data generation tool class, such as random generation of mobile phone numbers, bank card numbers, ID numbers, etc.
  • random data generation tool class such as random generation of mobile phone numbers, bank card numbers, ID numbers, etc.
  • this application is also provided with a Config layer.
  • the Config layer is used to define the configuration.
  • the Config layer includes environment information (Config-properties) and constant parameters. If there is a need for subsequent changes, the maintenance configuration information can be uniformly modified in the Config layer.
  • the environment information is used in the test case layer, such as interface IP, port, request URL, log file path, log file name and other information. If the subsequent environment information changes, it only needs to be uniformly modified in the Config configuration file, without the need to modify the test.
  • Constant parameters refer to: for example, some random numbers in the generation method of the dto layer, which are generated by the tool class of the tool layer. Some parameters are constants, and multiple interfaces and multiple dto methods may need to be used. They can be written in the Config configuration file. If the constant value needs to be changed later, there is no need to modify multiple dto methods, and only need to be in the Config configuration file. unified modification.
  • the embodiments of the present application can be applied in the field of artificial intelligence technology to test data interfaces related to artificial intelligence such as semantic analysis, image recognition, and biometric identification.
  • the execution strategy in the above API layer can also be stored in a node of a blockchain.
  • the blockchain referred to in this application is a new application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithm.
  • Blockchain essentially a decentralized database, is a series of data blocks associated with cryptographic methods. Each data block contains a batch of network transaction information to verify its Validity of information (anti-counterfeiting) and generation of the next block.
  • the blockchain can include the underlying platform of the blockchain, the platform product service layer, and the application service layer.
  • the present application may be used in numerous general purpose or special purpose computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, including A distributed computing environment for any of the above systems or devices, and the like.
  • the application may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer.
  • program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types.
  • the application may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network.
  • program modules may be located in both local and remote computer storage media including storage devices.
  • the aforementioned storage medium may be a non-volatile storage medium such as a magnetic disk, an optical disk, a read-only memory (Read-Only Memory, ROM), or a random access memory (Random Access Memory, RAM) or the like.
  • the present application provides an embodiment of an interface automated testing device, and the device embodiment corresponds to the method embodiment shown in FIG. 2 . Can be applied to various electronic devices.
  • the interface automated testing apparatus 300 described in this embodiment includes: a parameter generation module 301 , a request sending module 302 and a request execution module 303 .
  • the parameter generation module 301 is used to determine the test purpose corresponding to the test command when receiving the test command sent by the user, call the preset dto layer based on the test case layer, and pass the dto layer based on the test purpose layer generates interface input parameters
  • the request sending module 302 is configured to obtain the interface input parameters based on the test case layer, and generate an interface request based on the interface input parameters, and the interface request carries the test purpose
  • request execution module 303 Based on the test purpose, invoking an execution strategy corresponding to the test purpose in the preset API layer to execute the interface request to complete the interface test.
  • the independent generation of interface input parameters is achieved through a separately set dto layer, and then the generated interface input parameters are transmitted to the test case layer, which avoids the need to modify the test strategy correspondingly each time the parameters of the interface are changed, resulting in Test the case where the reusability of the strategy is low.
  • the application only needs to modify the generation method of the interface input parameters in the dto layer, and does not need to modify the test case layer, which effectively improves the reusability of the test strategy in the test case layer and improves the test efficiency.
  • the present application calls different execution strategies in the API layer in the execution process according to different testing purposes. It improves the simplicity and understandability of the overall test process, and realizes the rapid execution of the test process.
  • Described dto layer includes different dto classes, has different parameter generation strategies in described dto class, described parameter generation module 301 comprises to determine submodule, call submodule, select submodule and generate submodule.
  • the determination submodule is used to determine the test target user and the test purpose corresponding to the test instruction when receiving the test instruction sent by the user;
  • the calling submodule is used for calling the preset dto layer based on the test case layer;
  • the selection submodule is used for The corresponding dto class is selected based on the test target user, wherein the test target user and the dto class are in a one-to-one correspondence;
  • the generation sub-module is used to determine the corresponding parameter generation in the dto class based on the test purpose Strategy, the interface input parameters are generated through the parameter generation strategy.
  • the parameter generation strategy includes an assembly strategy.
  • the above generation sub-module is further used for: when the corresponding parameter generation strategy in the dto class determined based on the test purpose is assembly During the strategy, the preset interface parameters are obtained based on the test purpose, and the interface parameters are assembled through the dto layer to generate interface input parameters.
  • the parameter generation strategy includes a random generation strategy
  • the generation submodule includes a calling unit and a generating unit.
  • the calling unit is configured to obtain preset interface parameters based on the test purpose when the corresponding parameter generation strategy in the dto class determined based on the test purpose is a random generation strategy, and call the preset interface parameters through the dto layer.
  • a random number generation tool in the tool layer; the generation unit is used to obtain a timestamp, generate a random number according to the timestamp based on the random number generation tool, assemble the random number and preset interface parameters through the dto layer, and generate Interface input parameters.
  • the request execution module 303 includes an execution sub-module, a return sub-module, and an assertion sub-module.
  • the execution sub-module is used to invoke the corresponding main execution strategy in the first interface based on the test purpose, and to invoke the main execution strategy through the main execution strategy.
  • At least one sub-execution strategy corresponding to the second interface executes the interface request and obtains the final execution result;
  • the return submodule is used to return the final execution result to the first interface, and send the final execution result to the first interface through the first interface.
  • the final execution result is returned to the test case layer;
  • the assertion submodule is used to invoke the pre-set assertion tool in the tool layer through the test case layer, assert the final execution result, and obtain the assertion result to complete the interface test.
  • the execution sub-module is further configured to obtain a final execution result when the secondary execution strategy invoked by the primary execution strategy is one, and when the primary execution strategy invokes the secondary execution strategy
  • execute the secondary execution strategies in sequence wherein, each time a secondary execution strategy is executed, an intermediate execution result is obtained, and the intermediate execution result is returned to the first interface.
  • the next sub-execution strategy is executed until all sub-execution strategies called by the current main execution strategy are executed, and the final execution result is obtained.
  • the first interface includes a first primary execution strategy, a second primary execution strategy and a third primary execution strategy
  • the second interface includes a first secondary execution strategy, a second secondary execution strategy and a third secondary execution strategy
  • the module also includes an identification unit, an encryption unit, a log comparison unit and a notification log comparison unit.
  • the identification unit is used to identify the test purpose; the encryption unit is used to call the first main execution strategy in the first interface when the test purpose is parameter encryption, and call the first main execution strategy through the first main execution strategy.
  • the execution parameters of the first secondary execution strategy in the second interface are encrypted to obtain the final execution result;
  • the log comparison unit is used for calling the second main execution strategy in the first interface when the test purpose is log comparison, and through the The second main execution strategy invokes the first sub-execution strategy and the second sub-execution strategy in the second interface, respectively executes parameter encryption and log comparison in sequence, and obtains the intermediate execution result and the final execution result;
  • the notification type log comparison unit is used when all the The purpose of the test is to call the third main execution strategy in the first interface, and call the first sub-execution strategy and the second sub-execution strategy in the second interface through the third main execution strategy
  • the strategy and the third sub-execution strategy execute parameter encryption, log comparison, and notification log comparison in sequence to obtain intermediate execution results and final execution results.
  • the notification type log comparison unit includes a calling subunit, a query subunit and a comparison subunit.
  • the calling subunit is used to call the second main execution strategy to send a log comparison request to the second interface when the test purpose is log comparison;
  • the query subunit is used to pass the first secondary execution strategy in the second interface
  • Invoke the log extraction tool class in the preset tool layer perform log query based on the preset request serial number, obtain the interface log, use the interface log as an intermediate execution result, and return to the first interface; compare the subunit When receiving the continuation execution instruction sent by the first interface, obtain the parameters of calling the related party interface in the interface log through the second sub-execution strategy, and compare the parameters of calling the related party interface with all the parameters. Input parameters of the above interface, and obtain the log comparison result as the final execution result.
  • the above-mentioned comparison subunit module is further configured to: match the interface log through a preset regular expression, and obtain parameters in the interface log for calling the associated party interface; compare Whether the parameters for calling the associated party interface are the same as the keys of the interface input parameters; when the keys are the same, compare whether the corresponding values are consistent, and obtain the log comparison result.
  • the independent generation of interface input parameters is achieved through a separately set dto layer, and then the generated interface input parameters are transmitted to the test case layer, which avoids the need to modify the test strategy every time the parameters of the interface change, resulting in low test strategy reusability Case.
  • the application only needs to modify the generation method of the interface input parameters in the dto layer, and does not need to modify the test case layer, which effectively improves the reusability of the test strategy in the test case layer and improves the test efficiency.
  • the present application calls different execution strategies in the API layer in the execution process according to different testing purposes. It improves the simplicity and understandability of the overall test process, and realizes the rapid execution of the test process.
  • FIG. 4 is a block diagram of a basic structure of a computer device according to this embodiment.
  • the computer device 200 includes a memory 201 , a processor 202 , and a network interface 203 that communicate with each other through a system bus. It should be noted that only the computer device 200 with components 201-203 is shown in the figure, but it should be understood that implementation of all shown components is not required, and more or less components may be implemented instead. Among them, those skilled in the art can understand that the computer device here is a device that can automatically perform numerical calculation and/or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, special-purpose Integrated circuit (Application Specific Integrated Circuit, ASIC), programmable gate array (Field-Programmable Gate Array, FPGA), digital processor (Digital Signal Processor, DSP), embedded equipment, etc.
  • ASIC Application Specific Integrated Circuit
  • FPGA Field-Programmable Gate Array
  • DSP Digital Signal Processor
  • the computer equipment may be a desktop computer, a notebook computer, a palmtop computer, a cloud server and other computing equipment.
  • the computer device can perform human-computer interaction with the user through a keyboard, a mouse, a remote control, a touch pad or a voice control device.
  • the memory 201 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static Random Access Memory (SRAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), Programmable Read Only Memory (PROM), Magnetic Memory, Magnetic Disk, Optical Disk, etc.
  • the computer-readable storage medium may be non-volatile or volatile.
  • the memory 201 may be an internal storage unit of the computer device 200 , such as a hard disk or a memory of the computer device 200 .
  • the memory 201 may also be an external storage device of the computer device 200, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, flash memory card (Flash Card), etc.
  • the memory 201 may also include both the internal storage unit of the computer device 200 and its external storage device.
  • the memory 201 is generally used to store the operating system and various application software installed in the computer device 200 , such as computer-readable instructions of an interface automated testing method, and the like.
  • the memory 201 can also be used to temporarily store various types of data that have been output or will be output.
  • the processor 202 may be a central processing unit (Central Processing Unit, CPU), a controller, a microcontroller, a microprocessor, or other data processing chips.
  • the processor 202 is typically used to control the overall operation of the computer device 200 .
  • the processor 202 is configured to execute computer-readable instructions stored in the memory 201 or process data, for example, computer-readable instructions for executing the interface automated testing method.
  • the network interface 203 may include a wireless network interface or a wired network interface, and the network interface 203 is generally used to establish a communication connection between the computer device 200 and other electronic devices.
  • test case layer there is no need to modify the test case layer, which effectively improves the reusability of the test strategy in the test case layer and improves the test efficiency.
  • different execution strategies in the API layer are invoked, which improves the simplicity of the overall test process.
  • the present application also provides another embodiment, that is, to provide a computer-readable storage medium, where the computer-readable storage medium stores computer-readable instructions, and the computer-readable instructions can be executed by at least one processor to The at least one processor is caused to perform the steps of the interface automation testing method as described above.
  • test case layer there is no need to modify the test case layer, which effectively improves the reusability of the test strategy in the test case layer and improves the test efficiency.
  • different execution strategies in the API layer are invoked, which improves the simplicity of the overall test process.
  • the method of the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is better implementation.
  • the technical solution of the present application can be embodied in the form of a software product in essence or in a part that contributes to the prior art, and the computer software product is stored in a storage medium (such as ROM/RAM, magnetic disk, CD-ROM), including several instructions to make a terminal device (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) execute the methods described in the various embodiments of this application.
  • a storage medium such as ROM/RAM, magnetic disk, CD-ROM

Abstract

The embodiments of the present application belong to the technical field of tests, and relate to an automatic interface test method. The method comprises: when a test instruction sent by a user is received, determining a test purpose corresponding to the test instruction, calling a preset dto layer on the basis of a test case layer, and generating an interface access parameter by means of the dto layer and on the basis of the test purpose; acquiring the interface access parameter on the basis of the test case layer, and generating an interface request on the basis of the interface access parameter, wherein the interface request carries the test purpose; and on the basis of the test purpose, calling an execution policy, which corresponds to the test purpose, in a preset API layer to execute the interface request, so as to complete an interface test. Further provided are an automatic interface test apparatus, and a computer device and a storage medium. An execution policy in an API layer can be stored in a blockchain. By means of the present application, the reusability of a test case is effectively improved, and the test efficiency is improved.

Description

接口自动化测试方法、装置、计算机设备及存储介质Interface automated testing method, device, computer equipment and storage medium
本申请要求于2020年11月6日提交中国专利局、申请号为202011232732.5,发明名称为“接口自动化测试方法、装置、计算机设备及存储介质”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。This application claims the priority of the Chinese patent application filed on November 6, 2020 with the application number 202011232732.5 and the invention title is "Interface Automated Testing Method, Device, Computer Equipment and Storage Medium", the entire contents of which are by reference Incorporated in this application.
技术领域technical field
本申请涉及测试技术领域,尤其涉及接口自动化测试方法、装置、计算机设备及存储介质。The present application relates to the technical field of testing, and in particular, to a method, device, computer equipment and storage medium for automated testing of interfaces.
背景技术Background technique
随着信息化进程的加速推进和计算机水平的日益提高,各行各业都已应用计算机进行高效率的工作和审批等事务,在不同的服务器之间进行信息交互时,往往需要请求调用接口,为给用户提供更好的服务,这些接口提供给用户使用之前,均需要进行接口调用测试。With the acceleration of the informatization process and the improvement of the computer level, all walks of life have used computers for efficient work and approval. To provide users with better services, these interfaces need to be tested before they are provided to users.
发明人意识到,目前,常见的接口调用测试方案大多是将接口参数直接写入测试用例层的测试策略中,在接口参数改变时,需要修改对应的测试策略中的参数内容。随着项目的种类增加,这种方式导致测试策略的复用性较低,测试效率低的缺陷逐渐显露。The inventor realizes that, at present, most of the common interface invocation test solutions directly write the interface parameters into the test strategy of the test case layer. When the interface parameters are changed, the parameter content in the corresponding test strategy needs to be modified. As the types of projects increase, this approach leads to low reusability of test strategies, and the defects of low test efficiency are gradually revealed.
发明内容SUMMARY OF THE INVENTION
本申请实施例的目的在于提出一种接口自动化测试方法、装置、计算机设备及存储介质,有效的提高了测试用例的复用性,提升了测试效率。The purpose of the embodiments of the present application is to provide an interface automated testing method, device, computer equipment and storage medium, which effectively improves the reusability of test cases and improves the test efficiency.
为了解决上述技术问题,本申请实施例提供一种接口自动化测试方法,采用了如下所述的技术方案:In order to solve the above-mentioned technical problems, the embodiment of the present application provides an interface automatic testing method, which adopts the following technical solutions:
一种接口自动化测试方法,包括下述步骤:An interface automated testing method, comprising the following steps:
在接收到用户发送的测试指令时,确定所述测试指令对应的测试目的,基于测试用例层调用预设的dto层,并基于所述测试目的通过所述dto层生成接口入参;When receiving the test command sent by the user, determine the test purpose corresponding to the test command, call the preset dto layer based on the test case layer, and generate interface input parameters through the dto layer based on the test purpose;
基于所述测试用例层获取所述接口入参,并基于所述接口入参生成接口请求,所述接口请求携带所述测试目的;Obtain the interface input parameters based on the test case layer, and generate an interface request based on the interface input parameters, where the interface request carries the test purpose;
基于所述测试目的,调用预设的API层中与所述测试目的对应的执行策略执行所述接口请求,完成接口测试。Based on the test purpose, the execution strategy corresponding to the test purpose in the preset API layer is invoked to execute the interface request to complete the interface test.
为了解决上述技术问题,本申请实施例还提供一种接口自动化测试装置,采用了如下所述的技术方案:In order to solve the above-mentioned technical problems, the embodiment of the present application also provides an interface automatic testing device, which adopts the following technical solutions:
一种接口自动化测试装置,包括:An interface automated testing device, comprising:
参数生成模块,用于在接收到用户发送的测试指令时,确定所述测试指令对应的测试目的,基于测试用例层调用预设的dto层,并基于所述测试目的通过所述dto层生成接口入参;The parameter generation module is used to determine the test purpose corresponding to the test command when receiving the test command sent by the user, call the preset dto layer based on the test case layer, and generate an interface through the dto layer based on the test purpose input;
请求发送模块,用于基于所述测试用例层获取所述接口入参,并基于所述接口入参生成接口请求,所述接口请求携带所述测试目的;a request sending module, configured to obtain the interface input parameters based on the test case layer, and generate an interface request based on the interface input parameters, where the interface request carries the test purpose;
请求执行模块,用于基于所述测试目的,调用预设的API层中与所述测试目的对应的执行策略执行所述接口请求,完成接口测试。The request execution module is configured to, based on the test purpose, invoke the execution strategy corresponding to the test purpose in the preset API layer to execute the interface request to complete the interface test.
为了解决上述技术问题,本申请实施例还提供一种计算机设备,采用了如下所述的技术方案:In order to solve the above-mentioned technical problems, the embodiment of the present application also provides a computer device, which adopts the following technical solutions:
一种计算机设备,包括存储器和处理器,所述存储器中存储有计算机可读指令,所述处理器执行所述计算机可读指令时实现如下所述的接口自动化测试方法的步骤:A computer device, comprising a memory and a processor, wherein computer-readable instructions are stored in the memory, and when the processor executes the computer-readable instructions, the steps of the interface automated testing method described below are implemented:
在接收到用户发送的测试指令时,确定所述测试指令对应的测试目的,基于测试用例层调用预设的dto层,并基于所述测试目的通过所述dto层生成接口入参;When receiving the test command sent by the user, determine the test purpose corresponding to the test command, call the preset dto layer based on the test case layer, and generate interface input parameters through the dto layer based on the test purpose;
基于所述测试用例层获取所述接口入参,并基于所述接口入参生成接口请求,所述接口请求携带所述测试目的;Obtain the interface input parameters based on the test case layer, and generate an interface request based on the interface input parameters, where the interface request carries the test purpose;
基于所述测试目的,调用预设的API层中与所述测试目的对应的执行策略执行所述接口请求,完成接口测试。Based on the test purpose, the execution strategy corresponding to the test purpose in the preset API layer is invoked to execute the interface request to complete the interface test.
为了解决上述技术问题,本申请实施例还提供一种计算机可读存储介质,采用了如下所述的技术方案:In order to solve the above technical problems, the embodiments of the present application also provide a computer-readable storage medium, which adopts the following technical solutions:
一种计算机可读存储介质,所述计算机可读存储介质上存储有计算机可读指令,所述计算机可读指令被处理器执行时实现如下所述的接口自动化测试方法的步骤:A computer-readable storage medium, on which computer-readable instructions are stored, and when the computer-readable instructions are executed by a processor, the steps of the interface automated testing method described below are implemented:
在接收到用户发送的测试指令时,确定所述测试指令对应的测试目的,基于测试用例层调用预设的dto层,并基于所述测试目的通过所述dto层生成接口入参;When receiving the test command sent by the user, determine the test purpose corresponding to the test command, call the preset dto layer based on the test case layer, and generate interface input parameters through the dto layer based on the test purpose;
基于所述测试用例层获取所述接口入参,并基于所述接口入参生成接口请求,所述接口请求携带所述测试目的;Obtain the interface input parameters based on the test case layer, and generate an interface request based on the interface input parameters, where the interface request carries the test purpose;
基于所述测试目的,调用预设的API层中与所述测试目的对应的执行策略执行所述接口请求,完成接口测试。Based on the test purpose, the execution strategy corresponding to the test purpose in the preset API layer is invoked to execute the interface request to complete the interface test.
与现有技术相比,本申请实施例主要有以下有益效果:Compared with the prior art, the embodiments of the present application mainly have the following beneficial effects:
通过单独设置的dto层实现接口入参的独立生成,再将生成的接口入参传输至测试用例层,避免了每次接口的参数改变时,需要对应修改测试策略,导致测试策略复用性低的情况。本申请在需要修改接口的参数时,只需要修改dto层中接口入参的生成方法,不需要修改测试用例层,有效的提高了测试用例层中的测试策略的复用性,提升了测试效率。区别于现有技术的每一步执行过程需要调用对应的API,本申请将执行过程根据测试目的的不同,调用API层中不同的执行策略。提升了整体测试过程的简洁性,可理解性,实现了测试过程的快速执行。The independent generation of interface input parameters is achieved through a separately set dto layer, and then the generated interface input parameters are transmitted to the test case layer, which avoids the need to modify the test strategy every time the parameters of the interface change, resulting in low test strategy reusability Case. When the parameters of the interface need to be modified, the application only needs to modify the generation method of the interface input parameters in the dto layer, and does not need to modify the test case layer, which effectively improves the reusability of the test strategy in the test case layer and improves the test efficiency. . Different from the prior art where each step of the execution process needs to call the corresponding API, the present application calls different execution strategies in the API layer in the execution process according to different testing purposes. It improves the simplicity and understandability of the overall test process, and realizes the rapid execution of the test process.
附图说明Description of drawings
为了更清楚地说明本申请中的方案,下面将对本申请实施例描述中所需要使用的附图作一个简单介绍,显而易见地,下面描述中的附图是本申请的一些实施例,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他的附图。In order to illustrate the solutions in the present application more clearly, the following will briefly introduce the accompanying drawings used in the description of the embodiments of the present application. For those of ordinary skill, other drawings can also be obtained from these drawings without any creative effort.
图1是本申请可以应用于其中的示例性系统架构图;FIG. 1 is an exemplary system architecture diagram to which the present application can be applied;
图2是根据本申请的接口自动化测试方法的一个实施例的流程图;Fig. 2 is a flow chart of an embodiment of an interface automated testing method according to the present application;
图3是根据本申请的接口自动化测试装置的一个实施例的结构示意图;3 is a schematic structural diagram of an embodiment of an interface automated testing device according to the present application;
图4是根据本申请的计算机设备的一个实施例的结构示意图。FIG. 4 is a schematic structural diagram of an embodiment of a computer device according to the present application.
附图标记:200、计算机设备;201、存储器;202、处理器;203、网络接口;300、接口自动化测试装置;301、参数生成模块;302、请求发送模块;303、请求执行模块。Reference numerals: 200, computer equipment; 201, memory; 202, processor; 203, network interface; 300, interface automatic testing device; 301, parameter generation module; 302, request sending module;
具体实施方式Detailed ways
除非另有定义,本文所使用的所有的技术和科学术语与属于本申请的技术领域的技术人员通常理解的含义相同;本文中在申请的说明书中所使用的术语只是为了描述具体的实施例的目的,不是旨在于限制本申请;本申请的说明书和权利要求书及上述附图说明中的术语“包括”和“具有”以及它们的任何变形,意图在于覆盖不排他的包含。本申请的说明书和权利要求书或上述附图中的术语“第一”、“第二”等是用于区别不同对象,而不是用于描述特定顺序。Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the technical field of this application; the terms used herein in the specification of the application are for the purpose of describing specific embodiments only It is not intended to limit the application; the terms "comprising" and "having" and any variations thereof in the description and claims of this application and the above description of the drawings are intended to cover non-exclusive inclusion. The terms "first", "second" and the like in the description and claims of the present application or the above drawings are used to distinguish different objects, rather than to describe a specific order.
在本文中提及“实施例”意味着,结合实施例描述的特定特征、结构或特性可以包含在本申请的至少一个实施例中。在说明书中的各个位置出现该短语并不一定均是指相同的实施例,也不是与其它实施例互斥的独立的或备选的实施例。本领域技术人员显式地和隐式地理解的是,本文所描述的实施例可以与其它实施例相结合。Reference herein to an "embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the present application. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor a separate or alternative embodiment that is mutually exclusive of other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
为了使本技术领域的人员更好地理解本申请方案,下面将结合附图,对本申请实施例 中的技术方案进行清楚、完整地描述。In order to make those skilled in the art better understand the solutions of the present application, the technical solutions in the embodiments of the present application will be described clearly and completely below with reference to the accompanying drawings.
如图1所示,系统架构100可以包括终端设备101、102、103,网络104和服务器105。网络104用以在终端设备101、102、103和服务器105之间提供通信链路的介质。网络104可以包括各种连接类型,例如有线、无线通信链路或者光纤电缆等等。As shown in FIG. 1 , the system architecture 100 may include terminal devices 101 , 102 , and 103 , a network 104 and a server 105 . The network 104 is a medium used to provide a communication link between the terminal devices 101 , 102 , 103 and the server 105 . The network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, among others.
用户可以使用终端设备101、102、103通过网络104与服务器105交互,以接收或发送消息等。终端设备101、102、103上可以安装有各种通讯客户端应用,例如网页浏览器应用、购物类应用、搜索类应用、即时通信工具、邮箱客户端、社交平台软件等。The user can use the terminal devices 101, 102, 103 to interact with the server 105 through the network 104 to receive or send messages and the like. Various communication client applications may be installed on the terminal devices 101 , 102 and 103 , such as web browser applications, shopping applications, search applications, instant messaging tools, email clients, social platform software, and the like.
终端设备101、102、103可以是具有显示屏并且支持网页浏览的各种电子设备,包括但不限于智能手机、平板电脑、电子书阅读器、MP3播放器(Moving Picture Experts Group Audio Layer III,动态影像专家压缩标准音频层面3)、MP4(Moving Picture Experts Group Audio Layer IV,动态影像专家压缩标准音频层面4)播放器、膝上型便携计算机和台式计算机等等。The terminal devices 101, 102, and 103 can be various electronic devices that have a display screen and support web browsing, including but not limited to smart phones, tablet computers, e-book readers, MP3 players (Moving Picture Experts Group Audio Layer III, dynamic Picture Experts Compression Standard Audio Layer 3), MP4 (Moving Picture Experts Group Audio Layer IV, Moving Picture Experts Compression Standard Audio Layer 4) Players, Laptops and Desktops, etc.
服务器105可以是提供各种服务的服务器,例如对终端设备101、102、103上显示的页面提供支持的后台服务器。The server 105 may be a server that provides various services, such as a background server that provides support for the pages displayed on the terminal devices 101 , 102 , and 103 .
需要说明的是,本申请实施例所提供的接口自动化测试方法一般由服务器/终端设备执行,相应地,接口自动化测试装置一般设置于服务器/终端设备中。It should be noted that the automated interface testing method provided by the embodiments of the present application is generally performed by a server/terminal device, and accordingly, an automated interface testing apparatus is generally set in the server/terminal device.
应该理解,图1中的终端设备、网络和服务器的数目仅仅是示意性的。根据实现需要,可以具有任意数目的终端设备、网络和服务器。It should be understood that the numbers of terminal devices, networks and servers in FIG. 1 are merely illustrative. There can be any number of terminal devices, networks and servers according to implementation needs.
继续参考图2,示出了根据本申请的接口自动化测试方法的一个实施例的流程图。所述的接口自动化测试方法,包括以下步骤:Continuing to refer to FIG. 2 , a flowchart of an embodiment of an interface automated testing method according to the present application is shown. The interface automated testing method includes the following steps:
S1:在接收到用户发送的测试指令时,确定所述测试指令对应的测试目的,基于测试用例层调用预设的dto层,并基于所述测试目的通过所述dto层生成接口入参。S1: When receiving the test instruction sent by the user, determine the test purpose corresponding to the test instruction, call the preset dto layer based on the test case layer, and generate interface input parameters through the dto layer based on the test purpose.
在本实施例中,测试目的包含于测试用例层的测试策略中,根据测试指令确定测试用例层中对应的测试目的。DTO(Data Transfer Object,数据传输对象)一般用于数据的保存和传递。本申请将dto层与测试用例层结合,将原本的测试用例层中测试策略(即case方法)中所包含的接口入参等信息,通过dto层来生成,实现不同的测试策略可以重复使用。而dto层可以与测试用例层中不同的测试策略结合,满足不同测试策略生成不同类型参数的需求。在应用过程中,由于需求的变动,可能会造成参数的变动,进而导致测试用例层中的测试策略变动。例如:某需求优化时,需要在某接口增加一个必填参数,该接口原有50个参数,则该接口至少有51个测试策略(即case方法),其中,包括1个准入和50个参数校验测试策略(即case方法)。在这种情况下,需要修改51个测试策略的参数部分。而通过本申请的dto层统一管理生成接口入参之后,只需要修改dto类中对应接口的生成参数方法,对应测试用例和测试方法都无需修改,有效提升了测试策略的复用和计算机的测试速度。In this embodiment, the test purpose is included in the test strategy of the test case layer, and the corresponding test purpose in the test case layer is determined according to the test instruction. DTO (Data Transfer Object, data transfer object) is generally used for data storage and transfer. This application combines the dto layer with the test case layer, and generates the interface input parameters and other information contained in the test strategy (that is, the case method) in the original test case layer through the dto layer, so that different test strategies can be reused. The dto layer can be combined with different test strategies in the test case layer to meet the needs of different test strategies to generate different types of parameters. During the application process, due to changes in requirements, changes in parameters may occur, which in turn lead to changes in the test strategy in the test case layer. For example, when a requirement is optimized, a required parameter needs to be added to an interface. If the interface has 50 parameters, the interface has at least 51 test strategies (ie case methods), including 1 entry and 50 test strategies. Parameter validation test strategy (ie case method). In this case, the parameter section of the 51 test strategies needs to be modified. After the interface input parameters are generated through the unified management of the dto layer of the present application, only the generation parameter method of the corresponding interface in the dto class needs to be modified, and the corresponding test cases and test methods do not need to be modified, which effectively improves the reuse of test strategies and computer testing. speed.
在本实施例中,接口自动化测试方法运行于其上的电子设备(例如图1所示的服务器/终端设备)可以通过有线连接方式或者无线连接方式接收测试目的。需要指出的是,上述无线连接方式可以包括但不限于3G/4G连接、WiFi连接、蓝牙连接、WiMAX连接、Zigbee连接、UWB(ultra wideband)连接、以及其他现在已知或将来开发的无线连接方式。In this embodiment, the electronic device (for example, the server/terminal device shown in FIG. 1 ) on which the interface automated testing method runs may receive the test purpose through a wired connection or a wireless connection. It should be pointed out that the above wireless connection methods may include but are not limited to 3G/4G connection, WiFi connection, Bluetooth connection, WiMAX connection, Zigbee connection, UWB (ultra wideband) connection, and other wireless connection methods currently known or developed in the future .
具体的,所述dto层包括不同的dto类,所述dto类中具有不同的参数生成策略,所述在接收到用户发送的测试指令时,确定所述测试指令对应的测试目的,基于测试用例层调用预设的dto层,并基于所述测试目的通过所述dto层生成接口入参的步骤包括:Specifically, the dto layer includes different dto classes, and the dto classes have different parameter generation strategies. When receiving a test command sent by a user, the test purpose corresponding to the test command is determined, based on the test case The layer calls the preset dto layer, and the steps of generating interface input parameters through the dto layer based on the test purpose include:
在接收到用户发送的测试指令时,确定所述测试指令对应的测试目标用户和测试目的;When receiving the test instruction sent by the user, determine the test target user and the test purpose corresponding to the test instruction;
基于测试用例层调用预设的dto层;Call the preset dto layer based on the test case layer;
基于所述测试目标用户选择对应的dto类,其中,所述测试目标用户与所述dto类为一一对应关系;The corresponding dto class is selected based on the test target user, wherein the test target user and the dto class are in a one-to-one correspondence;
基于所述测试目的确定所述dto类中对应的参数生成策略,通过所述参数生成策略生 成接口入参。Determine the corresponding parameter generation strategy in the dto class based on the test purpose, and generate interface input parameters through the parameter generation strategy.
在本实施例中,所述参数生成策略与所述测试目的为一一对应关系。Dto层中包括不同的dto类,不同的测试目标用户对应不同的dto类,例如:一家银行可以对应一个dto类。在dto类下包括不同的参数生成策略(即dto生成方法),不同的测试目的对应不同的dto生成方法。如此设置,便于统一维护和管理,当项目需求变更,导致接口参数变化时,只需要找到对应的dto类,维护该类下的对应接口的dto生成方法即可。不同的dto类满足不同的测试策略生成不同类型参数的需求,例如:设定默认某一dto类生成正常场景的参数,并传入key和value,则该dto类根据接收到的key和value生成对应的参数。具体的,传入的key为请求流水号(applyNo),value为空(null),进一步生成请求流水号参数为空的参数效验的测试用例。例如:当因为实际需求的改变,而需要变动接口参数时,A接口有1、2、3参数,变成2、3、4参数,那么只需要在dto层修改A接口参数生成的方法,修改参数为2、3、4。此外,对应在测试用例层去掉A接口的1参数校验方法,增加4参数校验方法即可。In this embodiment, the parameter generation strategy and the test purpose are in a one-to-one correspondence. The Dto layer includes different dto classes, and different test target users correspond to different dto classes, for example, a bank can correspond to one dto class. Different parameter generation strategies (ie dto generation methods) are included under the dto class, and different test purposes correspond to different dto generation methods. This setting is convenient for unified maintenance and management. When the project requirements change and the interface parameters change, you only need to find the corresponding dto class and maintain the dto generation method of the corresponding interface under this class. Different dto classes meet the needs of different test strategies to generate different types of parameters. For example, if a default dto class is set to generate parameters for normal scenarios, and the key and value are passed in, the dto class will be generated according to the received key and value. corresponding parameters. Specifically, the incoming key is the request serial number (applyNo), and the value is null (null), and further generates a test case for parameter validation where the request serial number parameter is null. For example: when the interface parameters need to be changed due to changes in actual requirements, the A interface has 1, 2, and 3 parameters, which become 2, 3, and 4 parameters, then only the method for generating the parameters of the A interface needs to be modified at the dto layer. The parameters are 2, 3, 4. In addition, the 1-parameter verification method of the A interface is removed from the test case layer, and a 4-parameter verification method can be added.
此外,所述参数生成策略包括组装策略,所述通过所述参数生成策略生成接口入参的步骤包括:In addition, the parameter generation strategy includes an assembly strategy, and the step of generating interface input parameters through the parameter generation strategy includes:
当基于所述测试目的确定的所述dto类中对应的参数生成策略为组装策略时,基于所述测试目的获取预先设置的接口参数,并通过所述dto层组装所述接口参数,生成接口入参。When the corresponding parameter generation strategy in the dto class determined based on the test purpose is an assembly strategy, obtain preset interface parameters based on the test purpose, assemble the interface parameters through the dto layer, and generate an interface input Ref.
在本实施例中,在需要测试固定的参数的情况下,计算机接收设定接口参数,通过测试用例层调用dto层组装该接口参数,生成接口入参。若不需要固定的参数,而是随机测试的情况下,直接根据要求,通过dto层生成接口入参即可。In this embodiment, when a fixed parameter needs to be tested, the computer receives and sets the interface parameter, calls the dto layer through the test case layer to assemble the interface parameter, and generates the interface input parameter. If you do not need fixed parameters, but in the case of random testing, you can directly generate the interface input parameters through the dto layer according to the requirements.
对应的,所述参数生成策略包括随机生成策略,所述通过所述参数生成策略生成接口入参的步骤包括:Correspondingly, the parameter generation strategy includes a random generation strategy, and the step of generating interface input parameters through the parameter generation strategy includes:
当基于所述测试目的确定的所述dto类中对应的参数生成策略为随机生成策略时,基于所述测试目的获取预先设置的接口参数,并通过所述dto层调用预设的工具层中的随机数生成工具;When the corresponding parameter generation strategy in the dto class determined based on the test purpose is a random generation strategy, the preset interface parameters are acquired based on the test purpose, and the preset interface parameters in the tool layer are called through the dto layer. Random number generator;
获取时间戳,基于所述随机数生成工具根据时间戳生成随机数,通过所述dto层组装所述随机数和预先设定的接口参数,生成接口入参。Obtain a timestamp, generate a random number according to the timestamp based on the random number generating tool, assemble the random number and preset interface parameters through the dto layer, and generate interface input parameters.
在本实施例中,Dto层调用工具层(util层)中随机数生成工具生成随机数,其中,随机数生成工具可以采用预先封装的随机数生成函数。Dto层的设计便于与测试用例层进行解耦,且单独设置dto层进行接口入参的生成,满足参数可以重复使用的需求。同时dto层可以随机生成参数。例如:在贷款申请中,一般要求同一用户不能重复申请同款贷款产品。那么在接口测试过程中,用户的身份信息,如手机号、身份证号码、银行卡号等不能够重复使用。故可以通过时间戳随机生成随机数,使得参数不重复生成,实现各种测试用例可以重复执行。In this embodiment, the Dto layer invokes a random number generating tool in the tool layer (util layer) to generate random numbers, wherein the random number generating tool may use a pre-packaged random number generating function. The design of the Dto layer is convenient for decoupling from the test case layer, and the Dto layer is set separately to generate interface input parameters to meet the requirement that the parameters can be reused. At the same time, the dto layer can generate parameters randomly. For example, in loan application, it is generally required that the same user cannot apply for the same loan product repeatedly. Then, during the interface testing process, the user's identity information, such as mobile phone number, ID number, bank card number, etc., cannot be reused. Therefore, random numbers can be randomly generated through timestamps, so that parameters are not repeatedly generated, and various test cases can be executed repeatedly.
S2:基于所述测试用例层获取所述接口入参,并基于所述接口入参生成接口请求,所述接口请求携带所述测试目的。S2: Obtain the interface input parameters based on the test case layer, and generate an interface request based on the interface input parameters, where the interface request carries the test purpose.
在本实施例中,测试用例层,即Case层用于定义测试策略(case方法),包括流程测试策略和参数校验测试策略两种。由于单独通过dto层生成接口入参,使得本申请的测试用例层定义的测试策略的代码模板更为统一、清晰并且简单,便于快速复制到其他项目,相关人员的学习和测试策略的维护成本均较低。测试用例层根据测试目的的不同,向API层发送对应的接口请求,API层用于定义调用的API。In this embodiment, the test case layer, that is, the Case layer, is used to define a test strategy (case method), including two kinds of process test strategy and parameter verification test strategy. Because the interface input parameters are generated through the dto layer alone, the code template of the test strategy defined by the test case layer of the present application is more unified, clear and simple, and it is easy to quickly copy to other projects. The learning of relevant personnel and the maintenance cost of the test strategy are all lower. The test case layer sends corresponding interface requests to the API layer according to different test purposes, and the API layer is used to define the API to be called.
S3:基于所述测试目的,调用预设的API层中与所述测试目的对应的执行策略执行所述接口请求,完成接口测试。S3: Based on the test purpose, call the execution strategy corresponding to the test purpose in the preset API layer to execute the interface request, and complete the interface test.
在本实施例中,在调用API层中预设不同的执行策略,根据测试目的的不同,选择不同的执行策略,便于自动化测试的快速进行。In this embodiment, different execution strategies are preset in the calling API layer, and different execution strategies are selected according to different test purposes, so as to facilitate the rapid progress of automated testing.
具体的,所述API层中包括第一接口和第二接口,所述第一接口中封装有不同的主执行策略,所述第二接口中封装有不同的副执行策略,所述基于所述测试目的,调用预设的API层中与所述测试目的对应的执行策略执行所述接口请求,完成接口测试的步骤包括:Specifically, the API layer includes a first interface and a second interface, the first interface is encapsulated with different main execution strategies, the second interface is encapsulated with different secondary execution strategies, the For the test purpose, call the execution strategy corresponding to the test purpose in the preset API layer to execute the interface request, and the steps to complete the interface test include:
基于所述测试目的,调用所述第一接口中对应的主执行策略,并通过所述主执行策略调用所述第二接口中对应的至少一个副执行策略执行所述接口请求,获得最终执行结果;Based on the test purpose, the main execution strategy corresponding to the first interface is invoked, and at least one sub-execution strategy corresponding to the second interface is invoked through the main execution strategy to execute the interface request to obtain the final execution result ;
将所述最终执行结果返回至所述第一接口,并通过所述第一接口将所述最终执行结果返回至所述测试用例层;returning the final execution result to the first interface, and returning the final execution result to the test case layer through the first interface;
通过所述测试用例层调用预设的工具层中的断言工具,断言所述最终执行结果,获得断言结果以完成接口测试。The assertion tool in the preset tool layer is invoked through the test case layer, the final execution result is asserted, and the assertion result is obtained to complete the interface test.
在本实施例中,第一接口(FlowBaseAPI)中封装有不同的主执行策略。第二接口(BaseAPI)中封装有不同的副执行策略,其中,所述主执行策略与所述副执行策略之间存在一对一和一对多的对应关系。其中,当主执行策略调用多个副执行策略时,副执行策略依次执行对应的操作,即当一个副执行策略执行完成后,将结果返回至第一接口后,当接收到第一接口返回的继续执行指令时,才继续执行下一个副执行策略。基于测试目的的不同,调用第一接口中不同的主执行策略和第二接口中不同的副执行策略。通过在API层中设置两个具有递进关系的接口,即通过第一接口中的主执行策略调用所述第二接口中对应的至少一个副执行策略,实现自动化测试有条理的进行。测试用例层只会接受第一接口返回的最终执行结果(即最终处理结果),其中,断言工具用于对最终执行结果进行断言,常用的断言工具为JsonAssertion,将最终执行结果与预先设想的结果进行比较,然后输出一致或者不一致作为断言结果。In this embodiment, different main execution policies are encapsulated in the first interface (FlowBaseAPI). Different secondary execution strategies are encapsulated in the second interface (BaseAPI), wherein there is a one-to-one and one-to-many correspondence between the primary execution strategy and the secondary execution strategy. Among them, when the main execution strategy invokes multiple sub-execution strategies, the sub-execution strategies execute corresponding operations in sequence, that is, after the execution of one sub-execution strategy is completed, the result is returned to the first interface, and when the continuation returned by the first interface is received When the instruction is executed, it continues to execute the next sub-execution strategy. Based on different testing purposes, different primary execution strategies in the first interface and different secondary execution strategies in the second interface are invoked. By setting two interfaces with a progressive relationship in the API layer, that is, calling at least one corresponding sub-execution strategy in the second interface through the main execution strategy in the first interface, the automated testing can be carried out in an orderly manner. The test case layer will only accept the final execution result (that is, the final processing result) returned by the first interface. The assertion tool is used to assert the final execution result. The commonly used assertion tool is JsonAssertion, which compares the final execution result with the pre-conceived result. Compare, and output consistency or inconsistency as the assertion result.
进一步的,所述通过所述主执行策略调用所述第二接口中对应的至少一个副执行策略执行所述接口请求,获得最终执行结果的步骤包括:Further, the step of invoking at least one corresponding secondary execution policy in the second interface to execute the interface request through the primary execution policy, and obtaining a final execution result includes:
当所述主执行策略调用的所述副执行策略为一个时,获得最终执行结果;When the secondary execution strategy invoked by the main execution strategy is one, the final execution result is obtained;
当所述主执行策略调用的所述副执行策略为多个时,依次执行所述副执行策略,其中,每执行一个副执行策略,获得一个中间执行结果,将所述中间执行结果返回至所述第一接口,当接收到所述第一接口返回的继续执行指令时,执行下一个副执行策略,直至执行完当前主执行策略调用的所有副执行策略,获得最终执行结果。When there are multiple secondary execution strategies invoked by the main execution strategy, the secondary execution strategies are executed in sequence, wherein each secondary execution strategy is executed, an intermediate execution result is obtained, and the intermediate execution result is returned to the The first interface, when receiving the continuing execution instruction returned by the first interface, executes the next sub-execution strategy until all sub-execution strategies called by the current main execution strategy are executed, and the final execution result is obtained.
在本实施例中,测试用例层只会接受第一接口返回的最终执行结果(即最终处理结果)。第二接口里面可能执行了多步操作,每步操作有返回中间执行结果到第一接口,整个过程均在API层中处理。通过设置第一接口和第二接口既实现了对不同的接口测试有条理的执行,又使得中间执行结果返回至第一接口,保证了整个操作过程都在API层中,第一接口接收到中间执行结果后调用下一个副执行策略,直到接收到最终执行结果,才将最终执行结果返回至测试用例层,保证了测试用例层无需关心中间的执行过程,只接收最终执行结果即可,有效避免了测试混乱。In this embodiment, the test case layer only accepts the final execution result (ie, the final processing result) returned by the first interface. The second interface may perform multiple operations, and each step returns an intermediate execution result to the first interface, and the entire process is processed in the API layer. By setting the first interface and the second interface, the orderly execution of different interface tests is realized, and the intermediate execution result is returned to the first interface, which ensures that the entire operation process is in the API layer, and the first interface receives the intermediate execution result. After the execution result, the next sub-execution strategy is called, and the final execution result is not returned to the test case layer until the final execution result is received, which ensures that the test case layer does not need to care about the intermediate execution process, and only receives the final execution result. Test confusion.
具体的,所述第一接口包括第一主执行策略、第二主执行策略和第三主执行策略,所述第二接口包括第一副执行策略、第二副执行策略和第三副执行策略,基于所述测试目的,调用所述第一接口中对应的主执行策略,并通过所述主执行策略调用所述第二接口中对应的至少一个副执行策略执行所述接口请求,获得最终执行结果的步骤包括:Specifically, the first interface includes a first primary execution strategy, a second primary execution strategy and a third primary execution strategy, and the second interface includes a first secondary execution strategy, a second secondary execution strategy and a third secondary execution strategy , based on the test purpose, call the corresponding main execution strategy in the first interface, and invoke at least one sub-execution strategy corresponding to the second interface through the main execution strategy to execute the interface request, and obtain the final execution The resulting steps include:
识别所述测试目的;identify the purpose of the test;
当所述测试目的为参数加密时,调用所述第一接口中的第一主执行策略,通过所述第一主执行策略调用所述第二接口中的第一副执行策略执行参数加密,获得最终执行结果;When the test purpose is parameter encryption, the first main execution strategy in the first interface is called, and the first sub-execution strategy in the second interface is invoked through the first main execution strategy to perform parameter encryption, and obtain final execution result;
当所述测试目的为日志对比时,调用所述第一接口中的第二主执行策略,通过所述第二主执行策略调用第二接口中的第一副执行策略和第二副执行策略,分别依次执行参数加密和日志对比,获得中间执行结果和最终执行结果;When the test purpose is log comparison, the second primary execution strategy in the first interface is invoked, and the first secondary execution strategy and the second secondary execution strategy in the second interface are invoked through the second primary execution strategy, Execute parameter encryption and log comparison in turn to obtain intermediate execution results and final execution results;
当所述测试目的为通知类日志对比时,调用所述第一接口中的第三主执行策略,通过所述第三主执行策略调用所述第二接口中的第一副执行策略、第二副执行策略和第三副执 行策略,分别依次执行参数加密、日志对比和通知类日志对比,获得中间执行结果和最终执行结果。When the test purpose is to compare notification logs, the third main execution strategy in the first interface is invoked, and the first sub-execution strategy and the second sub-execution strategy in the second interface are invoked through the third main execution strategy. The sub-execution strategy and the third sub-execution strategy execute parameter encryption, log comparison, and notification log comparison in sequence to obtain intermediate execution results and final execution results.
在本实施例中,在测试目的为参数加密中,参数加密返回的结果属于最终执行结果。在测试目的为日志对比中,参数加密返回的结果属于中间执行结果,日志对比返回的结果属于最终执行结果。在测试目的为通知类日志对比中,参数加密操作、日志对比操作返回的结果属于中间执行结果。通知类日志对比操作返回的结果属于最终执行结果。通过主执行策略调用一个或者多个副执行策略,实现了在API层中,主执行策略对副执行策略的控制,保证了测试过程能够根据主执行策略的控制有序的进行。第一接口(FlowBaseAPI)包括三种不同的主执行策略(即方法):1)getAPIResult方法:接口请求发送。2)getCompareLogResult方法:接口请求发送,接口日志比对。3)getCompareNoticeLogResult方法:接口请求发送,接口日志比对,通知接口日志比对。第二接口(BaseAPI)包括三种不同的副执行策略:1)getAPIResult方法:报文加密并发送post请求。2)compareLog方法:接口入参和日志调用关联方接口入参比对,具体为:根据关键字,提取日志中请求关联方接口参数,并与接口入参进行比对,比对内容是根据接口相同的key,比较value值。3)compareNoticeLog方法:接口入参和通知类日志中的参数比对。In this embodiment, when the test purpose is parameter encryption, the result returned by parameter encryption belongs to the final execution result. When the test purpose is log comparison, the result returned by parameter encryption belongs to the intermediate execution result, and the result returned by log comparison belongs to the final execution result. In the test purpose of notification log comparison, the results returned by parameter encryption operations and log comparison operations belong to the intermediate execution results. The result returned by the notification class log comparison operation is the final execution result. One or more sub-execution strategies are invoked by the main execution strategy, which realizes the control of the sub-execution strategy by the main execution strategy in the API layer, and ensures that the test process can be carried out in an orderly manner according to the control of the main execution strategy. The first interface (FlowBaseAPI) includes three different main execution strategies (ie methods): 1) getAPIResult method: interface request sending. 2) getCompareLogResult method: interface request sending, interface log comparison. 3) getCompareNoticeLogResult method: interface request sending, interface log comparison, notification interface log comparison. The second interface (BaseAPI) includes three different sub-execution strategies: 1) getAPIResult method: encrypt the message and send a post request. 2) compareLog method: compare the input parameters of the interface and the interface input of the log call related party, specifically: according to the keyword, extract the interface parameters of the request related party in the log, and compare them with the interface input parameters. The comparison content is based on the interface For the same key, compare the value. 3) compareNoticeLog method: compares the interface input parameters with the parameters in the notification class log.
本申请需要说明且可以理解的是:参数加密的步骤是在测试目的为参数加密、日志对比以及通知类日志对比中均有执行的。日志对比的步骤是在测试目的为日志对比和通知类日志对比中均有执行的。通知类日志对比的步骤仅在测试目的为通知类日志对比时执行。It should be explained and understandable in this application that: the step of parameter encryption is executed in the test purpose of parameter encryption, log comparison and notification type log comparison. The steps of log comparison are performed in both log comparison and notification log comparison for test purposes. The steps of notification class log comparison are performed only when the test purpose is notification class log comparison.
其中,当所述测试目的为日志对比时,调用第二主执行策略、第一副执行策略、第二副执行策略执行参数加密操作和日志对比操作的步骤包括:Wherein, when the test purpose is log comparison, the steps of invoking the second main execution strategy, the first sub-execution strategy, and the second sub-execution strategy to perform the parameter encryption operation and the log comparison operation include:
当所述测试目的为日志对比时,调用第二主执行策略向所述第二接口发送日志对比请求;When the test purpose is log comparison, the second main execution strategy is invoked to send a log comparison request to the second interface;
通过所述第二接口中的第一副执行策略调用预设的工具层中的日记提取工具类,基于预设的请求流水号进行日志查询,获得接口日志,将所述接口日志作为中间执行结果,返回至所述第一接口;Call the log extraction tool class in the preset tool layer through the first secondary execution strategy in the second interface, perform log query based on the preset request serial number, obtain the interface log, and use the interface log as the intermediate execution result , return to the first interface;
当接收到所述第一接口发送的继续执行指令时,通过所述第二副执行策略获取所述接口日志中调用关联方接口的参数,比对所述调用关联方接口的参数与所述接口入参,获得日志比对结果,作为所述最终执行结果。When receiving the continuation execution instruction sent by the first interface, obtain the parameters for calling the associated party interface in the interface log through the second secondary execution policy, and compare the parameters for calling the associated party interface with the interface Enter the parameters to obtain the log comparison result as the final execution result.
在本实施例中,一般应用系统为了方便查看运行情况,以及遇到故障分析问题原因等,都会打印日志。日志会记录程序执行过程,执行信息等。本申请在开始测试时向被测应用系统发送接口请求后,无法直接获取被测系统调用关联方时发送的请求信息,只能通过被测服务器打印的日志信息获知,需要先提取日志获取调用关联方的请求参数,然后与dto层生成的接口入参进行比对,以确定被测系统调用关联方的请求信息中的请求参数无误,其中,被测系统调用关联方的请求信息中的请求参数为通过透传获取的接口入参。因被测系统向关联方进行请求的请求流水号(applyNo)唯一,故可以将请求流水号(applyNo)作为接口日志打印标记,同时作为提取日志关键字,进行日志文件的接口日志精准提取。In this embodiment, the general application system will print a log for the convenience of checking the running situation and analyzing the cause of the problem when encountering a failure. The log records the program execution process, execution information, etc. After the application sends an interface request to the application system under test at the beginning of the test, it cannot directly obtain the request information sent by the system under test when it calls the associated party. It can only be obtained through the log information printed by the server under test. It is necessary to extract the log first to obtain the call association The request parameters of the party under test are compared with the interface input parameters generated by the dto layer to confirm that the request parameters in the request information of the related party under test are correct, wherein the request parameters in the request information of the related party under test are called Indicates the interface input parameters obtained through transparent transmission. Since the request serial number (applyNo) of the request from the system under test to the related party is unique, the request serial number (applyNo) can be used as the interface log print mark, and at the same time as the extraction log keyword, to accurately extract the interface log of the log file.
进一步的,所述获取所述接口日志中调用关联方接口的参数,比对所述调用关联方接口的参数与所述接口入参,获得日志比对结果的步骤包括:Further, the step of obtaining the parameters for calling the related party interface in the interface log, comparing the parameters for calling the related party interface and the interface input parameters, and obtaining the log comparison result includes:
通过预设的正则表达式匹配所述接口日志,获得所述接口日志中调用关联方接口的参数;Match the interface log with a preset regular expression, and obtain the parameters for calling the associated party interface in the interface log;
比较所述调用关联方接口的参数与所述接口入参的key是否相同;Compare whether the parameters of the calling associated party interface are the same as the keys of the interface input parameters;
当key相同时,比较对应的value是否一致,获得日志比对结果。When the keys are the same, compare whether the corresponding values are consistent and obtain the log comparison result.
在本实施例中,正则表达式使用单个字符串来描述、匹配一系列符合某个句法规则的字符串。通过预设的正则表达式来匹配关联方的日志文件,获取接口关联方的请求参数,其中,关联方可以包括银行方或者平台方。本申请可以将参数提取方式封装为日志提取API,在参数提取时直接调用,具体包括:读取被测系统打印的日志文件,跟进被测系统的日志 打印信息,提取关联方的请求参数。In this embodiment, the regular expression uses a single character string to describe and match a series of character strings conforming to a certain syntax rule. A preset regular expression is used to match the log file of the related party, and the request parameters of the interface related party are obtained, wherein the related party may include the bank party or the platform party. The present application can encapsulate the parameter extraction method as a log extraction API, which is directly invoked during parameter extraction, specifically including: reading the log file printed by the system under test, following up the log print information of the system under test, and extracting the request parameters of the associated party.
以下为本申请上述实施例的具体详细执行过程:The specific detailed execution process of the above-mentioned embodiment of the present application is as follows:
执行所述参数加密的步骤包括:1)调用所述第一接口(FlowBaseAPI)中的第一主执行策略向所述第二接口(BaseAPI)发送post请求,所述post请求携带有所述接口入参;2)通过所述第二接口中的第一副执行策略调用工具层中的Http tool工具对所述接口入参进行参数加密,生成加密报文;3)基于所述加密报文,通过所述第二接口中的第一副执行策略调用所述Http tool工具发起接口准入请求,生成响应结果;4)将所述响应结果传输至第一接口;5)所述第一接口将所述响应结果传输至测试用例层;6)所述测试用例层调用断言工具对所述响应结果进行断言,生成断言结果,完成接口测试。因为安全需要,应用系统一般会对请求信息进行加密,故测试过程中,本申请也同样需要先加密请求参数,再发起请求,通过断言确定响应结果是否符合预期。其中,本申请还包括将加密报文与预期结果相比较,确定是否一致,若一致则参数加密测试无误。The step of executing the parameter encryption includes: 1) invoking the first main execution policy in the first interface (FlowBaseAPI) to send a post request to the second interface (BaseAPI), where the post request carries the interface entry. parameter; 2) parameter encryption is performed on the interface input parameter by the Http tool tool in the tool layer called by the first sub-execution policy in the second interface, and an encrypted message is generated; 3) based on the encrypted message, by The first secondary execution strategy in the second interface calls the Http tool tool to initiate an interface admission request, and generates a response result; 4) transmit the response result to the first interface; 5) the first interface transfers all The response result is transmitted to the test case layer; 6) The test case layer invokes an assertion tool to assert the response result, generates an assertion result, and completes the interface test. Due to security requirements, the application system generally encrypts the request information. Therefore, during the test process, the application also needs to encrypt the request parameters first, then initiate the request, and determine whether the response result meets the expectation through assertion. Wherein, the present application also includes comparing the encrypted message with the expected result to determine whether they are consistent, and if they are consistent, the parameter encryption test is correct.
执行所述日志对比的步骤包括:1)调用所述第一接口中的第二主执行策略向所述第二接口发送日志对比请求;2)通过所述第二接口中的第二副执行策略调用工具层中的日记提取工具类(GetLogUnits)进行日志查询,获得接口日志;3)获取所述接口日志中的调用关联方接口的参数,比对所述调用关联方接口的参数与所述接口入参,获得日志比对结果;4)返回所述日志比对结果至所述第一接口;5)所述第一接口将所述日志比对结果传输至测试用例层;6)所述测试用例层调用断言工具对所述日志比对结果进行断言,生成断言结果,完成接口测试。向被测应用系统发送接口请求后,无法直接获取被测系统调用关联方时的发送的请求信息,只能通过被测服务器打印的日志信息获知,需要先提取日志获取调用关联方的请求参数,然后和dto层生成的接口入参进行比对,以确定被测系统调用关联方的请求信息中的请求参数无误,其中,被测系统调用关联方的请求信息中的请求参数为通过透传获取的接口入参。The step of executing the log comparison includes: 1) invoking the second primary execution strategy in the first interface to send a log comparison request to the second interface; 2) through the second secondary execution strategy in the second interface Call the log extraction tool class (GetLogUnits) in the tool layer to perform log query to obtain the interface log; 3) obtain the parameters of the calling related party interface in the interface log, and compare the parameters of the calling related party interface with the interface Enter the parameters to obtain the log comparison result; 4) Return the log comparison result to the first interface; 5) The first interface transmits the log comparison result to the test case layer; 6) The test The use case layer invokes an assertion tool to assert the log comparison result, generates an assertion result, and completes the interface test. After sending an interface request to the application system under test, the request information sent when the system under test calls the related party cannot be directly obtained. It can only be obtained through the log information printed by the server under test. It is necessary to extract the log first to obtain the request parameters of the calling related party. Then, it is compared with the interface input parameters generated by the dto layer to confirm that the request parameters in the request information of the related party under test call are correct, wherein the request parameters in the request information of the related party under test call are obtained through transparent transmission interface input parameters.
执行所述通知类日志对比的步骤包括:1)调用所述第一接口第三主执行策略向所述第二接口发起通知接口日志比对请求;2)通过所述第二接口中的第三副执行策略调用工具层中日记提取工具类(GetLogUnits)历遍通知类日志集合,获得对应的通知类日志;3)提取并比对所述通知类日志中对应不同关联方的通知接口参数,获得通知类日志比对结果;4)返回所述通知类日志比对结果至所述第一接口;5)所述第一接口将所述通知类日志比对结果传输至测试用例层;6)所述测试用例层调用断言工具(JsonAssertion)对所述日志比对结果进行断言,生成断言结果,完成接口测试。对于通知来说,许多通知是异步的,并非实时发送通知。故在需要发送通知的情况下,需要额外进行通知类日志中参数的比对,以确定通知中的参数无误。The step of executing the notification class log comparison includes: 1) invoking the third main execution policy of the first interface to initiate a notification interface log comparison request to the second interface; 2) through the third interface in the second interface The log extraction tool class (GetLogUnits) in the sub-execution strategy calling tool layer traverses the notification log collection to obtain the corresponding notification log; 3) extracts and compares the notification interface parameters corresponding to different related parties in the notification log, and obtains Notification class log comparison result; 4) Return the notification class log comparison result to the first interface; 5) The first interface transmits the notification class log comparison result to the test case layer; 6) All The test case layer invokes an assertion tool (JsonAssertion) to assert the log comparison result, generates an assertion result, and completes the interface test. For notifications, many notifications are asynchronous and not sent in real time. Therefore, when a notification needs to be sent, it is necessary to additionally compare the parameters in the notification log to confirm that the parameters in the notification are correct.
需要说明的是:本申请中的工具类均部署于工具层(util),所述工具层(util)包括不同的工具类,如Http工具类(Http tool)、日记提取工具类(GetLogUnits)、断言工具类(JsonAssertion)、参数类型转换工具类、随机生成数据工具类,例如可以随机生成手机号码、银行卡号、身份证号码等、日志平台读取工具类、读取配置文件工具类以及请求发送工具类等。It should be noted that the tool classes in this application are all deployed in the tool layer (util), and the tool layer (util) includes different tool classes, such as Http tool class (Http tool), log extraction tool class (GetLogUnits), Assertion tool class (JsonAssertion), parameter type conversion tool class, random data generation tool class, such as random generation of mobile phone numbers, bank card numbers, ID numbers, etc., log platform reading tool class, configuration file reading tool class, and request sending tools etc.
此外,本申请还设置有Config层,Config层用于定义配置,Config层包括环境信息(Config-properties)和常量参数等,若后续有需要变更时,可以在Config层统一修改维护配置信息。In addition, this application is also provided with a Config layer. The Config layer is used to define the configuration. The Config layer includes environment information (Config-properties) and constant parameters. If there is a need for subsequent changes, the maintenance configuration information can be uniformly modified in the Config layer.
具体的:环境信息用于测试用例层使用,如接口IP、端口、请求URL、日志文件路径、日志文件名称等信息,若后续环境信息变更,只需要在Config配置文件统一修改,不需要修改测试用例层中的内容。常量参数是指:如dto层的生成方法中的一部分随机数,通过工具层的工具类生成。一部分参数是常量,可能多个接口以及多个dto方法都需要使用,则可以写在Config配置文件中,若后续需要导致常量值变更时,不需要修改多个dto方法,只需要在Config配置文件中统一修改。Concrete: The environment information is used in the test case layer, such as interface IP, port, request URL, log file path, log file name and other information. If the subsequent environment information changes, it only needs to be uniformly modified in the Config configuration file, without the need to modify the test. Content in the use case layer. Constant parameters refer to: for example, some random numbers in the generation method of the dto layer, which are generated by the tool class of the tool layer. Some parameters are constants, and multiple interfaces and multiple dto methods may need to be used. They can be written in the Config configuration file. If the constant value needs to be changed later, there is no need to modify multiple dto methods, and only need to be in the Config configuration file. unified modification.
本申请的实施例可以应用于人工智能技术领域中,对如语义分析、图像识别以及生物识别等人工智能相关的数据接口进行测试。The embodiments of the present application can be applied in the field of artificial intelligence technology to test data interfaces related to artificial intelligence such as semantic analysis, image recognition, and biometric identification.
需要强调的是,为进一步保证上述API层中的执行策略的私密和安全性,上述API层中的执行策略还可以存储于一区块链的节点中。It should be emphasized that, in order to further ensure the privacy and security of the execution strategy in the above API layer, the execution strategy in the above API layer can also be stored in a node of a blockchain.
本申请所指区块链是分布式数据存储、点对点传输、共识机制、加密算法等计算机技术的新型应用模式。区块链(Blockchain),本质上是一个去中心化的数据库,是一串使用密码学方法相关联产生的数据块,每一个数据块中包含了一批次网络交易的信息,用于验证其信息的有效性(防伪)和生成下一个区块。区块链可以包括区块链底层平台、平台产品服务层以及应用服务层等。The blockchain referred to in this application is a new application mode of computer technologies such as distributed data storage, point-to-point transmission, consensus mechanism, and encryption algorithm. Blockchain, essentially a decentralized database, is a series of data blocks associated with cryptographic methods. Each data block contains a batch of network transaction information to verify its Validity of information (anti-counterfeiting) and generation of the next block. The blockchain can include the underlying platform of the blockchain, the platform product service layer, and the application service layer.
本申请可用于众多通用或专用的计算机系统环境或配置中。例如:个人计算机、服务器计算机、手持设备或便携式设备、平板型设备、多处理器系统、基于微处理器的系统、置顶盒、可编程的消费电子设备、网络PC、小型计算机、大型计算机、包括以上任何系统或设备的分布式计算环境等等。本申请可以在由计算机执行的计算机可执行指令的一般上下文中描述,例如程序模块。一般地,程序模块包括执行特定任务或实现特定抽象数据类型的例程、程序、对象、组件、数据结构等等。也可以在分布式计算环境中实践本申请,在这些分布式计算环境中,由通过通信网络而被连接的远程处理设备来执行任务。在分布式计算环境中,程序模块可以位于包括存储设备在内的本地和远程计算机存储介质中。The present application may be used in numerous general purpose or special purpose computer system environments or configurations. For example: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, including A distributed computing environment for any of the above systems or devices, and the like. The application may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The application may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including storage devices.
本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机可读指令来指令相关的硬件来完成,该计算机可读指令可存储于一计算机可读取存储介质中,该计算机可读指令在执行时,可包括如上述各方法的实施例的流程。其中,前述的存储介质可为磁碟、光盘、只读存储记忆体(Read-Only Memory,ROM)等非易失性存储介质,或随机存储记忆体(Random Access Memory,RAM)等。Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be implemented by instructing the relevant hardware through computer-readable instructions, and the computer-readable instructions can be stored in a computer-readable storage medium. , when the computer-readable instructions are executed, the processes of the above-mentioned method embodiments may be included. Wherein, the aforementioned storage medium may be a non-volatile storage medium such as a magnetic disk, an optical disk, a read-only memory (Read-Only Memory, ROM), or a random access memory (Random Access Memory, RAM) or the like.
应该理解的是,虽然附图的流程图中的各个步骤按照箭头的指示依次显示,但是这些步骤并不是必然按照箭头指示的顺序依次执行。除非本文中有明确的说明,这些步骤的执行并没有严格的顺序限制,其可以以其他的顺序执行。而且,附图的流程图中的至少一部分步骤可以包括多个子步骤或者多个阶段,这些子步骤或者阶段并不必然是在同一时刻执行完成,而是可以在不同的时刻执行,其执行顺序也不必然是依次进行,而是可以与其他步骤或者其他步骤的子步骤或者阶段的至少一部分轮流或者交替地执行。It should be understood that although the various steps in the flowchart of the accompanying drawings are sequentially shown in the order indicated by the arrows, these steps are not necessarily executed in sequence in the order indicated by the arrows. Unless explicitly stated herein, the execution of these steps is not strictly limited to the order and may be performed in other orders. Moreover, at least a part of the steps in the flowchart of the accompanying drawings may include multiple sub-steps or multiple stages, and these sub-steps or stages are not necessarily executed at the same time, but may be executed at different times, and the execution sequence is also It does not have to be performed sequentially, but may be performed alternately or alternately with other steps or at least a portion of sub-steps or stages of other steps.
进一步参考图3,作为对上述图2所示方法的实现,本申请提供了一种接口自动化测试装置的一个实施例,该装置实施例与图2所示的方法实施例相对应,该装置具体可以应用于各种电子设备中。Further referring to FIG. 3 , as an implementation of the method shown in FIG. 2 above, the present application provides an embodiment of an interface automated testing device, and the device embodiment corresponds to the method embodiment shown in FIG. 2 . Can be applied to various electronic devices.
如图3所示,本实施例所述的接口自动化测试装置300包括:参数生成模块301、请求发送模块302以及请求执行模块303。其中:参数生成模块301,用于在接收到用户发送的测试指令时,确定所述测试指令对应的测试目的,基于测试用例层调用预设的dto层,并基于所述测试目的通过所述dto层生成接口入参;请求发送模块302,用于基于所述测试用例层获取所述接口入参,并基于所述接口入参生成接口请求,所述接口请求携带所述测试目的;请求执行模块303,用于基于所述测试目的,调用预设的API层中与所述测试目的对应的执行策略执行所述接口请求,完成接口测试。As shown in FIG. 3 , the interface automated testing apparatus 300 described in this embodiment includes: a parameter generation module 301 , a request sending module 302 and a request execution module 303 . Wherein: the parameter generation module 301 is used to determine the test purpose corresponding to the test command when receiving the test command sent by the user, call the preset dto layer based on the test case layer, and pass the dto layer based on the test purpose layer generates interface input parameters; the request sending module 302 is configured to obtain the interface input parameters based on the test case layer, and generate an interface request based on the interface input parameters, and the interface request carries the test purpose; request execution module 303: Based on the test purpose, invoking an execution strategy corresponding to the test purpose in the preset API layer to execute the interface request to complete the interface test.
在本实施例中,通过单独设置的dto层实现接口入参的独立生成,再将生成的接口入参传输至测试用例层,避免了每次接口的参数改变时,需要对应修改测试策略,导致测试策略复用性低的情况。本申请在需要修改接口的参数时,只需要修改dto层中接口入参的生成方法,不需要修改测试用例层,有效的提高了测试用例层中的测试策略的复用性,提升了测试效率。区别于现有技术的每一步执行过程需要调用对应的API,本申请将执行过程根据测试目的的不同,调用API层中不同的执行策略。提升了整体测试过程的简洁性,可理解性,实现了测试过程的快速执行。In this embodiment, the independent generation of interface input parameters is achieved through a separately set dto layer, and then the generated interface input parameters are transmitted to the test case layer, which avoids the need to modify the test strategy correspondingly each time the parameters of the interface are changed, resulting in Test the case where the reusability of the strategy is low. When the parameters of the interface need to be modified, the application only needs to modify the generation method of the interface input parameters in the dto layer, and does not need to modify the test case layer, which effectively improves the reusability of the test strategy in the test case layer and improves the test efficiency. . Different from the prior art where each step of the execution process needs to call the corresponding API, the present application calls different execution strategies in the API layer in the execution process according to different testing purposes. It improves the simplicity and understandability of the overall test process, and realizes the rapid execution of the test process.
所述dto层包括不同的dto类,所述dto类中具有不同的参数生成策略,所述参数生 成模块301包括确定子模块、调用子模块、选择子模块和生成子模块。确定子模块用于在接收到用户发送的测试指令时,确定所述测试指令对应的测试目标用户和测试目的;调用子模块用于基于测试用例层调用预设的dto层;选择子模块用于基于所述测试目标用户选择对应的dto类,其中,所述测试目标用户与所述dto类为一一对应关系;生成子模块用于基于所述测试目的确定所述dto类中对应的参数生成策略,通过所述参数生成策略生成接口入参。Described dto layer includes different dto classes, has different parameter generation strategies in described dto class, described parameter generation module 301 comprises to determine submodule, call submodule, select submodule and generate submodule. The determination submodule is used to determine the test target user and the test purpose corresponding to the test instruction when receiving the test instruction sent by the user; the calling submodule is used for calling the preset dto layer based on the test case layer; the selection submodule is used for The corresponding dto class is selected based on the test target user, wherein the test target user and the dto class are in a one-to-one correspondence; the generation sub-module is used to determine the corresponding parameter generation in the dto class based on the test purpose Strategy, the interface input parameters are generated through the parameter generation strategy.
所述参数生成策略包括组装策略,在本实施例的一些可选的实现方式中,上述生成子模块进一步用于:当基于所述测试目的确定的所述dto类中对应的参数生成策略为组装策略时,基于所述测试目的获取预先设置的接口参数,并通过所述dto层组装所述接口参数,生成接口入参。The parameter generation strategy includes an assembly strategy. In some optional implementations of this embodiment, the above generation sub-module is further used for: when the corresponding parameter generation strategy in the dto class determined based on the test purpose is assembly During the strategy, the preset interface parameters are obtained based on the test purpose, and the interface parameters are assembled through the dto layer to generate interface input parameters.
所述参数生成策略包括随机生成策略,生成子模块包括调用单元和生成单元。调用单元用于当基于所述测试目的确定的所述dto类中对应的参数生成策略为随机生成策略时,基于所述测试目的获取预先设置的接口参数,并通过所述dto层调用预设的工具层中的随机数生成工具;生成单元用于获取时间戳,基于所述随机数生成工具根据时间戳生成随机数,通过所述dto层组装所述随机数和预先设定的接口参数,生成接口入参。The parameter generation strategy includes a random generation strategy, and the generation submodule includes a calling unit and a generating unit. The calling unit is configured to obtain preset interface parameters based on the test purpose when the corresponding parameter generation strategy in the dto class determined based on the test purpose is a random generation strategy, and call the preset interface parameters through the dto layer. A random number generation tool in the tool layer; the generation unit is used to obtain a timestamp, generate a random number according to the timestamp based on the random number generation tool, assemble the random number and preset interface parameters through the dto layer, and generate Interface input parameters.
请求执行模块303包括执行子模块、返回子模块和断言子模块,执行子模块用于基于所述测试目的,调用所述第一接口中对应的主执行策略,并通过所述主执行策略调用所述第二接口中对应的至少一个副执行策略执行所述接口请求,获得最终执行结果;返回子模块用于将所述最终执行结果返回至所述第一接口,并通过所述第一接口将所述最终执行结果返回至所述测试用例层;断言子模块用于通过所述测试用例层调用预设的工具层中的断言工具,断言所述最终执行结果,获得断言结果以完成接口测试。The request execution module 303 includes an execution sub-module, a return sub-module, and an assertion sub-module. The execution sub-module is used to invoke the corresponding main execution strategy in the first interface based on the test purpose, and to invoke the main execution strategy through the main execution strategy. At least one sub-execution strategy corresponding to the second interface executes the interface request and obtains the final execution result; the return submodule is used to return the final execution result to the first interface, and send the final execution result to the first interface through the first interface. The final execution result is returned to the test case layer; the assertion submodule is used to invoke the pre-set assertion tool in the tool layer through the test case layer, assert the final execution result, and obtain the assertion result to complete the interface test.
在本实施例的一些可选的实现方式中,上述执行子模块还用于:当所述主执行策略调用的所述副执行策略为一个时,获得最终执行结果,当所述主执行策略调用的所述副执行策略为多个时,依次执行所述副执行策略,其中,每执行一个副执行策略,获得一个中间执行结果,将所述中间执行结果返回至第一接口,当接收到所述第一接口返回的继续执行指令时,执行下一个副执行策略,直至执行完当前主执行策略调用的所有副执行策略,获得最终执行结果。In some optional implementations of this embodiment, the execution sub-module is further configured to obtain a final execution result when the secondary execution strategy invoked by the primary execution strategy is one, and when the primary execution strategy invokes the secondary execution strategy When there are multiple secondary execution strategies, execute the secondary execution strategies in sequence, wherein, each time a secondary execution strategy is executed, an intermediate execution result is obtained, and the intermediate execution result is returned to the first interface. When the continuous execution instruction returned by the first interface is executed, the next sub-execution strategy is executed until all sub-execution strategies called by the current main execution strategy are executed, and the final execution result is obtained.
所述第一接口包括第一主执行策略、第二主执行策略和第三主执行策略,所述第二接口包括第一副执行策略、第二副执行策略和第三副执行策略,执行子模块还包括识别单元、加密单元、日志对比单元和通知类日志对比单元。识别单元用于识别所述测试目的;加密单元用于当所述测试目的为参数加密时,调用所述第一接口中的第一主执行策略,通过所述第一主执行策略调用所述第二接口中的第一副执行策略执行参数加密,获得最终执行结果;日志对比单元用于当所述测试目的为日志对比时,调用所述第一接口中的第二主执行策略,通过所述第二主执行策略调用第二接口中的第一副执行策略和第二副执行策略,分别依次执行参数加密和日志对比,获得中间执行结果和最终执行结果;通知类日志对比单元用于当所述测试目的为通知类日志对比时,调用所述第一接口中的第三主执行策略,通过所述第三主执行策略调用所述第二接口中的第一副执行策略、第二副执行策略和第三副执行策略,分别依次执行参数加密、日志对比和通知类日志对比,获得中间执行结果和最终执行结果。The first interface includes a first primary execution strategy, a second primary execution strategy and a third primary execution strategy, the second interface includes a first secondary execution strategy, a second secondary execution strategy and a third secondary execution strategy, and the executor The module also includes an identification unit, an encryption unit, a log comparison unit and a notification log comparison unit. The identification unit is used to identify the test purpose; the encryption unit is used to call the first main execution strategy in the first interface when the test purpose is parameter encryption, and call the first main execution strategy through the first main execution strategy. The execution parameters of the first secondary execution strategy in the second interface are encrypted to obtain the final execution result; the log comparison unit is used for calling the second main execution strategy in the first interface when the test purpose is log comparison, and through the The second main execution strategy invokes the first sub-execution strategy and the second sub-execution strategy in the second interface, respectively executes parameter encryption and log comparison in sequence, and obtains the intermediate execution result and the final execution result; the notification type log comparison unit is used when all the The purpose of the test is to call the third main execution strategy in the first interface, and call the first sub-execution strategy and the second sub-execution strategy in the second interface through the third main execution strategy The strategy and the third sub-execution strategy execute parameter encryption, log comparison, and notification log comparison in sequence to obtain intermediate execution results and final execution results.
所述通知类日志对比单元包括调用子单元、查询子单元和比对子单元。调用子单元用于当所述测试目的为日志对比时,调用第二主执行策略向所述第二接口发送日志对比请求;查询子单元用于通过所述第二接口中的第一副执行策略调用预设的工具层中的日记提取工具类,基于预设的请求流水号进行日志查询,获得接口日志,将所述接口日志作为中间执行结果,返回至所述第一接口;比对子单元用于当接收到所述第一接口发送的继续执行指令时,通过所述第二副执行策略获取所述接口日志中调用关联方接口的参数,比对所述调用关联方接口的参数与所述接口入参,获得日志比对结果,作为所述最终执行结果。The notification type log comparison unit includes a calling subunit, a query subunit and a comparison subunit. The calling subunit is used to call the second main execution strategy to send a log comparison request to the second interface when the test purpose is log comparison; the query subunit is used to pass the first secondary execution strategy in the second interface Invoke the log extraction tool class in the preset tool layer, perform log query based on the preset request serial number, obtain the interface log, use the interface log as an intermediate execution result, and return to the first interface; compare the subunit When receiving the continuation execution instruction sent by the first interface, obtain the parameters of calling the related party interface in the interface log through the second sub-execution strategy, and compare the parameters of calling the related party interface with all the parameters. Input parameters of the above interface, and obtain the log comparison result as the final execution result.
在本实施例的一些可选的实现方式中,上述比对子单元模块进一步用于:通过预设的正则表达式匹配所述接口日志,获得所述接口日志中调用关联方接口的参数;比较所述调用关联方接口的参数与所述接口入参的key是否相同;当key相同时,比较对应的value是否一致,获得日志比对结果。In some optional implementations of this embodiment, the above-mentioned comparison subunit module is further configured to: match the interface log through a preset regular expression, and obtain parameters in the interface log for calling the associated party interface; compare Whether the parameters for calling the associated party interface are the same as the keys of the interface input parameters; when the keys are the same, compare whether the corresponding values are consistent, and obtain the log comparison result.
通过单独设置的dto层实现接口入参的独立生成,再将生成的接口入参传输至测试用例层,避免了每次接口的参数改变时,需要对应修改测试策略,导致测试策略复用性低的情况。本申请在需要修改接口的参数时,只需要修改dto层中接口入参的生成方法,不需要修改测试用例层,有效的提高了测试用例层中的测试策略的复用性,提升了测试效率。区别于现有技术的每一步执行过程需要调用对应的API,本申请将执行过程根据测试目的的不同,调用API层中不同的执行策略。提升了整体测试过程的简洁性,可理解性,实现了测试过程的快速执行。The independent generation of interface input parameters is achieved through a separately set dto layer, and then the generated interface input parameters are transmitted to the test case layer, which avoids the need to modify the test strategy every time the parameters of the interface change, resulting in low test strategy reusability Case. When the parameters of the interface need to be modified, the application only needs to modify the generation method of the interface input parameters in the dto layer, and does not need to modify the test case layer, which effectively improves the reusability of the test strategy in the test case layer and improves the test efficiency. . Different from the prior art where each step of the execution process needs to call the corresponding API, the present application calls different execution strategies in the API layer in the execution process according to different testing purposes. It improves the simplicity and understandability of the overall test process, and realizes the rapid execution of the test process.
为解决上述技术问题,本申请实施例还提供计算机设备。具体请参阅图4,图4为本实施例计算机设备基本结构框图。To solve the above technical problems, the embodiments of the present application also provide computer equipment. Please refer to FIG. 4 for details. FIG. 4 is a block diagram of a basic structure of a computer device according to this embodiment.
所述计算机设备200包括通过系统总线相互通信连接存储器201、处理器202、网络接口203。需要指出的是,图中仅示出了具有组件201-203的计算机设备200,但是应理解的是,并不要求实施所有示出的组件,可以替代的实施更多或者更少的组件。其中,本技术领域技术人员可以理解,这里的计算机设备是一种能够按照事先设定或存储的指令,自动进行数值计算和/或信息处理的设备,其硬件包括但不限于微处理器、专用集成电路(Application Specific Integrated Circuit,ASIC)、可编程门阵列(Field-Programmable Gate Array,FPGA)、数字处理器(Digital Signal Processor,DSP)、嵌入式设备等。The computer device 200 includes a memory 201 , a processor 202 , and a network interface 203 that communicate with each other through a system bus. It should be noted that only the computer device 200 with components 201-203 is shown in the figure, but it should be understood that implementation of all shown components is not required, and more or less components may be implemented instead. Among them, those skilled in the art can understand that the computer device here is a device that can automatically perform numerical calculation and/or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, special-purpose Integrated circuit (Application Specific Integrated Circuit, ASIC), programmable gate array (Field-Programmable Gate Array, FPGA), digital processor (Digital Signal Processor, DSP), embedded equipment, etc.
所述计算机设备可以是桌上型计算机、笔记本、掌上电脑及云端服务器等计算设备。所述计算机设备可以与用户通过键盘、鼠标、遥控器、触摸板或声控设备等方式进行人机交互。The computer equipment may be a desktop computer, a notebook computer, a palmtop computer, a cloud server and other computing equipment. The computer device can perform human-computer interaction with the user through a keyboard, a mouse, a remote control, a touch pad or a voice control device.
所述存储器201至少包括一种类型的可读存储介质,所述可读存储介质包括闪存、硬盘、多媒体卡、卡型存储器(例如,SD或DX存储器等)、随机访问存储器(RAM)、静态随机访问存储器(SRAM)、只读存储器(ROM)、电可擦除可编程只读存储器(EEPROM)、可编程只读存储器(PROM)、磁性存储器、磁盘、光盘等。所述计算机可读存储介质可以是非易失性,也可以是易失性。在一些实施例中,所述存储器201可以是所述计算机设备200的内部存储单元,例如该计算机设备200的硬盘或内存。在另一些实施例中,所述存储器201也可以是所述计算机设备200的外部存储设备,例如该计算机设备200上配备的插接式硬盘,智能存储卡(Smart Media Card,SMC),安全数字(Secure Digital,SD)卡,闪存卡(Flash Card)等。当然,所述存储器201还可以既包括所述计算机设备200的内部存储单元也包括其外部存储设备。本实施例中,所述存储器201通常用于存储安装于所述计算机设备200的操作系统和各类应用软件,例如接口自动化测试方法的计算机可读指令等。此外,所述存储器201还可以用于暂时地存储已经输出或者将要输出的各类数据。The memory 201 includes at least one type of readable storage medium, and the readable storage medium includes flash memory, hard disk, multimedia card, card-type memory (for example, SD or DX memory, etc.), random access memory (RAM), static Random Access Memory (SRAM), Read Only Memory (ROM), Electrically Erasable Programmable Read Only Memory (EEPROM), Programmable Read Only Memory (PROM), Magnetic Memory, Magnetic Disk, Optical Disk, etc. The computer-readable storage medium may be non-volatile or volatile. In some embodiments, the memory 201 may be an internal storage unit of the computer device 200 , such as a hard disk or a memory of the computer device 200 . In other embodiments, the memory 201 may also be an external storage device of the computer device 200, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, flash memory card (Flash Card), etc. Of course, the memory 201 may also include both the internal storage unit of the computer device 200 and its external storage device. In this embodiment, the memory 201 is generally used to store the operating system and various application software installed in the computer device 200 , such as computer-readable instructions of an interface automated testing method, and the like. In addition, the memory 201 can also be used to temporarily store various types of data that have been output or will be output.
所述处理器202在一些实施例中可以是中央处理器(Central Processing Unit,CPU)、控制器、微控制器、微处理器、或其他数据处理芯片。该处理器202通常用于控制所述计算机设备200的总体操作。本实施例中,所述处理器202用于运行所述存储器201中存储的计算机可读指令或者处理数据,例如运行所述接口自动化测试方法的计算机可读指令。In some embodiments, the processor 202 may be a central processing unit (Central Processing Unit, CPU), a controller, a microcontroller, a microprocessor, or other data processing chips. The processor 202 is typically used to control the overall operation of the computer device 200 . In this embodiment, the processor 202 is configured to execute computer-readable instructions stored in the memory 201 or process data, for example, computer-readable instructions for executing the interface automated testing method.
所述网络接口203可包括无线网络接口或有线网络接口,该网络接口203通常用于在所述计算机设备200与其他电子设备之间建立通信连接。The network interface 203 may include a wireless network interface or a wired network interface, and the network interface 203 is generally used to establish a communication connection between the computer device 200 and other electronic devices.
在本实施例中,无需修改测试用例层,有效的提高了测试用例层中的测试策略的复用性,提升了测试效率。同时根据测试目的的不同,调用API层中不同的执行策略,提升了整体测试过程的简洁性。In this embodiment, there is no need to modify the test case layer, which effectively improves the reusability of the test strategy in the test case layer and improves the test efficiency. At the same time, according to different test purposes, different execution strategies in the API layer are invoked, which improves the simplicity of the overall test process.
本申请还提供了另一种实施方式,即提供一种计算机可读存储介质,所述计算机可读存储介质存储有计算机可读指令,所述计算机可读指令可被至少一个处理器执行,以使所述至少一个处理器执行如上述的接口自动化测试方法的步骤。The present application also provides another embodiment, that is, to provide a computer-readable storage medium, where the computer-readable storage medium stores computer-readable instructions, and the computer-readable instructions can be executed by at least one processor to The at least one processor is caused to perform the steps of the interface automation testing method as described above.
在本实施例中,无需修改测试用例层,有效的提高了测试用例层中的测试策略的复用性,提升了测试效率。同时根据测试目的的不同,调用API层中不同的执行策略,提升了整体测试过程的简洁性。In this embodiment, there is no need to modify the test case layer, which effectively improves the reusability of the test strategy in the test case layer and improves the test efficiency. At the same time, according to different test purposes, different execution strategies in the API layer are invoked, which improves the simplicity of the overall test process.
通过以上的实施方式的描述,本领域的技术人员可以清楚地了解到上述实施例方法可借助软件加必需的通用硬件平台的方式来实现,当然也可以通过硬件,但很多情况下前者是更佳的实施方式。基于这样的理解,本申请的技术方案本质上或者说对现有技术做出贡献的部分可以以软件产品的形式体现出来,该计算机软件产品存储在一个存储介质(如ROM/RAM、磁碟、光盘)中,包括若干指令用以使得一台终端设备(可以是手机,计算机,服务器,空调器,或者网络设备等)执行本申请各个实施例所述的方法。From the description of the above embodiments, those skilled in the art can clearly understand that the method of the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course can also be implemented by hardware, but in many cases the former is better implementation. Based on this understanding, the technical solution of the present application can be embodied in the form of a software product in essence or in a part that contributes to the prior art, and the computer software product is stored in a storage medium (such as ROM/RAM, magnetic disk, CD-ROM), including several instructions to make a terminal device (which may be a mobile phone, a computer, a server, an air conditioner, or a network device, etc.) execute the methods described in the various embodiments of this application.
显然,以上所描述的实施例仅仅是本申请一部分实施例,而不是全部的实施例,附图中给出了本申请的较佳实施例,但并不限制本申请的专利范围。本申请可以以许多不同的形式来实现,相反地,提供这些实施例的目的是使对本申请的公开内容的理解更加透彻全面。尽管参照前述实施例对本申请进行了详细的说明,对于本领域的技术人员来而言,其依然可以对前述各具体实施方式所记载的技术方案进行修改,或者对其中部分技术特征进行等效替换。凡是利用本申请说明书及附图内容所做的等效结构,直接或间接运用在其他相关的技术领域,均同理在本申请专利保护范围之内。Obviously, the above-described embodiments are only a part of the embodiments of the present application, rather than all of the embodiments. The accompanying drawings show the preferred embodiments of the present application, but do not limit the scope of the patent of the present application. This application may be embodied in many different forms, rather these embodiments are provided so that a thorough and complete understanding of the disclosure of this application is provided. Although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions described in the foregoing specific embodiments, or perform equivalent replacements for some of the technical features. . Any equivalent structure made by using the contents of the description and drawings of the present application, which is directly or indirectly used in other related technical fields, is also within the scope of protection of the patent of the present application.

Claims (20)

  1. 一种接口自动化测试方法,包括下述步骤:An interface automated testing method, comprising the following steps:
    在接收到用户发送的测试指令时,确定所述测试指令对应的测试目的,基于测试用例层调用预设的dto层,并基于所述测试目的通过所述dto层生成接口入参;When receiving the test command sent by the user, determine the test purpose corresponding to the test command, call the preset dto layer based on the test case layer, and generate interface input parameters through the dto layer based on the test purpose;
    基于所述测试用例层获取所述接口入参,并基于所述接口入参生成接口请求,所述接口请求携带所述测试目的;Obtain the interface input parameters based on the test case layer, and generate an interface request based on the interface input parameters, where the interface request carries the test purpose;
    基于所述测试目的,调用预设的API层中与所述测试目的对应的执行策略执行所述接口请求,完成接口测试。Based on the test purpose, the execution strategy corresponding to the test purpose in the preset API layer is invoked to execute the interface request to complete the interface test.
  2. 根据权利要求1所述的接口自动化测试方法,其中,所述API层中包括第一接口和第二接口,所述第一接口中封装有不同的主执行策略,所述第二接口中封装有不同的副执行策略,所述基于所述测试目的,调用预设的API层中与所述测试目的对应的执行策略执行所述接口请求,完成接口测试的步骤包括:The interface automated testing method according to claim 1, wherein the API layer includes a first interface and a second interface, the first interface is encapsulated with different main execution strategies, and the second interface is encapsulated with a For different sub-execution strategies, based on the test purpose, calling the execution strategy corresponding to the test purpose in the preset API layer to execute the interface request, and the steps of completing the interface test include:
    基于所述测试目的,调用所述第一接口中对应的主执行策略,并通过所述主执行策略调用所述第二接口中对应的至少一个副执行策略执行所述接口请求,获得最终执行结果;Based on the test purpose, the main execution strategy corresponding to the first interface is invoked, and at least one sub-execution strategy corresponding to the second interface is invoked through the main execution strategy to execute the interface request to obtain the final execution result ;
    将所述最终执行结果返回至所述第一接口,并通过所述第一接口将所述最终执行结果返回至所述测试用例层;returning the final execution result to the first interface, and returning the final execution result to the test case layer through the first interface;
    通过所述测试用例层调用预设的工具层中的断言工具,断言所述最终执行结果,获得断言结果以完成接口测试。The assertion tool in the preset tool layer is invoked through the test case layer, the final execution result is asserted, and the assertion result is obtained to complete the interface test.
  3. 根据权利要求2所述的接口自动化测试方法,其中,所述通过所述主执行策略调用所述第二接口中对应的至少一个副执行策略执行所述接口请求,获得最终执行结果的步骤包括:The interface automated testing method according to claim 2, wherein the step of invoking at least one corresponding sub-execution policy in the second interface to execute the interface request through the main execution policy, and obtaining a final execution result comprises:
    当所述主执行策略调用的所述副执行策略为一个时,获得最终执行结果;When the secondary execution strategy invoked by the main execution strategy is one, the final execution result is obtained;
    当所述主执行策略调用的所述副执行策略为多个时,依次执行所述副执行策略,其中,每执行一个副执行策略,获得一个中间执行结果,将所述中间执行结果返回至所述第一接口,当接收到所述第一接口返回的继续执行指令时,执行下一个副执行策略,直至执行完成当前主执行策略调用的所有副执行策略,获得最终执行结果。When there are multiple secondary execution strategies invoked by the main execution strategy, the secondary execution strategies are executed in sequence, wherein each secondary execution strategy is executed, an intermediate execution result is obtained, and the intermediate execution result is returned to the The first interface, when receiving the continuing execution instruction returned by the first interface, executes the next sub-execution strategy until all sub-execution strategies invoked by the current main execution strategy are executed, and the final execution result is obtained.
  4. 根据权利要求2所述的接口自动化测试方法,其中,所述第一接口包括第一主执行策略、第二主执行策略和第三主执行策略,所述第二接口包括第一副执行策略、第二副执行策略和第三副执行策略,基于所述测试目的,调用所述第一接口中对应的主执行策略,并通过所述主执行策略调用所述第二接口中对应的至少一个副执行策略执行所述接口请求,获得最终执行结果的步骤包括:The interface automated testing method according to claim 2, wherein the first interface includes a first main execution strategy, a second main execution strategy and a third main execution strategy, and the second interface includes a first secondary execution strategy, The second sub-execution strategy and the third sub-execution strategy, based on the test purpose, call the corresponding main execution strategy in the first interface, and invoke at least one sub-execution strategy corresponding to the second interface through the main execution strategy The execution strategy executes the interface request, and the step of obtaining the final execution result includes:
    识别所述测试目的;identify the purpose of the test;
    当所述测试目的为参数加密时,调用所述第一接口中的第一主执行策略,通过所述第一主执行策略调用所述第二接口中的第一副执行策略执行参数加密,获得最终执行结果;When the test purpose is parameter encryption, the first main execution strategy in the first interface is called, and the first sub-execution strategy in the second interface is invoked through the first main execution strategy to perform parameter encryption, and obtain final execution result;
    当所述测试目的为日志对比时,调用所述第一接口中的第二主执行策略,通过所述第二主执行策略调用第二接口中的第一副执行策略和第二副执行策略,分别依次执行参数加密和日志对比,获得中间执行结果和最终执行结果;When the test purpose is log comparison, the second primary execution strategy in the first interface is invoked, and the first secondary execution strategy and the second secondary execution strategy in the second interface are invoked through the second primary execution strategy, Execute parameter encryption and log comparison in turn to obtain intermediate execution results and final execution results;
    当所述测试目的为通知类日志对比时,调用所述第一接口中的第三主执行策略,通过所述第三主执行策略调用所述第二接口中的第一副执行策略、第二副执行策略和第三副执行策略,分别依次执行参数加密、日志对比和通知类日志对比,获得中间执行结果和最终执行结果。When the test purpose is to compare notification logs, the third main execution strategy in the first interface is invoked, and the first sub-execution strategy and the second sub-execution strategy in the second interface are invoked through the third main execution strategy. The sub-execution strategy and the third sub-execution strategy execute parameter encryption, log comparison, and notification log comparison in sequence to obtain intermediate execution results and final execution results.
  5. 根据权利要求1所述的接口自动化测试方法,其中,所述dto层包括不同的dto类,所述dto类中具有不同的参数生成策略,所述在接收到用户发送的测试指令时,确定所述测试指令对应的测试目的,基于测试用例层调用预设的dto层,并基于所述测试目的通过所述dto层生成接口入参的步骤包括:The interface automatic testing method according to claim 1, wherein the dto layer includes different dto classes, and the dto classes have different parameter generation strategies, and when receiving a test instruction sent by a user, determine the The test purpose corresponding to the test instruction, the preset dto layer is called based on the test case layer, and the steps of generating interface input parameters through the dto layer based on the test purpose include:
    在接收到用户发送的测试指令时,确定所述测试指令对应的测试目标用户和测试目的;When receiving the test instruction sent by the user, determine the test target user and the test purpose corresponding to the test instruction;
    基于测试用例层调用预设的dto层;Call the preset dto layer based on the test case layer;
    基于所述测试目标用户选择对应的dto类,其中,所述测试目标用户与所述dto类为一一对应关系;The corresponding dto class is selected based on the test target user, wherein the test target user and the dto class are in a one-to-one correspondence;
    基于所述测试目的确定所述dto类中对应的参数生成策略,通过所述参数生成策略生成接口入参。Determine the corresponding parameter generation strategy in the dto class based on the test purpose, and generate interface input parameters through the parameter generation strategy.
  6. 根据权利要求5所述的接口自动化测试方法,其中,所述参数生成策略包括组装策略,所述通过所述参数生成策略生成接口入参的步骤包括:The interface automated testing method according to claim 5, wherein the parameter generation strategy includes an assembly strategy, and the step of generating the interface input parameters through the parameter generation strategy includes:
    当基于所述测试目的确定的所述dto类中对应的参数生成策略为组装策略时,基于所述测试目的获取预先设置的接口参数,并通过所述dto层组装所述接口参数,生成接口入参。When the corresponding parameter generation strategy in the dto class determined based on the test purpose is an assembly strategy, obtain preset interface parameters based on the test purpose, assemble the interface parameters through the dto layer, and generate an interface input Ref.
  7. 根据权利要求5所述的接口自动化测试方法,其中,所述参数生成策略包括随机生成策略,所述通过所述参数生成策略生成接口入参的步骤包括:The interface automated testing method according to claim 5, wherein the parameter generation strategy comprises a random generation strategy, and the step of generating the interface input parameters through the parameter generation strategy comprises:
    当基于所述测试目的确定的所述dto类中对应的参数生成策略为随机生成策略时,基于所述测试目的获取预先设置的接口参数,并通过所述dto层调用预设的工具层中的随机数生成工具;When the corresponding parameter generation strategy in the dto class determined based on the test purpose is a random generation strategy, the preset interface parameters are acquired based on the test purpose, and the preset interface parameters in the tool layer are called through the dto layer. Random number generator;
    获取时间戳,基于所述随机数生成工具根据时间戳生成随机数,通过所述dto层组装所述随机数和预先设定的接口参数,生成接口入参。Obtain a timestamp, generate a random number according to the timestamp based on the random number generating tool, assemble the random number and preset interface parameters through the dto layer, and generate interface input parameters.
  8. 一种接口自动化测试装置,包括:An interface automated testing device, comprising:
    参数生成模块,用于在接收到用户发送的测试指令时,确定所述测试指令对应的测试目的,基于测试用例层调用预设的dto层,并基于所述测试目的通过所述dto层生成接口入参;The parameter generation module is used to determine the test purpose corresponding to the test command when receiving the test command sent by the user, call the preset dto layer based on the test case layer, and generate an interface through the dto layer based on the test purpose input;
    请求发送模块,用于基于所述测试用例层获取所述接口入参,并基于所述接口入参生成接口请求,所述接口请求携带所述测试目的;a request sending module, configured to obtain the interface input parameters based on the test case layer, and generate an interface request based on the interface input parameters, where the interface request carries the test purpose;
    请求执行模块,用于基于所述测试目的,调用预设的API层中与所述测试目的对应的执行策略执行所述接口请求,完成接口测试。The request execution module is configured to, based on the test purpose, invoke the execution strategy corresponding to the test purpose in the preset API layer to execute the interface request to complete the interface test.
  9. 一种计算机设备,包括存储器和处理器,所述存储器中存储有计算机可读指令,所述处理器执行所述计算机可读指令时实现如下所述的接口自动化测试方法的步骤:A computer device, comprising a memory and a processor, wherein computer-readable instructions are stored in the memory, and when the processor executes the computer-readable instructions, the steps of the interface automated testing method described below are implemented:
    在接收到用户发送的测试指令时,确定所述测试指令对应的测试目的,基于测试用例层调用预设的dto层,并基于所述测试目的通过所述dto层生成接口入参;When receiving the test command sent by the user, determine the test purpose corresponding to the test command, call the preset dto layer based on the test case layer, and generate interface input parameters through the dto layer based on the test purpose;
    基于所述测试用例层获取所述接口入参,并基于所述接口入参生成接口请求,所述接口请求携带所述测试目的;Obtain the interface input parameters based on the test case layer, and generate an interface request based on the interface input parameters, where the interface request carries the test purpose;
    基于所述测试目的,调用预设的API层中与所述测试目的对应的执行策略执行所述接口请求,完成接口测试。Based on the test purpose, the execution strategy corresponding to the test purpose in the preset API layer is invoked to execute the interface request to complete the interface test.
  10. 根据权利要求9所述的计算机设备,其中,所述API层中包括第一接口和第二接口,所述第一接口中封装有不同的主执行策略,所述第二接口中封装有不同的副执行策略,所述基于所述测试目的,调用预设的API层中与所述测试目的对应的执行策略执行所述接口请求,完成接口测试的步骤包括:The computer device according to claim 9, wherein the API layer includes a first interface and a second interface, the first interface is encapsulated with different main execution policies, and the second interface is encapsulated with different main execution policies The secondary execution strategy, based on the test purpose, invokes the execution strategy corresponding to the test purpose in the preset API layer to execute the interface request, and the steps of completing the interface test include:
    基于所述测试目的,调用所述第一接口中对应的主执行策略,并通过所述主执行策略调用所述第二接口中对应的至少一个副执行策略执行所述接口请求,获得最终执行结果;Based on the test purpose, the main execution strategy corresponding to the first interface is invoked, and at least one sub-execution strategy corresponding to the second interface is invoked through the main execution strategy to execute the interface request to obtain the final execution result ;
    将所述最终执行结果返回至所述第一接口,并通过所述第一接口将所述最终执行结果返回至所述测试用例层;returning the final execution result to the first interface, and returning the final execution result to the test case layer through the first interface;
    通过所述测试用例层调用预设的工具层中的断言工具,断言所述最终执行结果,获得断言结果以完成接口测试。The assertion tool in the preset tool layer is invoked through the test case layer, the final execution result is asserted, and the assertion result is obtained to complete the interface test.
  11. 根据权利要求10所述的计算机设备,其中,所述通过所述主执行策略调用所述第二接口中对应的至少一个副执行策略执行所述接口请求,获得最终执行结果的步骤包括:The computer device according to claim 10, wherein the step of invoking at least one corresponding secondary execution policy in the second interface to execute the interface request through the primary execution policy, and obtaining a final execution result comprises:
    当所述主执行策略调用的所述副执行策略为一个时,获得最终执行结果;When the secondary execution strategy invoked by the main execution strategy is one, the final execution result is obtained;
    当所述主执行策略调用的所述副执行策略为多个时,依次执行所述副执行策略,其中,每执行一个副执行策略,获得一个中间执行结果,将所述中间执行结果返回至所述第一接口,当接收到所述第一接口返回的继续执行指令时,执行下一个副执行策略,直至执行完成当前主执行策略调用的所有副执行策略,获得最终执行结果。When there are multiple secondary execution strategies invoked by the main execution strategy, the secondary execution strategies are executed in sequence, wherein each secondary execution strategy is executed, an intermediate execution result is obtained, and the intermediate execution result is returned to the The first interface, when receiving the continuing execution instruction returned by the first interface, executes the next sub-execution strategy until all sub-execution strategies invoked by the current main execution strategy are executed, and the final execution result is obtained.
  12. 根据权利要求10所述的计算机设备,其中,所述第一接口包括第一主执行策略、第二主执行策略和第三主执行策略,所述第二接口包括第一副执行策略、第二副执行策略和第三副执行策略,基于所述测试目的,调用所述第一接口中对应的主执行策略,并通过所述主执行策略调用所述第二接口中对应的至少一个副执行策略执行所述接口请求,获得最终执行结果的步骤包括:The computer device of claim 10, wherein the first interface includes a first primary execution strategy, a second primary execution strategy, and a third primary execution strategy, and the second interface includes a first secondary execution strategy, a second primary execution strategy, and a second primary execution strategy. The secondary execution strategy and the third secondary execution strategy, based on the test purpose, call the corresponding primary execution strategy in the first interface, and invoke at least one secondary execution strategy corresponding to the second interface through the primary execution strategy Execute the interface request, and the steps of obtaining the final execution result include:
    识别所述测试目的;identify the purpose of the test;
    当所述测试目的为参数加密时,调用所述第一接口中的第一主执行策略,通过所述第一主执行策略调用所述第二接口中的第一副执行策略执行参数加密,获得最终执行结果;When the test purpose is parameter encryption, the first main execution strategy in the first interface is called, and the first sub-execution strategy in the second interface is invoked through the first main execution strategy to perform parameter encryption, and obtain final execution result;
    当所述测试目的为日志对比时,调用所述第一接口中的第二主执行策略,通过所述第二主执行策略调用第二接口中的第一副执行策略和第二副执行策略,分别依次执行参数加密和日志对比,获得中间执行结果和最终执行结果;When the test purpose is log comparison, the second primary execution strategy in the first interface is invoked, and the first secondary execution strategy and the second secondary execution strategy in the second interface are invoked through the second primary execution strategy, Execute parameter encryption and log comparison in turn to obtain intermediate execution results and final execution results;
    当所述测试目的为通知类日志对比时,调用所述第一接口中的第三主执行策略,通过所述第三主执行策略调用所述第二接口中的第一副执行策略、第二副执行策略和第三副执行策略,分别依次执行参数加密、日志对比和通知类日志对比,获得中间执行结果和最终执行结果。When the test purpose is to compare notification logs, the third main execution strategy in the first interface is invoked, and the first sub-execution strategy and the second sub-execution strategy in the second interface are invoked through the third main execution strategy. The sub-execution strategy and the third sub-execution strategy execute parameter encryption, log comparison, and notification log comparison in sequence to obtain intermediate execution results and final execution results.
  13. 根据权利要求9所述的计算机设备,其中,所述dto层包括不同的dto类,所述dto类中具有不同的参数生成策略,所述在接收到用户发送的测试指令时,确定所述测试指令对应的测试目的,基于测试用例层调用预设的dto层,并基于所述测试目的通过所述dto层生成接口入参的步骤包括:The computer device according to claim 9, wherein the dto layer includes different dto classes, and the dto classes have different parameter generation strategies, and the test is determined when a test instruction sent by a user is received. The test purpose corresponding to the instruction, the preset dto layer is called based on the test case layer, and the steps of generating interface input parameters through the dto layer based on the test purpose include:
    在接收到用户发送的测试指令时,确定所述测试指令对应的测试目标用户和测试目的;When receiving the test instruction sent by the user, determine the test target user and the test purpose corresponding to the test instruction;
    基于测试用例层调用预设的dto层;Call the preset dto layer based on the test case layer;
    基于所述测试目标用户选择对应的dto类,其中,所述测试目标用户与所述dto类为一一对应关系;The corresponding dto class is selected based on the test target user, wherein the test target user and the dto class are in a one-to-one correspondence;
    基于所述测试目的确定所述dto类中对应的参数生成策略,通过所述参数生成策略生成接口入参。Determine the corresponding parameter generation strategy in the dto class based on the test purpose, and generate interface input parameters through the parameter generation strategy.
  14. 根据权利要求13所述的计算机设备,其中,所述参数生成策略包括组装策略,所述通过所述参数生成策略生成接口入参的步骤包括:The computer device according to claim 13, wherein the parameter generation strategy comprises an assembly strategy, and the step of generating interface input parameters through the parameter generation strategy comprises:
    当基于所述测试目的确定的所述dto类中对应的参数生成策略为组装策略时,基于所述测试目的获取预先设置的接口参数,并通过所述dto层组装所述接口参数,生成接口入参。When the corresponding parameter generation strategy in the dto class determined based on the test purpose is an assembly strategy, obtain preset interface parameters based on the test purpose, assemble the interface parameters through the dto layer, and generate an interface input Ref.
  15. 根据权利要求13所述的计算机设备,其中,所述参数生成策略包括随机生成策略,所述通过所述参数生成策略生成接口入参的步骤包括:The computer device according to claim 13, wherein the parameter generation strategy comprises a random generation strategy, and the step of generating the interface input parameters through the parameter generation strategy comprises:
    当基于所述测试目的确定的所述dto类中对应的参数生成策略为随机生成策略时,基于所述测试目的获取预先设置的接口参数,并通过所述dto层调用预设的工具层中的随机数生成工具;When the corresponding parameter generation strategy in the dto class determined based on the test purpose is a random generation strategy, the preset interface parameters are acquired based on the test purpose, and the preset interface parameters in the tool layer are called through the dto layer. Random number generator;
    获取时间戳,基于所述随机数生成工具根据时间戳生成随机数,通过所述dto层组装所述随机数和预先设定的接口参数,生成接口入参。Obtain a timestamp, generate a random number according to the timestamp based on the random number generating tool, assemble the random number and preset interface parameters through the dto layer, and generate interface input parameters.
  16. 一种计算机可读存储介质,所述计算机可读存储介质上存储有计算机可读指令,所述计算机可读指令被处理器执行时实现如下所述的接口自动化测试方法的步骤:A computer-readable storage medium, on which computer-readable instructions are stored, and when the computer-readable instructions are executed by a processor, the steps of the interface automated testing method described below are implemented:
    在接收到用户发送的测试指令时,确定所述测试指令对应的测试目的,基于测试用例层调用预设的dto层,并基于所述测试目的通过所述dto层生成接口入参;When receiving the test command sent by the user, determine the test purpose corresponding to the test command, call the preset dto layer based on the test case layer, and generate interface input parameters through the dto layer based on the test purpose;
    基于所述测试用例层获取所述接口入参,并基于所述接口入参生成接口请求,所述接 口请求携带所述测试目的;Obtain the interface input parameter based on the test case layer, and generate an interface request based on the interface input parameter, and the interface request carries the test purpose;
    基于所述测试目的,调用预设的API层中与所述测试目的对应的执行策略执行所述接口请求,完成接口测试。Based on the test purpose, the execution strategy corresponding to the test purpose in the preset API layer is invoked to execute the interface request to complete the interface test.
  17. 根据权利要求16所述的计算机可读存储介质,其中,所述API层中包括第一接口和第二接口,所述第一接口中封装有不同的主执行策略,所述第二接口中封装有不同的副执行策略,所述基于所述测试目的,调用预设的API层中与所述测试目的对应的执行策略执行所述接口请求,完成接口测试的步骤包括:The computer-readable storage medium according to claim 16, wherein the API layer includes a first interface and a second interface, the first interface is encapsulated with different main execution policies, and the second interface is encapsulated in There are different sub-execution strategies. Based on the test purpose, calling the execution strategy corresponding to the test purpose in the preset API layer to execute the interface request, and the steps of completing the interface test include:
    基于所述测试目的,调用所述第一接口中对应的主执行策略,并通过所述主执行策略调用所述第二接口中对应的至少一个副执行策略执行所述接口请求,获得最终执行结果;Based on the test purpose, the main execution strategy corresponding to the first interface is invoked, and at least one sub-execution strategy corresponding to the second interface is invoked through the main execution strategy to execute the interface request to obtain the final execution result ;
    将所述最终执行结果返回至所述第一接口,并通过所述第一接口将所述最终执行结果返回至所述测试用例层;returning the final execution result to the first interface, and returning the final execution result to the test case layer through the first interface;
    通过所述测试用例层调用预设的工具层中的断言工具,断言所述最终执行结果,获得断言结果以完成接口测试。The assertion tool in the preset tool layer is invoked through the test case layer, the final execution result is asserted, and the assertion result is obtained to complete the interface test.
  18. 根据权利要求17所述的计算机可读存储介质,其中,所述通过所述主执行策略调用所述第二接口中对应的至少一个副执行策略执行所述接口请求,获得最终执行结果的步骤包括:The computer-readable storage medium according to claim 17, wherein the step of invoking at least one corresponding secondary execution policy in the second interface to execute the interface request through the primary execution policy, and obtaining a final execution result comprises the following steps: :
    当所述主执行策略调用的所述副执行策略为一个时,获得最终执行结果;When the secondary execution strategy invoked by the main execution strategy is one, the final execution result is obtained;
    当所述主执行策略调用的所述副执行策略为多个时,依次执行所述副执行策略,其中,每执行一个副执行策略,获得一个中间执行结果,将所述中间执行结果返回至所述第一接口,当接收到所述第一接口返回的继续执行指令时,执行下一个副执行策略,直至执行完成当前主执行策略调用的所有副执行策略,获得最终执行结果。When there are multiple secondary execution strategies invoked by the main execution strategy, the secondary execution strategies are executed in sequence, wherein each secondary execution strategy is executed, an intermediate execution result is obtained, and the intermediate execution result is returned to the The first interface, when receiving the continuing execution instruction returned by the first interface, executes the next sub-execution strategy until all sub-execution strategies invoked by the current main execution strategy are executed, and the final execution result is obtained.
  19. 根据权利要求17所述的计算机可读存储介质,其中,其中,所述第一接口包括第一主执行策略、第二主执行策略和第三主执行策略,所述第二接口包括第一副执行策略、第二副执行策略和第三副执行策略,基于所述测试目的,调用所述第一接口中对应的主执行策略,并通过所述主执行策略调用所述第二接口中对应的至少一个副执行策略执行所述接口请求,获得最终执行结果的步骤包括:18. The computer-readable storage medium of claim 17, wherein the first interface includes a first primary execution policy, a second primary execution policy, and a third primary execution policy, and wherein the second interface includes a first secondary execution policy The execution strategy, the second sub-execution strategy and the third sub-execution strategy, based on the test purpose, call the corresponding main execution strategy in the first interface, and call the corresponding main execution strategy in the second interface through the main execution strategy At least one sub-execution strategy executes the interface request, and the step of obtaining the final execution result includes:
    识别所述测试目的;identify the purpose of the test;
    当所述测试目的为参数加密时,调用所述第一接口中的第一主执行策略,通过所述第一主执行策略调用所述第二接口中的第一副执行策略执行参数加密,获得最终执行结果;When the test purpose is parameter encryption, the first main execution strategy in the first interface is called, and the first sub-execution strategy in the second interface is invoked through the first main execution strategy to perform parameter encryption, and obtain final execution result;
    当所述测试目的为日志对比时,调用所述第一接口中的第二主执行策略,通过所述第二主执行策略调用第二接口中的第一副执行策略和第二副执行策略,分别依次执行参数加密和日志对比,获得中间执行结果和最终执行结果;When the test purpose is log comparison, the second primary execution strategy in the first interface is invoked, and the first secondary execution strategy and the second secondary execution strategy in the second interface are invoked through the second primary execution strategy, Execute parameter encryption and log comparison in turn to obtain intermediate execution results and final execution results;
    当所述测试目的为通知类日志对比时,调用所述第一接口中的第三主执行策略,通过所述第三主执行策略调用所述第二接口中的第一副执行策略、第二副执行策略和第三副执行策略,分别依次执行参数加密、日志对比和通知类日志对比,获得中间执行结果和最终执行结果。When the test purpose is to compare notification logs, the third main execution strategy in the first interface is invoked, and the first sub-execution strategy and the second sub-execution strategy in the second interface are invoked through the third main execution strategy. The sub-execution strategy and the third sub-execution strategy execute parameter encryption, log comparison, and notification log comparison in sequence to obtain intermediate execution results and final execution results.
  20. 根据权利要求16所述的计算机可读存储介质,其中,所述dto层包括不同的dto类,所述dto类中具有不同的参数生成策略,所述在接收到用户发送的测试指令时,确定所述测试指令对应的测试目的,基于测试用例层调用预设的dto层,并基于所述测试目的通过所述dto层生成接口入参的步骤包括:The computer-readable storage medium according to claim 16, wherein the dto layer includes different dto classes, and the dto classes have different parameter generation strategies, and when receiving a test instruction sent by a user, determining The test purpose corresponding to the test instruction, the preset dto layer is called based on the test case layer, and the steps of generating interface input parameters through the dto layer based on the test purpose include:
    在接收到用户发送的测试指令时,确定所述测试指令对应的测试目标用户和测试目的;When receiving the test instruction sent by the user, determine the test target user and the test purpose corresponding to the test instruction;
    基于测试用例层调用预设的dto层;Call the preset dto layer based on the test case layer;
    基于所述测试目标用户选择对应的dto类,其中,所述测试目标用户与所述dto类为一一对应关系;The corresponding dto class is selected based on the test target user, wherein the test target user and the dto class are in a one-to-one correspondence;
    基于所述测试目的确定所述dto类中对应的参数生成策略,通过所述参数生成策略生成接口入参。Determine the corresponding parameter generation strategy in the dto class based on the test purpose, and generate interface input parameters through the parameter generation strategy.
PCT/CN2021/109474 2020-11-06 2021-07-30 Automatic interface test method and apparatus, and computer device and storage medium WO2022095518A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN202011232732.5A CN112328486A (en) 2020-11-06 2020-11-06 Interface automation test method and device, computer equipment and storage medium
CN202011232732.5 2020-11-06

Publications (1)

Publication Number Publication Date
WO2022095518A1 true WO2022095518A1 (en) 2022-05-12

Family

ID=74316819

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2021/109474 WO2022095518A1 (en) 2020-11-06 2021-07-30 Automatic interface test method and apparatus, and computer device and storage medium

Country Status (2)

Country Link
CN (1) CN112328486A (en)
WO (1) WO2022095518A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115086436A (en) * 2022-06-16 2022-09-20 平安银行股份有限公司 Method and device for parameter verification between Application Program Interfaces (APIs), computer equipment and storage medium
CN115567455A (en) * 2022-09-23 2023-01-03 平安科技(深圳)有限公司 Access flow switching method and device, computer equipment and storage medium

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112328486A (en) * 2020-11-06 2021-02-05 深圳壹账通智能科技有限公司 Interface automation test method and device, computer equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130318402A1 (en) * 2012-05-23 2013-11-28 Sap Ag Software Systems Testing Interface
CN109783350A (en) * 2018-12-13 2019-05-21 重庆金融资产交易所有限责任公司 Interface test method, device and computer readable storage medium
CN110389898A (en) * 2019-06-19 2019-10-29 深圳壹账通智能科技有限公司 Acquisition methods, device, terminal and the computer readable storage medium of Test Strategy
CN111143192A (en) * 2019-11-28 2020-05-12 叮当快药科技集团有限公司 Interface automation test method and device and related product
CN112328486A (en) * 2020-11-06 2021-02-05 深圳壹账通智能科技有限公司 Interface automation test method and device, computer equipment and storage medium

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10452522B1 (en) * 2015-06-19 2019-10-22 Amazon Technologies, Inc. Synthetic data generation from a service description language model
CN109495334B (en) * 2017-09-13 2021-05-28 杭州海康威视系统技术有限公司 Test method and device
CN111190808A (en) * 2018-11-14 2020-05-22 北京京东尚科信息技术有限公司 Automated testing method, system, device and computer readable storage medium
CN109558316A (en) * 2018-11-21 2019-04-02 武汉风行在线技术有限公司 A kind of HTTP interface mobilism parameter test method of Test Strategy automatic configuration
CN110990269A (en) * 2019-11-26 2020-04-10 苏宁云计算有限公司 Interface testing method, device and system
CN111679989A (en) * 2020-06-16 2020-09-18 贝壳技术有限公司 Interface robustness testing method and device, electronic equipment and storage medium
CN111782546B (en) * 2020-07-23 2021-10-01 北京斗米优聘科技发展有限公司 Automatic interface testing method and device based on machine learning

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20130318402A1 (en) * 2012-05-23 2013-11-28 Sap Ag Software Systems Testing Interface
CN109783350A (en) * 2018-12-13 2019-05-21 重庆金融资产交易所有限责任公司 Interface test method, device and computer readable storage medium
CN110389898A (en) * 2019-06-19 2019-10-29 深圳壹账通智能科技有限公司 Acquisition methods, device, terminal and the computer readable storage medium of Test Strategy
CN111143192A (en) * 2019-11-28 2020-05-12 叮当快药科技集团有限公司 Interface automation test method and device and related product
CN112328486A (en) * 2020-11-06 2021-02-05 深圳壹账通智能科技有限公司 Interface automation test method and device, computer equipment and storage medium

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115086436A (en) * 2022-06-16 2022-09-20 平安银行股份有限公司 Method and device for parameter verification between Application Program Interfaces (APIs), computer equipment and storage medium
CN115567455A (en) * 2022-09-23 2023-01-03 平安科技(深圳)有限公司 Access flow switching method and device, computer equipment and storage medium
CN115567455B (en) * 2022-09-23 2024-05-07 平安科技(深圳)有限公司 Access flow switching method and device, computer equipment and storage medium

Also Published As

Publication number Publication date
CN112328486A (en) 2021-02-05

Similar Documents

Publication Publication Date Title
US11127088B2 (en) Cross-blockchain interaction method, system, computer device, and storage medium
WO2022095518A1 (en) Automatic interface test method and apparatus, and computer device and storage medium
CN110555299B (en) Electronic contract signing and storing method and device, computer equipment and storage medium
CN111414407A (en) Data query method and device of database, computer equipment and storage medium
CN108090351B (en) Method and apparatus for processing request message
CN111814179A (en) User authority management and data control method and related equipment thereof
WO2021013033A1 (en) File operation method, apparatus, device, and system, and computer readable storage medium
CN113254445B (en) Real-time data storage method, device, computer equipment and storage medium
CN112070608B (en) Information processing method, device, medium and electronic equipment
TWI811663B (en) Method and apparatus for generating software test reports
CN112150113A (en) Method, device and system for borrowing file data and method for borrowing data
CN109769010B (en) Method, device, equipment and storage medium for accessing CloudStack server based on SDK
CN112966304B (en) Tamper-proof method and device for flow document, computer equipment and medium
WO2022156087A1 (en) Data blood relationship establishing method and apparatus, computer device, and storage medium
CN116956326A (en) Authority data processing method and device, computer equipment and storage medium
CN116244682A (en) Database access method, device, equipment and storage medium
CN112448909A (en) Electronic lock management method, device, system and storage medium
CN113360172B (en) Application deployment method, device, computer equipment and storage medium
CN115733685A (en) Web session authentication management method and device, computer equipment and storage medium
WO2022126962A1 (en) Knowledge graph-based method for detecting guiding and abetting corpus and related device
CN112416875B (en) Log management method, device, computer equipment and storage medium
WO2021232860A1 (en) Communication method, apparatus and system
CN112256760B (en) Data prediction method and device, computer equipment and storage medium
CN114816361A (en) Method, device, equipment, medium and program product for generating splicing project
CN114637672A (en) Automatic data testing method and device, computer equipment and storage medium

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

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

122 Ep: pct application non-entry in european phase

Ref document number: 21888217

Country of ref document: EP

Kind code of ref document: A1