Test data generation method and device and electronic equipment

By analyzing data call requests, determining test conditions and data templates, and generating test data, the problem of low system testing efficiency caused by the large number of systems being tested is solved, and the technical effect of improving the efficiency of test data generation is achieved.

CN119961144APending Publication Date: 2025-05-09INDUSTRIAL AND COMMERCIAL BANK OF CHINA
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411773196.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-04
Publication Date
2025-05-09

AI Technical Summary

Technical Problem

When there are many systems under test, the workload of configuring the system associated with the system under test is large, resulting in low system testing efficiency.

Method used

By receiving the data call request from the target user, parsing the request to obtain test information and test requests, determining the target test conditions of the sender of the test request, and determining whether it meets these conditions. If the conditions are met, determine the sender's target data template, and generate test data based on the template, test information and test requests, and feedback to the sender.

Benefits of technology

There is no need to configure the called system, and simulated test data is generated directly based on the call information, which improves the efficiency of test data generation and solves the problem of low system testing efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119961144A_ABST
    Figure CN119961144A_ABST
Patent Text Reader

Abstract

The invention discloses a test data generation method and device and electronic equipment. Relates to the field of financial science and technology, and comprises the following steps: receiving a data calling request sent by a target user, and analyzing the data calling request to obtain test information and a test request; determining a target test condition of a sender of the test request according to the test information, and judging whether the test information meets the target test condition or not; under the condition that the test information meets the target test condition, determining a target data template of the sender according to the test request; and generating test data according to the target data template, the test information and the test request, and feeding back the test data to the sender. Through the method and the device, the problem that the system test efficiency is low due to the fact that the workload of configuring the system associated with the tested system is large under the condition that the number of the tested system is large in the related technology is solved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of financial technology, and specifically, to a method, device and electronic device for generating test data. Background Art

[0002] As the types and number of businesses in financial institutions continue to increase, the number of business systems also needs to increase accordingly to ensure that a large number of businesses can run stably. Before configuring a business system, it is necessary to test the business system to ensure that it can run normally.

[0003] However, since some systems need to exchange data with other systems through interfaces when they are running, for example, when system A performs a certain operation, it needs to call the interface of system B to obtain data from system B, and then complete business processing based on the data fed back by system B. In this case, the following situations often occur during the software testing phase: (1) The interface of system B is not ready, resulting in the inability to test system A; (2) The capacity configuration of system B is lower than that of the online environment, and the performance test of system A is limited by the performance bottleneck of system B, resulting in distorted results. Therefore, in order to ensure the accuracy of the test of system A, system B also needs to be configured when testing system A.

[0004] However, when there are a large number of systems interacting with system A, a large number of systems need to be configured, and after the system is configured, it can only be applied to this test and cannot be used in other test processes. As a result, when there are a large number of systems under test, the workload of configuring the systems associated with the systems under test is large, resulting in low system testing efficiency.

[0005] In view of the problem in the related art that when there are a large number of systems under test, the workload of configuring the systems associated with the systems under test is large, resulting in low system testing efficiency, no effective solution has been proposed yet. Summary of the invention

[0006] The main purpose of the present application is to provide a method, device and electronic device for generating test data, so as to solve the problem in the related art that when the number of systems under test is large, the workload of configuring the systems associated with the systems under test is large, resulting in low system testing efficiency.

[0007] In order to achieve the above-mentioned purpose, according to one aspect of the present application, a method for generating test data is provided. The method includes: receiving a data call request sent by a target user, parsing the data call request, and obtaining test information and a test request; determining the target test condition of the sender of the test request according to the test information, and judging whether the test information meets the target test condition; if the test information meets the target test condition, determining the target data template of the sender according to the test request; generating test data according to the target data template, the test information and the test request, and feeding back the test data to the sender.

[0008] Optionally, determining the target test conditions of the sender of the test request based on the test information includes: identifying the user information of the sender from the test information; determining whether there is an initial test condition corresponding to the user information in the database; if the initial test condition exists, determining the initial test condition as the target test condition; if the initial test condition does not exist, obtaining the preset test condition in the database, and determining the preset test condition as the target test condition.

[0009] Optionally, the target test condition is composed of M sub-test conditions, and determining whether the test information meets the target test condition includes: comparing each sub-test condition with the test information to obtain M comparison results, wherein the comparison result is used to characterize whether the test information meets the sub-test condition, and M is a positive integer; connecting the M sub-test conditions through logical operators according to the logical relationship between the M sub-test conditions to obtain a logical expression of the target test condition; determining an output value of the logical expression according to the M comparison results, and determining that the test information meets the target test condition when the output value is a first output value, and determining that the test information does not meet the target test condition when the output value is a second output value.

[0010] Optionally, determining the sender's target data template based on the test request includes: determining whether there is an initial data template associated with the test request in the database; if the initial data template exists in the database, determining the initial data template as the target data template; if the initial data template does not exist in the database, determining a preset data template as the target data template.

[0011] Optionally, generating test data according to the target data template, test information and test request includes: obtaining features that need to be filled in the target data template to obtain multiple target features; determining in turn whether the feature value of each target feature is located in the test information; for the target feature whose feature value is located in the test information, obtaining the feature value corresponding to the target feature from the test information to obtain multiple first feature values; for the target feature whose feature value is not located in the test information, generating the feature value corresponding to the target feature according to the test request to obtain multiple second feature values; adding the multiple first feature values ​​and the multiple second feature values ​​to the target data template to obtain initial data; obtaining the interface information of the test end used by the sender, and serializing the initial data according to the interface information to obtain test data.

[0012] Optionally, feeding back the test data to the sender includes: determining whether there is delay information in the test request; if there is delay information in the test request, obtaining the first moment for generating the test data, determining the second moment based on the first moment and the delay information, and feeding back the test data to the sender when the second moment is reached; if there is no delay information in the test request, feeding back the test data to the sender at the first moment.

