Test data generation method and device, computer equipment and storage medium

By automatically generating test data through automated engineering, the problem of low efficiency in manually creating test data is solved, and efficient and low-cost test data generation is achieved.

CN121579346APending Publication Date: 2026-02-27PING AN BANK CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202511685472.X
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-11-17
Publication Date
2026-02-27

AI Technical Summary

Technical Problem

Existing test data construction methods rely on manual creation, resulting in low construction efficiency and high data generation costs, making it difficult to meet the needs of large-scale test data.

Method used

The automated engineering process calls the built-in data generation scripts and parameter generation tools to automatically generate business data and system parameters corresponding to the target business system, thereby generating target test data.

Benefits of technology

By automating the generation of test data, the cost of data creation is significantly reduced and the efficiency of test data construction is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121579346A_ABST
    Figure CN121579346A_ABST
Patent Text Reader

Abstract

The invention belongs to the technical field of data processing, and relates to a test data generation method and device, computer equipment and a storage medium, and the method comprises the steps: judging whether a data generation request which is triggered by a user and corresponds to a to-be-tested target business system is received or not; if yes, loading a preset automation project; calling a built-in data generation script based on the automation project, and generating service data corresponding to the target service system based on the data generation script; calling a built-in parameter generation tool based on the automation project, and generating system parameters corresponding to the target business system based on the parameter generation tool; generating corresponding target test data based on the business data and the system parameters; and storing the target test data in a target storage medium corresponding to the target business system. In addition, the invention also relates to a block chain technology, and the target test data can be stored in a block chain. The construction cost of the target test data is effectively reduced, and the construction efficiency of the target test data is improved.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of data processing and the field of financial technology, and in particular to a test data generation method and device, a computer device and a storage medium. BACKGROUND

[0002] In the field of financial technology, especially in the business scenarios of financial credit and risk assessment, data query of the People's Bank of China credit investigation system has become an indispensable link. With the formal online of the second-generation credit investigation system, it provides more detailed and accurate personal and enterprise credit information, which is undoubtedly a key tool for financial institutions to improve risk identification and management capabilities.

[0003] In actual application, when testing a system with the function of querying the second-generation credit investigation system of the People's Bank of China, a significant problem is faced: a large number of query data (i.e. test data) conforming to the data format of the second-generation credit investigation system of the People's Bank of China need to be constructed for batch testing. These test data not only need to meet the input requirements of the system, but also need to ensure that they can truly reflect the data characteristics and query logic of the second-generation credit investigation system of the People's Bank of China, so as to accurately evaluate the performance and accuracy of the system.

[0004] However, the existing test data construction method for the to-be-tested system usually relies on manual creation. Although manual creation can ensure the accuracy and compliance of the data, it is low in construction efficiency, high in data construction cost, and difficult to meet the demand for large-scale test data. SUMMARY

[0005] The purpose of the embodiments of the present application is to provide a test data generation method, device, computer device and storage medium, to solve the technical problems of low construction efficiency and high data construction cost in the existing test data construction method for the to-be-tested system which usually relies on manual creation.

[0006] To solve the above technical problems, the embodiments of the present application provide a test data generation method, which adopts the following technical solutions: determine whether a data generation request triggered by a user and corresponding to a target business system to be tested is received; if yes, load a preset automation project; invoke an embedded data generation script based on the automation project, and generate business data corresponding to the target business system based on the data generation script; invoke an embedded parameter generation tool based on the automation project, and generate system parameters corresponding to the target business system based on the parameter generation tool; generate corresponding target test data based on the business data and the system parameters; store the target test data into a target storage medium corresponding to the target business system.

[0007] Further, the step of generating the system parameter corresponding to the target business system based on the parameter generation tool specifically includes: obtaining system parameter requirement information corresponding to the target business system; wherein the system parameter requirement information at least includes timestamp format and specified parameter information; based on the parameter generation tool, calling a preset time library, and based on the time library, obtaining the current time; based on the timestamp format, performing format processing on the current time to obtain the corresponding target time; based on the parameter generation tool, calling a preset random number generator, and based on the random number generator, generating a specified parameter corresponding to the specified parameter information; performing legality verification on the target time and the specified parameter; if the target time and the specified parameter both pass the legality verification, generating the system parameter corresponding to the target business system based on the target time and the specified parameter.

[0008] Further, before the step of calling the built-in data generation script based on the automation engineering, it further includes: based on a preset target file, obtaining business data requirement information corresponding to the target business system; based on the business data requirement information, constructing a corresponding data generation logic; based on the data generation logic, constructing a corresponding script template; based on the script template, generating the data generation script.

[0009] Further, before the step of calling the built-in parameter generation tool based on the automation engineering, it further includes: obtaining an initially constructed parameter generation tool; obtaining a preset test strategy; based on the test strategy, testing the initial parameter generation tool; if the initial parameter generation tool passes the test, taking the initial parameter generation tool as the parameter generation tool; integrating the parameter generation tool into the automation engineering.

[0010] Further, after the step of storing the target test data into the target storage medium corresponding to the target business system, it further includes: When a trigger condition of a target test task corresponding to the target business system is met, the target test task is invoked and executed based on the automation engineering to read out the target test data from the target storage medium; The target test data is used to construct a corresponding query request; The query request is sent to the target business system, and query response data returned by the target business system is received; The target test data is updated based on the query response data; The query response data is processed based on a preset target test framework to obtain a corresponding assertion processing result.

[0011] Further, the step of processing the query response data based on the preset target test framework to obtain a corresponding assertion processing result specifically includes: The state code, response header and response body of the query response data are obtained based on the target test framework; The state code is processed by assertion to obtain a corresponding first processing result; The response header is processed by assertion to obtain a corresponding second processing result; The response body is processed by assertion to obtain a corresponding third processing result; The assertion processing result is generated based on the first processing result, the second processing result and the third processing result.

