Test material generation method and device, electronic equipment and computer readable medium

By receiving and replacing the input parameters of the target interface and calling the material generation tool, the problem of poor scalability and high cost of the test material generation process in the existing technology is solved, and the ability to build tools without coding and quickly generate different types of test materials is realized. .

CN118626082APending Publication Date: 2024-09-10BEIJING WODONG TIANJUN INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410814445.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-21
Publication Date
2024-09-10

AI Technical Summary

Technical Problem

The test material generation process in the existing technology has poor scalability, high development costs and high maintenance costs, and requires a separate system development for each type of test material, resulting in cumbersome and high costs.

Method used

By receiving the variable values ​​of the target template and target interface input parameters submitted by the user, replacing the variable definitions, calling the interface defined by the material generation tool, obtaining the test materials, and building the material generation tool through configuration, avoiding coding operations.

Benefits of technology

It realizes the construction of test material generation tools without coding, reduces costs, improves scalability, can quickly generate different types of test materials, and reduces development and maintenance work.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118626082A
    Figure CN118626082A
Patent Text Reader

Abstract

The invention discloses a test material generation method and device, electronic equipment and a computer readable medium, and relates to the technical field of software testing. The method comprises the following steps: receiving a target template submitted by a user and variable values corresponding to target interface input parameters defined by the target template; replacing the variable definition corresponding to each target interface input parameter with the variable value corresponding to each target interface input parameter so as to obtain a tool input parameter; according to the tool input parameter, calling each target interface defined by a material generation tool in sequence so as to obtain an output parameter of each target interface; and according to a pre-configured material interface and a material field, obtaining a test material from the output parameter of each target interface. According to the embodiment, the technical problems of poor expandability, high development cost or high maintenance cost can be solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of software testing technology, and in particular to a method, device, electronic device and computer-readable medium for generating test materials. Background Art

[0002] The preparation of test materials has always been an important part of software testing. For systems with long links, test materials involve multiple systems and related personnel on the link, which makes the generation of test materials very complicated and requires high communication and time costs.

[0003] Currently, there are generally two ways to generate test materials:

[0004] Insert data into the database to generate test materials, or manually execute the business interface to generate test materials, but this method has poor repeatability, is prone to errors, and has high communication costs.

[0005] The system developers developed a test material generation system for their own system. The front end has a friendly user interface, and the back end executes the business interface to insert data, which can easily generate test materials. However, this method has the following shortcomings: (1) The system is developed separately for one or several test materials, and each test material must be developed individually. The system can only generate one or several test materials. If you want to generate other types of test materials, you need to continue to develop the system, which has poor scalability; (2) System development has certain time costs, maintenance costs and technical barriers. Summary of the invention

[0006] In view of this, embodiments of the present invention provide a method, device, electronic device and computer-readable medium for generating a test material to solve the technical problems of poor scalability, high development cost or high maintenance cost.

[0007] To achieve the above object, according to one aspect of an embodiment of the present invention, a method for generating a test material is provided, comprising:

[0008] Receive the target template submitted by the user and the variable values ​​corresponding to each target interface input parameter defined by the target template;

[0009] Replacing the variable definitions corresponding to the input parameters of each target interface with the variable values ​​corresponding to the input parameters of each target interface respectively, thereby obtaining the tool input parameters;

[0010] Calling each target interface defined by the material generation tool in sequence according to the tool input parameters, thereby obtaining output parameters of each target interface;

[0011] According to the pre-configured material interface and material field, the test material is obtained from the output parameters of each target interface.

[0012] Optionally, before receiving the target template submitted by the user and the variable values ​​corresponding to each target interface input parameter defined by the target template, the method further includes:

[0013] Register each interface;

[0014] Configure each template, wherein the template defines at least one interface input parameter, and the interface input parameter defines a variable;

[0015] Configure the variable attributes of each interface input parameter in each template, wherein the variable attributes include at least one of the following: variable name, variable definition, template, component type, data restriction, data format, and whether it is a default value.

[0016] Optionally, after configuring the variable attributes of each interface input parameter in each template, the method further includes:

[0017] According to each registered interface, at least one target interface and the calling sequence of each target interface are defined, so as to obtain a material generation tool;

[0018] Configure a material interface and a material field, wherein the material interface is selected from any one of the at least one target interface, and the material field is selected from an output parameter of the material interface;

[0019] The component attributes of each interface input parameter in each template are configured, and the component attributes include at least one of the following: length, width, and position.

[0020] Optionally, if the target interface is not the first interface called, the method further includes:

[0021] Configure the component properties of each interface input parameter in the template corresponding to the target interface; wherein the interface input parameter defines an upstream interface and a source field, the source field is selected from the output parameter of the upstream interface, and / or the interface input parameter defines a variable.

[0022] Optionally, after configuring the variable attributes of each interface input parameter in each template, the method further includes:

