Test data construction and function verification method and verification device
By establishing multiple test data types and data construction rules, configuring corresponding data types and construction rules for the test interface, and determining matching test interfaces based on scenario information, generating test data that meets specific formats or business needs, the problem of high randomness in the existing technology is solved and higher targeting is achieved.
Patent Information
- Application Number
- CN202510011350.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-01-03
- Publication Date
- 2025-05-06
AI Technical Summary
The test data generated in the prior art is very random and cannot meet the needs of specific business scenarios.
By establishing multiple test data types and data construction rules, the corresponding data types and data construction rules are configured for each interface field in the test interface, and the matching test interface is determined based on the scene information to generate test data that meets specific formats or business needs.
The generated test data is achieved with higher targetedness, can meet the needs of specific business scenarios, and solve the problem of high randomness of test data in the prior art.
Smart Images

Figure CN119938535A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of software testing, and in particular to a test data construction and function verification method, a verification device, a computer-readable storage medium, a computer program product, and a test data construction and function verification system. Background Art
[0002] The existing test data construction methods are mainly divided into three categories: manual construction, script random construction and direct use of real data desensitization. Manual construction is to manually set data values according to business scenarios. The operation is simple, but only a single configuration can be made and the data is fixed. The data needs to be manually modified for each test, which is troublesome and inflexible to use; script random construction is to set the data length and data type to be generated through a script, and generate data values of the specified length and type through script operation. The operation is simple, but the generated test data is highly random, cannot meet specific business scenarios, and is not conducive to reuse; real data desensitization is to obtain actual production data with approval, desensitize the data, and then import it into the test environment for testing in batches. Although the data is diverse and fits the business scenario, it involves data security, the application process is complicated, the data maintenance cost is high, and not all systems have production data available for desensitization. In summary, the existing test data construction methods have many problems, and cannot construct the desired data according to the actual scenario, so that the current test data construction results cannot meet the needs of testers. Summary of the invention
[0003] The main purpose of the present application is to provide a test data construction and function verification method, verification device, computer-readable storage medium, computer program product and test data construction and function verification system, so as to at least solve the problem that the test data generated in the prior art is highly random and cannot meet the needs of specific business scenarios.
[0004] In order to achieve the above-mentioned purpose, according to one aspect of the present application, a method for constructing and functionally verifying test data is provided, including: establishing multiple data types and multiple data construction rules for test data, wherein the data construction rules are used to specify that the test data is generated according to a specific format or business requirement when generating the test data; establishing multiple test interfaces, and configuring the data type and the data construction rules for each interface field in each of the test interfaces, wherein the interface field is a specific field in the test interface used for data interaction; establishing scenario information for multiple scenarios, and determining a predetermined number of the test data to be generated, a target data type, and a target data construction rule based on the scenario information, wherein the target data type is all the test data that the test data should have. The data type, the target data construction rule is all the data construction rules that all the target data types should have, and the scenario information includes a scenario name and a scenario description; when the data type configured by the target test interface includes the target data type and the data construction rule corresponding to the data type includes the target data construction rule, the target test interface is determined to be a matching test interface for the scenario information, and the target test interface is any one of the test interfaces; the matching test interface is called to generate the predetermined number of test data; the predetermined number of test data is sent to the test environment corresponding to the scenario for testing, and a test result is obtained to verify whether the function implementation of the test environment is normal.
[0005] Optionally, multiple data types are established, including: establishing basic data types, the basic data types including integer, floating point, long integer, Boolean and string; establishing special data types, the special data types are data types with specific formats or business meanings.
[0006] Optionally, multiple data construction rules are established, including: setting the weight ratio when generating the interface field according to the scenario information to obtain a weight adaptive construction rule; setting the interface field to be generated according to a specified statistical interval according to the scenario information to obtain a normal distribution construction rule; setting the interface field to be generated according to a specified length according to the scenario information to obtain a fixed-length data construction rule; setting the interface field to be generated according to preset requirements according to the scenario information to obtain a precise data construction rule.
[0007] Optionally, determining that the target test interface is a matching test interface for the scene information includes: in a case where the current test interface does not have a matching test interface for the scene information, establishing a new data type and / or a new data construction rule, and establishing a new test interface based on the new data type and / or the new data construction rule, so that the current test interface has a matching test interface for the scene information; in a case where the current test interface has a matching test interface for the scene information, adjusting the data construction rule of the interface field of the matching test interface so that the matching test interface conforms to the scene information.
[0008] Optionally, adjusting the data construction rule of the interface field of the matching test interface includes: when the data construction rule of the interface field is the weight adaptive construction rule, adjusting the weight ratio when the interface field is generated according to the current scenario information; when the data construction rule of the interface field is the normal distribution construction rule, adjusting the statistical interval when the interface field is generated according to the current scenario information; when the data construction rule of the interface field is the fixed-length data construction rule, adjusting the length when the interface field is generated according to the current scenario information; when the data construction rule of the interface field is the precise data construction rule, adjusting the preset requirements when the interface field is generated according to the current scenario information.
[0009] Optionally, the predetermined amount of the test data is sent to the test environment corresponding to the scenario for testing to obtain the test result, including: obtaining environmental information of the test environment, the environmental information including the address and port of the test server; sending the test data to the test server for testing according to the environmental information, and receiving the test result returned by the test server.
[0010] In order to achieve the above-mentioned purpose, according to one aspect of the present application, a test data construction and function verification device is provided, including: a first establishment unit, used to establish multiple data types and multiple data construction rules of test data, and the data construction rules are used to specify that the test data is generated according to a specific format or business requirement when generating the test data; a second establishment unit, used to establish multiple test interfaces, and configure the data type and the data construction rules for each interface field in each of the test interfaces, and the interface field is a specific field in the test interface for data interaction; a third establishment unit, used to establish scenario information of multiple scenarios, and determine the predetermined number of the test data to be generated, the target data type and the target data construction rule according to the scenario information, and the target data type is all the test data that the test data should have. The data type, the target data construction rule is all the data construction rules that all the target data types should have, and the scenario information includes a scenario name and a scenario description; a first determination unit, used to determine that the target test interface is a matching test interface for the scenario information when the data type configured by the target test interface includes the target data type and the data construction rule corresponding to the data type includes the target data construction rule, and the target test interface is any one of the test interfaces; a first generation unit, used to call the matching test interface to generate the predetermined number of test data; a first control unit, used to send the predetermined number of test data to the test environment corresponding to the scenario for testing to obtain a test result to verify whether the function implementation of the test environment is normal.
[0011] According to another aspect of the present application, a computer-readable storage medium is provided, wherein the computer-readable storage medium includes a stored program, wherein when the program is executed, the method described in any one of the devices where the computer-readable storage medium is located is controlled.
[0012] According to another aspect of the present application, a computer program product is provided, comprising a computer program, wherein when the computer program is executed by a processor, any one of the methods described above is implemented.
[0013] According to another aspect of the present application, a test data construction and function verification system is provided, 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 methods for executing any one of the described methods.
[0014] Applying the technical solution of the present application, in the above-mentioned method for constructing and verifying the function of test data, it includes: establishing multiple data types and multiple data construction rules for test data, the above-mentioned data construction rules are used to specify that the above-mentioned test data is generated according to a specific format or business requirement when generating the above-mentioned test data; establishing multiple test interfaces, and configuring the above-mentioned data type and the above-mentioned data construction rules for each interface field in each of the above-mentioned test interfaces, the above-mentioned interface field is a specific field used for data interaction in the above-mentioned test interface; establishing scenario information for multiple scenarios, and determining the predetermined number of the above-mentioned test data to be generated, the target data type and the target data construction rule according to the above-mentioned scenario information, the above-mentioned target data type being all the above-mentioned data that the above-mentioned test data should have. type, the target data construction rules are all the data construction rules that all the target data types should have, and the scenario information includes the scenario name and the scenario description; when the data types configured by the target test interface include the target data types and the data construction rules corresponding to the data types include the target data construction rules, the target test interface is determined to be the matching test interface of the scenario information, and the target test interface is any one of the test interfaces; the matching test interface is called to generate the predetermined number of test data; the predetermined number of test data is sent to the test environment corresponding to the scenario for testing, and the test results are obtained to verify whether the function of the test environment is implemented normally. The present application establishes multiple test data types and data construction rules, determines the corresponding data types and data construction rules for each interface field in the test interface, determines a matching test interface in the test interface according to the data type and data construction method of the test data corresponding to the scenario information, determines a predetermined number of test data to be generated, calls the matching test interface to generate a predetermined number of test data, and sends the test data to the corresponding test environment to test the test data to verify whether the functional implementation of the above-mentioned test environment is normal. By calling the test interface to generate test data according to the data type and data construction method of the test data corresponding to the scenario information, the generated test data can be made more targeted, which solves the problem that the test data generated in the prior art is highly random and cannot meet the needs of specific business scenarios. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] Figure 1 A hardware structure block diagram of a mobile terminal for executing a method for constructing and verifying function of test data provided in an embodiment of the present application is shown;
[0016] Figure 2 A schematic diagram of a flow chart of a test data construction and function verification method provided according to an embodiment of the present application is shown;
[0017] Figure 3An overall component diagram of a test data construction and function verification method provided according to an embodiment of the present application is shown;
[0018] Figure 4 A flowchart of a construction component of a test data construction and function verification method provided according to an embodiment of the present application is shown;
[0019] Figure 5 A flowchart of an interface component of a test data construction and function verification method provided according to an embodiment of the present application is shown;
[0020] Figure 6 A scenario component flow chart of a test data construction and function verification method provided according to an embodiment of the present application is shown;
[0021] Figure 7 A flow chart of a sending component of a test data construction and function verification method provided according to an embodiment of the present application is shown;
[0022] Figure 8 A structural block diagram of a test data construction and function verification device provided according to an embodiment of the present application is shown.
[0023] The above drawings include the following reference numerals:
[0024] 102, processor; 104, memory; 106, transmission device; 108, input and output devices. DETAILED DESCRIPTION
[0025] It should be noted that, in the absence of conflict, the embodiments and features in the embodiments of the present application can be combined with each other. The present application will be described in detail below with reference to the accompanying drawings and in combination with the embodiments.
[0026] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work should fall within the scope of protection of the present application.
[0027] It should be noted that the terms "first", "second", etc. in the specification and claims of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequential order. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present application described here. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0028] As introduced in the background technology, the prior art is unable to construct the desired data according to the actual scenario, so that the current test data construction results cannot meet the needs of testers. To solve this technical problem, the embodiments of the present application provide a test data construction and function verification method, verification device, computer-readable storage medium, computer program product and test data construction and function verification system.
[0029] 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.
[0030] The method embodiments provided in the embodiments of the present application 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 of a test data construction and function verification method 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 shown.
[0031] The memory 104 can be used to store computer programs, for example, software programs and modules of application software, such as a computer program corresponding to a test data construction and function verification method in an 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 may 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.
[0032] In this embodiment, a method for constructing and functionally verifying test data running on a mobile terminal, a computer terminal or a similar computing device 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 may be executed in an order different from that shown here.
[0033] Figure 2 1 is a flow chart of a method for constructing test data and verifying functions according to an embodiment of the present application. Figure 2 As shown, the method comprises the following steps:
[0034] Step S201, establishing multiple data types and multiple data construction rules of test data, wherein the data construction rules are used to specify that the test data is generated according to a specific format or business requirement when generating the test data;
[0035] Specifically, by establishing a variety of data types and data construction rules, it is possible to flexibly generate test data that meets specific formats and business scenario requirements, effectively improving the accuracy and pertinence of test data.
[0036] Step S202, establishing multiple test interfaces, and configuring the above data type and the above data construction rule for each interface field in each of the above test interfaces, wherein the above interface field is a specific field in the above test interface used for data interaction;
[0037] Specifically, a test interface is established to generate test data, and basic information of the interface is entered when establishing the test interface, including key information such as interface name, interface address, and interface description. Data types and data construction rules are configured for each specific interface field of multiple test interfaces. Interface fields can also be imported in batches to configure data types and data construction rules for interface fields at one time, thereby improving the efficiency of testers and realizing customized configuration of each interface field of each test interface. When generating test data, you only need to call the test interface that meets the scenario requirements to generate specified test data.
[0038] Step S203, establishing scenario information of multiple scenarios, and determining a predetermined number of the test data to be generated, a target data type, and a target data construction rule according to the scenario information, wherein the target data type is all the data types that the test data should have, and the target data construction rule is all the data construction rules that all the target data types should have, and the scenario information includes a scenario name and a scenario description;
[0039] Specifically, scenario information for different scenarios is established, and the amount of test data that needs to be generated is determined based on the scenario information. The data types of all the test data that need to be generated are determined, and the data construction rules corresponding to each data type are determined. This achieves a high degree of customization of the test data construction, ensuring that the test data in each scenario is not only adapted in quantity, but also that the type and construction rules accurately match business requirements.
[0040] Step S204, when the data type configured by the target test interface includes the target data type and the data construction rule corresponding to the data type includes the target data construction rule, determining that the target test interface is a matching test interface for the scenario information, and the target test interface is any one of the test interfaces;
[0041] Specifically, when the data type configured by the target test interface includes the target data type required by the scenario information, and its data construction rules include the target data construction rules required by the scenario, the target test interface is confirmed to be the ideal interface that matches the current scenario. This precise matching mechanism ensures the efficiency and accuracy of the test data construction, enables the testing process to accurately reflect and verify the system behavior under specific business scenarios, and improves the targeted nature of software testing.
[0042] Step S205, calling the matching test interface to generate the predetermined amount of test data;
[0043] Specifically, by utilizing the determined matching test interface and the configured number of test data, a preset amount of test data can be generated in batches. This process not only follows specific data types and construction rules, but also ensures a high degree of fit between the data and the business scenario.
[0044] Step S206: Send the predetermined amount of the test data to the test environment corresponding to the scenario for testing, and obtain a test result to verify whether the function of the test environment is implemented normally.
[0045] Specifically, the generated test data is accurately placed in the corresponding test environment to obtain test results to determine whether the functional implementation of the test environment is normal, ensuring that the functional implementation of the test environment can be comprehensively and accurately tested.
[0046] Through this embodiment, in the above-mentioned test data construction and function verification method, multiple data types and multiple data construction rules of test data are established, and the above-mentioned data construction rules are used to specify that the above-mentioned test data is generated according to a specific format or business requirement when generating the above-mentioned test data; multiple test interfaces are established, and the above-mentioned data type and the above-mentioned data construction rules are configured for each interface field in each of the above-mentioned test interfaces, and the above-mentioned interface field is a specific field used for data interaction in the above-mentioned test interface; scenario information of multiple scenarios is established, and the predetermined number of the above-mentioned test data to be generated, the target data type and the target data construction rule are determined according to the above-mentioned scenario information, and the above-mentioned target data type is all the above-mentioned data types that the above-mentioned test data should have. The above-mentioned target data construction rules are all the above-mentioned data construction rules that all the above-mentioned target data types should have, and the above-mentioned scenario information includes the scenario name and the scenario description; when the above-mentioned data types configured by the target test interface include the above-mentioned target data types and the above-mentioned data construction rules corresponding to the above-mentioned data types include the above-mentioned target data construction rules, the above-mentioned target test interface is determined to be the matching test interface of the above-mentioned scenario information, and the above-mentioned target test interface is any one of the above-mentioned test interfaces; the above-mentioned matching test interface is called to generate the above-mentioned predetermined number of the above-mentioned test data; the above-mentioned predetermined number of the above-mentioned test data is sent to the test environment corresponding to the above-mentioned scenario for testing, and the test results are obtained to verify whether the functional implementation of the above-mentioned test environment is normal. The present application establishes multiple test data types and data construction rules, determines the corresponding data types and data construction rules for each interface field in the test interface, determines a matching test interface in the test interface according to the data type and data construction method of the test data corresponding to the scenario information, determines a predetermined number of test data to be generated, calls the matching test interface to generate a predetermined number of test data, and sends the test data to the corresponding test environment to test the test data to verify whether the functional implementation of the above-mentioned test environment is normal. By calling the test interface to generate test data according to the data type and data construction method of the test data corresponding to the scenario information, the generated test data can be made more targeted, which solves the problem that the test data generated in the prior art is highly random and cannot meet the needs of specific business scenarios.
[0047] In order to obtain multiple data types, in an optional implementation, multiple data types are established, and the above step S201 includes:
[0048] Step S2011, establishing basic data types, the basic data types include integer, floating point, long integer, Boolean and string;
[0049] Specifically, multiple basic data types are established so that when configuring the data type of the interface field of the test interface, the required data type can be obtained. The basic data types include integer, single floating point, double floating point, long integer, Boolean, numeric string, and alphanumeric string, etc.
[0050] Step S2012: establishing a special data type, where the special data type is a data type with a specific format or business meaning.
[0051] Specifically, a variety of special data types are established so that when configuring the data type of the interface field of the test interface, the required data type can be used. Special data types are data types with specific formats or business meanings, such as ID number, mobile phone number, IP address, longitude and latitude. According to the needs of the scenario, corresponding data types that conform to the scenario information can be established to meet the needs of the scenario to generate test data of the specified type.
[0052] In order to obtain multiple data construction rules, in an optional implementation, multiple data construction rules are established, and the above step S201 further includes:
[0053] Step S2013, setting the weight ratio when generating the above interface fields according to the above scenario information to obtain a weight adaptive construction rule;
[0054] Specifically, according to the characteristics of specific business scenarios, the weight parameters of interface fields in the generation process are dynamically set, thereby forming weight-adaptive data construction rules. For example, for certain data, there are four optional data items: A, B, C, and D. For different test scenarios, the weight ratios of the four data are automatically adjusted to ensure that data that meets the test scenarios is accurately constructed. This rule allows the generation of test data to be more intelligent and adaptive, ensuring that in specific scenarios, the frequency of occurrence of key fields matches that in actual business.
[0055] Step S2014, setting the interface field to be generated according to the specified statistical interval according to the scenario information to obtain a normal distribution construction rule;
[0056] Specifically, according to the specific needs of the business scenarios, the generation strategy of the interface fields is carefully formulated, and the normal distribution construction rules are adopted to ensure that the field values are generated within the specified statistical interval and have distribution characteristics similar to the actual business data. For example, if an integer or floating-point number is randomly generated from a certain data in the range of 1 to 100, the normal distribution construction rules can be used to set the generation method of the data. The implementation of this strategy improves the statistical authenticity of the test data and makes the generated data closer to the normal distribution of business operations.
[0057] Step S2015, setting the above interface field to be generated according to the specified length according to the above scenario information to obtain a fixed-length data construction rule;
[0058] Specifically, according to the specific requirements of the business scenarios, precise length parameters are set for the interface fields, thus forming a fixed-length data construction rule. The formulation of this rule ensures that the generated test data is strictly consistent with the actual business data in length. For example, if the generated string type data is set to a length of 10, the fixed-length data construction rule can be used to generate data, effectively avoiding the problem of test deviation caused by data length mismatch.
[0059] Step S2016, setting the above interface fields according to the above scenario information and generating them according to preset requirements to obtain accurate data construction rules.
[0060] Specifically, strict generation conditions are set for the interface fields based on the specific needs of the business scenarios, thereby establishing precise data construction rules. For example, when generating ID number information, the first six digits of the generated ID number can be strictly set to be unified. Through the application of this rule, the generated test data can be highly consistent with the expected business scenarios. Not only does it strictly match the format, its content also accurately reflects the specific requirements of business operations.
[0061] In order to determine the matching test interface of the current scene, in an optional implementation, the target test interface is determined to be the matching test interface of the scene information, and the step S204 includes:
[0062] Step S2041, in the case that the current test interface does not have the matching test interface of the scenario information, a new data type and / or a new data construction rule is established, and a new test interface is established according to the new data type and / or the new data construction rule, so that the current test interface has the matching test interface of the scenario information;
[0063] Specifically, when the existing test interface cannot meet the complex requirements of a specific business scenario, new data types or data construction rules can be customized according to the scenario information, and a customized test interface can be created based on these new data types and data construction rules, so that a matching test interface that meets the current scenario can be called to generate test data. The implementation of this mechanism greatly enhances the flexibility and adaptability of the test framework.
[0064] Step S2042: When the matching test interface of the scenario information exists in the current test interface, the data construction rule of the interface field of the matching test interface is adjusted so that the matching test interface conforms to the scenario information.
[0065] Specifically, when the existing test interface can preliminarily match a specific business scenario, that is, the data type and data construction rule type of the matching test interface meet the current business scenario, but the specific data construction rule content does not meet the current scenario requirements. For example, if the weight settings are different, the weight in the weight adaptive construction rule can be adjusted according to the scenario information of the current scenario. Or, if the field in a certain account dynamic interface is the transaction time, when it is necessary to construct a scenario in which the user moves the account in the early morning, it is only necessary to configure the data construction rule of the transaction time in the scenario to meet the conditions of the early morning, and the construction rules of other fields do not need to be changed. This strategy allows testers to fine-tune the field generation rules of the matched test interface according to the subtle needs of the current scenario to ensure that the test data more accurately reflects the business characteristics.
[0066] In order to obtain a data construction rule that meets the scenario, in an optional implementation, the data construction rule of the interface field of the matching test interface is adjusted, and the step S2042 includes:
[0067] Step S20421, when the data construction rule of the interface field is the weight adaptive construction rule, adjusting the weight ratio when the interface field is generated according to the current scenario information;
[0068] Specifically, when the interface fields of the test interface follow the weight adaptive construction rules, testers can fine-tune the weight distribution of field data during generation in real time according to the specific needs of the current business scenario to ensure that the constructed test data conforms to the scenario information.
[0069] Step S20422: When the data construction rule of the interface field is the normal distribution construction rule, adjusting the statistical interval when the interface field is generated according to the current scenario information;
[0070] Specifically, when the interface field generation of the test interface follows the normal distribution construction rules, testers can accurately adjust the statistical interval during data generation based on the characteristics of the current business scenario to ensure that the test data is consistent with actual business operations in terms of numerical distribution.
[0071] Step S20423, when the data construction rule of the interface field is the fixed-length data construction rule, adjusting the length of the interface field when it is generated according to the current scenario information;
[0072] Specifically, when the interface field generation of the test interface follows the fixed-length data construction rules, the tester can flexibly change the fixed length of the field data generation based on the specific requirements of the current business scenario to ensure that the format of the test data accurately matches the business requirements, especially in scenarios with specific restrictions on data length.
[0073] Step S20424: When the data construction rule of the interface field is the precise data construction rule, the preset requirements for generating the interface field are adjusted according to the current scenario information.
[0074] Specifically, when the interface field generation of the test interface follows the fixed-length data construction rules, the tester can flexibly modify the preset conditions when generating the field data according to the specific details of the current business scenario, ensuring that the test data strictly follows the precise standards set by the business scenario.
[0075] In order to test the test data, in an optional implementation, the predetermined amount of the test data is sent to a test environment corresponding to the scenario for testing to obtain a test result. The step S206 includes:
[0076] Step S2061, obtaining the environmental information of the test environment, the environmental information including the address and port of the test server;
[0077] Specifically, in implementing the function of sending test data to a specific environment, environmental information of different test environments can be obtained, including the identification of key parameters such as the address and port of the test server, to ensure that the test data can be accurately delivered to the predetermined test environment for testing. At the same time, according to the test requirements, the test data generated for the current scenario can be reused, and the generated test data can be sent to other test environments that meet the current scenario for testing, so that the test data generated for the same scenario can be reused in other test environments.
[0078] Step S2062: Send the test data to the test server for testing according to the environment information, and receive the test result returned by the test server.
[0079] Specifically, this process ensures that the test data can be directly and efficiently transmitted to the designated test server, while receiving the test results returned by the test server to obtain the system function verification results in real time.
[0080] In one embodiment, Figure 3 FIG. 1 shows an overall component diagram of a test data construction and function verification method provided according to an embodiment of the present application, such as Figure 3 As shown:
[0081] A method for constructing test data and verifying functions is implemented by constructing components, interface components, scenario components, and sending components. Next, the specific functions of the constructing components, interface components, scenario components, and sending components are explained.
[0082] The construction component is used to analyze the test data characteristics and encapsulate the data construction method;
[0083] The interface component is used to enter basic information about the interface and configure the type of interface fields and default data construction rules for the interface;
[0084] The scenario component is used to input the test scenario information and customize the data construction rules of the scenario, that is, to adjust the data construction rules of the test interface according to the actual business scenario, and generate test data that meets the current business scenario according to the selected interface;
[0085] The sending component is used to configure the information of the test environment, and sends the generated test data to the selected test environment for testing. At the same time, it receives and analyzes the test results to verify whether the functions of the test environment are implemented normally.
[0086] Figure 4 A flowchart of a construction component of a test data construction and function verification method provided according to an embodiment of the present application is shown, such as Figure 4 As shown:
[0087] The construction component is used for data type analysis and data construction rule analysis. Data type analysis specifically establishes basic data types and special data types by analyzing data types. Data construction rule analysis specifically establishes weight adaptive method, normal random distribution method, fixed-length data method and precise data method by analyzing data construction rules, which correspond to the above-mentioned weight adaptive construction rules, normal distribution construction rules, fixed-length data construction rules and precise data construction rules respectively. By encapsulating the two established data types and four data construction rules one by one through the orthogonal combination permutation method, a variety of encapsulated data construction methods are finally obtained.
[0088] Figure 5 The following is a flowchart of an interface component of a test data construction and function verification method provided in accordance with an embodiment of the present application, as shown in FIG. Figure 5 As shown:
[0089] The interface component is used to enter interface information for the established test interface, enter interface field information, and set default data construction rules for the interface fields. It also supports batch import of interface field information and data construction rules to complete the establishment of the test interface.
[0090] Figure 6 A flow chart of scene components of a test data construction and function verification method provided according to an embodiment of the present application is shown, as Figure 6 As shown:
[0091] The scene component is used to enter scene information for the established scene and analyze the logical relationship between the current scene data. That is, through the above analysis process, the data type of the test data that needs to be generated for the current scene and the data construction rules corresponding to the data type are determined, and the test interface that meets the current scene is selected. The data construction rules are configured and adjusted according to the current scene. At the same time, the scene data construction quantity is analyzed according to the scene information, that is, the number of test data that need to be generated for the current scene, and the scene data construction quantity is configured in the scene component, and the test data is generated according to the selected test interface and scene data construction quantity.
[0092] Figure 7 A flow chart of a sending component of a test data construction and function verification method provided according to an embodiment of the present application is shown, such as Figure 7 As shown:
[0093] The sending component is used to configure the test environment information, and select the test data generated in the scenario component to send to the specified test environment for testing, while receiving the response results from the server and analyzing the response results to verify whether the functions of the above test environment are implemented normally.
[0094] It should be noted that the steps shown in the flowcharts of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and that, although a logical order is shown in the flowcharts, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0095] The present application embodiment also provides a kind of test data construction and function verification device. It should be noted that the test data construction and function verification device of the present application embodiment can be used to execute the test data construction and function verification method provided by the present application embodiment. The device is used to implement the above-mentioned embodiment and preferred implementation mode, and the description has been made without further details. As used below, the term "module" can implement a combination of software and / or hardware of a predetermined function. Although the device described in the following embodiments is preferably implemented in software, the implementation of hardware, or a combination of software and hardware is also possible and conceived.
[0096] The following introduces a test data structure and function verification device provided in an embodiment of the present application.
[0097] Figure 8 1 is a structural block diagram of a test data construction and function verification device according to an embodiment of the present application. Figure 8 As shown, the device comprises:
[0098] A first establishing unit 10 is used to establish multiple data types and multiple data construction rules for test data, wherein the data construction rules are used to specify that the test data is generated according to a specific format or business requirement when generating the test data;
[0099] Specifically, by establishing a variety of data types and data construction rules, it is possible to flexibly generate test data that meets specific formats and business scenario requirements, effectively improving the accuracy and pertinence of test data.
[0100] A second establishing unit 20 is used to establish a plurality of test interfaces, and configure the data type and the data construction rule for each interface field in each of the test interfaces, wherein the interface field is a specific field in the test interface for data interaction;
[0101] Specifically, a test interface is established to generate test data, and basic information of the interface is entered when establishing the test interface, including key information such as interface name, interface address, and interface description. Data types and data construction rules are configured for each specific interface field of multiple test interfaces. Interface fields can also be imported in batches to configure data types and data construction rules for interface fields at one time, thereby improving the efficiency of testers and realizing customized configuration of each interface field of each test interface. When generating test data, you only need to call the test interface that meets the scenario requirements to generate specified test data.
[0102] The third establishing unit 30 is used to establish scenario information of multiple scenarios, and determine the predetermined number of the test data to be generated, the target data type and the target data construction rule according to the scenario information, wherein the target data type is all the data types that the test data should have, and the target data construction rule is all the data construction rules that all the target data types should have, and the scenario information includes a scenario name and a scenario description;
[0103] Specifically, scenario information for different scenarios is established, and the amount of test data that needs to be generated is determined based on the scenario information. The data types of all the test data that need to be generated are determined, and the data construction rules corresponding to each data type are determined. This achieves a high degree of customization of the test data construction, ensuring that the test data in each scenario is not only adapted in quantity, but also that the type and construction rules accurately match business requirements.
[0104] A first determining unit 40 is used to determine that the target test interface is a matching test interface for the scenario information when the data type configured by the target test interface includes the target data type and the data construction rule corresponding to the data type includes the target data construction rule, and the target test interface is any one of the test interfaces;
[0105] Specifically, when the data type configured by the target test interface includes the target data type required by the scenario information, and its data construction rules include the target data construction rules required by the scenario, the target test interface is confirmed to be the ideal interface that matches the current scenario. This precise matching mechanism ensures the efficiency and accuracy of the test data construction, enables the testing process to accurately reflect and verify the system behavior under specific business scenarios, and improves the targeted nature of software testing.
[0106] A first generating unit 50 is used to call the matching test interface to generate the predetermined amount of test data;
[0107] Specifically, by utilizing the determined matching test interface and the configured number of test data, a preset amount of test data can be generated in batches. This process not only follows specific data types and construction rules, but also ensures a high degree of fit between the data and the business scenario.
[0108] The first control unit 60 is used to send the predetermined amount of the test data to the test environment corresponding to the scenario for testing, and obtain the test result to verify whether the function of the test environment is implemented normally.
[0109] Specifically, the generated test data is accurately placed in the corresponding test environment to obtain test results to determine whether the functional implementation of the test environment is normal, ensuring that the functional implementation of the test environment can be comprehensively and accurately tested.
[0110] Through this embodiment, in the above-mentioned test data construction and function verification device, the first establishment unit is used to establish multiple data types and multiple data construction rules for test data, and the above-mentioned data construction rules are used to specify that the above-mentioned test data is generated according to a specific format or business requirement when generating the above-mentioned test data; the second establishment unit is used to establish multiple test interfaces, and configure the above-mentioned data type and the above-mentioned data construction rules for each interface field in each of the above-mentioned test interfaces, and the above-mentioned interface field is a specific field used for data interaction in the above-mentioned test interface; the third establishment unit is used to establish scenario information of multiple scenarios, and determine the predetermined number of the above-mentioned test data to be generated, the target data type and the target data construction rule according to the above-mentioned scenario information, and the above-mentioned target data type is all the above-mentioned data types that the above-mentioned test data should have. The above-mentioned target data construction rules are all the above-mentioned data construction rules that all the above-mentioned target data types should have, and the above-mentioned scenario information includes a scenario name and a scenario description; a first determination unit is used to determine that the above-mentioned target test interface is a matching test interface of the above-mentioned scenario information when the above-mentioned data type configured by the target test interface includes the above-mentioned target data type and the above-mentioned data construction rules corresponding to the above-mentioned data type include the above-mentioned target data construction rules, and the above-mentioned target test interface is any one of the above-mentioned test interfaces; a first generation unit is used to call the above-mentioned matching test interface to generate the above-mentioned predetermined number of the above-mentioned test data; a first control unit is used to send the above-mentioned predetermined number of the above-mentioned test data to the test environment corresponding to the above-mentioned scenario for testing, and obtain test results to verify whether the functional implementation of the above-mentioned test environment is normal. The present application establishes multiple test data types and data construction rules, determines the corresponding data types and data construction rules for each interface field in the test interface, determines a matching test interface in the test interface according to the data type and data construction method of the test data corresponding to the scenario information, determines a predetermined number of test data to be generated, calls the matching test interface to generate a predetermined number of test data, and sends the test data to the corresponding test environment to test the test data to verify whether the functional implementation of the above-mentioned test environment is normal. By calling the test interface to generate test data according to the data type and data construction method of the test data corresponding to the scenario information, the generated test data can be made more targeted, which solves the problem that the test data generated in the prior art is highly random and cannot meet the needs of specific business scenarios.
[0111] In order to obtain multiple data types, in an optional implementation, multiple data types are established, and the first establishing unit includes:
[0112] The first establishment module is used to establish basic data types, and the basic data types include integer, floating point, long integer, Boolean and string;
[0113] Specifically, multiple basic data types are established so that when configuring the data type of the interface field of the test interface, the required data type can be obtained. The basic data types include integer, single floating point, double floating point, long integer, Boolean, numeric string, and alphanumeric string, etc.
[0114] The second establishing module is used to establish a special data type, where the special data type is a data type with a specific format or business meaning.
[0115] Specifically, a variety of special data types are established so that when configuring the data type of the interface field of the test interface, the required data type can be used. Special data types are data types with specific formats or business meanings, such as ID number, mobile phone number, IP address, longitude and latitude. According to the needs of the scenario, corresponding data types that conform to the scenario information can be established to meet the needs of the scenario to generate test data of the specified type.
[0116] In order to obtain multiple data construction rules, in an optional implementation, multiple data construction rules are established, and the first establishing unit further includes:
[0117] The third establishment module is used to set the weight ratio when the above interface field is generated according to the above scenario information to obtain a weight adaptive construction rule;
[0118] Specifically, according to the characteristics of specific business scenarios, the weight parameters of interface fields in the generation process are dynamically set, thereby forming weight-adaptive data construction rules. For example, for certain data, there are four optional data items: A, B, C, and D. For different test scenarios, the weight ratios of the four data are automatically adjusted to ensure that data that meets the test scenarios is accurately constructed. This rule allows the generation of test data to be more intelligent and adaptive, ensuring that in specific scenarios, the frequency of occurrence of key fields matches that in actual business.
[0119] A fourth establishment module is used to set the interface field to be generated according to the specified statistical interval according to the scenario information to obtain a normal distribution construction rule;
[0120] Specifically, according to the specific needs of the business scenarios, the generation strategy of the interface fields is carefully formulated, and the normal distribution construction rules are adopted to ensure that the field values are generated within the specified statistical interval and have distribution characteristics similar to the actual business data. For example, if an integer or floating-point number is randomly generated from a certain data in the range of 1 to 100, the normal distribution construction rules can be used to set the generation method of the data. The implementation of this strategy improves the statistical authenticity of the test data and makes the generated data closer to the normal distribution of business operations.
[0121] A fifth establishment module, used for setting the interface field to be generated according to a specified length according to the scenario information to obtain a fixed-length data construction rule;
[0122] Specifically, according to the specific requirements of the business scenarios, precise length parameters are set for the interface fields, thus forming a fixed-length data construction rule. The formulation of this rule ensures that the generated test data is strictly consistent with the actual business data in length. For example, if the generated string type data is set to a length of 10, the fixed-length data construction rule can be used to generate data, effectively avoiding the problem of test deviation caused by data length mismatch.
[0123] The sixth establishment module is used to set the above interface fields according to the above scenario information and generate them according to preset requirements to obtain accurate data construction rules.
[0124] Specifically, strict generation conditions are set for the interface fields based on the specific needs of the business scenarios, thereby establishing precise data construction rules. For example, when generating ID number information, the first six digits of the generated ID number can be strictly set to be unified. Through the application of this rule, the generated test data can be highly consistent with the expected business scenarios. Not only does it strictly match the format, its content also accurately reflects the specific requirements of business operations.
[0125] In order to determine the matching test interface of the current scene, in an optional implementation manner, the target test interface is determined to be the matching test interface of the scene information, and the first determining unit includes:
[0126] A first determination module is used to establish a new data type and / or a new data construction rule when the current test interface does not have the matching test interface for the scenario information, and to establish a new test interface according to the new data type and / or the new data construction rule, so that the current test interface has the matching test interface for the scenario information;
[0127] Specifically, when the existing test interface cannot meet the complex requirements of a specific business scenario, new data types or data construction rules can be customized according to the scenario information, and a customized test interface can be created based on these new data types and data construction rules, so that a matching test interface that meets the current scenario can be called to generate test data. The implementation of this mechanism greatly enhances the flexibility and adaptability of the test framework.
[0128] The second determination module is used to adjust the data construction rule of the interface field of the matching test interface when the matching test interface of the scenario information exists in the current test interface, so that the matching test interface conforms to the scenario information.
[0129] Specifically, when the existing test interface can preliminarily match a specific business scenario, that is, the data type and data construction rule type of the matching test interface meet the current business scenario, but the specific data construction rule content does not meet the current scenario requirements. For example, if the weight settings are different, the weight in the weight adaptive construction rule can be adjusted according to the scenario information of the current scenario. Or, if the field in a certain account dynamic interface is the transaction time, when it is necessary to construct a scenario in which the user moves the account in the early morning, it is only necessary to configure the data construction rule of the transaction time in the scenario to meet the conditions of the early morning, and the construction rules of other fields do not need to be changed. This strategy allows testers to fine-tune the field generation rules of the matched test interface according to the subtle needs of the current scenario to ensure that the test data more accurately reflects the business characteristics.
[0130] In order to obtain a data construction rule that meets the scenario, in an optional implementation, the data construction rule of the interface field of the matching test interface is adjusted, and the second determination module includes:
[0131] A first determination submodule is used to adjust the weight ratio when the interface field is generated according to the current scenario information when the data construction rule of the interface field is the weight adaptive construction rule;
[0132] Specifically, when the interface fields of the test interface follow the weight adaptive construction rules, testers can fine-tune the weight distribution of field data during generation in real time according to the specific needs of the current business scenario to ensure that the constructed test data conforms to the scenario information.
[0133] A second determination submodule is used to adjust the statistical interval when the interface field is generated according to the current scenario information when the data construction rule of the interface field is the normal distribution construction rule;
[0134] Specifically, when the interface field generation of the test interface follows the normal distribution construction rules, testers can accurately adjust the statistical interval during data generation based on the characteristics of the current business scenario to ensure that the test data is consistent with actual business operations in terms of numerical distribution.
[0135] A third determining submodule is used to adjust the length of the interface field when it is generated according to the current scenario information when the data construction rule of the interface field is the fixed-length data construction rule;
[0136] Specifically, when the interface field generation of the test interface follows the fixed-length data construction rules, the tester can flexibly change the fixed length of the field data generation based on the specific requirements of the current business scenario to ensure that the format of the test data accurately matches the business requirements, especially in scenarios with specific restrictions on data length.
[0137] The fourth determination submodule is used to adjust the preset requirements when generating the above-mentioned interface field according to the current above-mentioned scenario information when the above-mentioned data construction rule of the above-mentioned interface field is the above-mentioned precise data construction rule.
[0138] Specifically, when the interface field generation of the test interface follows the fixed-length data construction rules, the tester can flexibly modify the preset conditions when generating the field data according to the specific details of the current business scenario, ensuring that the test data strictly follows the precise standards set by the business scenario.
[0139] In order to test the test data, in an optional implementation, the predetermined amount of the test data is sent to a test environment corresponding to the scenario for testing to obtain a test result, and the first control unit includes:
[0140] A first control module, used to obtain environmental information of the test environment, wherein the environmental information includes the address and port of the test server;
[0141] Specifically, in implementing the function of sending test data to a specific environment, environmental information of different test environments can be obtained, including the identification of key parameters such as the address and port of the test server, to ensure that the test data can be accurately delivered to the predetermined test environment for testing. At the same time, according to the test requirements, the test data generated for the current scenario can be reused, and the generated test data can be sent to other test environments that meet the current scenario for testing, so that the test data generated for the same scenario can be reused in other test environments.
[0142] The second control module is used to send the test data to the test server for testing according to the environmental information, and receive the test result returned by the test server.
[0143] Specifically, this process ensures that the test data can be directly and efficiently transmitted to the designated test server, while receiving the test results returned by the test server to obtain the system function verification results in real time.
[0144] The above-mentioned test data construction and function verification device includes a processor and a memory, and the above-mentioned first establishment unit, second establishment unit, third establishment unit, first determination unit, first generation unit and first control unit are all stored in the memory as program units, and the processor executes the above-mentioned program units stored in the memory to realize corresponding functions. The above-mentioned modules are all located in the same processor; or, the above-mentioned modules are located in different processors in the form of any combination.
[0145] The processor contains a kernel, which calls the corresponding program unit from the memory. One or more kernels can be set, and the generated test data can be more targeted by adjusting the kernel parameters to meet the test data requirements of specific business scenarios.
[0146] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory, such as read-only memory (ROM) or flash RAM, and the memory includes at least one memory chip.
[0147] An embodiment of the present invention provides a computer-readable storage medium, which includes a stored program, wherein when the program is run, the device where the computer-readable storage medium is located is controlled to execute the above-mentioned test data construction and function verification method.
[0148] Specifically, a method for constructing and verifying test data includes:
[0149] Step S201, establishing multiple data types and multiple data construction rules of test data, wherein the data construction rules are used to specify that the test data is generated according to a specific format or business requirement when generating the test data;
[0150] Step S202, establishing multiple test interfaces, and configuring the above data type and the above data construction rule for each interface field in each of the above test interfaces, wherein the above interface field is a specific field in the above test interface used for data interaction;
[0151] Step S203, establishing scenario information of multiple scenarios, and determining a predetermined number of the test data to be generated, a target data type, and a target data construction rule according to the scenario information, wherein the target data type is all the data types that the test data should have, and the target data construction rule is all the data construction rules that all the target data types should have, and the scenario information includes a scenario name and a scenario description;
[0152] Step S204, when the data type configured by the target test interface includes the target data type and the data construction rule corresponding to the data type includes the target data construction rule, determining that the target test interface is a matching test interface for the scenario information, and the target test interface is any one of the test interfaces;
[0153] Step S205, calling the matching test interface to generate the predetermined amount of test data;
[0154] Step S206: Send the predetermined amount of the test data to the test environment corresponding to the scenario for testing, and obtain a test result to verify whether the function of the test environment is implemented normally.
[0155] An embodiment of the present invention provides a processor, which is used to run a program, wherein the program executes the above-mentioned test data construction and function verification method when running.
[0156] Specifically, a method for constructing and verifying test data includes:
[0157] Step S201, establishing multiple data types and multiple data construction rules of test data, wherein the data construction rules are used to specify that the test data is generated according to a specific format or business requirement when generating the test data;
[0158] Step S202, establishing multiple test interfaces, and configuring the above data type and the above data construction rule for each interface field in each of the above test interfaces, wherein the above interface field is a specific field in the above test interface used for data interaction;
[0159] Step S203, establishing scenario information of multiple scenarios, and determining a predetermined number of the test data to be generated, a target data type, and a target data construction rule according to the scenario information, wherein the target data type is all the data types that the test data should have, and the target data construction rule is all the data construction rules that all the target data types should have, and the scenario information includes a scenario name and a scenario description;
[0160] Step S204, when the data type configured by the target test interface includes the target data type and the data construction rule corresponding to the data type includes the target data construction rule, determining that the target test interface is a matching test interface for the scenario information, and the target test interface is any one of the test interfaces;
[0161] Step S205, calling the matching test interface to generate the predetermined amount of test data;
[0162] Step S206: Send the predetermined amount of the test data to the test environment corresponding to the scenario for testing, and obtain a test result to verify whether the function of the test environment is implemented normally.
[0163] The present application also provides a computer program product, which, when executed on a data processing device, is suitable for executing a program for initializing at least the following method steps:
[0164] Step S201, establishing multiple data types and multiple data construction rules of test data, wherein the data construction rules are used to specify that the test data is generated according to a specific format or business requirement when generating the test data;
[0165] Step S202, establishing multiple test interfaces, and configuring the above data type and the above data construction rule for each interface field in each of the above test interfaces, wherein the above interface field is a specific field in the above test interface used for data interaction;
[0166] Step S203, establishing scenario information of multiple scenarios, and determining a predetermined number of the test data to be generated, a target data type, and a target data construction rule according to the scenario information, wherein the target data type is all the data types that the test data should have, and the target data construction rule is all the data construction rules that all the target data types should have, and the scenario information includes a scenario name and a scenario description;
[0167] Step S204, when the data type configured by the target test interface includes the target data type and the data construction rule corresponding to the data type includes the target data construction rule, determining that the target test interface is a matching test interface for the scenario information, and the target test interface is any one of the test interfaces;
[0168] Step S205, calling the matching test interface to generate the predetermined amount of test data;
[0169] Step S206: Send the predetermined amount of the test data to the test environment corresponding to the scenario for testing, and obtain a test result to verify whether the function of the test environment is implemented normally.
[0170] An embodiment of the present application also provides a test data construction and function verification method system, including: 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, including executing any one of the above-mentioned methods for optimizing the design of a low-frequency on-load tap changer.
[0171] Specifically, a method for constructing and verifying test data includes:
[0172] Step S201, establishing multiple data types and multiple data construction rules of test data, wherein the data construction rules are used to specify that the test data is generated according to a specific format or business requirement when generating the test data;
[0173] Step S202, establishing multiple test interfaces, and configuring the above data type and the above data construction rule for each interface field in each of the above test interfaces, wherein the above interface field is a specific field in the above test interface used for data interaction;
[0174] Step S203, establishing scenario information of multiple scenarios, and determining a predetermined number of the test data to be generated, a target data type, and a target data construction rule according to the scenario information, wherein the target data type is all the data types that the test data should have, and the target data construction rule is all the data construction rules that all the target data types should have, and the scenario information includes a scenario name and a scenario description;
[0175] Step S204, when the data type configured by the target test interface includes the target data type and the data construction rule corresponding to the data type includes the target data construction rule, determining that the target test interface is a matching test interface for the scenario information, and the target test interface is any one of the test interfaces;
[0176] Step S205, calling the matching test interface to generate the predetermined amount of test data;
[0177] Step S206: Send the predetermined amount of the test data to the test environment corresponding to the scenario for testing, and obtain a test result to verify whether the function of the test environment is implemented normally.
[0178] Obviously, those skilled in the art should understand that the above modules or steps of the present invention can be implemented by a general computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, they can be implemented by a program code executable by a computing device, so that they can be stored in a storage device and executed by the computing device, and in some cases, the steps shown or described can be executed in a different order than here, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.
[0179] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of a complete hardware embodiment, a complete software embodiment, or an embodiment in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented in one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that include computer-usable program code.
[0180] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0181] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.
[0182] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.
[0183] In a typical configuration, a computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory.
[0184] The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0185] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0186] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a process, method, commodity or device including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such process, method, commodity or device. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the process, method, commodity or device including the elements.
[0187] From the above description, it can be seen that the above embodiments of the present application achieve the following technical effects:
[0188] 1) A test data construction and function verification method of the present application, by establishing multiple test data types and data construction rules, determines the corresponding data type and data construction rule for each interface field in the test interface, and determines a matching test interface in the test interface according to the data type and data construction method of the test data corresponding to the scenario information, and determines the predetermined number of test data to be generated, calls the matching test interface to generate a predetermined number of test data, and sends the test data to the corresponding test environment to test the test data to verify whether the function implementation of the above-mentioned test environment is normal. By calling the test interface to generate test data according to the data type and data construction method of the test data corresponding to the scenario information, the generated test data can be made more targeted, which solves the problem that the test data generated in the prior art is highly random and cannot meet the needs of specific business scenarios.
[0189] 2) A test data construction and function verification device of the present application, by establishing multiple test data types and data construction rules, determines the corresponding data type and data construction rule for each interface field in the test interface, and determines a matching test interface in the test interface according to the data type and data construction method of the test data corresponding to the scenario information, and determines the predetermined number of test data to be generated, calls the matching test interface to generate a predetermined number of test data, and sends the test data to the corresponding test environment to test the test data to verify whether the function implementation of the above-mentioned test environment is normal. By calling the test interface to generate test data according to the data type and data construction method of the test data corresponding to the scenario information, the generated test data can be made more targeted, which solves the problem that the test data generated in the prior art is highly random and cannot meet the needs of specific business scenarios.
[0190] The above description is only the preferred embodiment of the present application and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.
Claims
1. A method for constructing and verifying test data, characterized in that: include: Establishing multiple data types and multiple data construction rules for test data, wherein the data construction rules are used to specify that the test data is generated according to a specific format or business requirement when generating the test data; Establishing multiple test interfaces, and configuring the data type and the data construction rule for each interface field in each of the test interfaces, wherein the interface field is a specific field in the test interface used for data interaction; Establish scenario information of multiple scenarios, and determine the predetermined number of test data to be generated, target data types, and target data construction rules according to the scenario information, wherein the target data types are all the data types that the test data should have, and the target data construction rules are all the data construction rules that all the target data types should have, and the scenario information includes a scenario name and a scenario description; In a case where the data type configured by the target test interface includes the target data type and the data construction rule corresponding to the data type includes the target data construction rule, determining that the target test interface is a matching test interface for the scenario information, and the target test interface is any one of the test interfaces; Calling the matching test interface to generate the predetermined amount of test data; The predetermined amount of test data is sent to the test environment corresponding to the scenario for testing, and a test result is obtained to verify whether the function implementation of the test environment is normal.
2. The method according to claim 1, characterized in that Create multiple data types, including: Establishing basic data types, the basic data types include integer, floating point, long integer, Boolean and string; A special data type is established, where the special data type is a data type with a specific format or business meaning.
3. The method according to claim 2, characterized in that Establish multiple data construction rules, including: According to the scenario information, a weight ratio when the interface field is generated is set to obtain a weight adaptive construction rule; The interface field is set to be generated according to a specified statistical interval according to the scenario information to obtain a normal distribution construction rule; The interface field is set to be generated according to a specified length according to the scenario information to obtain a fixed-length data construction rule; The interface fields are set according to the scenario information and generated according to preset requirements to obtain accurate data construction rules.
4. The method according to claim 3, characterized in that Determining that the target test interface is a matching test interface of the scene information includes: In the case that the current test interface does not have the matching test interface of the scenario information, a new data type and / or a new data construction rule is established, and a new test interface is established according to the new data type and / or the new data construction rule, so that the current test interface has the matching test interface of the scenario information; In the case that the matching test interface of the scenario information exists in the current test interface, the data construction rule of the interface field of the matching test interface is adjusted so that the matching test interface conforms to the scenario information.
5. The method according to claim 4, characterized in that Adjusting the data construction rule of the interface field of the matching test interface includes: In a case where the data construction rule of the interface field is the weight adaptive construction rule, adjusting the weight ratio when the interface field is generated according to the current scenario information; When the data construction rule of the interface field is the normal distribution construction rule, adjusting the statistical interval when the interface field is generated according to the current scenario information; When the data construction rule of the interface field is the fixed-length data construction rule, adjusting the length of the interface field when it is generated according to the current scenario information; In the case where the data construction rule of the interface field is the precise data construction rule, the preset requirement when generating the interface field is adjusted according to the current scenario information.
6. The method according to claim 1, characterized in that Sending the predetermined amount of test data to the test environment of the corresponding scenario for testing to obtain a test result includes: Acquire environmental information of the test environment, the environmental information including the address and port of the test server; The test data is sent to the test server for testing according to the environment information, and the test result returned by the test server is received.
7. A test data construction and function verification device, characterized in that: include: A first establishing unit, used to establish multiple data types and multiple data construction rules for test data, wherein the data construction rules are used to specify that the test data is generated according to a specific format or business requirement when generating the test data; A second establishing unit is used to establish a plurality of test interfaces, and configure the data type and the data construction rule for each interface field in each of the test interfaces, wherein the interface field is a specific field in the test interface used for data interaction; A third establishing unit is used to establish scenario information of multiple scenarios, and determine a predetermined number of the test data to be generated, a target data type, and a target data construction rule according to the scenario information, wherein the target data type is all the data types that the test data should have, and the target data construction rule is all the data construction rules that all the target data types should have, and the scenario information includes a scenario name and a scenario description; A first determining unit, configured to determine that the target test interface is a matching test interface for the scenario information when the data type configured by the target test interface includes the target data type and the data construction rule corresponding to the data type includes the target data construction rule, and the target test interface is any one of the test interfaces; A first generating unit, configured to call the matching test interface to generate the predetermined amount of test data; The first control unit is used to send the predetermined amount of test data to the test environment corresponding to the scenario for testing, and obtain the test result to verify whether the function of the test environment is implemented normally.
8. 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 according to any one of claims 1 to 6.
9. 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 6 is implemented.
10. A test data construction and function verification system, 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 methods for executing any one of claims 1 to 6.