[0012] Further, after the step of processing the query response data based on the preset target test framework to obtain a corresponding assertion processing result, the method further includes: After the target test task is executed, test process data corresponding to the target test task is collected; The test process data is processed by test evaluation to obtain a corresponding evaluation result; The target test report is generated based on the test process data and the evaluation result; The target test report is stored.

[0013] To solve the above technical problems, the embodiment of the present application further provides a test data generation device, which adopts the technical scheme as follows: A judgment module is configured to judge whether a data generation request corresponding to a target business system to be tested triggered by a user is received; A loading module is configured to load a preset automation engineering if the data generation request is received; The first generation module is used to call the built-in data generation script based on the automation project, and generate business data corresponding to the target business system based on the data generation script; The second generation module is used to call the built-in parameter generation tool based on the automation project, and generate system parameters corresponding to the target business system based on the parameter generation tool. The third generation module is used to generate corresponding target test data based on the business data and the system parameters; The first storage module is used to store the target test data in a target storage medium corresponding to the target business system.

[0014] To address the aforementioned technical problems, this application also provides a computer device that employs the following technical solution: Determine whether a user-triggered data generation request corresponding to the target business system under test has been received; If so, load the preset automated project; The automated engineering system calls the built-in data generation script and generates business data corresponding to the target business system based on the data generation script. The automated engineering process invokes the built-in parameter generation tool and generates system parameters corresponding to the target business system based on the parameter generation tool. Based on the business data and the system parameters, corresponding target test data is generated; The target test data is stored in the target storage medium corresponding to the target business system.

[0015] To address the aforementioned technical problems, this application also provides a computer-readable storage medium, employing the technical solution described below: Determine whether a user-triggered data generation request corresponding to the target business system under test has been received; If so, load the preset automated project; The automated engineering system calls the built-in data generation script and generates business data corresponding to the target business system based on the data generation script. The automated engineering process invokes the built-in parameter generation tool and generates system parameters corresponding to the target business system based on the parameter generation tool. Based on the business data and the system parameters, corresponding target test data is generated; The target test data is stored in the target storage medium corresponding to the target business system.

[0016] Compared with the prior art, the embodiments of this application have the following main advantages: The application first determines whether a user triggered data generation request corresponding to a target business system to be tested is received; if yes, a preset automation project is loaded; then a built-in data generation script is called based on the automation project, and business data corresponding to the target business system is generated based on the data generation script; thereafter, a built-in parameter generation tool is called based on the automation project, and system parameters corresponding to the target business system are generated based on the parameter generation tool; subsequently, corresponding target test data is generated based on the business data and the system parameters; finally, the target test data is stored in a target storage medium corresponding to the target business system. By using an automation project, the application can automatically generate business data corresponding to a target business system to be tested based on a built-in data generation script called based on the automation project, and can automatically generate system parameters corresponding to the target business system based on a built-in parameter generation tool called based on the automation project, and then can automatically and accurately generate target test data for a test query of the target business system according to the obtained business data and system parameters, effectively reducing the data generation cost of the target test data and improving the construction efficiency of the target test data. BRIEF DESCRIPTION OF DRAWINGS

[0017] In order to more clearly illustrate the scheme in the application, the drawings needed in the description of the embodiments of the application will be briefly introduced. Obviously, the drawings in the following description are some embodiments of the application, and other drawings can be obtained by those skilled in the art without creative labor.

[0018] Figure 1 is an exemplary system architecture diagram in which the application can be applied; Figure 2 a flowchart of one embodiment of the test data generation method according to the application; Figure 3 is a structural schematic diagram of one embodiment of the test data generation device according to the application; Figure 4 is a structural schematic diagram of one embodiment of the computer device according to the application. DETAILED DESCRIPTION

[0019] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs; the terms used in the specification are intended to describe the particular embodiments and are not intended to limit the application; the terms "include" and "have" and their any variations used in the specification and the claims and the above description of drawings are intended to cover the non-exclusive inclusion; the terms "first", "second" and the like used in the specification and the claims and the above description of drawings are intended to distinguish different objects, not to describe a particular order.

[0020] Reference herein to "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment can be included in at least one embodiment of the application. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are they necessarily mutually exclusive or alternative embodiments. It is expressly understood that the embodiments described herein are combinable with each other.

[0021] In order to make the person skilled in the art better understand the scheme of the present application, the technical solutions in the embodiments of the present application will be described clearly and completely in conjunction with the drawings below.

[0022] As shown in Figure 1 The system architecture 100 can include a terminal device 101, a network 102 and a server 103, and the terminal device 101 can be a notebook computer 1011, a tablet computer 1012 or a mobile phone 1013. The network 102 is a medium for providing a communication link between the terminal device 101 and the server 103. The network 102 can include various connection types, such as wired, wireless communication links or optical fiber cables, etc.

[0023] The user can use the terminal device 101 to interact with the server 103 through the network 102 to receive or send messages, etc. Various communication client applications can be installed on the terminal device 101, such as web browser applications, shopping applications, search applications, instant messaging tools, email clients, social platform software, etc.

[0024] The terminal device 101 can be various electronic devices with a display screen and supporting web browsing, in addition to the notebook computer 1011, the tablet computer 1012 or the mobile phone 1013, the terminal device 101 can also be an electronic book reader, an MP3 player ( Moving Picture Experts Group Audio Layer III), an MP4 ( Moving Picture Experts Group Audio Layer IV) player, a laptop computer and a desktop computer, etc.

[0025] The server 103 can be a server providing various services, for example, a background server providing support for a page displayed on the terminal device 101.

[0026] It should be noted that the test data generation method provided by the embodiments of the present application is generally executed by a server / terminal device, and accordingly, the test data generation apparatus is generally arranged in the server / terminal device.

[0027] It should be understood that, Figure 1 The number of terminal devices, networks and servers in