[0023] Configure assertions for each interface, which define the assertion fields, comparison methods, and expected values.

[0024] Optionally, the method further comprises:

[0025] Whenever a target interface is called, a check is performed based on the output parameters of the target interface and the assertion of the template interface. If the check passes, the next target interface is called. If the check fails, the call stops.

[0026] Optionally, after obtaining the test material from the output parameters of each target interface according to the preconfigured material interface and material field, the method further includes:

[0027] The test material is stored in a database for query.

[0028] In addition, according to another aspect of an embodiment of the present invention, there is provided a device for generating a test material, comprising:

[0029] A receiving module, used to receive a target template submitted by a user and variable values ​​corresponding to each target interface input parameter defined by the target template;

[0030] A replacement module, used to replace the variable definitions corresponding to the input parameters of each target interface with the variable values ​​corresponding to the input parameters of each target interface, so as to obtain the tool input parameters;

[0031] A calling module is used to call each target interface defined by the material generation tool in sequence according to the tool input parameters, so as to obtain the output parameters of each target interface;

[0032] The acquisition module is used to acquire the test material from the output parameters of each target interface according to the pre-configured material interface and material field.

[0033] Optionally, the device further comprises a configuration module, configured to:

[0034] Register each interface;

[0035] Configure each template, wherein the template defines at least one interface input parameter, and the interface input parameter defines a variable;

[0036] Configure the variable attributes of each interface input parameter in each template, wherein the variable attributes include at least one of the following: variable name, variable definition, template, component type, data restriction, data format, and whether it is a default value.

[0037] Optionally, the configuration module is further used to:

[0038] According to each registered interface, at least one target interface and the calling sequence of each target interface are defined, so as to obtain a material generation tool;

[0039] Configure a material interface and a material field, wherein the material interface is selected from any one of the at least one target interface, and the material field is selected from an output parameter of the material interface;

[0040] The component attributes of each interface input parameter in each template are configured, and the component attributes include at least one of the following: length, width, and position.

[0041] Optionally, if the target interface is not the first called interface, the configuration module is further used to:

[0042] Configure the component properties of each interface input parameter in the template corresponding to the target interface; wherein the interface input parameter defines an upstream interface and a source field, the source field is selected from the output parameter of the upstream interface, and / or the interface input parameter defines a variable.

[0043] Optionally, the configuration module is further used to:

[0044] Configure assertions for each interface, which define the assertion fields, comparison methods, and expected values.

[0045] Optionally, the calling module is further used for:

[0046] Whenever a target interface is called, a check is performed based on the output parameters of the target interface and the assertion of the template interface. If the check passes, the next target interface is called. If the check fails, the call stops.

[0047] Optionally, the acquisition module is further used to:

[0048] The test material is stored in a database for query.

[0049] According to another aspect of an embodiment of the present invention, there is further provided an electronic device, including:

[0050] one or more processors;

[0051] a storage device for storing one or more programs,

[0052] When the one or more programs are executed by the one or more processors, the one or more processors implement the method described in any one of the above embodiments.

[0053] According to another aspect of an embodiment of the present invention, a computer-readable medium is provided, on which a computer program is stored. When the program is executed by a processor, the method described in any one of the above embodiments is implemented.

[0054] According to another aspect of an embodiment of the present invention, a computer program product is provided, including a computer program, and when the computer program is executed by a processor, the method described in any one of the above embodiments is implemented.

[0055] An embodiment of the above invention has the following advantages or beneficial effects: because the target template submitted by the user and the variable values ​​corresponding to the input parameters of each target interface defined by the target template are first received, and the variable definitions corresponding to the input parameters of each target interface are replaced with the variable values ​​corresponding to the input parameters of each target interface, thereby obtaining the tool input parameters, and then calling the target interfaces defined by the material generation tool in sequence according to the tool input parameters, thereby obtaining the output parameters of each target interface, and finally obtaining the technical means of the test material from the output parameters of each target interface according to the pre-configured material interface and material field, so as to overcome the technical problems of poor scalability, high development cost or high maintenance cost in the prior art. The embodiment of the present invention builds the material generation tool in a configured manner, does not require code writing, and has low construction cost. If a new type of test material is to be generated, it only needs to make relevant configurations in the system to build a new material generation tool, does not require development work, and has strong scalability.

[0056] The further effects of the above-mentioned non-conventional optional manner will be described below in conjunction with the specific implementation manner. BRIEF DESCRIPTION OF THE DRAWINGS

[0057] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the prior art descriptions. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work. Among them:

[0058] Figure 1 is a flow chart of a method for generating a test material according to an embodiment of the present invention;

[0059] Figure 2 is a flow chart of a method for generating a test material according to a reference embodiment of the present invention;

[0060] Figure 3 is a flow chart of a method for generating a test material according to another reference embodiment of the present invention;