[0013] Optionally, before parsing the data call request, the method also includes: obtaining system information of the sender of the data call request, and determining whether there is credential information corresponding to the system information; if there is credential information, executing the step of parsing the data call request; if there is no credential information, feeding back prompt information to the sender, wherein the prompt information is used to indicate that processing of the data call request is prohibited.

[0014] In order to achieve the above-mentioned purpose, according to another aspect of the present application, a device for generating test data is provided. The device includes: a receiving unit, which is used to receive a data call request sent by a target user, and parse the data call request to obtain test information and a test request; a first determining unit, which is used to determine the target test condition of the sender of the test request according to the test information, and judge whether the test information meets the target test condition; a second determining unit, which is used to determine the target data template of the sender according to the test request when the test information meets the target test condition; a generating unit, which is used to generate test data according to the target data template, the test information and the test request, and feed the test data back to the sender.

[0015] In an embodiment of the present application, a data call request sent by a target user is received, and the data call request is parsed to obtain test information and a test request; the target test condition of the sender of the test request is determined according to the test information, and it is judged whether the test information meets the target test condition; when the test information meets the target test condition, the target data template of the sender is determined according to the test request; test data is generated according to the target data template, the test information and the test request, and the test data is fed back to the sender. By receiving a data call request, generating test data according to the test information and the test request in the data call request, and feeding back the test data to the caller, there is no need to configure the called system, but directly generate corresponding simulation test data according to the call information, and can feed back corresponding test data according to different data call requests sent by different senders, thereby achieving the technical effect of improving the efficiency of test data generation, and further solving the technical problem in the related art that when the number of systems under test is large, the workload of configuring the system associated with the system under test is large, resulting in low system testing efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] The drawings constituting a part of the present application are used to provide a further understanding of the present application. The illustrative embodiments and descriptions of the present application are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:

[0017] Figure 1 A hardware structure block diagram of a computer terminal for implementing a method for generating test data is shown;

[0018] Figure 2 is a flowchart of a method for generating test data according to Example 1 of the present application;

[0019] Figure 3 is a flowchart of a test data generating method provided in an embodiment of the present application;

[0020] Figure 4 is a flowchart of an optional method for generating test data according to Embodiment 1 of the present application;

[0021] Figure 5 is a schematic diagram of a device for generating test data according to Embodiment 2 of the present application;

[0022] Figure 6 It is a structural block diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION

[0023] 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.

[0024] 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.

[0025] 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 sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. 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.

[0026] It should be noted that the test data generation method, device and electronic device determined in the present disclosure can be used in the field of financial technology, and can also be used in any field other than the field of financial technology. The application field of the test data generation method, device and electronic device determined in the present disclosure is not limited.

[0027] It should be noted that the collected information, user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) used in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of relevant data are in compliance with the relevant laws, regulations and standards of the relevant regions, necessary confidentiality measures are taken, and public order and good customs are not violated. Corresponding operation portals are provided for users to choose to authorize or refuse to use. For example, an interface is set up between this system and relevant users or organizations. Before obtaining relevant information, it is necessary to send an acquisition request to the aforementioned user or organization through the interface, and obtain relevant information after receiving the consent information fed back by the aforementioned user or organization.

[0028] The embodiments or examples of the present disclosure are not exhaustive, but are only illustrative of some embodiments or examples, and are not intended to be specific limitations on the scope of protection of the present disclosure. In the absence of contradiction, each step in a certain embodiment or example can be implemented as an independent example, and the steps can be combined arbitrarily. For example, the scheme after removing some steps in a certain embodiment or example can also be implemented as an independent example, and the order of the steps in a certain embodiment or example can be arbitrarily exchanged. In addition, the optional methods or optional examples in a certain embodiment or example can be combined arbitrarily; in addition, the various embodiments or examples can be combined arbitrarily, for example, some or all steps of different embodiments or examples can be combined arbitrarily, and a certain embodiment or example can be combined arbitrarily with the optional methods or optional examples of other embodiments or examples.

[0029] For the convenience of description, some nouns or terms involved in the embodiments of the present application are explained below:

[0030] JVM (Java Virtual Machine): Java virtual machine, a virtual machine that can execute Java bytecode, is part of the Java platform. The main job of JVM is to interpret its own instruction set (that is, the bytecode compiled by the Java language) and map it to the local CPU processor instruction set and operating system calls.

[0031] JVM-SANDBOX (JVM sandbox): JVM sandbox is a device that implements AOP solutions without restarting the JVM and intruding the target JVM application. In the JVM sandbox, any Java program method call can be decomposed into three stages: before calling (BEFORE), returning results (RETURN), and throwing exceptions (THROWS). Based on the event separation of the three stages BEFORE, RETURN, and THROWS, the sandbox module can complete many types of AOP operations. The JVM sandbox has the following characteristics: (1) non-intrusive, the target application does not need to be restarted or aware of the existence of the sandbox; (2) class isolation, the sandbox and the sandbox modules will not interfere with the classes of the target application; (3) pluggable, the sandbox and the sandbox modules can be loaded and unloaded at any time, and will not leave traces in the target application; (4) multi-tenant, the target application can simultaneously mount sandboxes under different tenants and control them independently.

[0032] AOP (Aspect Oriented Programming): Aspect-oriented programming is a programming paradigm used to enhance the modularity and maintainability of applications by separating cross-cutting concerns and core business logic.

[0033] Serialization and deserialization: Serialization is the process of converting an object into an ordered byte stream so that it can be transmitted over the network or saved in a local file; deserialization is the process of reconstructing the object state and description information saved in the byte stream into an object.

[0034] Example 1

