CN114064327A - Baffle testing method, device, storage medium and program product - Google Patents

Baffle testing method, device, storage medium and program product Download PDF

Info

Publication number
CN114064327A
CN114064327A CN202111439691.1A CN202111439691A CN114064327A CN 114064327 A CN114064327 A CN 114064327A CN 202111439691 A CN202111439691 A CN 202111439691A CN 114064327 A CN114064327 A CN 114064327A
Authority
CN
China
Prior art keywords
baffle
target
configuration information
response message
adapter
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202111439691.1A
Other languages
Chinese (zh)
Inventor
庞振海
赵晓明
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
China Construction Bank Corp
Original Assignee
China Construction Bank Corp
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 China Construction Bank Corp filed Critical China Construction Bank Corp
Priority to CN202111439691.1A priority Critical patent/CN114064327A/en
Publication of CN114064327A publication Critical patent/CN114064327A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/541Interprogram communication via adapters, e.g. between incompatible applications
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • G06F9/445Program loading or initiating
    • G06F9/44505Configuring for program initiating, e.g. using registry, configuration files

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The application provides a baffle testing method, equipment, a storage medium and a program product, wherein baffle configuration information of a target baffle to be started is acquired, and the baffle configuration information comprises a target protocol of the target baffle; determining a baffle adapter corresponding to a target protocol of a target baffle, wherein the baffle adapter is used for analyzing a request message of the target protocol and generating a corresponding message; and starting a new baffle thread, and operating the baffle adapter in the new baffle thread to perform baffle test. By selecting the baffle adapter corresponding to the target protocol and operating the large baffle adapter in the new baffle thread, the baffle can support the target protocol and can be dynamically started, so that the test task of a new user or a new system can be dynamically supported, the universality and the expansibility of the baffle are improved, code intervention by the user is not needed, and the user experience is improved.

Description