[0061] Figure 4 is a flow chart of a method for generating a test material according to yet another reference embodiment of the present invention;

[0062] Figure 5 is a schematic diagram of a test material generating device according to an embodiment of the present invention;

[0063] Figure 6 is an exemplary system architecture diagram to which embodiments of the present invention may be applied;

[0064] Figure 7It is a schematic diagram of the structure of a computer system of a terminal device or a server suitable for implementing an embodiment of the present invention. DETAILED DESCRIPTION

[0065] The following is a description of exemplary embodiments of the present invention in conjunction with the accompanying drawings, including various details of the embodiments of the present invention to facilitate understanding, which should be considered as merely exemplary. Therefore, it should be recognized by those of ordinary skill in the art that various changes and modifications may be made to the embodiments described herein without departing from the scope and spirit of the present invention. Similarly, for clarity and conciseness, the description of well-known functions and structures is omitted in the following description.

[0066] It should be noted that the collection, collection, updating, analysis, processing, use, transmission, storage and other aspects of user personal information involved in the technical solution of this disclosure are in compliance with the provisions of relevant laws and regulations, are used for legitimate purposes, and do not violate public order and good morals. Necessary measures are taken for user personal information to prevent illegal access to user personal information data and maintain the security of user personal information, network security and national security.

[0067] Figure 1 is a flow chart of a method for generating a test material according to an embodiment of the present invention. As an embodiment of the present invention, Figure 1 As shown, the method for generating the test material may include:

[0068] Step 101: Receive a target template submitted by a user and variable values ​​corresponding to each target interface input parameter defined in the target template.

[0069] The user can select a target template on the client page and can also enter the variable values ​​corresponding to the input parameters of each target interface defined by the target template on the client page. When the user clicks the Submit button on the client page, the test material generation system receives the target template submitted by the user and the variable values ​​corresponding to the input parameters of each target interface defined by the target template.

[0070] Optionally, before step 101, the method further includes: registering each interface; configuring each template, wherein the template defines at least one interface input parameter, and the interface input parameter defines a variable; configuring variable properties of each interface input parameter in each template, wherein the variable properties include at least one of the following: variable name, variable definition, template to which it belongs, component type, data restriction, data format, and default value.

[0071] Test materials are always generated through interface calls (one or more interface calls), so all interfaces required for generating test materials are first registered in the test material generation system, such as HTTP requests, RPC requests, requests for reading and writing databases, middleware (MQ) requests, requests for reading and writing caches, etc. For example, generating a certain test material requires executing an HTTP request and a database insertion operation, so the interface information of the HTTP request and the interface information of the database operation need to be registered in the system. It should be noted that the embodiments of the present invention refer to HTTP requests, RPC requests, requests for reading and writing databases, MQ requests, and requests for reading and writing caches as interface calls.

[0072] In the embodiments of the present invention, test materials refer to data required for testing software, such as products, promotions, orders, etc., which are all test materials. For example, if you need to test a promotion, you need to create the promotion and the products applicable to the promotion in the system. In this scenario, the products and promotions are test materials.

[0073] After completing the registration of each interface, configure each template. Each template defines at least one interface input parameter, and each interface input parameter defines a variable. Therefore, the template is equivalent to the input parameter of the interface, and the template corresponds to the type of test material. For example, for an interface for creating a promotion, different types of promotions can be created. There may be different promotion rules such as step-by-step discounts, discount of N pieces for M pieces, and percentage discounts. Although the same interface is used to create promotions (that is, test materials), the interface input parameters corresponding to different types of promotions are quite different. Therefore, a template can be created for each type of promotion, and the content of the template is the interface input parameter. The advantage of using a template is that when creating a material generation tool, you only need to select the target template to automatically fill in the interface input parameters defined by the target template, without the need for users to fill them in manually.

[0074] After completing the configuration of each template, continue to configure the variable attributes of each interface input parameter in each template. When creating a material generation tool, even the same material type may require different interface input parameters. For example, if there is a promotion rule, if there is a template that allows N pieces to be subtracted when M pieces are purchased, M and N here are variables, and the promotion start time and end time are also variables. For example, a template defines interface input parameters such as ${deliverNum}, ${needNum}, ${startTime}, and ${endTime}. When using the material generation tool, these interface input parameters are variables, and the user needs to enter the actual variable values.

[0075] In an embodiment of the present invention, the interface input parameters are mainly configured to display the variable name on the client page, variable definition (such as ${deliverNum}, ${needNum}, ${startTime}, ${endTime}, etc.), the corresponding template, the component type displayed on the client page (text input box, numeric input box, drop-down box, check box, radio button, date selector, time selector, etc.), data restrictions (maximum value, minimum value, candidate value, etc.), data format (timestamp, date and time format, etc.), whether it is the default value, etc.