[0035] According to an embodiment of the present application, an embodiment of a method for generating test data is also provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.

[0036] The method embodiment provided in the first embodiment of the present application can be executed in a mobile terminal, a computer terminal or a similar computing device. Figure 1 FIG. 1 shows a hardware structure block diagram of a computer terminal for implementing a method for generating test data. Figure 1 As shown, the computer terminal 10 (or mobile device) may include one or more (102a, 102b, ..., 102n are used to illustrate) processors 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), a memory 104 for storing data, and a transmission device 106 for communication functions. In addition, it may also include: a display, an input / output interface (I / O interface), a universal serial bus (USB) port (which may be included as one of the ports of the BUS bus), a network interface, a power supply and / or a camera. 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 above electronic device. Figure 1 More or fewer components as shown, or with Figure 1 Different configurations shown.

[0037] It should be noted that the one or more processors 102 and / or other data processing circuits described above may generally be referred to herein as "data processing circuits". The data processing circuits may be embodied in whole or in part as software, hardware, firmware, or any other combination thereof. In addition, the data processing circuit may be a single independent processing module, or may be incorporated in whole or in part into any of the other components in the computer terminal 10 (or mobile device). As described in the embodiments of the present application, the data processing circuit acts as a processor control (e.g., selection of a variable resistor terminal path connected to an interface).

[0038] The memory 104 can be used to store software programs and modules of application software, such as program instructions / data storage devices corresponding to the method for generating test data in the embodiment of the present application. The processor 102 executes various functional applications and data processing by running the software programs and modules stored in the memory 104, that is, the method for generating test data described above is realized. 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 instances, the memory 104 may further include a memory remotely arranged relative to the processor 102, and these remote memories may be connected to the computer terminal 10 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 combinations thereof.