[0028] With reference to Figure 2 , a flow chart of one embodiment of the test data generation method according to the present application is shown. The order of the steps in the flow chart can be changed according to different needs, and some steps can be omitted. The test data generation method provided by the embodiments of the present application can be applied to any scenario requiring data generation, and thus the test data generation method can be applied to products in these scenarios, for example, test data generation processing in the financial insurance field. The test data generation method comprises the following steps: Step S201, determining whether a data generation request corresponding to a target business system to be tested triggered by a user is received.

[0029] In the present embodiment, the electronic device (for example Figure 1The server / terminal device shown) can obtain a data generation request through a wired connection or a wireless connection. It should be noted that the wireless connection can include but is not limited to 3G / 4G / 5G connection, WiFi connection, Bluetooth connection, WiMAX connection, Zigbee connection, UWB (ultra wideband) connection, and other now known or future developed wireless connection. The execution subject of the present application can be a data generation system with built-in automation engineering, or simply referred to as a system. The present application can be applied to the generation and processing of test data in the business scenario of the second generation of people credit inquiry. The above target business system can be a financial business system with data query function of the second generation of people credit inquiry to be tested. The above data generation request is a request triggered by the user in the front-end interface of the data generation system to command the system to automatically generate test data corresponding to the target business system to be tested for generating test query processing.

[0030] Step S202, if yes, load the preset automation engineering.

[0031] In this embodiment, a Spring Boot project (i.e., the automation project) is created beforehand, and necessary dependencies, such as Spring Data JPA and MyBatis, are configured for interaction with the database of the system under test (the target business system). Then, database connection information is configured to ensure that the Spring Boot project can successfully connect to the database of the system under test. Database entity classes and corresponding Repository interfaces are written for data access and manipulation. Specifically, the functions of the created automation project include: generating system parameters that can be legally verified by the system (such as request system parameters generated using timestamps); generating business data for test queries (including but not limited to: customer name, ID number, ID type, query channel, query reason, etc.); supporting Job task registry scheduling and enabling task scheduling triggering through custom parameters to complete the uploading and result updating of batch query data; and leveraging the data-driven characteristics of the TestNG automation framework, maintaining the batch query template for People's Bank of China data in an Excel file, which allows for dynamic expansion of test data volume and test scenarios. The automated testing module supports testing actions on the business logic of the system under test, performing RespAssert logical assertions based on the HTTP Response Header and Response data. It initializes the storage media connection for the system under test using Spring Boot, collects the test data, and then performs DBAssert assertions. The module completes the data loop for automated testing by connecting to the OpenAPI of the Mock service, and schedules scenario mocks using mockId tags in Excel files.

[0032] Step S203: Based on the automation project, call the built-in data generation script, and generate business data corresponding to the target business system based on the data generation script.

[0033] In this embodiment, the construction process of the data generation script will be described in further detail in subsequent specific embodiments, and will not be elaborated upon here. Furthermore, by using an automated engineering process to call the aforementioned data generation script, business data that meets the requirements corresponding to the target business system is generated.

[0034] Step S204: Based on the automation project, call the built-in parameter generation tool, and generate system parameters corresponding to the target business system based on the parameter generation tool.

[0035] In the embodiment, the specific implementation process of generating the system parameters corresponding to the target business system based on the parameter generation tool is described in further details in subsequent embodiments.

[0036] In step S205, the target test data corresponding to the target business system is generated based on the business data and the system parameters.

[0037] In the embodiment, the integrated data can be obtained by integrating the business data and the system parameters, and the integrated data is used as the target test data corresponding to the target business system.

[0038] In step S206, the target test data is stored in the target storage medium corresponding to the target business system.

[0039] In the embodiment, the target storage medium can be the database of the target business system.

[0040] The application first determines whether the data generation request corresponding to the target business system to be tested triggered by the user is received; if yes, the preset automation project is loaded; then the built-in data generation script is called based on the automation project, and the business data corresponding to the target business system is generated based on the data generation script; then the built-in parameter generation tool is called based on the automation project, and the system parameters corresponding to the target business system are generated based on the parameter generation tool; subsequently, the target test data corresponding to the target business system is generated based on the business data and the system parameters; finally, the target test data is stored in the target storage medium corresponding to the target business system. By using the automation project, the business data corresponding to the target business system to be tested can be automatically generated based on the built-in data generation script called by the automation project, and the system parameters corresponding to the target business system can be automatically generated based on the built-in parameter generation tool called by the automation project. Therefore, the target test data for the test query of the target business system can be automatically and accurately generated according to the obtained business data and system parameters, which effectively reduces the cost of generating the target test data and improves the construction efficiency of the target test data.

[0041] In some optional implementations, the step S204 of generating the system parameters corresponding to the target business system based on the parameter generation tool includes the following steps: The system parameter requirement information corresponding to the target business system is obtained; wherein the system parameter requirement information at least includes the timestamp format and the specified parameter information.

[0042] In the embodiment, the system parameter requirement information corresponding to the target business system can be determined according to actual business requirements. The system parameter requirement information can include timestamp format and specified parameter information. The timestamp format is used to determine the format of the timestamp (such as ISO 8601, UNIX timestamp, etc.). The specified parameter information refers to whether other system parameters (such as random number, user ID, session ID, etc.) are required in addition to the timestamp. In addition, the system parameter requirement information can also include legality verification information, which is used to understand how the target business system verifies the legality of these parameters (such as whether the timestamp is within the valid range, whether the random number meets a specific format or range).

[0043] The parameter generation tool calls a preset time library based on the parameter, and obtains the current time based on the time library.

[0044] In the embodiment, a programming language (such as Python, Java, JavaScript, etc.) is selected according to actual requirements to write the parameter generation tool. The time library refers to the time library corresponding to the programming language.

[0045] The current time is formatted based on the timestamp format to obtain the corresponding target time.