[0076] Optionally, after configuring the variable attributes of the input parameters of each interface in each template, the method further includes: defining at least one target interface and the calling order of each target interface according to each registered interface, so as to obtain a material generation tool; configuring the material interface and material field, the material interface is selected from any one of the at least one target interface, and the material field is selected from the output parameter of the material interface; configuring the component attributes of the input parameters of each interface in each template, and the component attributes include at least one of the following: length, width, and position. When it is necessary to create a material generation tool, select one or more required interfaces to form a material generation tool, and then configure the material generation tool, such as configuring the material interface and material field, that is, which field of which interface the test material is obtained from, which is used to obtain the test material from the output parameter of the material interface when using the material generation tool, and the configuration method is interface and JsonPath, such as ${create promotion, $.tid}, indicating that the $.tid field in the output parameter of the create promotion interface is the test material. Then, further configure the component attributes of the input parameters of each interface defined in each template. The interface input defines variables, and each variable is displayed through a page component. After selecting the interface, you also need to configure the page component of the interface input. You can configure the component style (length, width, etc.), field description, default value, etc. You can also drag the component to change its placement.

[0077] For each test material, users can create a material generation tool in this way. The whole process is configured, no code is required, and the configuration cost is low. After the tool configuration is completed, users can use the tool to generate test materials. The interface displayed to the user mainly consists of three parts: template selection, variable input, and submission. Users must first select the target template. The template to be selected depends on the type of test material the user wants to generate. For example, if you want to generate a promotion activity of full M minus N, you need to select the full M minus N template; after selecting the template, you need to enter the variable values ​​used by the target template. For example, the full M minus N template has 4 variables, and there are two value input boxes (full items and reduced items) and two time selectors (promotion start time and promotion end time) on the page. Since the default value is configured for the promotion start time, the default time will be automatically displayed.

[0078] Step 102: Replace the variable definitions corresponding to the target interface input parameters with the variable values ​​corresponding to the target interface input parameters, thereby obtaining tool input parameters.

[0079] After receiving the target template submitted by the user and the variable values ​​corresponding to each target interface input parameter defined by the target template, the test material generation system replaces the variable definitions corresponding to each target interface input parameter with the variable values ​​corresponding to each target interface input parameter, thereby obtaining the tool input parameter.

[0080] After the user selects the target template and enters the variable value, clicks the Execute button, and all interfaces defined by the material generation tool will be executed. Before execution, the variable definition in the template must be replaced with the input variable value.

[0081] Step 103, calling each target interface defined by the material generation tool in sequence according to the tool input parameters, so as to obtain the output parameters of each target interface.

[0082] Since one or more interfaces have been selected to form the material generation tool, each interface defined by the material generation tool can be called in sequence to obtain the output parameters of each target interface.

[0083] Step 104: According to the pre-configured material interface and material field, the test material is obtained from the output parameters of each target interface.

[0084] After all interfaces are executed, the generated test materials are obtained according to the configured material interface and material field. For example, if the configured material interface and material field are ${create promotion, $.tid}, the test materials are extracted from the $.tid field in the output parameter of the create promotion interface and stored in the database. The generated test materials are available for query after being stored in the warehouse. Users do not need to regenerate test materials and can use them directly.

[0085] According to the various embodiments described above, it can be seen that the embodiment of the present invention first receives the target template submitted by the user and the variable values ​​corresponding to the input parameters of each target interface defined by the target template, and replaces the variable definitions corresponding to the input parameters of each target interface with the variable values ​​corresponding to the input parameters of each target interface, thereby obtaining the tool input parameters, and then sequentially calls the various target interfaces defined by the material generation tool according to the tool input parameters, thereby obtaining the output parameters of each target interface, and finally obtains the technical means of test materials from the output parameters of each target interface according to the pre-configured material interface and material field, which solves the technical problems of poor scalability, high development cost or high maintenance cost in the prior art. The embodiment of the present invention builds the material generation tool in a configured manner, does not require code writing, and has low construction cost. If a new type of test material is to be generated, it only needs to make relevant configurations in the system to build a new material generation tool, does not require development work, and has strong scalability.

[0086] Figure 2 is a flow chart of a method for generating a test material according to a reference embodiment of the present invention. As another embodiment of the present invention, Figure 2 As shown, the method for generating the test material may include:

[0087] Step 201, register each interface.

[0088] First, register all interfaces required to generate test materials into the test material generation system, such as HTTP requests, RPC requests, requests to read and write databases, middleware (MQ) requests, requests to read and write caches, etc.

[0089] For HTTP requests, you need to provide interface information such as interface name, interface type, interface address (URL), IP, port, etc. when registering the interface. For RPC requests, you need to provide interface information such as interface name, interface type, interface address, method name, calling method, access method, IP, port, etc. when registering the interface. For requests to read and write databases, you need to provide interface information such as interface name, interface type, database address, user name, password, etc. when registering the interface. For MQ requests, you need to provide interface information such as interface name, interface type, message address, topic, producer application name, token, etc. when registering the interface. For requests to read and write caches, you need to provide interface information such as interface name, interface type, cache address, etc. when registering the interface.