[0039] The transmission device 106 is used to receive or send data via a network. The specific example of the above network may include a wireless network provided by a communication provider of the computer terminal 10. In one example, the transmission device 106 includes a network adapter (Network Interface Controller, 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 can be a radio frequency (RF) module, which is used to communicate with the Internet wirelessly.

[0040] The display may be, for example, a touch screen liquid crystal display (LCD) that enables a user to interact with a user interface of the computer terminal 10 (or mobile device).

[0041] Under the above operating environment, this application provides Figure 2 The test data generation method shown in FIG. Figure 2 is a flow chart of a method for generating test data according to Example 1 of the present application, such as Figure 2 As shown, the method includes:

[0042] Step S201, receiving a data call request sent by a target user, and parsing the data call request to obtain test information and a test request.

[0043] Specifically, the execution subject of this embodiment can be a test simulator, which can be used to simulate the called system and feedback the test value according to the call request. The test simulator can be a virtual machine based on the JAV sandbox mechanism. The target user can be a user of the sender, such as a tester of a tester. The target user can send a data call request to the test simulator through the test terminal device used by the sender, so that the test simulator can feedback the called data to the target user of the sender according to the data call request, thereby completing the test operation on the sender's system.

[0044] It should be noted that after receiving the data call request, the data call request needs to be parsed to obtain test information and test requests, wherein the test information may include the system under test, that is, the relevant information of the sender's system, such as IP address, user name, etc., and also needs to include business information of the business being tested by the user, such as relevant information of the business being tested. The test request may include requirements for test data that the test simulator needs to feedback, such as generating random numbers based on business information, obtaining time and other related test requirements, so that the test data that the sender needs to obtain can be determined based on the test information and test request, thereby achieving the technical effect of accurately feeding back test information to the sender.

[0045] Step S202: determining the target test condition of the sender of the test request according to the test information, and judging whether the test information meets the target test condition.

[0046] Specifically, after obtaining the test information, it is necessary to determine the sender's target test conditions based on the test information, and determine whether the test information has an abnormality based on the target test conditions, thereby determining whether the test information is correct based on the target test conditions.

[0047] It should be noted that the target test condition may be a test condition configured by the sender in the test server before the test, and the test condition may be used to determine whether the data call request sent by the sender is accurate. If it is accurate, the test data may be fed back in response to the data call request. If the data call request is inaccurate, it indicates that there is an abnormality in the data call request sent by the sender's system to the test server during the test, and it may be determined that there is a problem with the test process. In this case, it may be determined that the test result is abnormal, and there is no need to feed back the test data to the sender, thereby reducing the complexity of the test process.

[0048] Step S203: When the test information meets the target test condition, determine the target data template of the sender according to the test request.

[0049] Specifically, when the test information meets the target test conditions, the representation can feedback test data for this data call request. At this time, the target data template can be obtained according to the test request. After the test data is generated, the test data can be added to the preset target data template according to the requirements of the initiator of the call request, thereby ensuring the accuracy of the format of the feedback test data and ensuring that the initiator system can receive the test data normally.

[0050] Step S204: Generate test data according to the target data template, test information and test request, and feed back the test data to the sender.

[0051] Specifically, after determining the target data template, the call data required by the sender can be generated according to the test request, and the call data can be added to the target template. In addition, part of the test information needs to be added to the target data template according to the requirements of the template, so that the data obtained by combining the call data, test information and target data template is determined as test data, and the test data is fed back to the sender of the data call request, thereby completing the generation and feedback of the test data. Then, without the need to connect the sender system with the calling system, the corresponding test data is generated according to the data call request through the test simulator, and the test data is fed back, so that the test simulator simulates the process of the calling system feeding back the call data, thereby achieving the technical effect of improving the efficiency of obtaining call data.

[0052] The test data generation method provided in the embodiment of the present application adopts the method of receiving a data call request sent by a target user, parsing the data call request, obtaining test information and a test request; determining the target test condition of the sender of the test request according to the test information, and judging whether the test information meets the target test condition; determining the target data template of the sender according to the test request when the test information meets the target test condition; generating test data according to the target data template, the test information and the test request, and feeding back the test data to the sender. By receiving a data call request, generating test data according to the test information and the test request in the data call request, and feeding back the test data to the caller, there is no need to configure the called system, but directly generate corresponding simulation test data according to the call information, and can feed back corresponding test data according to different data call requests sent by different senders, thereby achieving the technical effect of improving the efficiency of test data generation, and further solving the technical problem in the related art that when the number of systems under test is large, the workload of configuring the systems associated with the systems under test is large, resulting in low system testing efficiency.

[0053] Optionally, in the test data generation method provided in the embodiment of the present application, determining the target test conditions of the sender of the test request based on the test information includes: identifying the user information of the sender from the test information; determining whether there is an initial test condition corresponding to the user information in the database; if the initial test condition exists, determining the initial test condition as the target test condition; if the initial test condition does not exist, obtaining the preset test condition in the database, and determining the preset test condition as the target test condition.

[0054] Specifically, when determining the target test conditions, since the target test conditions can be the test conditions configured by the sender in the test simulator before using the test simulator to perform test operations, when determining the target test conditions, user information can be identified from the test information, and the test conditions corresponding to the user information can be queried in the database corresponding to the test simulator based on the user information, thereby obtaining the target test conditions.

[0055] It should be noted that since the sender can perform multiple tests on different systems through a test simulator, when determining the test conditions based on user information, a preset identifier can also be added, and the test conditions corresponding to the current test content can be determined based on the preset identifier and user information, thereby ensuring that the test conditions accurately match the current test content.

[0056] It should be noted that in some cases, the sender's user information may not have corresponding test conditions in the database. In this case, the preset test conditions can be used as target test conditions to ensure the normal operation of the test data generation process.

[0057] This embodiment determines the target test conditions based on user information, and uses preset test conditions as target test conditions when there are no corresponding target test conditions in the user information, thereby ensuring that relatively accurate target test conditions are obtained. While ensuring the normal execution of the test process, it is ensured that the test information can be accurately judged whether it is correct based on the test conditions later.

[0058] Optionally, in the test data generation method provided in the embodiment of the present application, the target test condition is composed of M sub-test conditions, and determining whether the test information meets the target test condition includes: comparing each sub-test condition with the test information respectively to obtain M comparison results, wherein the comparison result is used to characterize whether the test information meets the sub-test condition, and M is a positive integer; connecting the M sub-test conditions through logical operators according to the logical relationship between the M sub-test conditions to obtain a logical expression of the target test condition; determining the output value of the logical expression according to the M comparison results, and determining that the test information meets the target test condition when the output value is the first output value, and determining that the test information does not meet the target test condition when the output value is the second output value.

[0059] Specifically, the target test condition may include multiple sub-test conditions. After obtaining the test information, the test information needs to be compared with each sub-test condition in turn to obtain multiple comparison results, wherein the comparison results may include compliance and non-compliance. After obtaining multiple comparison results, the multiple sub-test conditions are combined according to the logical relationship between them, such as "and", "or", etc., to obtain the logical expression of the target test condition.

[0060] Furthermore, after obtaining the logical expression, since the value of the logical expression is a logical value, that is, true or false, the final result of the logical expression can be determined based on the comparison results, thereby determining whether the test information meets the target test condition based on whether the final result is true or false, wherein the first output value can be true, and the second output value can be false. When the output value is the first output value, that is, the output value is true, it can be determined that the test information meets the target test condition. When the output value is the second output value, that is, the output value is false, it is determined that the test information does not meet the target test condition, thereby completing the judgment operation on the test information according to the target test condition.

[0061] For example, the logical expression supports logical operators including: equal to (==), not equal to (!=), found (found), not found (notfound), and (&&), or (||). The variables of the logical expression of the target test condition can be, for example: "arg0.action=='xncs'&&arg0.user=='admin'", which means that when the action value of the first input parameter in the test information is equal to xncs and the user of the first input parameter is equal to admin, the logical expression is true, thereby completing the identification operation of the test information.

[0062] This embodiment achieves accurate identification and confirmation of the test information by comparing the test conditions with the test information, thereby ensuring the accuracy of the test information.

[0063] Optionally, in the test data generation method provided in an embodiment of the present application, determining the target data template of the sender according to the test request includes: determining whether there is an initial data template associated with the test request in the database; if the initial data template exists in the database, determining the initial data template as the target data template; if the initial data template does not exist in the database, determining a preset data template as the target data template.

[0064] Specifically, in order to ensure that the test data can be accurately received by the sender, when generating the test data, the test data needs to be generated according to the data format and display format specified by the data template. Therefore, when generating the test data, it is necessary to first generate the corresponding initial data template according to the test request, and add the data generated according to the test request to the initial data template to obtain complete test data, and then feed the test data back to the sender to ensure that the sender can receive and identify each data information in the test data.

[0065] It should be noted that when determining the initial data template, it can be determined based on the test request. If there is a data template corresponding to the test request in the database, the data template can be directly determined as the initial data template. If there is no data template corresponding to the test request in the database, the preset data template can be determined as the target data template, thereby ensuring that the test data can be generated normally according to the data generation process, and avoiding the phenomenon that the test data cannot be fed back to the sender due to the inability to obtain the data template.

[0066] This embodiment ensures normal generation of test data by accurately determining the data template, and at the same time ensures that the sender can receive and identify the data content in the test data, thereby ensuring the normal progress of the test process.

[0067] Optionally, in the test data generation method provided in the embodiment of the present application, generating test data according to the target data template, test information and test request includes: obtaining features that need to be filled in the target data template to obtain multiple target features; judging in turn whether the feature value of each target feature is located in the test information; for the target feature whose feature value is located in the test information, obtaining the feature value corresponding to the target feature from the test information to obtain multiple first feature values; for the target feature whose feature value is not located in the test information, generating the feature value corresponding to the target feature according to the test request to obtain multiple second feature values; adding the multiple first feature values ​​and the multiple second feature values ​​to the target data template to obtain initial data; obtaining the interface information of the test end used by the sender, and serializing the initial data according to the interface information to obtain test data.

[0068] Specifically, after the target data template is acquired, the test data required by the sender may be generated according to the test information and the test request.

[0069] First, obtain the characteristic information that needs to be filled in the target data template, that is, the target feature. For example, the characteristic information contained in the target data template may be: user name, user account, withdrawal amount, withdrawal time. At this time, it is necessary to generate the characteristic values ​​corresponding to each of the above characteristic information in turn, so as to complete the generation of the data content in the target data template, and then obtain the complete test data required by the sender.

[0070] After obtaining the target feature, you can first obtain the feature values ​​of some target features from the test information, such as user name, user account and other feature values, that is, the first feature value. For target features that do not exist in the test information, you can generate corresponding feature values ​​according to the test request to obtain the second feature value. For example, the withdrawal amount and withdrawal time cannot be obtained from the test information. At this time, the test simulator can generate corresponding data according to the requirements of the target feature. For example, for the withdrawal amount and withdrawal time, the withdrawal amount can be generated by generating random numbers, and the current time is determined as the withdrawal time, thereby completing the generation operation of the feature value of the target feature.

[0071] Furthermore, after obtaining multiple first eigenvalues ​​and multiple second eigenvalues, each eigenvalue can be added to the target data template according to the correspondence between the eigenvalue and the target feature, thereby obtaining initial data, and the initial data can be serialized to obtain test data that is convenient for data transmission, thereby completing the test data generation operation.

[0072] For example, Figure 3 is a flow chart of a test data generating method provided in an embodiment of the present application, such as Figure 3As shown, the test simulator may include a data management module, wherein the data management module may include a data pool module 301, a kernel instruction pool module 302, an extended instruction pool module 303 and a data filling module 304, wherein:

[0073] The core of the module is the data pool module 301, which can be a Key-Value data pool for storing data. The data can include data generated according to the test request and data templates, etc., which are not limited here.

[0074] The kernel instruction pool module 302 is used for the instructions for directly operating the data pool, including: (1) setting the Key-Value key value (2) obtaining the Value value of the Key (3) filling the string, that is, replacing ${Key} in the string with the Value value.

[0075] The extended instruction pool module 303 is used to call the kernel instruction pool module 302 to complete various business logics. It is the data provided to the simulator users, including but not limited to (1) generating random numbers (2) obtaining the current time (3) inputting parameter values ​​from the interface, etc.

[0076] The data filling module 304 is used to add the data generated by the kernel instruction pool module 302 and the extended instruction pool module 303 to the target data template, so as to obtain initial data.

[0077] Steps S301-S303 can represent the process of obtaining feature values ​​according to target features and generating test data according to feature values ​​and data templates, wherein the extended instruction pool module 303 is used to generate data according to test requests and obtain feature values ​​corresponding to target features from test information. The data filling module 304 is used to replace data variables in the template with feature values, that is, to replace ${Key} in the string with Value values, obtain initial data, and perform serialization operations on the initial data, converting the initial data into an ordered byte stream to obtain test data, so as to transmit the test data to the sender, thereby completing the test data generation operation.

[0078] This embodiment obtains the feature value in the template according to the test request and the test information, and adds the feature value to the template to obtain the test data, thereby ensuring the matching degree and accuracy between the test data and the data call request.

[0079] Optionally, in the test data generating method provided in the embodiment of the present application, feeding back the test data to the sender includes: determining whether there is delay information in the test request; if there is delay information in the test request, obtaining the first moment for generating the test data, and determining the second moment based on the first moment and the delay information, and feeding back the test data to the sender when the second moment is reached; if there is no delay information in the test request, feeding back the test data to the sender at the first moment.

[0080] Specifically, after generating the test data, in order to ensure that the test process is consistent with the actual business process, it is necessary to determine the sending time of the test data according to business needs. Therefore, it is possible to first determine whether there is delay information in the test request, where the delay information is used to indicate whether the test data needs to be delayed and the delay feedback duration of the test data.

[0081] When there is delay information in the test request, the delay phenomenon needs to be simulated to characterize the test process. At this time, the first moment of generating the test data can be obtained, and the delay duration in the delay information required in the test request can be obtained, so as to add the delay duration and the first moment to obtain the second moment, and when the second moment is reached, the test data is fed back to the sender.

[0082] It should be noted that when determining the second moment, the second moment can also be determined based on the receiving moment of the data call request, the receiving moment and the delay duration, and when the second moment is reached, the test data is fed back to the sender, thereby completing the test content of the delayed feedback data.

[0083] It should be noted that in the absence of delay information, there is no need to perform a delayed feedback test data operation. At this time, after the test data is generated, the test data can be directly fed back to the sender, thereby completing the test data transmission process and ensuring timely transmission of the test data.

[0084] This embodiment ensures that the feedback mode of test data matches the test requirements and ensures the accuracy of the test process by judging whether a delay is required in the test process.

[0085] Optionally, in the test data generation method provided in the embodiment of the present application, before parsing the data call request, the method also includes: obtaining system information of the sender of the data call request, and determining whether there is credential information corresponding to the system information; if there is credential information, executing the step of parsing the data call request; if there is no credential information, feeding back prompt information to the sender, wherein the prompt information is used to indicate that processing of the data call request is prohibited.

[0086] Specifically, when a data call request is received, since the test simulator can be connected to multiple test systems at the same time, it is necessary to determine the system information of the sender of the data call request and determine whether there is credential information corresponding to the system information in the database based on the system information.

[0087] In the presence of credential information, the representation can feedback test information based on the data call request and consume the credential information, thereby ensuring that when the test simulator is connected and interacting with multiple systems at the same time, a test system will not occupy the test simulator for a long time, thereby ensuring the normal operation of the test simulator.

[0088] In the absence of credential information, it means that the sender cannot obtain test data from the test simulator at the current moment. At this time, a prompt message can be directly fed back to the sender, thereby notifying the sender that it needs to apply for credential information from the control end of the test simulator. Only after applying for the credential information can the test data be generated through the test simulator, thereby ensuring the normal operation of the test simulator.

[0089] It should be noted that the control end is connected to the test simulator and is used to manage the test simulator. When the test simulator is running, it is necessary to obtain and organize the simulator operation information and report it to the control end at regular intervals. The collected operation information may include the number of interface calls, the number of case hits, the IP address, the JVM process number, and the user configuration element summary. The control end can store the operation information of the test simulator, and judge the operation status of the test simulator and the test information of the test party using the test simulator based on the operation information, so as to allocate credential information to different test parties based on the test information, wherein the credential information can be set in the form of an access ticket, and different test parties have different IPs. By setting different numbers of access tickets for different IPs, the number of times the test party can use the test simulator is represented, and when the number of uses is reached, since there are no remaining access tickets, the test party needs to send an access ticket acquisition request to the control end, thereby ensuring the stable operation of the test simulator and realizing centralized management of the simulator operation.

[0090] This embodiment controls the data interaction between the sender and the test simulator by setting the credential information, thereby ensuring the stable operation of the test simulator.

[0091] Figure 4 is a flowchart of an optional method for generating test data according to Example 1 of the present application, such as Figure 4As shown, after receiving the data call request sent by the sender, it is necessary to determine whether the sender can use the test simulator to generate test data. When the simulator allows access, it is determined whether the test information meets the target test conditions according to the target test conditions. When the test information meets the target test conditions, the sender's target data template is determined according to the test request, and test data is generated according to the target data template, test information and test request. The response time is simulated according to the data feedback requirements, and when the response time is reached, the test data is fed back to the sender of the data call request, thereby ensuring that the test data is generated and fed back according to user requirements, thereby ensuring the accuracy of the test process and the accuracy of the test results.

[0092] 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.

[0093] Example 2

[0094] The embodiment of the present application also provides a test data generation device. It should be noted that the test data generation device of the embodiment of the present application can be used to execute the test data generation method provided in the embodiment of the present application. The test data generation device provided in the embodiment of the present application is introduced below.

[0095] According to an embodiment of the present application, a device for implementing the above test data generation method is also provided. Figure 5 is a schematic diagram of a test data generating device provided in Example 2 of the present application, such as Figure 5 As shown, the device comprises:

[0096] The receiving unit 51 is used to receive a data calling request sent by a target user, and parse the data calling request to obtain test information and a test request.

[0097] The first determining unit 52 is used to determine the target test condition of the sender of the test request according to the test information, and to judge whether the test information meets the target test condition.

[0098] The second determining unit 53 is configured to determine the target data template of the sender according to the test request when the test information meets the target test condition.

[0099] The generating unit 54 is used to generate test data according to the target data template, the test information and the test request, and feed the test data back to the sender.

[0100] The test data generating device provided in the embodiment of the present application receives a data call request sent by a target user through a receiving unit 51, and parses the data call request to obtain test information and a test request; a first determining unit 52 determines the target test condition of the sender of the test request according to the test information, and determines whether the test information meets the target test condition; a second determining unit 53 determines the target data template of the sender according to the test request when the test information meets the target test condition; a generating unit 54 generates test data according to the target data template, the test information and the test request, and feeds back the test data to the sender. By receiving a data call request, generating test data according to the test information and the test request in the data call request, and feeding back the test data to the caller, there is no need to configure the called system, but directly generates corresponding simulation test data according to the call information, and can feed back corresponding test data according to different data call requests sent by different senders, thereby achieving the technical effect of improving the generation efficiency of test data, thereby solving the technical problem in the related art that when the number of systems under test is large, the workload of configuring the systems associated with the system under test is large, resulting in low system test efficiency.

[0101] Optionally, in the test data generating device provided in the embodiment of the present application, the first determination unit 52 includes: an identification module, used to identify the user information of the sender from the test information; a first judgment module, used to judge whether there is an initial test condition corresponding to the user information in the database; the first determination module, used to determine the initial test condition as the target test condition when the initial test condition exists; and a second determination module, used to obtain the preset test condition in the database when the initial test condition does not exist, and determine the preset test condition as the target test condition.

[0102] Optionally, in the test data generating device provided in the embodiment of the present application, the target test condition is composed of M sub-test conditions, and the first determination unit 52 includes: a comparison module, which is used to compare each sub-test condition with the test information respectively to obtain M comparison results, wherein the comparison result is used to characterize whether the test information meets the sub-test condition, and M is a positive integer; a connection module, which is used to connect the M sub-test conditions through logical operators according to the logical relationship between the M sub-test conditions to obtain a logical expression of the target test condition; a third determination module, which is used to determine the output value of the logical expression according to the M comparison results, and when the output value is the first output value, determine that the test information meets the target test condition, and when the output value is the second output value, determine that the test information does not meet the target test condition.

[0103] Optionally, in the test data generating device provided in the embodiment of the present application, the second determination unit 53 includes: a second judgment module, used to determine whether there is an initial data template associated with the test request in the database; a fourth determination module, used to determine the initial data template as the target data template when the initial data template exists in the database; and a fifth determination module, used to determine the preset data template as the target data template when the initial data template does not exist in the database.

[0104] Optionally, in the test data generation device provided in the embodiment of the present application, the generation unit 54 includes: a first acquisition module, used to acquire features that need to be filled in the target data template to obtain multiple target features; a third judgment module, used to judge in turn whether the feature value of each target feature is located in the test information; a second acquisition module, used to acquire the feature value corresponding to the target feature from the test information for the target feature whose feature value is located in the test information, and obtain multiple first feature values; a generation module, used to generate the feature value corresponding to the target feature according to the test request for the target feature whose feature value is not located in the test information, and obtain multiple second feature values; an adding module, used to add multiple first feature values ​​and multiple second feature values ​​to the target data template to obtain initial data; a third acquisition module, used to acquire the interface information of the test end used by the sender, and serialize the initial data according to the interface information to obtain test data.

[0105] Optionally, in the test data generating device provided in the embodiment of the present application, the generating unit 54 includes: a fourth judgment module, used to determine whether there is delay information in the test request; a first feedback module, used to obtain the first moment of generating the test data when there is delay information in the test request, and determine the second moment based on the first moment and the delay information, and feed back the test data to the sender when the second moment is reached; a second feedback module, used to feed back the test data to the sender at the first moment when there is no delay information in the test request.

[0106] Optionally, in the test data generating device provided in the embodiment of the present application, before parsing the data call request, the device also includes: an acquisition unit, used to acquire system information of the sender of the data call request, and determine whether there is credential information corresponding to the system information; an execution unit, used to execute the step of parsing the data call request when the credential information exists; and a feedback unit, used to feedback prompt information to the sender when the credential information does not exist, wherein the prompt information is used to indicate that processing of the data call request is prohibited.

[0107] It should be noted that the receiving unit 51, the first determining unit 52, the second determining unit 53, and the generating unit 54 correspond to steps S201 to S204 in Embodiment 1, and the two modules and the corresponding steps implement the same examples and application scenarios, but are not limited to the contents disclosed in Embodiment 1. It should be noted that the modules or units may be hardware components or software components stored in a memory (e.g., memory 104) and processed by one or more processors (e.g., processors 102a, 102b, ..., 102n), and the modules may also be part of a device and run in the computer terminal 10 provided in Embodiment 1.

[0108] Example 3

[0109] An embodiment of the present application may provide an electronic device, Figure 6 is a structural block diagram of an electronic device according to an embodiment of the present application. Figure 6 As shown, the electronic device may include: one or more ( Figure 6 (only one is shown) processor 1002, memory 1004, storage controller, and peripheral interface, wherein the peripheral interface is connected to the radio frequency module, audio module and display.

[0110] Among them, the memory can be used to store software programs and modules, such as program instructions / modules corresponding to the methods and devices in the embodiments of the present application, and the processor executes various functional applications and data processing by running the software programs and modules stored in the memory, that is, realizing the above-mentioned method. The memory 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 instances, the memory may further include a memory remotely arranged relative to the processor, and these remote memories may be connected to the 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 combinations thereof.

[0111] The processor can call the information and application stored in the memory through the transmission device to perform the following steps: receive a data call request sent by the target user, and parse the data call request to obtain test information and a test request; determine the target test conditions of the sender of the test request based on the test information, and determine whether the test information meets the target test conditions; when the test information meets the target test conditions, determine the target data template of the sender based on the test request; generate test data based on the target data template, test information and test request, and feed the test data back to the sender.

[0112] The processor can also call the information and application stored in the memory through the transmission device to perform the following steps: identify the user information of the sender from the test information; determine whether there is an initial test condition corresponding to the user information in the database; if the initial test condition exists, determine the initial test condition as the target test condition; if the initial test condition does not exist, obtain the preset test condition in the database, and determine the preset test condition as the target test condition.

[0113] The processor can also call the information and application stored in the memory through the transmission device to perform the following steps: compare each sub-test condition with the test information to obtain M comparison results, where the comparison result is used to characterize whether the test information meets the sub-test condition, and M is a positive integer; connect the M sub-test conditions through logical operators according to the logical relationship between the M sub-test conditions to obtain the logical expression of the target test condition; determine the output value of the logical expression according to the M comparison results, and when the output value is the first output value, determine that the test information meets the target test condition, and when the output value is the second output value, determine that the test information does not meet the target test condition.

[0114] The processor can also call the information and application stored in the memory through the transmission device to perform the following steps: determine whether there is an initial data template associated with the test request in the database; if the initial data template exists in the database, determine the initial data template as the target data template; if the initial data template does not exist in the database, determine the preset data template as the target data template.

[0115] The processor can also call the information and application stored in the memory through the transmission device to perform the following steps: obtain the features that need to be filled in the target data template to obtain multiple target features; determine in turn whether the feature value of each target feature is located in the test information; for the target feature whose feature value is located in the test information, obtain the feature value corresponding to the target feature from the test information to obtain multiple first feature values; for the target feature whose feature value is not located in the test information, generate the feature value corresponding to the target feature according to the test request to obtain multiple second feature values; add the multiple first feature values ​​and the multiple second feature values ​​to the target data template to obtain initial data; obtain the interface information of the test end used by the sender, and serialize the initial data according to the interface information to obtain test data.

[0116] The processor can also call the information and application stored in the memory through the transmission device to perform the following steps: determine whether there is delay information in the test request; if there is delay information in the test request, obtain the first time for generating test data, and determine the second time based on the first time and the delay information, and when the second time is reached, feed back the test data to the sender; if there is no delay information in the test request, feed back the test data to the sender at the first time.

[0117] The processor can also call the information and application stored in the memory through the transmission device to perform the following steps: obtain the system information of the sender of the data call request, and determine whether there is credential information corresponding to the system information; if there is credential information, execute the step of parsing the data call request; if there is no credential information, feedback prompt information to the sender, wherein the prompt information is used to indicate that the data call request is prohibited from being processed.

[0118] It can be understood by those skilled in the art that Figure 6 The structure shown is for illustration only, and the electronic device may also be a smart phone (such as an Android phone, an iOS phone, etc.), a tablet computer, a PDA, a mobile Internet device (Mobile Internet Devices, MID), a PAD, and other terminal devices. Figure 6 The structure of the electronic device is not limited. Figure 6 More or fewer components (such as network interfaces, display devices, etc.) shown in, or having Figure 6 Different configurations shown.

[0119] A person of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing the hardware related to the terminal device through a program, and the program can be stored in a computer-readable storage medium, and the storage medium may include: a flash drive, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk, etc.

[0120] Example 4

[0121] The embodiment of the present application further provides a storage medium. Optionally, in this embodiment, the storage medium can be used to store the program code executed by the test data generation method provided in the first embodiment.

[0122] Optionally, in this embodiment, the above storage medium may be located in any computer terminal in a computer terminal group in a computer network, or in any mobile terminal in a mobile terminal group.

[0123] The present application also provides a computer program product, which is suitable for executing the steps of the test data generation method when executed on a data processing device.

[0124] The serial numbers of the above-mentioned embodiments of the present application are for description only and do not represent the advantages or disadvantages of the embodiments.

[0125] In the above embodiments of the present application, the description of each embodiment has its own emphasis. For parts that are not described in detail in a certain embodiment, please refer to the relevant description of other embodiments.

[0126] In the several embodiments provided in this application, it should be understood that the disclosed technical content can be implemented in other ways. Among them, the device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of units or modules, which can be electrical or other forms.

[0127] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0128] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.

[0129] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, in essence, or the part that contributes to the prior art or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, a server or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: U disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), mobile hard disk, disk or optical disk and other media that can store program codes.