[0046] In the embodiment, the target time can be obtained by formatting the obtained current time into the required timestamp format.

[0047] The parameter generation tool calls a preset random number generator based on the parameter, and generates a specified parameter corresponding to the specified parameter information based on the random number generator.

[0048] In the embodiment, the specified parameter can be obtained by using the random number generator to generate the required other system parameters corresponding to the target business system.

[0049] The target time and the specified parameter are subjected to legality verification.

[0050] In the embodiment, the target time and the specified parameter can be subjected to legality verification according to the legality verification information included in the system parameter requirement information, and a corresponding legality verification result can be obtained. The legality verification result includes that the target time and the specified parameter both pass the legality verification, or that the target time and the specified parameter do not both pass the legality verification.

[0051] If the target time and the specified parameter both pass the legality verification, the system parameters corresponding to the target business system are generated based on the target time and the specified parameter.

[0052] In the embodiment, if the target time and the specified parameter pass the legality check, the target time and the specified parameter are integrated to obtain integrated data, and the integrated data are taken as the system parameter corresponding to the target business system.

[0053] The application obtains the system parameter requirement information corresponding to the target business system, then calls a preset time library based on the parameter generation tool, and obtains the current time based on the time library; and formats the current time based on the timestamp format to obtain the corresponding target time; then calls a preset random number generator based on the parameter generation tool, and generates the specified parameter corresponding to the specified parameter information based on the random number generator; subsequently, the target time and the specified parameter are subjected to legality check; if the target time and the specified parameter pass the legality check, the system parameter corresponding to the target business system is generated based on the target time and the specified parameter. By using the parameter generation tool, the application calls the preset time library to generate the target time corresponding to the timestamp format in the system parameter requirement information, and calls the preset random number generator to generate the specified parameter corresponding to the specified parameter information in the system parameter requirement information, and when it is detected that the target time and the specified parameter pass the legality check, the system parameter corresponding to the target business system can be quickly and accurately generated based on the obtained target time and specified parameter, the generation efficiency of the system parameter corresponding to the target business system is effectively improved, and the legality and accuracy of the system parameter are ensured.

[0054] In some optional implementation manners of the embodiment, before step S203, the electronic device can further perform the following steps: obtain the business data requirement information corresponding to the target business system based on a preset target file.

[0055] In the embodiment, the target file is an Excel file pre-constructed to record the business data type matching the target business system for test query, i.e., the business data requirement information. The business data requirement information can include at least the customer name, the ID card number, the ID card type, the query channel, the query reason, and the like. The business data requirement information corresponding to the target business system can be obtained by extracting information from the target file.

[0056] construct the corresponding data generation logic based on the business data requirement information.

[0057] In the embodiment, the construction of the data generation logic includes determining the format, range, constraint condition, etc. of the data. For example, the customer name can be a combination of randomly generated Chinese characters or selected from a preset name library. The certificate number is generated according to the certificate type to meet the format requirements. For example, for the Chinese ID number, it needs to follow the specific format and verification rules. The certificate type can be randomly selected from the preset certificate type list. The query channel can also be randomly selected from the preset channel list or customized according to the needs of the test scenario. The query reason can generate random text or randomly select from the preset reason list.

[0058] Based on the data generation logic, a corresponding script template is constructed.

[0059] In the embodiment, the corresponding script template can be written according to the constructed data generation logic. The script template can be written using programming languages such as Python, Java, etc., and related libraries or frameworks can be used to generate data. For example, the random library of Python can be used to generate random numbers and random text. The regular expression library is used to generate certificate numbers that meet specific formats. The preset name library, certificate type list, channel list and reason list are read from the database.

[0060] Based on the script template, the data generation script is generated.

[0061] In the embodiment, the script template constructed can be directly used as the data generation script. In addition, the data generation script can be further integrated into the above-mentioned automation engineering, so that it can be automatically called during subsequent test execution.

[0062] The application obtains the business data requirement information corresponding to the target business system based on the preset target file, then constructs the corresponding data generation logic based on the business data requirement information, and then constructs the corresponding script template based on the data generation logic. The application can intelligently and accurately construct a matching data generation script based on the obtained data generation logic, effectively improving the construction efficiency and construction intelligence of the data generation script. The use of the data generation script can automatically and quickly generate business data for testing, thereby improving the generation efficiency and generation intelligence of the business data.

[0063] In some optional implementations, before step S204, the electronic device can further perform the following steps: An initial parameter generation tool is obtained.

[0064] In the embodiment, the initial parameter generation tool can be a tool with a timestamp generation and other system parameter generation function pre-programmed by a language.

[0065] Obtain a preset test strategy.

[0066] In the embodiment, the strategy content of the test strategy can include performing unit testing, integration testing and system testing. The unit testing includes writing a unit test to verify the correctness and stability of the parameter generation tool. The integration testing includes performing integration testing to ensure compatibility with other components after integrating the parameter generation tool in the automation engineering. The system testing includes running the test in an actual production environment to verify whether the generated parameters can be correctly identified and verified by the system.

[0067] Test the initial parameter generation tool based on the test strategy.

[0068] In the embodiment, the initial parameter generation tool can be tested according to the strategy content of the test strategy, and a corresponding test result can be generated. If the initial parameter generation tool passes the unit testing, integration testing and system testing at the same time, it is determined that the initial parameter generation tool passes the test, otherwise it is determined that the initial parameter generation tool fails the test.

[0069] If the initial parameter generation tool passes the test, the initial parameter generation tool is used as the parameter generation tool.

[0070] In the embodiment, if the initial parameter generation tool passes the test, it indicates that the function and usability of the initial parameter generation tool meet the requirements, and then the initial parameter generation tool is used as the final parameter generation tool.

[0071] Integrate the parameter generation tool into the automation engineering.

[0072] In the embodiment, the parameter generation tool can be integrated into the automation engineering through API calling, so that it can be automatically called in subsequent test execution.