[0090] Step 202, configuring each template, wherein the template defines at least one interface input parameter, and the interface input parameter defines a variable.

[0091] After completing the registration of each interface, different templates can be configured for each interface according to the material type, and the interface input parameters can be defined in the template. The interface input parameters defined by the template include variables, so the template is equivalent to the interface input parameters, and the template corresponds to the type of test material.

[0092] Step 203: configure the variable attributes of each interface input parameter in each template.

[0093] After completing the configuration of each template, continue to configure the variable attributes of each interface input parameter in each template. The variable attributes include at least one of the following: variable name, variable definition, template, component type, data restriction, data format, and whether it is a default value.

[0094] Step 204, based on each registered interface, define at least one target interface and the calling sequence of each target interface, so as to obtain a material generation tool.

[0095] When you need to create a material generation tool, select one or more target interfaces to form a material generation tool, and define the calling order of each target interface.

[0096] Step 205, configuring a material interface and a material field, wherein the material interface is selected from any one of the at least one target interface, and the material field is selected from an output parameter of the material interface.

[0097] After the material generation tool is created, the tool is further configured, that is, steps 205 and 206 are executed.

[0098] In step 205, the material interface and material field are configured, that is, the test material is obtained from which field of which interface, which is used to obtain the test material from the output parameter of the material interface when using the material generation tool. The configuration method is interface and JsonPath, such as ${create promotion, $.tid}, which means that the $.tid field in the output parameter of the create promotion interface is the test material.

[0099] If the target interface is not the first interface called, the method further includes: configuring the component properties of each interface input parameter in the template corresponding to the target interface; wherein the interface input parameter defines the upstream interface and the source field, the source field is selected from the output parameter of the upstream interface, and / or the interface input parameter defines a variable. Assume that there are two interfaces, create promotion and product promotion, whose functions are to create a promotion and add a product to the promotion. The response of the create promotion interface contains a tid field, which is the id of the promotion. The product promotion interface needs to use this field as an input parameter, so the template configuration of the product promotion can be configured as follows:

[0100] {

[0101] "skuId":"${skuId}",

[0102] "tid":"${create promotion,$.tid}"

[0103] }

[0104] Among them, ${create promotion, $.tid} represents the tid field of the output parameter of the create promotion interface.

[0105] Step 206: configure component attributes of each interface input parameter in each template, wherein the component attributes include at least one of the following: length, width, and position.

[0106] Further configure the component properties of each interface input parameter defined in each template. The interface input parameter defines the variable, and each variable is displayed through a page component. After selecting the interface, you also need to configure the page component of the interface input parameter. You can configure the component style (length, width, etc.), field description, default value, etc. You can also drag the component to change the component placement. The interface variables correspond to the page components. Configure the properties of the page components to achieve the desired page display effect and improve the user experience of using the material generation tool.

[0107] For each test material, the user can create a material generation tool through steps 204 to 206. The entire process is configured, no code needs to be written, and the configuration cost is low.

[0108] Step 207: Receive the target template submitted by the user and the variable values ​​corresponding to each target interface input parameter defined by the target template.

[0109] After the material generation tool is configured, users can use the tool to generate test materials. The interface displayed to users mainly consists of three parts: template selection, variable input, and submission.

[0110] The user must first select the target template. The template selected depends on the type of test material the user wants to generate. For example, if you want to generate a promotion of buying M or more and getting N less, you need to select the template. After selecting the template, you need to enter the variable values ​​used by the target template. For example, the template has 4 variables. There are two value input boxes (full items and reduced items) and two time selectors (promotion start time and promotion end time) on the page. Since the default value is configured for the promotion start time, the default time will be automatically displayed.

[0111] Step 208: Replace the variable definitions corresponding to the target interface input parameters with the variable values ​​corresponding to the target interface input parameters, thereby obtaining tool input parameters.

[0112] After the user selects the target template and enters the variable value, clicks the Execute button, and all interfaces defined by the material generation tool will be executed. Before execution, the variable definition in the template must be replaced with the input variable value.

[0113] Step 209, calling each target interface defined by the material generation tool in sequence according to the tool input parameters, so as to obtain the output parameters of each target interface.

[0114] Since one or more interfaces have been selected to form the material generation tool, each interface defined by the material generation tool can be called in sequence to obtain the output parameters of each target interface.

[0115] Step 210: Acquire test materials from the output parameters of each target interface according to the pre-configured material interface and material field.

[0116] After all interfaces are executed, the generated test materials are obtained according to the configured material interfaces and material fields.

[0117] Steps 201 to 203 are for interface management, steps 204 to 206 are for tool building, and steps 207 to 210 are for material generation.