Baffle testing method, device, storage medium and program product
Technical Field
The present application relates to computer and communications technologies, and in particular, to a method, an apparatus, a storage medium, and a program product for testing a baffle.
Background
In some cross-system performance test projects, due to the limitation of objective factors, such as limited test hardware resources, coordination among multiple systems, and the like, a complete test environment cannot be generally set up to complete the test work, at this time, a system to be tested is generally set up, and then a software program is adopted to simulate the functions of other related systems, and the software program is generally called a baffle.
In the process of software testing, the traditional baffle generally has no universality, but most project groups develop and use by themselves and need to be maintained with a certain amount of effort; in addition, some technologies of the universal barrier can be adopted, for example, a Smart Simulator is adopted, but the universality is poor, the supported protocols are few, the test task of a new user or a new system cannot be dynamically supported, and the expansibility is poor.
Disclosure of Invention
The application provides a baffle testing method, equipment, a storage medium and a program product, which are used for improving the universality and the expansibility of a baffle.
In a first aspect, the present application provides a baffle testing method, comprising:
acquiring baffle configuration information of a target baffle to be started, wherein the baffle configuration information comprises a target protocol of the target baffle;
determining a baffle adapter corresponding to a target protocol of the target baffle, wherein the baffle adapter is used for analyzing a request message of the target protocol and generating a corresponding message;
and starting a new baffle thread, and running the baffle adapter in the new baffle thread to perform baffle testing.
In one possible design, the acquiring the baffle configuration information of the target baffle to be activated includes:
scanning baffle configuration information stored in a database;
if the baffle configuration information which is not started exists in the database, the baffle configuration information which is not started is obtained and determined as the baffle configuration information of the target baffle to be started.
In one possible design, the acquiring the non-activated baffle configuration information and determining the non-activated baffle configuration information as the baffle configuration information of the target baffle to be activated includes:
inquiring a state field of the un-started baffle configuration information, wherein the state field is used for identifying whether the baffle configuration information is valid or not;
and if the configuration information of the baffle which is not started is determined to be valid according to the state field, acquiring the configuration information of the baffle which is not started, and determining the configuration information of the baffle which is the target baffle to be started.
In one possible design, the determining a baffle adapter corresponding to a target protocol of the target baffle includes:
and calling the Class of the baffle adapter corresponding to the target protocol of the target baffle through a JAVA reflection mechanism according to the target protocol of the target baffle.
In one possible design, the method further includes:
and receiving baffle configuration information input by a user, and storing the baffle configuration information into the database.
In one possible design, the baffle configuration information further includes:
a response message template corresponding to the target protocol and a method for acquiring fields required by the response message template.
In one possible design, after the baffle adapter is run in the new baffle thread, the method further includes:
receiving a request message;
analyzing the request message through the baffle adapter, and acquiring the response message template and the field required by the response message template from the database according to the analysis result;
acquiring fields required by the response message template according to the acquisition method of the fields required by the response message template, filling the response message template, and generating a response message corresponding to the request message;
and outputting the response message.
In a possible design, the obtaining the fields required by the response packet template according to the method for obtaining the fields required by the response packet template includes:
acquiring fields required by the message template from the request message according to the method for acquiring the fields required by the response message template; and/or
And according to the method for acquiring the fields required by the response message template, acquiring input parameters from the request message, inquiring fields corresponding to the input parameters from a target database, and determining the fields as the fields required by the message template.
In a second aspect, the present application provides a baffle testing apparatus comprising:
the system comprises an acquisition module, a control module and a control module, wherein the acquisition module is used for acquiring baffle configuration information of a target baffle to be started, and the baffle configuration information comprises a target protocol of the target baffle;
the determining module is used for determining a baffle adapter corresponding to a target protocol of the target baffle, and the baffle adapter is used for analyzing a request message of the target protocol and generating a corresponding message;
and the operation module is used for starting a new baffle thread and operating the baffle adapter in the new baffle thread to perform baffle test.
In a third aspect, the present application provides an electronic device, comprising: a processor, and a memory communicatively coupled to the processor;
the memory stores computer-executable instructions;
the processor executes computer-executable instructions stored by the memory to implement the method as described in the first method.
In a fourth aspect, the present application provides a computer-readable storage medium having stored thereon computer-executable instructions for implementing the method according to the first method when executed by a processor.
In a fifth aspect, the present application provides a computer program product comprising a computer program which, when executed by a processor, implements the method as described in the first method.
According to the baffle testing method, the baffle testing equipment, the storage medium and the program product, baffle configuration information of a target baffle to be started is obtained, and the baffle configuration information comprises a target protocol of the target baffle; determining a baffle adapter corresponding to a target protocol of a target baffle, wherein the baffle adapter is used for analyzing a request message of the target protocol and generating a corresponding message; and starting a new baffle thread, and operating the baffle adapter in the new baffle thread to perform baffle test. By selecting the baffle adapter corresponding to the target protocol and operating the large baffle adapter in the new baffle thread, the baffle can support the target protocol and can be dynamically started, so that the test task of a new user or a new system can be dynamically supported, the universality and the expansibility of the baffle are improved, code intervention by the user is not needed, and the user experience is improved.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and together with the description, serve to explain the principles of the application.
Fig. 1 is a schematic view of an application scenario of a baffle testing method according to an embodiment of the present application;
FIG. 2 is a flow chart of a method for testing a baffle according to an embodiment of the present application;
FIG. 3 is a flow chart of a method for testing a baffle according to another embodiment of the present application;
FIG. 4 is a block diagram of a baffle testing apparatus according to an embodiment of the present application;
fig. 5 is a block diagram of an electronic device according to an embodiment of the present application.
With the above figures, there are shown specific embodiments of the present application, which will be described in more detail below. These drawings and written description are not intended to limit the scope of the inventive concepts in any manner, but rather to illustrate the inventive concepts to those skilled in the art by reference to specific embodiments.
Detailed Description
Reference will now be made in detail to the exemplary embodiments, examples of which are illustrated in the accompanying drawings. When the following description refers to the accompanying drawings, like numbers in different drawings represent the same or similar elements unless otherwise indicated. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present application. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present application, as detailed in the appended claims.
In some cross-system performance test projects, due to the limitation of objective factors, such as limited test hardware resources, coordination among multiple systems, and the like, a complete test environment cannot be generally set up to complete the test work, at this time, a system to be tested is generally set up, and then a software program is adopted to simulate the functions of other related systems, and the software program is generally called a baffle.
In the process of software testing, the traditional baffle generally has no universality, but most project groups develop and use by themselves and need to be maintained with a certain amount of effort; in addition, some technologies of the universal barrier can be adopted, for example, a Smart Simulator is adopted, but the universality is poor, the supported protocols are few, the test task of a new user or a new system cannot be dynamically supported, and the expansibility is poor.
In order to solve the technical problem, the present application provides a baffle testing method, in which baffle configuration information of a target baffle to be started is obtained, the baffle configuration information includes a target protocol of the target baffle, a baffle adapter corresponding to the target protocol of the target baffle is further determined, a new baffle thread is started, and the baffle adapter is operated in the new baffle thread to perform a baffle test, where the baffle adapter is used to analyze a request message of the target protocol and generate a corresponding response message in the baffle test. Through the process, the baffle can support various protocols, and can dynamically support the test task of a new user or a new system, so that the universality and the expansibility of the baffle are improved.
The application provides a baffle testing method, which is suitable for an application scene shown in fig. 1 and comprises a user terminal 11, a database 12 and a server 13, wherein the user terminal 11 can input baffle configuration information of a target baffle and store the baffle configuration information into the database 12, the server 13 can scan the database 12 and obtain the baffle configuration information of the target baffle to be started from the database 12, the baffle configuration information comprises a target protocol of the target baffle, and a baffle adapter corresponding to the target protocol of the target baffle is determined, wherein the baffle adapter is used for analyzing a request message of the target protocol and generating a corresponding message; and starting a new baffle thread, and operating the baffle adapter in the new baffle thread to perform baffle test.
The following describes the technical solutions of the present application and how to solve the above technical problems with specific embodiments. The following several specific embodiments may be combined with each other, and details of the same or similar concepts or processes may not be repeated in some embodiments. Embodiments of the present application will be described below with reference to the accompanying drawings.
Fig. 2 is a flowchart of a method for testing a baffle according to an embodiment of the present disclosure. The embodiment provides a baffle testing method, an execution main body of which is a server, and the baffle testing method comprises the following specific steps:
s201, baffle configuration information of a target baffle to be started is obtained, and the baffle configuration information comprises a target protocol of the target baffle.
In this embodiment, a front-end and back-end interaction mode can be used, and a user can fill and write the baffle configuration information of the target baffle into a front-end page and store the baffle configuration information into a database of the background server, so that the baffle configuration information is more conveniently configured by the user, the user does not need to directly modify or write a baffle configuration file, and the method is more user-friendly.
The baffle configuration information comprises a target protocol of the target baffle, the target protocol is used for determining a baffle adapter corresponding to the target protocol, the request message of the target protocol can be analyzed, and a corresponding message can be generated, so that the baffle can support various protocols, wherein the target protocol comprises but is not limited to http, https, swift, socket, p8583, kafka, rpc and the like, and the universality of the baffle is improved.
Further, the baffle configuration information may further include: at least one response message template corresponding to the target protocol and a method for acquiring fields required by the response message template. After inputting the target protocol of the target baffle, a user can input a response message template corresponding to the target protocol and then input an acquisition method of required fields of the response message template, wherein some required fields in the response message template can be directly acquired from a request message; and/or, some required fields in the response message template may need to be processed for the fields in the request message, and the processing result is used as the required fields of the message template; and/or, some required fields in the response message template may need to extract input parameters from the request message, and then the fields corresponding to the input parameters are inquired from the database according to the input parameters to be used as the required fields of the message template.
When a user needs to perform baffle test, baffle configuration information of a target baffle is input and stored in a database; the server may obtain baffle configuration information for a target baffle to be activated from a database. Alternatively, the server may scan the baffle configuration information in the database at predetermined intervals.
When the baffle configuration information stored in the database is scanned, if the baffle configuration information which is not started exists in the database, the baffle configuration information which is not started is obtained and is determined as the baffle configuration information of the target baffle to be started.
Optionally, a status field of each baffle configuration information may be further set in the database, and is used to identify whether the baffle configuration information is valid, and whether the baffle configuration information is enabled can be controlled by configuring the status information; further, when it is determined that the un-started baffle configuration information exists in the database, the status field of the un-started baffle configuration information may be queried, and if it is determined that the un-started baffle configuration information is valid according to the status field, the un-started baffle configuration information is obtained, and the un-started baffle configuration information is determined to be the baffle configuration information of the target baffle to be started.
S202, determining a baffle adapter corresponding to the target protocol of the target baffle, wherein the baffle adapter is used for analyzing the request message of the target protocol and generating a corresponding message.
In this embodiment, after the baffle configuration information of the target baffle to be started is obtained, the target protocol of the target baffle may be determined from the baffle configuration information, and then the baffle adapter corresponding to the target protocol is determined, and the baffle adapter may analyze the request message of the target protocol according to the baffle configuration information, obtain the field required by the response message template, fill the response message template, and generate the response message corresponding to the request message.
Optionally, in this embodiment, a Class of the baffle adapter corresponding to the target protocol of the target baffle may be called through a JAVA reflection mechanism according to the target protocol of the target baffle.
The JAVA reflection mechanism is in a running state, and all attributes and methods of any class can be known; any method and attribute of any object can be called; this function of dynamically acquiring information and dynamically invoking methods of objects is referred to as the reflection mechanism of the JAVA language. To dissect a Class, the object of the bytecode file of the Class needs to be obtained first, and the method in the Class is used for dissection, so that the object of the Class corresponding to each bytecode file needs to be obtained first. Based on JAVA reflection mechanism, the Class object of the baffle adapter corresponding to the target protocol can be constructed, the member variable and method of the object can be accessed and called, the function of the baffle adapter is realized, the flexibility and expansibility of the program are improved, the coupling is reduced, and the adaptability is improved.
S203, starting a new baffle thread, and operating the baffle adapter in the new baffle thread to perform baffle test.
In this embodiment, after determining the baffle adapter corresponding to the target protocol of the target baffle, at least one new baffle thread may be started, and the baffle adapter is run in the new baffle thread, that is, the starting of the target baffle is realized, so as to facilitate the subsequent baffle test. The baffle adapter is operated in the new baffle thread, the baffle adapters in other threads are not influenced, and the expansibility is effectively improved.
In the baffle testing method provided by this embodiment, baffle configuration information of a target baffle to be started is obtained, where the baffle configuration information includes a target protocol of the target baffle; determining a baffle adapter corresponding to a target protocol of a target baffle, wherein the baffle adapter is used for analyzing a request message of the target protocol and generating a corresponding message; and starting a new baffle thread, and operating the baffle adapter in the new baffle thread to perform baffle test. By selecting the baffle adapter corresponding to the target protocol and operating the large baffle adapter in the new baffle thread, the baffle can support the target protocol and can be dynamically started, so that the test task of a new user or a new system can be dynamically supported, the universality and the expansibility of the baffle are improved, code intervention by the user is not needed, and the user experience is improved.
On the basis of the foregoing embodiment, as shown in fig. 3, after the running the baffle adapter in the new baffle thread in S203, the method may further include:
s301, receiving a request message;
s302, analyzing the request message through the baffle adapter, and acquiring the response message template and the acquiring method of the fields required by the response message template from the database according to the analysis result;
s303, acquiring fields required by the response message template according to the acquisition method of the fields required by the response message template, filling the response message template, and generating a response message corresponding to the request message;
and S304, outputting the response message.
In this embodiment, the baffle adapter is operated in a new baffle thread, that is, the target baffle is started, the target baffle can be used for performing baffle test, after the target baffle receives the request message, the request message can be analyzed by the baffle adapter, a response message template corresponding to the request message and an acquisition method of fields required by the response message template are determined, and the response message template corresponding to the request message and the acquisition method of the fields required by the response message template can be acquired from baffle configuration information; further, the baffle adapter may obtain the field required by the response message template according to the method for obtaining the field required by the response message template, fill the obtained field required by the message template into the response message template, generate a response message corresponding to the request message, and output the response message to respond to the request message.
Optionally, the obtaining, according to the method for obtaining the field required by the response packet template, the field required by the response packet template may specifically include:
acquiring fields required by the message template from the request message according to the method for acquiring the fields required by the response message template; and/or
And according to the method for acquiring the fields required by the response message template, acquiring input parameters from the request message, inquiring fields corresponding to the input parameters from a target database, and determining the fields as the fields required by the message template.
In this embodiment, some required fields in the response message template may be directly obtained from the request message; and/or, some required fields in the response message template may need to be processed for the fields in the request message, and the processing result is used as the required fields of the message template; the corresponding acquisition method is described in the acquisition method of the field required by the response message template, so that the baffle adapter can acquire the field required by the message template from the request message directly or after processing according to the acquisition method of the field required by the response message template, and finally add the field to the response message template to realize the automatic generation of the response message.
In addition, some required fields in the response message template may be from a certain target database, so that input parameters, such as field identifiers (such as serial numbers or transaction numbers), can be extracted from the request message, and fields corresponding to the input parameters are inquired from the database according to the input parameters; the corresponding acquisition method is described in the acquisition method of the field required by the response message template, so that the baffle adapter can inquire the field corresponding to the input parameter from the target database according to the acquisition method of the field required by the response message template, determine the field required by the message template, and finally add the field to the response message template to realize the automatic generation of the response message.
Fig. 4 is a structural diagram of a baffle testing apparatus according to an embodiment of the present application. The baffle testing apparatus provided in this embodiment may execute the processing flow provided in the embodiment of the baffle testing method, as shown in fig. 4, the baffle testing apparatus 400 includes an obtaining module 401, a determining module 402, and an operating module 403.
An obtaining module 401, configured to obtain baffle configuration information of a target baffle to be started, where the baffle configuration information includes a target protocol of the target baffle;
a determining module 402, configured to determine a baffle adapter corresponding to a target protocol of the target baffle, where the baffle adapter is configured to analyze a request packet of the target protocol and generate a corresponding packet;
a running module 403, configured to start a new baffle thread, and run the baffle adapter in the new baffle thread to perform a baffle test.
In one or more embodiments of the present application, the obtaining module 401, when obtaining the baffle configuration information of the target baffle to be activated, is configured to:
scanning baffle configuration information stored in a database;
if the baffle configuration information which is not started exists in the database, the baffle configuration information which is not started is obtained and determined as the baffle configuration information of the target baffle to be started.
In one or more embodiments of the present application, when acquiring the non-activated baffle configuration information and determining it as the baffle configuration information of the target baffle to be activated, the acquiring module 401 is configured to:
inquiring a state field of the un-started baffle configuration information, wherein the state field is used for identifying whether the baffle configuration information is valid or not;
and if the configuration information of the baffle which is not started is determined to be valid according to the state field, acquiring the configuration information of the baffle which is not started, and determining the configuration information of the baffle which is the target baffle to be started.
In one or more embodiments of the present application, the determining module 402, when determining a baffle adapter corresponding to a target protocol of the target baffle, is configured to:
and calling the Class of the baffle adapter corresponding to the target protocol of the target baffle through a JAVA reflection mechanism according to the target protocol of the target baffle.
In one or more embodiments of the present application, the apparatus further comprises an input module 404 for receiving user-input baffle configuration information and storing the baffle configuration information in the database.
In one or more embodiments of the present application, the baffle configuration information further includes:
a response message template corresponding to the target protocol and a method for acquiring fields required by the response message template.
In one or more embodiments of the present application, the execution module 403, after executing the baffle adapter in the new baffle thread, is further configured to:
receiving a request message;
analyzing the request message through the baffle adapter, and acquiring the response message template and the field required by the response message template from the database according to the analysis result;
acquiring fields required by the response message template according to the acquisition method of the fields required by the response message template, filling the response message template, and generating a response message corresponding to the request message;
and outputting the response message.
In one or more embodiments of the present application, when the running module 403 acquires the fields required by the response packet template according to the method for acquiring the fields required by the response packet template, the running module is configured to:
acquiring fields required by the message template from the request message according to the method for acquiring the fields required by the response message template; and/or
And according to the method for acquiring the fields required by the response message template, acquiring input parameters from the request message, inquiring fields corresponding to the input parameters from a target database, and determining the fields as the fields required by the message template.
The baffle testing device provided in the embodiment of the present application may be specifically configured to execute the method embodiments provided in fig. 2 to 3, and specific functions are not described herein again.
According to the baffle testing equipment provided by the embodiment of the application, the baffle configuration information of the target baffle to be started is obtained, and the baffle configuration information comprises a target protocol of the target baffle; determining a baffle adapter corresponding to a target protocol of a target baffle, wherein the baffle adapter is used for analyzing a request message of the target protocol and generating a corresponding message; and starting a new baffle thread, and operating the baffle adapter in the new baffle thread to perform baffle test. By selecting the baffle adapter corresponding to the target protocol and operating the large baffle adapter in the new baffle thread, the baffle can support the target protocol and can be dynamically started, so that the test task of a new user or a new system can be dynamically supported, the universality and the expansibility of the baffle are improved, code intervention by the user is not needed, and the user experience is improved.
Fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present application. The electronic device provided in the embodiment of the present application may execute the processing flow provided in the embodiment of the baffle testing method, as shown in fig. 5, the electronic device 50 includes a memory 51, a processor 52, and a computer program; wherein a computer program is stored in the memory 51 and is configured to execute the baffle testing method described in the above embodiments by the processor 52. In addition, the electronic device 50 may also have a communication interface 53 for transmitting control instructions and/or data (including messages and/or information).
The electronic device in the embodiment shown in fig. 5 may be used to implement the technical solution of the above-mentioned embodiment of the baffle testing method, and the implementation principle and technical effect are similar, which are not described herein again.
Processor 52 may be, among other things, one or more Application Specific Integrated Circuits (ASICs), Digital Signal Processors (DSPs), Digital Signal Processing Devices (DSPDs), Programmable Logic Devices (PLDs), Field Programmable Gate Arrays (FPGAs), controllers, micro-controllers, microprocessors or other electronic component implementations configured to perform the above-described methods. The memory 51 may be a non-transitory computer readable storage medium.
In addition, the present embodiment also provides a computer-readable storage medium on which a computer program is stored, the computer program being executed by a processor to implement the method of the above embodiment.
In addition, the present embodiment also provides a computer program product, which includes a computer program, and the computer program is executed by a processor to implement the method of the above embodiment.
In the several embodiments provided in the embodiments of the present application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the division of the units is only one logical division, and other divisions may be realized in practice, for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection through some interfaces, devices or units, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present application may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit. The integrated unit can be realized in a form of hardware, or in a form of hardware plus a software functional unit.
The integrated unit implemented in the form of a software functional unit may be stored in a computer readable storage medium. The software functional unit is stored in a storage medium and includes several instructions to enable a computer device (which may be a personal computer, a server, or a network device) or a processor (processor) to execute some steps of the methods described in the embodiments of the present application. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
It is obvious to those skilled in the art that, for convenience and simplicity of description, the foregoing division of the functional modules is merely used as an example, and in practical applications, the above function distribution may be performed by different functional modules according to needs, that is, the internal structure of the device is divided into different functional modules to perform all or part of the above described functions. For the specific working process of the device described above, reference may be made to the corresponding process in the foregoing method embodiment, which is not described herein again.
The above embodiments are only used for illustrating the technical solutions of the embodiments of the present application, and are not limited thereto; although the embodiments of the present application have been described in detail with reference to the foregoing embodiments, those skilled in the art will understand that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present application.
Other embodiments of the present application will be apparent to those skilled in the art from consideration of the specification and practice of the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the invention following, in general, the principles of the application and including such departures from the present disclosure as come within known or customary practice within the art to which the invention pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the application being indicated by the following claims.
It will be understood that the present application is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the application is limited only by the appended claims.