[0130] The above is only a preferred implementation of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A method for generating test data, characterized in that: include: Receiving a data call request sent by a target user, and parsing the data call request to obtain test information and a test request; Determining a target test condition of the sender of the test request according to the test information, and judging whether the test information meets the target test condition; In the case where the test information meets the target test condition, determining the target data template of the sender according to the test request; Generate test data according to the target data template, the test information and the test request, and feed back the test data to the sender.

2. The method according to claim 1, characterized in that: Determining the target test condition of the sender of the test request according to the test information includes: Identifying user information of the sender from the test information; Determine whether there is an initial test condition corresponding to the user information in the database; In the case where the initial test condition exists, determining the initial test condition as the target test condition; In the case where the initial test condition does not exist, a preset test condition in the database is obtained, and the preset test condition is determined as the target test condition.

3. The method according to claim 1, characterized in that The target test condition is composed of M sub-test conditions, and judging whether the test information meets the target test condition includes: Compare each sub-test condition with the test information to obtain M comparison results, wherein the comparison result is used to indicate whether the test information meets the sub-test condition, and M is a positive integer; Connecting the M sub-test conditions through logical operators according to the logical relationship between the M sub-test conditions to obtain a logical expression of the target test condition; The output value of the logical expression is determined according to the M comparison results, and when the output value is a first output value, it is determined that the test information meets the target test condition; when the output value is a second output value, it is determined that the test information does not meet the target test condition.