[0118] The embodiment of the present invention generates test materials in a configurable manner. All material generation tools are configurable and do not require writing any code. Moreover, most test materials can be generated by configuring corresponding tools in this system. There is no need to develop a separate material generation system for each test material. In addition, templates make it more convenient to create different types of materials, and variables bring flexibility.

[0119] In addition, the specific implementation content of the method for generating a test material in a reference embodiment of the present invention has been described in detail in the method for generating a test material described above, so the repeated content will not be described again here.

[0120] Figure 3 FIG. 1 is a flow chart of a method for generating a test material according to another reference embodiment of the present invention. As another embodiment of the present invention, Figure 3 As shown, the method for generating the test material may include:

[0121] Step 301, register each interface.

[0122] Step 302: configure each template, wherein the template defines at least one interface input parameter, and the interface input parameter defines a variable.

[0123] Step 303: configure the variable attributes of each interface input parameter in each template, wherein the variable attributes include at least one of the following: variable name, variable definition, template, component type, data restriction, data format, and whether it is a default value.

[0124] Step 304: configure assertions for each interface, wherein the assertions define assertion fields, comparison methods, and expected values.

[0125] Assertions are checks on interface responses and are optional configuration items. If a tool involves multiple interfaces, when the response of one of the interfaces does not meet expectations, the entire process can be terminated and subsequent interfaces will no longer be executed. This requires configuring assertions on the interfaces.

[0126] An assertion consists of three items: assertion field (which can be configured through JsonPath), comparison method (contains, does not contain, is contained, equal to, not equal to, greater than, greater than or equal to, less than, less than or equal to, array length, empty, not empty, etc.), and expected value.

[0127] Step 305: Define at least one target interface and the calling sequence of each target interface according to each registered interface, so as to obtain a material generation tool.

[0128] Step 306, configuring a material interface and a material field, wherein the material interface is selected from any one of the at least one target interface, and the material field is selected from an output parameter of the material interface.

[0129] Step 307: configure component attributes of each interface input parameter in each template, wherein the component attributes include at least one of the following: length, width, and position.

[0130] Step 308: Receive the target template submitted by the user and the variable values ​​corresponding to each target interface input parameter defined by the target template.

[0131] Step 309: Replace the variable definitions corresponding to the target interface input parameters with the variable values ​​corresponding to the target interface input parameters, thereby obtaining tool input parameters.

[0132] Step 310, calling each target interface defined by the material generation tool in sequence according to the tool input parameters, so as to obtain the output parameters of each target interface.

[0133] Optionally, the method further comprises: each time a target interface is called, a verification is performed based on the output parameters of the target interface and the assertion of the template interface, if the verification passes, the next target interface is called, if the verification fails, the call is stopped. After an interface is executed, if the interface is configured with an assertion, the system will check the assertion, if the assertion fails, the subsequent interface will not be executed.

[0134] Step 311, according to the pre-configured material interface and material field, obtain the test material from the output parameters of each target interface.

[0135] Step 312, storing the test material in a database for query.

[0136] like Figure 4 As shown, steps 301 to 304 are for interface management, including interface registration, template configuration, parameter configuration, and assertion configuration; steps 305 to 307 are for tool building, including interface selection, page layout, and material configuration; steps 308 to 312 are for material generation, including template selection and variable value input, interface execution, and material warehousing.

[0137] The embodiment of the present invention generates test materials in a configurable manner. All material generation tools are configurable and do not require writing any code. Moreover, most test materials can be generated by configuring corresponding tools in this system. There is no need to develop a separate material generation system for each test material. In addition, templates make it more convenient to create different types of materials, and variables bring flexibility.

[0138] In addition, the specific implementation content of the method for generating the test material in another reference embodiment of the present invention has been described in detail in the method for generating the test material described above, so the repeated content will not be described again here.

[0139] Figure 5 Schematic diagram of a device for generating test materials according to an embodiment of the present invention. Figure 5 As shown, the test material generation device 500 includes a receiving module 501, a replacement module 502, a calling module 503 and an acquisition module 504; wherein the receiving module 501 is used to receive the target template submitted by the user and the variable values ​​corresponding to the input parameters of each target interface defined by the target template; the replacement module 502 is used to replace the variable definitions corresponding to the input parameters of each target interface with the variable values ​​corresponding to the input parameters of each target interface, thereby obtaining the tool input parameters; the calling module 503 is used to call the various target interfaces defined by the material generation tool in sequence according to the tool input parameters, thereby obtaining the output parameters of each target interface; the acquisition module 504 is used to obtain the test material from the output parameters of each target interface according to the pre-configured material interface and material field.

[0140] Optionally, the device further comprises a configuration module, configured to:

[0141] Register each interface;

[0142] Configure each template, wherein the template defines at least one interface input parameter, and the interface input parameter defines a variable;