Claims (12)

1. A baffle testing method, comprising:
acquiring baffle configuration information of a target baffle to be started, wherein the baffle configuration information comprises a target protocol of the target baffle;
determining a baffle adapter corresponding to a target protocol of the target baffle, wherein the baffle adapter is used for analyzing a request message of the target protocol and generating a corresponding message;
and starting a new baffle thread, and running the baffle adapter in the new baffle thread to perform baffle testing.
2. The method of claim 1, wherein the obtaining baffle configuration information for a target baffle to be activated comprises:
scanning baffle configuration information stored in a database;
if the baffle configuration information which is not started exists in the database, the baffle configuration information which is not started is obtained and determined as the baffle configuration information of the target baffle to be started.
3. The method of claim 2, wherein the obtaining of the non-activated baffle configuration information and determining the non-activated baffle configuration information as the baffle configuration information of the target baffle to be activated comprises:
inquiring a state field of the un-started baffle configuration information, wherein the state field is used for identifying whether the baffle configuration information is valid or not;
and if the configuration information of the baffle which is not started is determined to be valid according to the state field, acquiring the configuration information of the baffle which is not started, and determining the configuration information of the baffle which is the target baffle to be started.
4. The method of claim 1, wherein said determining a baffle adapter corresponding to a target protocol of the target baffle comprises:
and calling the Class of the baffle adapter corresponding to the target protocol of the target baffle through a JAVA reflection mechanism according to the target protocol of the target baffle.
5. The method according to any one of claims 1-4, further comprising:
and receiving baffle configuration information input by a user, and storing the baffle configuration information into the database.
6. The method of claim 5, wherein the baffle configuration information further comprises:
a response message template corresponding to the target protocol and a method for acquiring fields required by the response message template.
7. The method of claim 6, after running the baffle adapter in the new baffle thread, further comprising:
receiving a request message;
analyzing the request message through the baffle adapter, and acquiring the response message template and the field required by the response message template from the database according to the analysis result;
acquiring fields required by the response message template according to the acquisition method of the fields required by the response message template, filling the response message template, and generating a response message corresponding to the request message;
and outputting the response message.
8. The method according to claim 7, wherein the obtaining fields required by the response message template according to the method for obtaining fields required by the response message template comprises:
acquiring fields required by the message template from the request message according to the method for acquiring the fields required by the response message template; and/or
And according to the method for acquiring the fields required by the response message template, acquiring input parameters from the request message, inquiring fields corresponding to the input parameters from a target database, and determining the fields as the fields required by the message template.
9. A baffle testing apparatus, comprising:
the system comprises an acquisition module, a control module and a control module, wherein the acquisition module is used for acquiring baffle configuration information of a target baffle to be started, and the baffle configuration information comprises a target protocol of the target baffle;
the determining module is used for determining a baffle adapter corresponding to a target protocol of the target baffle, and the baffle adapter is used for analyzing a request message of the target protocol and generating a corresponding message;
and the operation module is used for starting a new baffle thread and operating the baffle adapter in the new baffle thread to perform baffle test.
10. An electronic device, comprising: a processor, and a memory communicatively coupled to the processor;
the memory stores computer-executable instructions;
the processor executes computer-executable instructions stored by the memory to implement the method of any of claims 1-8.
11. A computer-readable storage medium having computer-executable instructions stored thereon, which when executed by a processor, perform the method of any one of claims 1-8.
12. A computer program product, characterized in that it comprises a computer program which, when being executed by a processor, carries out the method of any one of claims 1 to 8.
CN202111439691.1A 2021-11-30 2021-11-30 Baffle testing method, device, storage medium and program product Pending CN114064327A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111439691.1A CN114064327A (en) 2021-11-30 2021-11-30 Baffle testing method, device, storage medium and program product

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111439691.1A CN114064327A (en) 2021-11-30 2021-11-30 Baffle testing method, device, storage medium and program product