[0073] The application obtains an initial parameter generation tool constructed in advance, then obtains a preset test strategy, tests the initial parameter generation tool based on the test strategy, takes the initial parameter generation tool as the parameter generation tool if the initial parameter generation tool passes the test, and integrates the parameter generation tool into the automation engineering subsequently. After obtaining the initial parameter generation tool constructed in advance, the application intelligently tests the initial parameter generation tool based on the test strategy, and takes the initial parameter generation tool passing the test as the final parameter generation tool, so that the performance and availability of the generated parameter generation tool can be effectively ensured. In addition, the parameter generation tool is integrated into the automation engineering, so that the parameter generation tool can be automatically called during subsequent test execution.

[0074] In some optional implementations, after step S206, the electronic device described above can further perform the following steps: When a trigger condition of a target test task corresponding to the target business system is met, the target test task is invoked and executed based on the automation engineering to read out the target test data from the target storage medium.

[0075] In this embodiment, in the automation engineering, a Quartz or other task scheduling framework can be used to configure a Job task registry center. A Job class is written to implement specific test task logic corresponding to the target business system. In the Job class, a test task corresponding to the target business system is triggered according to a custom parameter (such as a batch number, a query reason, etc.). The state and log information of the test task can be recorded during the execution of the test task. The Job task registry center is well supported by the automation engineering, which realizes the "full automation" of the entire batch pedestrian query scene, and integrates batch triggering and assertion into the automation scene case.

[0076] After the target test task is executed using the automation engineering, the required target test data is read out from the target storage medium corresponding to the target business system. The batch query mode can be used for data reading. The business data contained in the target test data can be query data corresponding to the requirements of the pedestrian credit second-generation query. In addition, the batch data to be processed can be queried from the target storage medium. Then the batch data is traversed, and the list is thrown piece by piece. In addition, for the historical failed batch, retry operation is performed, and the retry number and result are recorded. The task state in the target storage medium is updated to "querying / retrying".

[0077] A corresponding query request is constructed based on the target test data.

[0078] In the embodiment, a corresponding query request can be constructed according to the obtained target test data. Specifically, the query request can be constructed by setting query parameters and constructing a request body.

[0079] The query request is sent to the target business system, and query response data returned by the target business system is received.

[0080] In the embodiment, the query API of the target business system can be called by using an HTTP client to send a query request. The query response data returned by the target business system is received. The query response data is usually a JSON or XML format data packet, which contains query results and related metadata. The query response data can be parsed to extract useful information (such as query results, error information, etc.).

[0081] Based on the query response data, the data state of the target test data is updated.

[0082] In the embodiment, the data state of the corresponding batch in the target storage medium can be updated to "success" or "failure" according to the received query response result. This helps to track the execution result of the query task.

[0083] Based on the preset target test framework, the query response data is subjected to assertion processing to obtain a corresponding assertion processing result.

[0084] In the embodiment, the target test framework can be TestNG framework. The specific implementation process of the assertion processing of the query response data based on the preset target test framework to obtain the corresponding assertion processing result will be further described in detail in subsequent specific embodiments, and will not be described in detail here.

[0085] In addition, libraries such as Mockito can also be used to write Mock service classes to simulate the behavior of the target business system to be tested. Then, different Mock scenarios are configured according to the mockId mark in the Excel file. During the test execution phase, Mock services are called according to the scenario to complete the data loop of the automated test.

[0086] When the trigger condition of the target test task corresponding to the target business system is met, the target test task is invoked and executed based on the automation engineering, so as to read the target test data from the target storage medium; then a corresponding query request is constructed based on the target test data; then the query request is sent to the target business system, and the query response data returned by the target business system is received; subsequently, the target test data is updated in data state based on the query response data; and the query response data is processed by assertion based on the preset target test framework, to obtain a corresponding assertion processing result. When it is detected that the trigger condition of the target test task corresponding to the target business system is met, the target test data is used to automatically and effectively execute the target test task corresponding to the target business system based on the use of the automation engineering, so that the test efficiency and test intelligence of the query test on the target business system are improved. In addition, the query response data is processed by assertion intelligently based on the use of the target test framework, so that the function and performance of the target business system can be automatically verified whether they meet the expectation.

[0087] In some optional implementation manners of the embodiment, the assertion processing of the query response data based on the preset target test framework to obtain a corresponding assertion processing result comprises the following steps: Based on the target test framework, the status code, the response header and the response body of the query response data are obtained.

[0088] In the embodiment, the target test framework can specifically adopt a TestNG test framework. Logical assertion and data assertion are managed by using TestNG data driving and JAVA object-oriented design. Flexible horizontal expansion capability and logical reuse of common scenarios can be achieved for different associated party query scenarios, so as to reduce the amount of automatic code of newly added scenarios and subsequent operation and maintenance cost.

[0089] The corresponding status code, response header and response body can be extracted by data analysis of the query response data.

[0090] The status code is processed by assertion to obtain a corresponding first processing result.

[0091] In the embodiment, the assertion processing of the status code comprises verifying whether the status code of the query response data meets the expectation (for example, 200 indicates success). The content of the first processing result comprises that the status code meets the expectation or the status code does not meet the expectation.

[0092] The response header is processed by assertion to obtain a corresponding second processing result.

[0093] In the embodiment, the assertion processing on the response header includes verifying whether a specific field in the response header exists and is correct (such as Content-Type, Date, etc.). The content of the second processing result includes that the response header is expected or the response header is not expected.

[0094] The response body is subjected to assertion processing to obtain a corresponding third processing result.

[0095] In the embodiment, the assertion processing on the response body includes verifying whether the content of the response body is expected (such as the value of a field in JSON format data). The content of the second processing result includes that the response body is expected or the response body is not expected.

[0096] The assertion processing result is generated based on the first processing result, the second processing result, and the third processing result.