[0143] Configure the variable attributes of each interface input parameter in each template, wherein the variable attributes include at least one of the following: variable name, variable definition, template, component type, data restriction, data format, and whether it is a default value.

[0144] Optionally, the configuration module is further used to:

[0145] According to each registered interface, at least one target interface and the calling sequence of each target interface are defined, so as to obtain a material generation tool;

[0146] Configure a material interface and a material field, wherein the material interface is selected from any one of the at least one target interface, and the material field is selected from an output parameter of the material interface;

[0147] The component attributes of each interface input parameter in each template are configured, and the component attributes include at least one of the following: length, width, and position.

[0148] Optionally, if the target interface is not the first called interface, the configuration module is further used to:

[0149] Configure the component properties of each interface input parameter in the template corresponding to the target interface; wherein the interface input parameter defines an upstream interface and a source field, the source field is selected from the output parameter of the upstream interface, and / or the interface input parameter defines a variable.

[0150] Optionally, the configuration module is further used to:

[0151] Configure assertions for each interface, which define the assertion fields, comparison methods, and expected values.

[0152] Optionally, the calling module 503 is further used to:

[0153] Whenever a target interface is called, a check is performed based on the output parameters of the target interface and the assertion of the template interface. If the check passes, the next target interface is called. If the check fails, the call stops.

[0154] Optionally, the acquisition module 504 is further used for:

[0155] The test material is stored in a database for query.

[0156] It should be noted that the specific implementation content of the test material generating device of the present invention has been described in detail in the test material generating method described above, so the repeated content will not be described again here.

[0157] Figure 6An exemplary system architecture 600 is shown to which the method for generating test material or the apparatus for generating test material according to the embodiment of the present invention can be applied.

[0158] like Figure 6 As shown, system architecture 600 may include terminal devices 601, 602, 603, network 604 and server 605. Network 604 is used to provide a medium for communication links between terminal devices 601, 602, 603 and server 605. Network 604 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc.

[0159] Users can use terminal devices 601, 602, and 603 to interact with server 605 through network 604 to receive or send messages, etc. Various communication client applications can be installed on terminal devices 601, 602, and 603, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, etc. (only examples).

[0160] The terminal devices 601 , 602 , and 603 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop computers, and desktop computers, etc.

[0161] The server 605 may be a server that provides various services, such as a backend management server (for example only) that provides support for shopping websites browsed by users using the terminal devices 601, 602, and 603. The backend management server may analyze and process the received data such as the item information query request, and feed back the processing results to the terminal device.

[0162] It should be noted that the test material generation method provided in the embodiment of the present invention is generally executed by the server 605 , and accordingly, the test material generation device is generally set in the server 605 .

[0163] It should be understood that Figure 6 The number of terminal devices, networks and servers in the embodiment is only for illustration. Any number of terminal devices, networks and servers may be provided according to implementation requirements.

[0164] Reference below Figure 7 , which shows a schematic diagram of the structure of a computer system 700 of a terminal device suitable for implementing an embodiment of the present invention. Figure 7 The terminal device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention.

[0165] like Figure 7As shown, the computer system 700 includes a central processing unit (CPU) 701, which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) 702 or a program loaded from a storage part 708 into a random access memory (RAM) 703. In the RAM 703, various programs and data required for the operation of the system 700 are also stored. The CPU 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input / output (I / O) interface 705 is also connected to the bus 704.

[0166] The following components are connected to the I / O interface 705: an input section 706 including a keyboard, a mouse, etc.; an output section 707 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 708 including a hard disk, etc.; and a communication section 709 including a network interface card such as a LAN card, a modem, etc. The communication section 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to the I / O interface 705 as needed. A removable medium 711, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 710 as needed, so that a computer program read therefrom is installed into the storage section 708 as needed.

[0167] In particular, according to the embodiments disclosed in the present invention, the process described above with reference to the flowchart can be implemented as a computer software program. For example, the embodiments disclosed in the present invention include a computer program, which includes a computer program carried on a computer-readable medium, and the computer program includes a program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from the network through the communication part 709, and / or installed from the removable medium 711. When the computer program is executed by the central processing unit (CPU) 701, the above-mentioned functions defined in the system of the present invention are executed.

[0168] It should be noted that the computer-readable medium shown in the present invention may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present invention, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present invention, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, which carries a computer-readable program code. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.

[0169] The flow chart and block diagram in the accompanying drawings illustrate the possible architecture, functions and operations of the system, method and computer program according to various embodiments of the present invention. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some alternative implementations, the functions marked in the box can also occur in a different order from the order marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.

[0170] The modules involved in the embodiments of the present invention may be implemented by software or hardware. The modules described may also be set in a processor, for example, it may be described as follows: a processor includes a receiving module, a replacing module, a calling module and an acquiring module, wherein the names of these modules do not constitute limitations on the modules themselves in some cases.