4. The method according to claim 1, characterized in that: Determining the target data template of the sender according to the test request includes: Determining whether there is an initial data template associated with the test request in a database; In the case where the initial data template exists in the database, determining the initial data template as the target data template; When the initial data template does not exist in the database, a preset data template is determined as the target data template.

5. The method according to claim 1, characterized in that Generating test data according to the target data template, the test information and the test request includes: Acquire the features that need to be filled in the target data template to obtain multiple target features; Determine in turn whether the feature value of each target feature is located in the test information; For a target feature whose feature value is in the test information, acquiring a feature value corresponding to the target feature from the test information to obtain a plurality of first feature values; For a target feature whose feature value is not in the test information, generating a feature value corresponding to the target feature according to the test request to obtain a plurality of second feature values; Adding the plurality of first characteristic values ​​and the plurality of second characteristic values ​​to the target data template to obtain initial data; The interface information of the test end used by the sender is obtained, and the initial data is serialized according to the interface information to obtain the test data.

6. The method according to claim 1, characterized in that Feeding back the test data to the sender includes: Determining whether there is delay information in the test request; When the delay information exists in the test request, obtaining a first time at which the test data is generated, determining a second time according to the first time and the delay information, and feeding back the test data to the sender when the second time is reached; In a case where the delay information does not exist in the test request, the test data is fed back to the sender at the first moment.

7. The method according to claim 1, characterized in that Before parsing the data call request, the method further includes: Obtaining system information of a sender of the data call request, and determining whether there is credential information corresponding to the system information; In the case where the credential information exists, executing the step of parsing the data call request; In the absence of the credential information, prompt information is fed back to the sender, wherein the prompt information is used to indicate that processing of the data call request is prohibited.

8. A device for generating test data, characterized in that: include: A receiving unit, used to receive a data call request sent by a target user, and parse the data call request to obtain test information and a test request; A first determining unit, configured to determine a target test condition of the sender of the test request according to the test information, and to determine whether the test information meets the target test condition; A second determining unit, configured to determine a target data template of the sender according to the test request if the test information meets the target test condition; A generating unit is used to generate test data according to the target data template, the test information and the test request, and feed back the test data to the sender.

9. A computer program product comprising computer instructions, characterized in that When the computer instructions are executed by a processor, the steps of the test data generation method according to any one of claims 1 to 7 are implemented.

10. An electronic device, characterized in that: include: A memory storing an executable program; A processor is used to run the program, wherein the program executes the test data generation method according to any one of claims 1 to 7 when running.