[0097] In the embodiment, the assertion processing result can be obtained by integrating the obtained first processing result, second processing result, and third processing result.

[0098] The application obtains the status code, response header, and response body of the query response data based on the target test framework, then subjects the status code to assertion processing to obtain a corresponding first processing result, subjects the response header to assertion processing to obtain a corresponding second processing result, and subjects the response body to assertion processing to obtain a corresponding third processing result, and subsequently generates the assertion processing result based on the first processing result, the second processing result, and the third processing result. By using the target test framework, the application first obtains the status code, response header, and response body of the query response data, then subjects the status code, response header, and response body of the query response data to assertion processing, so that the first processing result, second processing result, and third processing result can be combined to intelligently and accurately generate the corresponding assertion processing result, thereby improving the data accuracy of the generated assertion processing result.

[0099] In some optional implementation manners of the embodiment, after the step of subjecting the query response data to assertion processing based on the preset target test framework to obtain a corresponding assertion processing result, the electronic device can further perform the following steps: After the target test task is executed, test process data corresponding to the target test task is collected.

[0100] In the embodiment, the test process data can at least include test execution data, defect data and log information. The test execution data includes the execution time, execution result (success / failure), failure reason, etc. of the target test task. The defect data includes defect information found in the test process, including defect ID, defect description, defect level, discovery time, repair time, etc. The log information includes log information collected in the test execution process, including system log, application log, test framework log, etc. to facilitate problem positioning when problems occur.

[0101] The test process data is subjected to test evaluation processing to obtain a corresponding evaluation result.

[0102] In the embodiment, the number of defects found in the test process, and the level and distribution of these defects can be counted according to the test process data. The relationship between the defect discovery rate and the number of test executions is then analyzed to evaluate the efficiency and effectiveness of the test to obtain the corresponding evaluation result.

[0103] A corresponding target test report is generated based on the test process data and the evaluation result.

[0104] In the embodiment, the test process data and the evaluation result can be filled into the corresponding positions in the preset test report template to generate the corresponding target test report. The test report template is a template file containing process data area and result area, which is constructed in advance according to actual business needs.

[0105] The target test report is subjected to storage processing.

[0106] In the embodiment, the storage method of the target test report is not limited, for example, database storage, cloud server storage, blockchain storage, etc.

[0107] After the target test task is executed, the test process data corresponding to the target test task is collected, and the test process data is subjected to test evaluation processing to obtain a corresponding evaluation result. Then, a corresponding target test report is generated based on the test process data and the evaluation result. The target test report is subjected to storage processing. After the target test task is executed, the test process data corresponding to the target test task is automatically and intelligently collected, and the test process data is subjected to test evaluation processing to obtain a corresponding evaluation result. Then, a corresponding target test report is generated based on the test process data and the evaluation result, thereby realizing the automatic generation of the target test report, improving the generation efficiency and intelligence of the target test report. The target test report is subjected to storage processing to ensure the data security of the target test report.

[0108] In some optional implementations, the acquired user information seeks user consent and complies with relevant laws and relevant policies.

[0109] In addition, the non-company software tools or components appearing in the embodiments of the present application are only examples and do not represent actual use.

[0110] It should be understood that the size of the serial number of each step in the above embodiments does not mean the order of execution, and the execution order of each process should be determined according to its function and inherent logic, and should not constitute any limitation on the implementation process of the embodiments of the present application.

[0111] It should be emphasized that in order to further ensure the privacy and security of the above target test data, the above target test data can also be stored in a node of a block chain.

[0112] The blockchain referred to in the present application is a new application mode of distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm and other computer technologies. Blockchain, in essence, is a decentralized database, which is a series of data blocks associated using cryptographic methods, each data block contains a batch of network transaction information, used to verify the validity (anti-fake) of the information and generate the next block. The blockchain can include a blockchain underlying platform, a platform product service layer, and an application service layer.

[0113] The embodiments of the present application can acquire and process related data based on artificial intelligence technology. Among them, artificial intelligence (Artificial Intelligence, AI) is to use digital computers or computer-controlled machines to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results. Theory, method, technology and application system. The basic technology of artificial intelligence generally includes technologies such as sensors, special artificial intelligence chips, cloud computing, distributed storage, big data processing technology, operation / interaction system, mechatronics, etc. The software technology of artificial intelligence mainly includes computer vision technology, robot technology, biometric technology, speech processing technology, natural language processing technology, and machine learning / deep learning, etc. Several major directions.

[0114] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiment methods can be completed by instructing relevant hardware through computer readable instructions, and the computer readable instructions can be stored in a computer readable storage medium. When the program is executed, it can include the processes of the above-mentioned embodiment methods. Among them, the storage medium can be a non-volatile storage medium such as a magnetic disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).

[0115] It should be understood that although each step in the flowchart of the accompanying drawings is shown in sequence according to the direction of the arrow, these steps are not necessarily executed in sequence according to the direction of the arrow. Unless otherwise specified herein, the execution of these steps is not strictly limited in sequence, and they can be executed in other orders. Moreover, at least part of the steps in the flowchart of the accompanying drawings can include multiple sub-steps or multiple stages, which are not necessarily executed at the same time, but can be executed at different times, and the execution sequence is not necessarily sequential, but can be alternately executed with other steps or sub-steps or stages of other steps.

[0116] Further referring to Figure 3 , as an implementation of the method shown in the above Figure 2 , the present application provides an embodiment of a test data generation device, which corresponds to the method embodiment shown in Figure 2 , and the device can be applied to various electronic devices.