[0171] As another aspect, the present invention also provides a computer-readable medium, which may be included in the device described in the above embodiment; or it may exist independently without being assembled into the device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by a device, the device implements the following method: receiving a target template submitted by a user and variable values ​​corresponding to each target interface input parameter defined by the target template; replacing the variable definitions corresponding to each target interface input parameter with the variable values ​​corresponding to each target interface input parameter, thereby obtaining tool input parameters; calling each target interface defined by the material generation tool in sequence according to the tool input parameters, thereby obtaining output parameters of each target interface; obtaining test materials from the output parameters of each target interface according to the pre-configured material interface and material field.

[0172] As another aspect, an embodiment of the present invention further provides a computer program product, including a computer program, and when the computer program is executed by a processor, the method described in any of the above embodiments is implemented.

[0173] According to the technical solution of the embodiment of the present invention, because the target template submitted by the user and the variable values ​​corresponding to the input parameters of each target interface defined by the target template are first received, and the variable definitions corresponding to the input parameters of each target interface are replaced with the variable values ​​corresponding to the input parameters of each target interface, thereby obtaining the tool input parameters, and then calling the various target interfaces defined by the material generation tool in sequence according to the tool input parameters, thereby obtaining the output parameters of each target interface, and finally obtaining the technical means of the test material from the output parameters of each target interface according to the pre-configured material interface and material field, the technical problems of poor scalability, high development cost or high maintenance cost in the prior art are overcome. The embodiment of the present invention builds the material generation tool in a configured manner, does not require code writing, and has low construction cost. If a new type of test material is to be generated, only relevant configurations need to be made in the system to build a new material generation tool, and no development work is required, and the scalability is strong.

[0174] The above specific implementations do not constitute a limitation on the protection scope of the present invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may occur depending on design requirements and other factors. Any modification, equivalent substitution and improvement made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A method for generating a test material, characterized in that: include: Receive the target template submitted by the user and the variable values ​​corresponding to each target interface input parameter defined by the target template; Replacing the variable definitions corresponding to the input parameters of each target interface with the variable values ​​corresponding to the input parameters of each target interface respectively, thereby obtaining the tool input parameters; Calling each target interface defined by the material generation tool in sequence according to the tool input parameters, thereby obtaining output parameters of each target interface; According to the pre-configured material interface and material field, the test material is obtained from the output parameters of each target interface.

2. The method according to claim 1, characterized in that Before receiving the target template submitted by the user and the variable values ​​corresponding to each target interface input parameter defined by the target template, the method further includes: Register each interface; Configure each template, wherein the template defines at least one interface input parameter, and the interface input parameter defines a variable; Configure the variable attributes of each interface input parameter in each template, wherein the variable attributes include at least one of the following: variable name, variable definition, template to which it belongs, component type, data restriction, data format, and whether it is a default value.

3. The method according to claim 2, characterized in that After configuring the variable attributes of each interface input parameter in each template, the method further includes: According to each registered interface, at least one target interface and the calling sequence of each target interface are defined, so as to obtain a material generation tool; Configure a material interface and a material field, wherein the material interface is selected from any one of the at least one target interface, and the material field is selected from an output parameter of the material interface; The component attributes of each interface input parameter in each template are configured, and the component attributes include at least one of the following: length, width, and position.

4. The method according to claim 3, characterized in that If the target interface is not the first interface called, the method further includes: Configure the component properties of each interface input parameter in the template corresponding to the target interface; wherein the interface input parameter defines an upstream interface and a source field, the source field is selected from the output parameter of the upstream interface, and / or the interface input parameter defines a variable.

5. The method according to claim 2, characterized in that: After configuring the variable attributes of each interface input parameter in each template, the method further includes: Configure assertions for each interface, which define the assertion fields, comparison methods, and expected values.

6. The method according to claim 5, characterized in that The method further comprises: Whenever a target interface is called, a check is performed based on the output parameters of the target interface and the assertion of the template interface. If the check passes, the next target interface is called. If the check fails, the call stops.

7. The method according to claim 1, characterized in that After obtaining the test material from the output parameters of each target interface according to the pre-configured material interface and material field, the method further includes: The test material is stored in a database for query.

8. A device for generating a test material, characterized in that: include: A receiving module, used to receive a target template submitted by a user and variable values ​​corresponding to each target interface input parameter defined by the target template; A replacement module, used to replace the variable definitions corresponding to the input parameters of each target interface with the variable values ​​corresponding to the input parameters of each target interface, so as to obtain the tool input parameters; A calling module is used to call each target interface defined by the material generation tool in sequence according to the tool input parameters, so as to obtain the output parameters of each target interface; The acquisition module is used to acquire the test material from the output parameters of each target interface according to the pre-configured material interface and material field.

9. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 7.

10. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.

11. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.