Method and device for generating test baffle
Through parser and timer technology, the test bezel is generated and automatically updated, which solves the technical threshold and high labor cost of test bezel services in the existing technology, and improves system efficiency and scalability.
Patent Information
- Application Number
- CN202411327602.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-23
- Publication Date
- 2024-12-20
AI Technical Summary
The existing test baffle service has a technical threshold, and it is necessary to manually select the code warehouse and cannot automatically update the baffle information of the corresponding code warehouse, resulting in high labor costs.
By receiving data source information, determining data source tag information, using a parser to parse the data source, obtaining initial keywords, performing checksum encapsulation, generating test bezels, and using a timer to automatically update.
Multi-data source import and intelligent generation of test bezels are realized, which improves system efficiency and scalability, reduces labor costs, and solves the problem of automatic updates.
Smart Images

Figure CN119166529A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of software testing, and in particular to a method for generating a test baffle, a device for generating a test baffle, a computer-readable storage medium and an electronic device. Background Art
[0002] A test baffle refers to a method in which a virtual object is used to replace some objects that are difficult to construct or obtain during the test process for the purpose of testing.
[0003] Baffle technology is widely used in software development and testing. It builds a simulated dependency environment according to its own needs, supports joint debugging between microservices within the system, or simulates dependent systems to support joint debugging between systems. For example: in a development scenario with front-end and back-end separation, front-end developers can perform joint debugging in advance by simulating back-end services; testers use baffle services to solve problems where third-party systems cannot provide a test environment or test scenarios are difficult to construct.
[0004] However, the construction and configuration of baffle services require a certain technical foundation, and the construction and maintenance of baffle services also require a large investment of manpower costs.
[0005] Commonly used baffle tools include Easy Mock and Wire Mock. Easy Mock is an open source testing tool for Java applications that can simulate objects and perform unit tests. Wire Mock is an open source testing tool for simulating HTTP services that can simulate RESTful APIs and perform integration tests. However, the configuration, construction, and maintenance of existing baffle services require a certain amount of manpower costs, and there are also technical barriers. In addition, each time you use it, you need to manually select a code repository, and the system cannot automatically update the baffle information of the corresponding code repository.
[0006] To address the above-mentioned problems, no effective solution has been proposed yet. Summary of the invention
[0007] The embodiments of the present invention provide a method for generating a test baffle, a device for generating a test baffle, a computer-readable storage medium and an electronic device, so as to at least solve the technical problems in the prior art that the baffle service has a technical threshold, requires manual selection of a code repository, cannot automatically update the baffle information of the corresponding code repository, and has a high labor cost.
[0008] According to one aspect of an embodiment of the present invention, a method for generating a test baffle is provided, comprising: receiving data source information, the data source information comprising at least a type of data source; determining tag information of each data source according to the data source information, the tag information being used to uniquely identify the data source; parsing the corresponding data source using a parser according to the tag information of the data source to obtain an initial keyword of the data source, the parser corresponding to the type of the data source in a one-to-one manner; verifying the initial keyword to obtain a verified keyword, and encapsulating the verified keyword to obtain a test baffle corresponding to the data source, the test baffle being a virtual object in the test process.
[0009] Optionally, a parser is used to parse the corresponding data source according to the tag information of the data source to obtain an initial keyword of the data source, including: obtaining a first mapping relationship, the first mapping relationship representing a mapping relationship between a type of data source and a parser; determining a first target parser for parsing the target data source according to type information in the tag information of the target data source and the first mapping relationship; determining a data structure of the target data source according to the tag information of the target data source, and determining an extraction rule of the target data source according to the data structure of the target data source; parsing the target data source according to the extraction rule of the target data source and using the first target parser to obtain at least one of the initial keywords of the target data source.
[0010] Optionally, the data source is a Postman configuration file, and the Postman configuration file is a data source in which data information is stored in a json file in the form of a key-value pair. A parser is used to parse the corresponding data source according to the tag information of the data source to obtain an initial keyword of the data source, including: using a second target parser corresponding to the Postman configuration file to traverse each key-value pair in the json file in turn, and verify the key-value pairs to obtain a verification result; determining whether the key-value pair is key information of the data source according to the verification result; if the key-value pair is the key information, extracting and saving the key-value pair as the initial keyword of the data source; if the key-value pair is non-key information, confirming whether the key-value pair in the json file is completely verified, and if the key-value pair in the json file is not completely verified, continuing to verify the next key-value pair.
[0011] Optionally, the initial keyword is verified to obtain a verified keyword, including: traversing each of the initial keywords in the keyword information list in turn, and determining whether the target keyword is a required item; if the target keyword is a required item and is empty, determining that the target keyword verification has failed, and recording verification failure information; if the target keyword is a required item and is not empty, determining whether the format of the target keyword satisfies the correctness verification rules, and the required item is information required to generate the test baffle; if the format of the target keyword does not satisfy the correctness verification rules, determining that the target keyword verification has failed, and recording verification failure information; if the format of the target keyword satisfies the correctness verification rules, determining whether there is a historical keyword that is the same as the target keyword; if the historical keyword exists, updating the historical keyword to the target keyword to obtain the verified keyword.
[0012] Optionally, the verified keywords are encapsulated to obtain a test baffle corresponding to the data source, including: determining the type of baffle tool and the corresponding encapsulator according to the type of the data source; determining the storage structure of the baffle tool according to the type of the baffle tool; and encapsulating the verified keywords according to the storage structure of the baffle tool and using the corresponding encapsulator to obtain the test baffle corresponding to the data source.
[0013] Optionally, the comprehensive score of each of the suitable persons is calculated according to the quantitative value and the weight, including: calculating the product of the quantitative value of each of the target feature attributes and the weight, and calculating the sum of the scores of multiple target feature attributes to obtain the comprehensive score of each of the suitable persons.
[0014] Optionally, after encapsulating the verified keywords to obtain a test baffle corresponding to the data source, the method for generating the test baffle further includes: setting an update time period; periodically acquiring the latest data source according to the update time period; performing preset operations on the test baffle according to the latest data source, the preset operations including at least one of the following: adding an operation, modifying an operation, or deleting an operation.
[0015] Optionally, the type of the data source includes at least one of the following: a json interface configuration file exported by Postman, a Swagger interface document, a jt l file exported by JMeter, a custom word file, or a custom excel interface document.
[0016] According to another aspect of an embodiment of the present invention, there is further provided a device for generating a test baffle, comprising: a receiving unit, configured to receive data source information, wherein the data source information comprises at least a type of data source; a first determining unit, configured to determine tag information of each of the data sources according to the data source information, wherein the tag information is used to uniquely identify the data source; a first processing unit, configured to parse the corresponding data source using a parser according to the tag information of the data source to obtain an initial keyword of the data source, wherein the parser corresponds to the type of the data source in a one-to-one manner; and a second processing unit, configured to verify the initial keyword to obtain a verified keyword, and to encapsulate the verified keyword to obtain a test baffle corresponding to the data source, wherein the test baffle is a virtual object in the test process.
[0017] Optionally, the first processing unit includes: an acquisition subunit, used to acquire a first mapping relationship, wherein the first mapping relationship represents a mapping relationship between a type of data source and a parser; a first determination subunit, used to determine a first target parser for parsing the target data source based on type information in the tag information of the target data source and the first mapping relationship; a second determination subunit, used to determine a data structure of the target data source based on the tag information of the target data source, and determine an extraction rule of the target data source based on the data structure of the target data source; and a parsing subunit, used to parse the target data source according to the extraction rule of the target data source and using the first target parser to obtain at least one initial keyword of the target data source.
[0018] Optionally, the first processing unit includes: a first processing sub-unit, used to use a second target parser corresponding to the Postman configuration file to traverse each key-value pair in the json file in turn, and verify the key-value pairs to obtain a verification result; a third determination sub-unit, used to determine whether the key-value pair is key information of the data source according to the verification result; a second processing sub-unit, used to extract and save the key-value pair as the initial keyword of the data source when the key-value pair is the key information; the third processing sub-unit, used to confirm whether the key-value pair in the json file is completely verified when the key-value pair is non-key information, and continue to verify the next key-value pair when the key-value pair in the json file is not completely verified.
[0019] Optionally, the second processing unit includes: a fourth processing sub-unit, used to traverse each of the initial keywords in the keyword information list in turn, and determine whether the target keyword is a required item; a fifth processing sub-unit, used to determine that the target keyword verification fails and record the verification failure information when the target keyword is a required item and is empty, and determine whether the format of the target keyword satisfies the correctness verification rules when the target keyword is a required item and is not empty, and the required items are information required to generate the test baffle; a sixth processing sub-unit, used to determine that the target keyword verification fails and record the verification failure information when the format of the target keyword does not satisfy the correctness verification rules, and determine whether there is a historical keyword that is the same as the target keyword when the format of the target keyword satisfies the correctness verification rules; an updating sub-unit, used to update the historical keyword to the target keyword to obtain the verified keyword when the historical keyword exists.
[0020] Optionally, the second processing unit includes: a fourth determination subunit, used to determine the type of the baffle tool and the corresponding encapsulator according to the type of the data source; a fifth determination subunit, used to determine the storage structure of the baffle tool according to the type of the baffle tool; and an encapsulation subunit, used to encapsulate the verified keyword according to the storage structure of the baffle tool and using the corresponding encapsulator to obtain the test baffle corresponding to the data source.
[0021] Optionally, the device for generating the test baffle further includes: a setting unit, used to set an update time period after encapsulating the verified keyword to obtain a test baffle corresponding to the data source; an acquisition unit, used to periodically acquire the latest data source according to the update time period; and a preset unit, used to perform preset operations on the test baffle according to the latest data source, wherein the preset operations include at least one of the following: a new operation, a modification operation, and a deletion operation.
[0022] Optionally, the type of the data source includes at least one of the following: a json interface configuration file exported by Postman, a Swagger interface document, a jt l file exported by JMeter, a custom word file, or a custom excel interface document.
[0023] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is further provided, wherein the computer-readable storage medium includes a stored program, wherein when the program is run, the device where the computer-readable storage medium is located is controlled to execute any one of the above-mentioned methods for generating a test baffle.
[0024] According to another aspect of an embodiment of the present invention, there is also provided an electronic device, comprising: one or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by the one or more processors, and the one or more programs include a method for generating a test baffle for executing any one of the above-mentioned items.
[0025] According to another aspect of an embodiment of the present invention, a processor is further provided, the processor being used to run a program, wherein the program, when running, executes any one of the above-mentioned methods for generating a test baffle.
[0026] According to another aspect of an embodiment of the present invention, a computer program product is provided, comprising computer instructions, wherein when the computer instructions are executed by a processor, any one of the above-mentioned methods for generating a test baffle is executed.
[0027] In an embodiment of the present invention, data source information is received, and the data source information at least includes the type of the data source; the tag information of each data source is determined according to the data source information, and the tag information is used to uniquely identify the data source; the corresponding data source is parsed by a parser according to the tag information of the data source to obtain the initial keyword of the data source, and the parser corresponds to the type of the data source one by one; the initial keyword is verified to obtain the verified keyword, and the verified keyword is encapsulated to obtain a test baffle corresponding to the data source, and the test baffle is a virtual object in the test process. Through the technical solution provided by the present invention, the purpose of importing compatible with multiple data source information through a customized parser, and using a built-in timer and data source uniqueness rule verification, and regularly updating the test baffle information is achieved, thereby achieving the technical effect of multiple data source import and intelligent generation of test baffles, improving system efficiency and scalability, and thus solving the technical barriers of baffle services in the prior art, and the need to manually select code warehouses, unable to automatically update the baffle information of the corresponding code warehouse, and the technical problems of high labor costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0028] The drawings described herein are used to provide a further understanding of the present invention and constitute a part of this application. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation of the present invention. In the drawings:
[0029] Figure 1 It is a hardware structure block diagram of a mobile terminal of a method for generating a test baffle according to an embodiment of the present invention;
[0030] Figure 2 is a flow chart of a method for generating a test baffle according to an embodiment of the present invention;
[0031] Figure 3is an overall architecture diagram of a method for generating a test baffle according to an embodiment of the present invention;
[0032] Figure 4 is a schematic diagram of keyword information of a test baffle according to an embodiment of the present invention;
[0033] Figure 5 is a schematic diagram of a Postman configuration file according to an embodiment of the present invention;
[0034] Figure 6 is a flowchart of Postman extraction rules according to an embodiment of the present invention;
[0035] Figure 7 is a flowchart of the Postman verification rule according to an embodiment of the present invention;
[0036] Figure 8 is a conversion diagram of the moco packaging rule according to an embodiment of the present invention;
[0037] Fig. 9 is a schematic diagram of a device for generating a test baffle according to an embodiment of the present invention.
[0038] The above drawings include the following reference numerals:
[0039] 102, processor; 104, memory; 106, transmission device; 108, input and output devices. DETAILED DESCRIPTION
[0040] In order to enable those skilled in the art to better understand the scheme of the present invention, the technical scheme in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present invention.
[0041] It should be noted that the terms "first", "second", etc. in the specification and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present invention described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any variations thereof are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device that includes a series of steps or units is not necessarily limited to those steps or units that are clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0042] As introduced in the background technology, the existing baffle service has technical barriers and requires manual selection of code repositories. It is impossible to automatically update the baffle information of the corresponding code repositories, which results in high labor costs. In view of the above defects, a method for generating a test baffle, a device for generating a test baffle, a computer-readable storage medium, and an electronic device are provided in the embodiments of the present invention.
[0043] The technical solutions in the embodiments of the present invention will be described clearly and completely below in conjunction with the accompanying drawings in the embodiments of the present invention.
[0044] The method embodiments provided in the embodiments of the present invention can be executed in a mobile terminal, a computer terminal or a similar computing device. Taking running on a mobile terminal as an example, Figure 1 FIG. 1 is a hardware structure diagram of a mobile terminal for a method for generating a test baffle according to an embodiment of the present invention. Figure 1 As shown, the mobile terminal may include one or more ( Figure 1 Only one is shown in the figure) a processor 102 (the processor 102 may include but is not limited to a processing device such as a microprocessor MCU or a programmable logic device FPGA) and a memory 104 for storing data, wherein the mobile terminal may also include a transmission device 106 and an input / output device 108 for communication functions. It can be understood by those skilled in the art that Figure 1 The structure shown is only for illustration and does not limit the structure of the mobile terminal. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations are shown.
[0045] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as the computer program corresponding to the method for generating the test baffle in the embodiment of the present invention. The processor 102 executes various functional applications and data processing by running the computer program stored in the memory 104, that is, the above method is implemented. The memory 104 may include a high-speed random access memory, and may also include a non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some examples, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories can be connected to the mobile terminal via a network. Examples of the above-mentioned network include but are not limited to the Internet, an intranet, a local area network, a mobile communication network, and a combination thereof. The transmission device 106 is used to receive or send data via a network. The above-mentioned specific network example may include a wireless network provided by a communication provider of the mobile terminal. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, referred to as NIC), which can be connected to other network devices through a base station so as to communicate with the Internet. In one example, the transmission device 106 may be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.
[0046] According to an embodiment of the present invention, a method embodiment of a method for generating a test baffle is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0047] Figure 2 is a flow chart of a method for generating a test baffle according to an embodiment of the present invention. Figure 2 As shown, the method comprises the following steps:
[0048] Step S202: receiving data source information, where the data source information at least includes the type of data source.
[0049] In this embodiment, receiving data source information including data source types can help the system identify and distinguish different data sources, so as to perform corresponding data processing and analysis.
[0050] Figure 3 FIG. 1 is an overall architecture diagram of a method for generating a test baffle according to an embodiment of the present invention. Figure 3As shown, it mainly consists of three functional modules: baffle generation module, baffle management module and storage module. Among them, the baffle generation module is responsible for parsing the data source and generating the test baffle. The module consists of data access layer, data parsing layer, data verification layer and data encapsulation layer.
[0051] Specifically, the data access layer is responsible for receiving the incoming data source information, managing the incoming data source type and access method, and transmitting the information to the data parsing layer. The data access layer will distinguish the different incoming data source types, and also supports the input of custom data sources.
[0052] It should be noted that this embodiment can support multiple data source types, taking commonly used data sources as examples: json interface configuration exported by Postman, Swagger interface document, jt l file exported by JMeter, etc. At the same time, it also supports the import of custom data sources, such as custom word or excel interface documents, etc.
[0053] In addition, different data source types have different access methods. Taking Swagger and JMeter as examples, Swagger is a url link and needs to be imported in the form of an input box. JMeter is a jt l file and needs to be imported by uploading a file. Therefore, when users import data, they need to select the data source type and enter the corresponding data source information such as file or access address according to the selected data source type.
[0054] Step S204: determine the tag information of each data source according to the data source information, where the tag information is used to uniquely identify the data source.
[0055] In this embodiment, each data source is uniquely identified by labeling it according to the data source information, so that it can be more easily identified and distinguished when querying or managing the data source, and the required data source can be found quickly. At the same time, different data sources can also be classified, managed and permission controlled.
[0056] It should be noted that the above data access layer needs to distinguish different data sources. It is necessary to add a unique identifier to each data source by tagging. Different data source types have different methods for setting tags. Taking Swagger and JMeter as examples, the label of Swagger is its URL link. The label of JMeter is the file name of the jt l file. The unique identifier is used to distinguish repeated imports of the same type and the same data source to facilitate update operations.
[0057] Step S206: according to the tag information of the data source, a parser is used to parse the corresponding data source to obtain the initial keyword of the data source. The parser corresponds to the type of the data source one by one.
[0058] like Figure 3 As shown, the data parsing layer in the baffle generation module is responsible for maintaining parsers corresponding to different data source types. The parsers are used to parse the corresponding data source information. The parsers are used to parse the corresponding data source according to the label information of the data source, and the keyword information (i.e., initial keywords) required to generate the test baffle is extracted to find the required information more quickly, thereby ensuring that the parser can accurately understand and process different types of data sources.
[0059] Step S208, verifying the initial keyword to obtain a verified keyword, and encapsulating the verified keyword to obtain a test baffle corresponding to the data source, where the test baffle is a virtual object in the test process.
[0060] In this embodiment, the data verification layer will verify the parsed information (i.e., the initial keywords), and the information that passes the verification will be transmitted to the encapsulation layer for test baffle encapsulation, which can eliminate erroneous keywords and ensure the accuracy of the test baffle. The test baffle formed by encapsulating the verified keywords can simplify the test process and can be reused in different scenarios.
[0061] As can be seen from the above, the data source information is received, and the data source information at least includes the type of the data source; the tag information of each data source is determined according to the data source information, and the tag information is used to uniquely identify the data source; the corresponding data source is parsed by a parser according to the tag information of the data source to obtain the initial keyword of the data source, and the parser corresponds to the type of the data source one by one; the initial keyword is verified to obtain the verified keyword, and the verified keyword is encapsulated to obtain the test baffle corresponding to the data source, and the test baffle is a virtual object in the test process. Through the technical solution provided by the present invention, the purpose of importing compatible with multiple data source information through a customized parser is achieved, and the built-in timer and data source uniqueness rule verification are used to regularly update the test baffle information, thereby achieving the technical effect of multiple data source import and intelligent generation of test baffles, and improving system efficiency and scalability.
[0062] The technical solution provided by the embodiment of the present invention solves the technical problems of the baffle service in the prior art, such as the need to manually select a code repository, the inability to automatically update the baffle information of the corresponding code repository, and the high labor cost.
[0063] According to the above embodiment of the present invention, a parser is used to parse the corresponding data source according to the tag information of the data source to obtain an initial keyword of the data source, including: obtaining a first mapping relationship, the first mapping relationship representing the mapping relationship between the type of the data source and the parser; determining a first target parser for parsing the target data source according to the type information in the tag information of the target data source and the first mapping relationship; determining a data structure of the target data source according to the tag information of the target data source, and determining an extraction rule of the target data source according to the data structure of the target data source; parsing the target data source according to the extraction rule of the target data source and using the first target parser to obtain at least one initial keyword of the target data source.
[0064] Figure 4 is a schematic diagram of the keyword information of the test baffle according to an embodiment of the present invention, such as Figure 4 As shown, there are multiple parsers in the parsing layer, each parser corresponds to a data source type. After the information is passed in, the system selects the corresponding parser according to the passed in data source type to parse the corresponding data source content and generate test baffle keyword information.
[0065] It should be noted that this embodiment supports the expansion of data source types, which is specifically implemented as follows: the data access layer adds a new data source type and its access method, the data parsing layer adds a parser corresponding to the data source and designs extraction rules for the data structure of the data source, so that this embodiment supports the expansion of data source types, including customized data source types.
[0066] In this embodiment, the mapping relationship between the type of data source and the parser (i.e., the first mapping relationship) can be obtained, and the corresponding parser (i.e., the first target parser) and the corresponding data structure can be determined according to the type information and the mapping relationship of the target data source, and the extraction rules can be determined. Thereafter, the parser is used to parse the target data source to obtain at least one initial keyword. By analyzing the type and structure of the target data source, it is determined which parser and extraction rule to use to obtain key information in the target data source, so that the required data can be obtained more quickly and accurately, thereby achieving effective use and analysis of data, which helps to improve the efficiency and accuracy of data processing.
[0067] According to the above embodiment of the present invention, the data source is a Postman configuration file, and the Postman configuration file is a data source in which data information is stored in a json file in the form of a key-value pair. A parser is used to parse the corresponding data source according to the tag information of the data source to obtain the initial keyword of the data source, including: using a second target parser corresponding to the Postman configuration file to traverse each key-value pair in the json file in turn, and verify the key-value pair to obtain a verification result; determining whether the key-value pair is key information of the data source according to the verification result; if the key-value pair is key information, extracting and saving the key-value pair as the initial keyword of the data source; if the key-value pair is non-key information, confirming whether the key-value pair in the json file is completely verified, and if the key-value pair in the json file is not completely verified, continuing to verify the next key-value pair.
[0068] Figure 5 is a schematic diagram of a Postman configuration file according to an embodiment of the present invention, such as Figure 5 As shown, the key information of the test baffle includes method, header, url, code and body, and the data information is stored in the json file in the form of key-value pairs.
[0069] Figure 6 is a flowchart of the Postman extraction rule according to an embodiment of the present invention, such as Figure 6 As shown, for this type of data source information, the extraction rules of the corresponding parser (i.e., the second target parser) are: traverse each key-value pair of the json file, determine whether the key is the key information of the test baffle, extract the key-value pair determined to be the key information of the test baffle and save it as the initial keyword of the data source, and if the key-value pair is non-key information, confirm whether the key-value pair in the json file is completely verified, and if the key-value pair in the json file is not completely verified, continue to verify the next key-value pair.
[0070] In this embodiment, the key-value pairs in the json file can be verified, and the initial key information of the data source can be extracted and saved to ensure the accuracy and completeness of the data source. By traversing the key-value pairs one by one and verifying them, possible problems or errors in the data source can be discovered in time, and corrections or adjustments can be made, thereby improving the quality and reliability of the data source. At the same time, confirming the key information of the data source can make it easier to use and understand the data source, thereby improving the readability and usability of the data.
[0071] According to the above embodiment of the present invention, the initial keyword is verified to obtain the verified keyword, including: traversing each initial keyword in the keyword information list in turn, and determining whether the target keyword is a required item; when the target keyword is a required item and is empty, determining that the target keyword verification fails, and recording the verification failure information; when the target keyword is a required item and is not empty, determining whether the format of the target keyword satisfies the correctness verification rules, and the required items are information required for generating a test baffle; when the format of the target keyword does not satisfy the correctness verification rules, determining that the target keyword verification fails, and recording the verification failure information; when the format of the target keyword satisfies the correctness verification rules, determining whether there is a historical keyword that is the same as the target keyword; when the historical keyword exists, updating the historical keyword to the target keyword to obtain the verified keyword.
[0072] like Figure 3 As shown, the preset check items of the verification layer are: keyword missing check, parameter value correctness check and uniqueness check. Among them, the uniqueness check verifies the unique identification of the test baffle and determines whether the incoming test baffle should perform a new addition or update operation. The uniqueness check realizes one-click update of the test baffle and improves maintenance efficiency.
[0073] Figure 7 is a flowchart of the Postman verification rule according to an embodiment of the present invention, such as Figure 7 As shown, first perform a keyword missing check, then perform a parameter value correctness check, and finally perform a uniqueness check. Figure 4 Figure 7This embodiment is described as follows: 1) Keyword missing check. The keyword information output by the data parsing layer is divided into mandatory items and non-mandatory items. If the non-mandatory items are empty, it will not affect the generation of the test baffle, such as the Headers item in the Request and Response. The mandatory items are necessary information for generating the test baffle. If they are empty, the test baffle cannot be generated normally, such as the URI item. The keyword missing check verifies the mandatory items in the incoming information. If the mandatory items are empty, it is judged as a verification failure, and a prompt message indicating that the mandatory items are empty is returned to the user, and the import process is terminated. 2) Parameter correctness check verifies the format of the keyword information. Some keyword information has fixed format requirements, such as the Status of the Response should be a three-digit status code such as 200, 400, 500, etc., and the Method should be "Post", "Get", "Put", "Delete", etc. If the format of the keyword information input does not meet the format requirements, the verification fails. 3) Uniqueness check acts on multiple import scenarios of the same data source. The verification is based on the unique identifier set by the data access layer for each data source. If the URI in the same data source is the same, it is considered to be a repeated import. If the verification result is that there are no duplicates, the passed in information is used to add a new baffle; if the verification result is that there are duplicates, the historical keyword is updated to the target keyword, and the passed in information is used to update the existing baffle.
[0074] It should be noted that the above uniqueness check can reduce storage redundancy when the same data source is repeatedly imported. At the same time, it supports one-click update of the corresponding baffle service when the interface information of the same data source changes, thereby improving maintenance efficiency.
[0075] In this embodiment, the initial keywords can be verified and updated to ensure the accuracy and completeness of the keyword information so that the correct data can be used when generating the test baffle. By verifying the required items and correctness of the target keywords, the input of erroneous data can be effectively avoided and the generated test baffle can be guaranteed to meet the expected requirements. At the same time, updating historical keywords can ensure the consistency and accuracy of the data, making the generation of the test baffle more reliable and effective, thereby improving the quality and effectiveness of the test data.
[0076] According to the above embodiment of the present invention, the verified keywords are encapsulated to obtain a test baffle corresponding to the data source, including: determining the type of baffle tool and the corresponding encapsulator according to the type of data source; determining the storage structure of the baffle tool according to the type of baffle tool; encapsulating the verified keywords according to the storage structure of the baffle tool and using the corresponding encapsulator to obtain a test baffle corresponding to the data source.
[0077] It should be noted that the data verification layer will verify the parsed information. The information that passes the verification will be transmitted to the encapsulation layer for test baffle encapsulation. If it fails, a prompt message will be returned according to the verification failure item, and the import operation will be terminated. In order to adapt to different baffle frameworks and tools, the encapsulation layer designs corresponding encapsulators according to the integrated baffle tool type. The core function of the encapsulator is to encapsulate the keyword information according to the storage structure of different baffle tools and pass it to the storage layer. The storage structure of different baffles is different. For example, the moco baffle is stored in json format files, and the request and response information are stored in the Request and Response key-value pairs respectively. Mockjs stores baffle information in js files.
[0078] Figure 8 is a conversion diagram of the moco packaging rule according to an embodiment of the present invention, such as Figure 8 As shown, the baffle file of the moco framework is taken as an example to illustrate this embodiment. The keyword information is encapsulated in the json file in the form of key-value pairs. The encapsulation rule of the encapsulator is: traverse the keyword information output by the data verification layer, encapsulate the keywords in the format order of the moco file, and generate the baffle file.
[0079] In this embodiment, the storage structure of the baffle tool and the corresponding encapsulator can be determined according to the type of data source, and the keywords can be encapsulated after verification. That is, the data encapsulation layer is responsible for encapsulating the verified keyword information, generating a baffle, and transmitting it to the storage layer, which can simulate the situation of the real data source, better discover problems and defects in the system, and improve test efficiency and quality.
[0080] like Figure 3 As shown, it also includes a storage module and a baffle management module. The storage module is used to receive the test baffle data encapsulated by the encapsulation layer and perform persistent storage, which facilitates the later maintenance and management of the baffle service. The baffle management module is responsible for the visualization of baffle management and provides users with interactive methods. The baffle management module can be divided into a baffle scheduled update module, a baffle maintenance module and a baffle service module. Among them, the baffle scheduled update module is responsible for automatically updating the existing test baffles. This function supports data source information imported by version management software such as svn and git. When the user imports the data source information, the system will prompt "Do you need to update it regularly?" You need to select "Yes" and fill in the scheduled update cycle. After importing, it can also be managed in the "scheduled update module".
[0081] According to the above embodiment of the present invention, after the verified keywords are encapsulated to obtain a test baffle corresponding to the data source, the method for generating the test baffle further includes: setting an update time period; obtaining the latest data source regularly according to the update time period; performing preset operations on the test baffle according to the latest data source, and the preset operations include at least one of the following: a new operation, a modification operation, and a deletion operation.
[0082] In this embodiment, after the scheduled update is started, the system can obtain the latest data from the data source information storage address according to the set time period, and automatically execute the operation of generating a test baffle. After the test baffle is generated, the system executes the operation of adding or updating the test baffle (i.e., the preset operation) according to the unique identifier, which can ensure the accuracy and completeness of the test baffle and improve the testing efficiency.
[0083] like Figure 3 As shown, the baffle maintenance module displays all stored baffles and provides basic operations such as "add", "modify", "delete" and "query". Among them, "add baffle" can be selected from "manually configure baffle information" and "import data source file to generate baffle". "Modify, delete, query" is to change or search the stored test baffle information. The baffle service module provides users with "start baffle service", "turn off baffle service" and "restart baffle service" operations.
[0084] According to the above embodiment of the present invention, the type of data source includes at least one of the following: a json interface configuration file exported by Postman, a Swagger interface document, a jt l file exported by JMeter, a custom word file, and a custom excel interface document.
[0085] In this embodiment, the above-mentioned data source types can be used to describe different interface information, including interface request parameters, response results, interface address, request method and other information, so as to better understand the design and function of the interface, help implement interface functions, design test cases and conduct interface testing. At the same time, these data sources can also be used for interface documentation and management, which facilitates the review and use of interface information.
[0086] Through the technical solution provided in the above-mentioned embodiment of the present invention, through a customized parser, upward compatibility with the import of information from multiple data sources is achieved, and a test baffle is generated, thereby meeting the scalability requirements of the system. At the same time, through the built-in timer and data source uniqueness rule verification, the function of regularly obtaining the latest data from the data source information storage address and updating the existing test baffle information is achieved, thereby improving the maintenance efficiency of the test baffle.
[0087] That is, the above technical solution provided by the embodiment of the present invention comprehensively considers various factors. Compared with the prior art, it addresses the shortcomings of existing baffles and similar inventions, supports the import of multiple data sources, does not limit application scenarios, and supports the expansion of data source types, that is, supports the import of multiple data source types, including customized data source types, to meet the needs of identifying the type of incoming data, generates a test baffle according to the incoming data source, and updates it regularly.
[0088] It should be noted that, for the aforementioned method embodiments, for the sake of simplicity, they are all expressed as a series of action combinations, but those skilled in the art should be aware that the present application is not limited by the described order of actions, because according to the present application, certain steps can be performed in other orders or simultaneously. Secondly, those skilled in the art should also be aware that the embodiments described in the specification are all preferred embodiments, and the actions and modules involved are not necessarily required by the present application.
[0089] Through the description of the above implementation methods, those skilled in the art can clearly understand that the method according to the above embodiment can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application, or the part that contributes to the prior art, can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes a number of instructions for a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods of each embodiment of the present application.
[0090] According to an embodiment of the present invention, there is also provided a test baffle generation device for implementing the test baffle generation method described above. Fig. 9 is a schematic diagram of a device for generating a test baffle according to an embodiment of the present invention, such as Fig. 9 As shown, the device includes: a receiving unit 901, a first determining unit 903, a first processing unit 905 and a second processing unit 907. The device for generating the test baffle is described below.
[0091] The receiving unit 901 is used to receive data source information, where the data source information at least includes the type of the data source.
[0092] The first determining unit 903 is used to determine the tag information of each data source according to the data source information, where the tag information is used to uniquely identify the data source.
[0093] The first processing unit 905 is used to parse the corresponding data source using a parser according to the tag information of the data source to obtain an initial keyword of the data source. The parser corresponds to the type of the data source one by one.
[0094] The second processing unit 907 is used to verify the initial keyword to obtain the verified keyword, and encapsulate the verified keyword to obtain a test baffle corresponding to the data source. The test baffle is a virtual object in the test process.
[0095] It should be noted here that the above-mentioned receiving unit 901, the first determination unit 903, the first processing unit 905 and the second processing unit 907 correspond to steps S202 to S208 in the above-mentioned embodiments, and the four modules are the same as the instances and application scenarios implemented by the corresponding steps, but are not limited to the contents disclosed in the above-mentioned embodiments.
[0096] As can be seen from the above, in the scheme recorded in the above-mentioned embodiment of the present invention, first, a receiving unit can be used to receive data source information, and the data source information includes at least the type of the data source; then, a first determination unit can be used to determine the label information of each data source according to the data source information, and the label information is used to uniquely identify the data source; secondly, a first processing unit can be used to parse the corresponding data source using a parser according to the label information of the data source to obtain an initial keyword of the data source, and the parser corresponds to the type of the data source one by one; finally, a second processing unit can be used to verify the initial keyword to obtain a verified keyword, and the verified keyword is encapsulated to obtain a test baffle corresponding to the data source, and the test baffle is a virtual object in the test process, which achieves the purpose of compatible import of multiple data source information through a customized parser, and uses a built-in timer to verify the data source uniqueness rule, and regularly updates the test baffle information, thereby realizing the technical effect of multiple data source import and intelligent generation of test baffles, and improving system efficiency and scalability.
[0097] The technical solution provided by the embodiment of the present invention solves the technical problems of the baffle service in the prior art, such as the need to manually select a code repository, the inability to automatically update the baffle information of the corresponding code repository, and the high labor cost.
[0098] In an optional embodiment, the first processing unit includes: an acquisition subunit, used to acquire a first mapping relationship, the first mapping relationship representing a mapping relationship between a type of a data source and a parser; a first determination subunit, used to determine a first target parser for parsing a target data source based on type information in the tag information of the target data source and the first mapping relationship; a second determination subunit, used to determine a data structure of the target data source based on the tag information of the target data source, and determine an extraction rule of the target data source based on the data structure of the target data source; and a parsing subunit, used to parse the target data source according to the extraction rule of the target data source and using the first target parser to obtain at least one initial keyword of the target data source.
[0099] In an optional embodiment, the first processing unit includes: a first processing sub-unit, used to use a second target parser corresponding to the Postman configuration file to traverse each key-value pair in the json file in turn, and verify the key-value pair to obtain a verification result; a third determination sub-unit, used to determine whether the key-value pair is key information of the data source according to the verification result; a second processing sub-unit, used to extract and save the key-value pair as the initial keyword of the data source when the key-value pair is key information; a third processing sub-unit, used to confirm whether the key-value pair in the json file is completely verified when the key-value pair is non-key information, and continue to verify the next key-value pair when the key-value pair in the json file is not completely verified.
[0100] In an optional embodiment, the second processing unit includes: a fourth processing sub-unit, which is used to traverse each initial keyword in the keyword information list in turn, and determine whether the target keyword is a required item; a fifth processing sub-unit, which is used to determine that the target keyword verification fails when the target keyword is a required item and is empty, and record the verification failure information; when the target keyword is a required item and is not empty, determine whether the format of the target keyword satisfies the correctness verification rules, and the required items are information required to generate a test baffle; a sixth processing sub-unit, which is used to determine that the target keyword verification fails when the format of the target keyword does not satisfy the correctness verification rules, and record the verification failure information; when the format of the target keyword satisfies the correctness verification rules, determine whether there is a historical keyword that is the same as the target keyword; an update sub-unit, which is used to update the historical keyword to the target keyword when the historical keyword exists, and obtain a verified keyword.
[0101] In an optional embodiment, the second processing unit includes: a fourth determination subunit, used to determine the type of the baffle tool and the corresponding encapsulator according to the type of the data source; a fifth determination subunit, used to determine the storage structure of the baffle tool according to the type of the baffle tool; and an encapsulation subunit, used to encapsulate the verified keyword according to the storage structure of the baffle tool and using the corresponding encapsulator to obtain a test baffle corresponding to the data source.
[0102] In an optional embodiment, the device for generating the test baffle further includes: a setting unit, which is used to set an update time period after encapsulating the verified keyword to obtain the test baffle corresponding to the data source; an acquisition unit, which is used to periodically acquire the latest data source according to the update time period; and a preset unit, which is used to perform preset operations on the test baffle according to the latest data source, and the preset operations include at least one of the following: a new operation, a modification operation, and a deletion operation.
[0103] In an optional embodiment, the type of data source includes at least one of the following: a json interface configuration file exported by Postman, a Swagger interface document, a jt l file exported by JMeter, a custom word file, and a custom excel interface document.
[0104] According to another aspect of an embodiment of the present invention, there is also provided an electronic device, comprising: one or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by the one or more processors, and the one or more programs include a method for generating a test baffle for executing any of the above items.
[0105] According to another aspect of an embodiment of the present invention, a processor is further provided, and the processor is used to run a program, wherein when the program is run, any one of the above-mentioned methods for generating a test baffle is executed.
[0106] According to another aspect of an embodiment of the present invention, a computer program product is provided, including computer instructions, and when the computer instructions are executed by a processor, any one of the above-mentioned methods for generating a test baffle is executed.
[0107] According to another aspect of an embodiment of the present invention, a computer-readable storage medium is provided, the computer-readable storage medium including a stored program, wherein when the program is executed, the device where the computer-readable storage medium is located is controlled to execute any one of the above-mentioned methods for generating a test baffle.
[0108] Optionally, in this embodiment, the computer-readable storage medium may be located in any one of the computer terminals in a computer terminal group in a computer network, or in any one of the communication devices in a communication device group.
[0109] Optionally, in this embodiment, a computer-readable storage medium is configured to store program code for executing the following steps: receiving data source information, the data source information including at least the type of the data source; determining tag information of each data source based on the data source information, the tag information being used to uniquely identify the data source; parsing the corresponding data source using a parser based on the tag information of the data source to obtain an initial keyword of the data source, the parser corresponding to the type of the data source one-to-one; verifying the initial keyword to obtain a verified keyword, and encapsulating the verified keyword to obtain a test baffle corresponding to the data source, the test baffle being a virtual object in the test process.
[0110] Optionally, in this embodiment, a computer-readable storage medium is configured to store program code for performing the following steps: obtaining a first mapping relationship, the first mapping relationship representing a mapping relationship between a type of data source and a parser; determining a first target parser for parsing the target data source based on type information in the tag information of the target data source and the first mapping relationship; determining a data structure of the target data source based on the tag information of the target data source, and determining an extraction rule of the target data source based on the data structure of the target data source; parsing the target data source based on the extraction rule of the target data source and using the first target parser to obtain at least one initial keyword of the target data source.
[0111] Optionally, in this embodiment, the computer-readable storage medium is configured to store program code for performing the following steps: using a second target parser corresponding to the Postman configuration file to traverse each key-value pair in the json file in turn, and verify the key-value pair to obtain a verification result; determining whether the key-value pair is key information of the data source based on the verification result; in the case where the key-value pair is key information, extracting and saving the key-value pair as the initial keyword of the data source; in the case where the key-value pair is non-key information, confirming whether the key-value pair in the json file is completely verified, and if the key-value pair in the json file is not completely verified, continuing to verify the next key-value pair.
[0112] Optionally, in this embodiment, the computer-readable storage medium is configured to store program code for performing the following steps: traversing each initial keyword in the keyword information list in turn, and determining whether the target keyword is a required item; when the target keyword is a required item and is empty, determining that the target keyword verification has failed, and recording the verification failure information; when the target keyword is a required item and is not empty, determining whether the format of the target keyword satisfies the correctness verification rules, and the required items are information required to generate a test baffle; when the format of the target keyword does not satisfy the correctness verification rules, determining that the target keyword verification has failed, and recording the verification failure information; when the format of the target keyword satisfies the correctness verification rules, determining whether there is a historical keyword that is the same as the target keyword; if the historical keyword exists, updating the historical keyword to the target keyword to obtain a verified keyword.
[0113] Optionally, in this embodiment, the computer-readable storage medium is configured to store program code for performing the following steps: determining the type of baffle tool and the corresponding encapsulator according to the type of data source; determining the storage structure of the baffle tool according to the type of baffle tool; encapsulating the verified keywords according to the storage structure of the baffle tool and using the corresponding encapsulator to obtain a test baffle corresponding to the data source.
[0114] Optionally, in this embodiment, the computer-readable storage medium is configured to store program codes for executing the following steps: setting an update time period; obtaining the latest data source regularly according to the update time period; performing preset operations on the test baffle according to the latest data source, and the preset operations include at least one of the following: adding an operation, modifying an operation, and deleting an operation.
[0115] Optionally, in this embodiment, the computer-readable storage medium is configured to store program codes for executing the following steps: a json interface configuration file exported by Postman, a Swagger interface document, a jt l file exported by JMeter, a customized word file, and a customized excel interface document.
[0116] The serial numbers of the above embodiments of the present invention are only for description and do not represent the advantages or disadvantages of the embodiments.
[0117] In the above embodiments of the present invention, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, reference can be made to the relevant descriptions of other embodiments.
[0118] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units can be a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.
[0119] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple units. Some or all of the units may be selected according to actual needs to achieve the purpose of the present embodiment.
[0120] In addition, each functional unit in each embodiment of the present invention may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0121] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, magnetic disk or optical disk and other media that can store program codes.
[0122] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principle of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A method for generating a test baffle, characterized in that: include: receiving data source information, wherein the data source information at least includes a type of the data source; Determine tag information of each of the data sources according to the data source information, wherein the tag information is used to uniquely identify the data source; According to the tag information of the data source, a parser is used to parse the corresponding data source to obtain an initial keyword of the data source, and the parser corresponds to the type of the data source one by one; The initial keyword is verified to obtain a verified keyword, and the verified keyword is encapsulated to obtain a test baffle corresponding to the data source, wherein the test baffle is a virtual object in the test process.
2. The method according to claim 1, characterized in that According to the tag information of the data source, a parser is used to parse the corresponding data source to obtain an initial keyword of the data source, including: Acquire a first mapping relationship, where the first mapping relationship represents a mapping relationship between a type of data source and a parser; Determining a first target parser for parsing the target data source according to type information in the tag information of the target data source and the first mapping relationship; Determine the data structure of the target data source according to the tag information of the target data source, and determine the extraction rule of the target data source according to the data structure of the target data source; The target data source is parsed according to the extraction rule of the target data source and using the first target parser to obtain at least one of the initial keywords of the target data source.
3. The method according to claim 1, characterized in that The data source is a Postman configuration file, and the Postman configuration file is a data source in which data information is stored in a json file in the form of a key-value pair. A parser is used to parse the corresponding data source according to the tag information of the data source to obtain the initial keyword of the data source, including: Using a second target parser corresponding to the Postman configuration file, traverse each of the key-value pairs in the json file in turn, and verify the key-value pairs to obtain a verification result; Determine whether the key-value pair is key information of the data source according to the verification result; In the case where the key-value pair is the key information, extracting and saving the key-value pair as an initial keyword of the data source; In the case where the key-value pair is non-critical information, confirm whether the key-value pair in the json file is completely verified, and if the key-value pair in the json file is not completely verified, continue to verify the next key-value pair.
4. The method according to claim 1, characterized in that: Verifying the initial keyword to obtain a verified keyword includes: Traversing each of the initial keywords in the keyword information list in turn, and determining whether the target keyword is a required item; In the case where the target keyword is a required item and is empty, determining that the target keyword verification fails, and recording verification failure information; in the case where the target keyword is a required item and is not empty, determining whether the format of the target keyword meets the correctness verification rules, and the required item is information required to generate the test baffle; If the format of the target keyword does not satisfy the correctness verification rule, determine that the target keyword verification fails and record verification failure information; if the format of the target keyword satisfies the correctness verification rule, determine whether there is a historical keyword that is the same as the target keyword; In the case that the historical keyword exists, the historical keyword is updated to the target keyword to obtain the verified keyword.
5. The method according to claim 1, characterized in that The verified keyword is packaged to obtain a test baffle corresponding to the data source, including: Determine the type of the baffle tool and the corresponding wrapper according to the type of the data source; determining a storage structure of the baffle tool according to the type of the baffle tool; The verified keyword is encapsulated according to the storage structure of the baffle tool and using the corresponding encapsulator to obtain the test baffle corresponding to the data source.
6. The method according to any one of claims 1 to 5, characterized in that After encapsulating the verified keyword to obtain a test baffle corresponding to the data source, the method further includes: Set the update time period; Obtain the latest data source regularly according to the update time period; The test baffle is subjected to a preset operation according to the latest data source, wherein the preset operation includes at least one of the following: a adding operation, a modifying operation, and a deleting operation.
7. The method according to any one of claims 1 to 5, characterized in that The type of the data source includes at least one of the following: a json interface configuration file exported by Postman, a Swagger interface document, a jtl file exported by JMeter, a custom word file, or a custom excel interface document.
8. A device for generating a test baffle, characterized in that: include: A receiving unit, configured to receive data source information, wherein the data source information at least includes a type of data source; A first determining unit, configured to determine tag information of each of the data sources according to the data source information, wherein the tag information is used to uniquely identify the data source; A first processing unit, configured to parse the corresponding data source using a parser according to the tag information of the data source to obtain an initial keyword of the data source, wherein the parser corresponds to the type of the data source in a one-to-one manner; The second processing unit is used to verify the initial keyword to obtain a verified keyword, and to encapsulate the verified keyword to obtain a test baffle corresponding to the data source, wherein the test baffle is a virtual object in the test process.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium includes a stored program, wherein when the program is executed, the device where the computer-readable storage medium is located is controlled to execute the method for generating a test baffle according to any one of claims 1 to 7.
10. An electronic device, characterized in that: include: One or more processors, a memory, and one or more programs, wherein the one or more programs are stored in the memory and are configured to be executed by the one or more processors, and the one or more programs include a method for executing the test baffle generation method described in any one of claims 1 to 7.