Publications (1)

Publication Number Publication Date
CN114064327A true CN114064327A (en) 2022-02-18

Family

ID=80277337

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111439691.1A Pending CN114064327A (en) 2021-11-30 2021-11-30 Baffle testing method, device, storage medium and program product

Country Status (1)

Country Link
CN (1) CN114064327A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115052053A (en) * 2022-07-27 2022-09-13 中国工商银行股份有限公司 Message processing method and simulator for bank system test

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN115052053A (en) * 2022-07-27 2022-09-13 中国工商银行股份有限公司 Message processing method and simulator for bank system test

Similar Documents

Publication Publication Date Title
CN107659455B (en) Method, storage medium, device and system for Mock data of iOS (internet operating system) end
CN109408375B (en) Method and device for generating interface document
CN108038212B (en) Data interaction method, device, system, equipment and storage medium
CN111597110B (en) Page test method and device, electronic equipment and storage medium
US11954013B2 (en) Method of testing applet performance, electronic device, and computer-readable medium
CN114780326B (en) Cross-platform calibration test method, device and equipment
CN113434396A (en) Interface test method, device, equipment, storage medium and program product
CN114064327A (en) Baffle testing method, device, storage medium and program product
CN109144846B (en) Test method and device for testing server
CN110209565A (en) A kind of metadata schema adjustment method and its device
CN112579454A (en) Task data processing method, device and equipment
CN116257451A (en) Interface testing method, device, equipment, storage medium and product
CN113641628B (en) Data quality detection method, device, equipment and storage medium
CN113485855B (en) Memory sharing method and device, electronic equipment and readable storage medium
CN115794064A (en) Configuration method and device of task processing flow, electronic equipment and storage medium
CN111078518B (en) Data acquisition method, terminal device and computer readable storage medium
CN114116491A (en) Webpage program testing method and device, electronic equipment and storage medium
CN111881112A (en) Database configuration method and device and related equipment
CN116107900A (en) Interface performance test method and system
CN111124923B (en) Running state query method and device, server equipment and storage medium
CN111488283B (en) Task generation method and device, electronic equipment and storage medium
CN113254328B (en) White box testing method, system, mobile terminal and storage medium
CN114448791B (en) Configuration method and device of routing module, electronic equipment and readable storage medium
CN113225717B (en) Control method and device of Bluetooth equipment and computer readable storage medium
CN108958654B (en) Management method and related device of storage system

Legal Events

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