[0117] As shown in Figure 3 , the test data generation device 300 of the present embodiment includes a judgment module 301, a loading module 302, a first generation module 303, a second generation module 304, a third generation module 305, and a first storage module 306. Among them: The judgment module 301 is configured to determine whether a data generation request corresponding to a target business system to be tested triggered by a user is received; The loading module 302 is configured to load a preset automation project if the data generation request is received; The first generation module 303 is configured to call an embedded data generation script based on the automation project, and generate business data corresponding to the target business system based on the data generation script; The second generation module 304 is configured to call an embedded parameter generation tool based on the automation project, and generate system parameters corresponding to the target business system based on the parameter generation tool; The third generation module 305 is configured to generate corresponding target test data based on the service data and the system parameter. The first storage module 306 is configured to store the target test data into a target storage medium corresponding to the target service system.

[0118] In the embodiment, the above modules or units are respectively used for performing operations corresponding to the steps of the test data generation method of the foregoing embodiments, and thus will not be described here.

[0119] In some optional implementations of the embodiment, the second generation module 304 includes: A first acquisition sub-module is configured to acquire system parameter requirement information corresponding to the target service system, wherein the system parameter requirement information at least includes timestamp format and designated parameter information; A second acquisition sub-module is configured to call a preset time library based on the parameter generation tool, and acquire a current time based on the time library; A formatting sub-module is configured to perform format processing on the current time based on the timestamp format to obtain a corresponding target time; A first generation sub-module is configured to call a preset random number generator based on the parameter generation tool, and generate a designated parameter corresponding to the designated parameter information based on the random number generator; A verification sub-module is configured to perform legality verification on the target time and the designated parameter; A second generation sub-module is configured to generate a system parameter corresponding to the target service system based on the target time and the designated parameter if the target time and the designated parameter both pass the legality verification.

[0120] In some optional implementations of the embodiment, the test data generation apparatus further includes: A first acquisition module is configured to acquire service data requirement information corresponding to the target service system based on a preset target file; A first construction module is configured to construct corresponding data generation logic based on the service data requirement information; A second construction module is configured to construct a corresponding script template based on the data generation logic; A fourth generation module is configured to generate the data generation script based on the script template.

[0121] In some optional implementations of the embodiment, the test data generation apparatus further includes: A second acquisition module is configured to acquire a pre-constructed initial parameter generation tool; A third acquisition module is configured to acquire a preset test strategy; a testing module, configured to test the initial parameter generation tool based on the test strategy; a determination module, configured to determine that the initial parameter generation tool is the parameter generation tool if the initial parameter generation tool passes the test; an integration module, configured to integrate the parameter generation tool into the automation engineering.

[0122] In some optional implementations of the embodiment, the test data generation apparatus further includes: a reading module, configured to read out the target test data from the target storage medium based on the automation engineering when a trigger condition of a target test task corresponding to the target business system is met, and invoke and execute the target test task; a third construction module, configured to construct a corresponding query request based on the target test data; a sending module, configured to send the query request to the target business system, and receive query response data returned by the target business system; an updating module, configured to perform data state updating processing on the target test data based on the query response data; an assertion module, configured to perform assertion processing on the query response data based on a preset target test framework, to obtain a corresponding assertion processing result.

[0123] In some optional implementations of the embodiment, the assertion module includes: a third acquisition sub-module, configured to acquire a status code, a response header and a response body of the query response data based on the target test framework; a first processing sub-module, configured to perform assertion processing on the status code, to obtain a corresponding first processing result; a second processing sub-module, configured to perform assertion processing on the response header, to obtain a corresponding second processing result; a third processing sub-module, configured to perform assertion processing on the response body, to obtain a corresponding third processing result; a third generation sub-module, configured to generate the assertion processing result based on the first processing result, the second processing result and the third processing result.

[0124] In some optional implementations of the embodiment, the test data generation apparatus further includes: a collection module, configured to collect test process data corresponding to the target test task after the target test task is executed; an evaluation module, configured to perform test evaluation processing on the test process data, to obtain a corresponding evaluation result; A fifth generation module is configured to generate a target test report corresponding to the test process data and the evaluation result; A second storage module is configured to store the target test report.

[0125] To solve the above technical problems, the embodiments of the present application further provide a computer device. For details, please refer to Figure 4 , Figure 4 The basic structure block diagram of the computer device is shown in the figure.

[0126] The computer device 4 comprises a memory 41, a processor 42 and a network interface 43 which are connected to each other through a system bus. It should be noted that only the computer device 4 with components 41-43 is shown in the figure, but it should be understood that all the shown components are not required to be implemented, and more or less components can be alternatively implemented. Among them, those skilled in the art can understand that the computer device herein is a device capable of automatically performing numerical calculation and / or information processing according to pre-set or stored instructions, and its hardware includes but is not limited to microprocessors, application specific integrated circuits (ASICs), field programmable gate arrays (FPGAs), digital signal processors (DSPs), embedded devices, etc.

[0127] The computer device can be a desktop computer, a notebook computer, a palm computer, a cloud server and other computing devices. The computer device can interact with the user through a keyboard, a mouse, a remote controller, a touchpad or a voice control device.

[0128] The memory 41 includes at least one type of readable storage medium, such as a flash memory, a hard disk, a multimedia card, a card-type memory (e.g., an SD or DX memory, etc.), a random access memory (RAM), a static random access memory (SRAM), a read-only memory (ROM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (PROM), a magnetic memory, a magnetic disk, an optical disk, etc. In some embodiments, the memory 41 can be an internal storage unit of the computer device 4, such as a hard disk or a memory of the computer device 4. In other embodiments, the memory 41 can also be an external storage device of the computer device 4, such as a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card, etc. equipped on the computer device 4. Of course, the memory 41 can also include both an internal storage unit and an external storage device of the computer device 4. In this embodiment, the memory 41 is generally used to store an operating system and various application software installed on the computer device 4, such as computer readable instructions of the test data generation method, etc. In addition, the memory 41 can also be used to temporarily store various data that have been output or will be output.

[0129] The processor 42 can be a central processing unit (CPU), a controller, a microcontroller, a microprocessor, or other data processing chip in some embodiments. The processor 42 is generally used to control the overall operation of the computer device 4. In this embodiment, the processor 42 is used to run computer readable instructions or process data stored in the memory 41, such as computer readable instructions of the test data generation method.

[0130] The network interface 43 can include a wireless network interface or a wired network interface, and is generally used to establish a communication connection between the computer device 4 and other electronic devices.

[0131] The present application also provides another embodiment, i.e., to provide a computer readable storage medium storing computer readable instructions, which can be executed by at least one processor to make the at least one processor perform the steps of the test data generation method as described above.

[0132] Those skilled in the art can clearly understand the above-mentioned embodiment method can be realized by means of software and the necessary general hardware platform, of course, it can also be realized by hardware, but in many cases, the former is a better embodiment. Based on such understanding, the technical solutions of the present application can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk) and includes a plurality of instructions for making a terminal device (which can be a mobile phone, computer, server, air conditioner, or network device, etc.) execute the methods described in various embodiments of the present application.

[0133] Obviously, the above-described embodiments are only some of the embodiments of the present application, not all the embodiments, and the drawings show the preferred embodiments of the present application, but do not limit the patent scope of the present application. The present application can be implemented in many different forms, and conversely, the purpose of providing these embodiments is to make the disclosure of the present application more thorough and comprehensive. Although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art can still modify the technical solutions recorded in the foregoing specific embodiments, or make equivalent replacements to some of the technical features. Any equivalent structure made by using the content of the specification and drawings, directly or indirectly applied to other related technical fields, is also within the scope of the patent protection of the present application.

Claims

1. A method of generating test data, characterized by, The method comprises the following steps: determining whether a user-triggered data generation request corresponding to a target business system to be tested is received; if yes, loading a preset automation project; calling an embedded data generation script based on the automation project, and generating business data corresponding to the target business system based on the data generation script; calling an embedded parameter generation tool based on the automation project, and generating system parameters corresponding to the target business system based on the parameter generation tool; generating corresponding target test data based on the business data and the system parameters; storing the target test data into a target storage medium corresponding to the target business system.

2. The method of claim 1, wherein, The step of generating system parameters corresponding to the target business system based on the parameter generation tool specifically comprises: obtaining system parameter requirement information corresponding to the target business system; wherein the system parameter requirement information at least includes a timestamp format and specified parameter information; calling a preset time library based on the parameter generation tool, and obtaining a current time based on the time library; formatting the current time based on the timestamp format to obtain corresponding target time; calling a preset random number generator based on the parameter generation tool, and generating a specified parameter corresponding to the specified parameter information based on the random number generator; performing legality verification on the target time and the specified parameter; if both the target time and the specified parameter pass the legality verification, generating system parameters corresponding to the target business system based on the target time and the specified parameter.

3. The method of claim 1, wherein, Before the step of calling the embedded data generation script based on the automation project, the method further comprises: obtaining business data requirement information corresponding to the target business system based on a preset target file; constructing corresponding data generation logic based on the business data requirement information; constructing a corresponding script template based on the data generation logic; generating the data generation script based on the script template.

4. The method of claim 1, wherein, Before the step of calling the embedded parameter generation tool based on the automation project, the method further comprises: obtaining a pre-constructed initial parameter generation tool; obtaining a preset test strategy; testing the initial parameter generation tool based on the test strategy; if the initial parameter generation tool passes the test, taking the initial parameter generation tool as the parameter generation tool; integrating the parameter generation tool into the automation project.

5. The method of claim 1, wherein, After the step of storing the target test data into the target storage medium corresponding to the target business system, the method further comprises: when a trigger condition of a target test task corresponding to the target business system is met, calling and executing the target test task based on the automation project to read out the target test data from the target storage medium; constructing a corresponding query request based on the target test data; sending the query request to the target business system, and receiving query response data returned by the target business system; updating the target test data based on the query response data; performing data state updating processing on the target test data based on the query response data; The query response data is subjected to assertion processing based on a preset target test framework, to obtain a corresponding assertion processing result.

6. The method of claim 5, wherein, The step of subjecting the query response data to assertion processing based on a preset target test framework to obtain a corresponding assertion processing result specifically includes: Based on the target test framework, the state code, response header and response body of the query response data are obtained; The state code is subjected to assertion processing to obtain a corresponding first processing result; The response header is subjected to assertion processing to obtain a corresponding second processing result; The response body is subjected to assertion processing to obtain a corresponding third processing result; The first processing result, the second processing result and the third processing result are used to generate the assertion processing result.

7. The method of claim 5, wherein, After the step of subjecting the query response data to assertion processing based on a preset target test framework to obtain a corresponding assertion processing result, the method further includes: After the target test task is executed, test process data corresponding to the target test task is collected; The test process data is subjected to test evaluation processing to obtain a corresponding evaluation result; The test process data and the evaluation result are used to generate a corresponding target test report; The target test report is subjected to storage processing.

8. An apparatus for generating test data, characterized by It includes: A judgment module is configured to determine whether a data generation request corresponding to a target business system to be tested triggered by a user is received; A loading module is configured to load a preset automation engineering if the data generation request is received; A first generation module is configured to call an embedded data generation script based on the automation engineering, and generate business data corresponding to the target business system based on the data generation script; A second generation module is configured to call an embedded parameter generation tool based on the automation engineering, and generate system parameters corresponding to the target business system based on the parameter generation tool; A third generation module is configured to generate target test data based on the business data and the system parameters; A first storage module is configured to store the target test data into a target storage medium corresponding to the target business system.

9. A computer device, comprising: The memory and the processor are included, the memory has computer readable instructions stored therein, and the processor implements the steps of the test data generation method according to any one of claims 1 to 7 when executing the computer readable instructions.

10. A computer-readable storage medium, characterized in that, The computer readable storage medium has computer readable instructions stored thereon, and the computer readable instructions are executed by the processor to implement the steps of the test data generation method according to any one of claims 1 to 7.