CN114595159B - Test data generation method, device, equipment and storage medium - Google Patents

Test data generation method, device, equipment and storage medium Download PDF

Info

Publication number
CN114595159B
CN114595159B CN202210500979.3A CN202210500979A CN114595159B CN 114595159 B CN114595159 B CN 114595159B CN 202210500979 A CN202210500979 A CN 202210500979A CN 114595159 B CN114595159 B CN 114595159B
Authority
CN
China
Prior art keywords
tested
service system
test data
database
test
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202210500979.3A
Other languages
Chinese (zh)
Other versions
CN114595159A (en
Inventor
赵鹏飞
纪海音
游妍
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Taiping Finance Technology Services Shanghai Co ltd
Original Assignee
Taiping Finance Technology Services Shanghai Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Taiping Finance Technology Services Shanghai Co ltd filed Critical Taiping Finance Technology Services Shanghai Co ltd
Priority to CN202210500979.3A priority Critical patent/CN114595159B/en
Publication of CN114595159A publication Critical patent/CN114595159A/en
Application granted granted Critical
Publication of CN114595159B publication Critical patent/CN114595159B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Computational Linguistics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The application relates to a test data generation method, a device, equipment and a storage medium, wherein the method comprises the following steps: determining a service system to be tested from a link, wherein the link comprises a plurality of service systems; acquiring test parameters of a service system to be tested, wherein the test parameters are used for representing conditions for generating test data; based on the service system to be tested and the test parameters, obtaining test data corresponding to the test parameters from a preset database corresponding to the service system to be tested; the preset database stores test data corresponding to the service system to be tested. The technical scheme provided by the embodiment of the application can improve the efficiency of generating the test data of the service system to be tested.

Description

Test data generation method, device, equipment and storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a method, an apparatus, a device, and a storage medium for generating test data.
Background
With the rapid development of information system construction, large-scale business systems are increasingly applied in daily work management. A large service system generally includes a plurality of service systems, and service data is circulated among the plurality of service systems to form a link. When a service test is performed on a certain service system in a link, upstream and downstream service data of the service system need to be used as test data.
In the conventional method, when test data of a service system to be tested is acquired, the test data is manually entered into the service system to be tested and an upstream service system of the service system to be tested, and then the test data is transferred and processed by the service systems to generate the test data of the service system to be tested. Then, the business system to be tested can be tested based on the test data of the business system to be tested.
However, with the increasing of links, when obtaining the test data of the service system to be tested, the test data needs to be manually entered into the service system to be tested and the upstream service system of the service system to be tested, respectively.
Disclosure of Invention
Based on this, the embodiment of the application provides a method, a device, equipment and a storage medium for generating test data, which can improve the efficiency of generating the test data of the service system to be tested.
In a first aspect, a test data generation method is provided, and the method includes:
determining a service system to be tested from a link, wherein the link comprises a plurality of service systems; acquiring test parameters of a service system to be tested, wherein the test parameters are used for representing conditions for generating test data; based on the service system to be tested and the test parameters, obtaining test data corresponding to the test parameters from a preset database corresponding to the service system to be tested; the preset database stores test data corresponding to the service system to be tested.
In one embodiment, acquiring test data corresponding to a test parameter from a preset database corresponding to a service system to be tested based on the service system to be tested and the test parameter includes:
and based on the service system to be tested and the test parameters, controlling the database operation script to acquire the test data corresponding to the test parameters from a preset database corresponding to the service system to be tested.
In one embodiment, the database operation script comprises a database lookup script; based on the service system to be tested and the test parameters, the method for controlling the database operation script to obtain the test data corresponding to the test parameters from the preset database corresponding to the service system to be tested comprises the following steps:
and based on the service system to be tested and the test parameters, controlling the database to search the script to search the test data corresponding to the test parameters from the preset database corresponding to the service system to be tested.
In one embodiment, the database operation script further comprises a database insertion script; based on the service system to be tested and the test parameters, the method for controlling the search script to search the test data corresponding to the test parameters from the preset database corresponding to the service system to be tested comprises the following steps:
acquiring target test data corresponding to the test parameters based on the test parameters; and when the test data corresponding to the test parameters are not searched in the preset database corresponding to the service system to be tested, controlling the database to insert the script into the preset database corresponding to the service system to be tested based on the service system to be tested and the test parameters, and inserting the target test data.
In one embodiment, the database operation script further comprises a database update script; based on the service system to be tested and the test parameters, the method for controlling the database operation script to obtain the test data corresponding to the test parameters from the preset database corresponding to the service system to be tested comprises the following steps:
and controlling the database updating script to update the test data corresponding to the test parameters in a preset database corresponding to the service system to be tested based on the service system to be tested and the test parameters.
In one embodiment, the method for determining the test parameters comprises the following steps:
acquiring a service system to be tested and a plurality of service nodes corresponding to an upstream service system of the service system to be tested; the service node is used for representing the state of the test data; test parameters are selected from a plurality of service nodes.
In one embodiment, after obtaining test data corresponding to the test parameters from a preset database corresponding to the service system to be tested based on the service system to be tested and the test parameters, the method includes:
acquiring a first test result obtained by testing the to-be-tested service system based on the test data; and verifying the first test result based on the test data to obtain a verification result.
In a second aspect, there is provided a test data generating apparatus, the apparatus comprising:
the system comprises a determining module, a judging module and a judging module, wherein the determining module is used for determining a service system to be tested from a link, and the link comprises a plurality of service systems;
the first acquisition module is used for acquiring test parameters of the service system to be tested, and the test parameters are used for representing conditions for generating test data;
the second acquisition module is used for acquiring test data corresponding to the test parameters from a preset database corresponding to the service system to be tested based on the service system to be tested and the test parameters; the preset database stores test data corresponding to the service system to be tested.
In a third aspect, a computer device is provided, comprising a memory and a processor, the memory storing a computer program, and the computer program, when executed by the processor, implementing the method steps in any of the embodiments of the first aspect.
In a fourth aspect, a computer-readable storage medium is provided, on which a computer program is stored, which computer program, when being executed by a processor, carries out the method steps of any of the embodiments of the first aspect described above.
The test data generation method, the test data generation device, the test data generation equipment and the test data generation storage medium determine the service system to be tested from a plurality of service systems in the link; acquiring test parameters of a service system to be tested; and acquiring test data corresponding to the test parameters from a preset database corresponding to the service system to be tested based on the service system to be tested and the test parameters. In the technical scheme provided by the embodiment of the application, compared with the traditional method, the test data corresponding to the service system to be tested is stored in the preset database, and the corresponding test data is obtained from the preset database by running the background program, so that the test data does not need to be manually input into each service system in a link, and the efficiency of generating the test data of the service system to be tested is improved.
Drawings
FIG. 1 is a diagram of an application environment according to an embodiment of the present application;
fig. 2 is a flowchart of a test data generation method according to an embodiment of the present disclosure;
FIG. 3 is a flowchart illustrating insertion of test data into a default database according to an embodiment of the present disclosure;
FIG. 4 is a flowchart of determining test parameters according to an embodiment of the present application;
fig. 5 is a flowchart illustrating a test of a service system to be tested based on test data according to an embodiment of the present application;
FIG. 6 is a block diagram for generating test data architecture according to an embodiment of the present application;
fig. 7 is a flowchart of a test data generation method according to an embodiment of the present application;
fig. 8 is a block diagram of a test data generation apparatus according to an embodiment of the present application;
fig. 9 is a block diagram of a computer device according to an embodiment of the present application.
Detailed Description
To make the objects, technical solutions and advantages of the present application more clear, the following detailed description of the embodiments of the present application will be made with reference to the accompanying drawings.
The test data generation method provided by the application can be applied to the application environment shown in fig. 1. The system comprises a test data management platform and a link, wherein the test data management platform is used for controlling a database operation script and displaying and maintaining generated test data. The link can comprise a plurality of service systems, namely a source service system, at least one midstream system and a tail end service system. Each service system corresponds to a service scene, and each service system can be used as a service system to be tested. Each service system is provided with a corresponding front-end page and a corresponding background database, and the front-end page of the test data management platform is associated with the background database of each service system. The test data management platform and each service system may be a computer device, the computer device may be a server or a terminal, where the server may be one server or a server cluster composed of multiple servers, and the terminal may be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers, and portable wearable devices.
The test data generation method provided by the present application may be applied to a computer device corresponding to a test data management platform, it should be noted that an execution subject of the present application embodiment may be a computer device, and may also be a test data generation apparatus, and the following method embodiment is described with a computer device as an execution subject.
In one embodiment, as shown in fig. 2, which shows a flowchart of a test data generation method provided in an embodiment of the present application, the method may include the following steps:
step 220, determining a service system to be tested from a link, wherein the link comprises a plurality of service systems.
The link is a complete system formed by a plurality of service systems according to the data flow direction, and a complete data flow can flow on the link at one time. The service systems in the link may include a source service system, an end service system, and at least one midstream system. For example, for the service of the existing paperless job-going process, the sequence of the service systems involved in the process is as follows: the system comprises an enterprise system, a marketing system, a training system, an attendance system and a people management system, wherein the five systems form a link. The enterprise system is a source business system in a link, the people management system is a tail end business system in the link, and the marketing system, the training system and the attendance system are midstream systems in the link, so that a user data is required to be transferred between the enterprise system and the people management system when the work-on-duty process is completed. The service system to be tested is any one of the service systems in the link, and in practice, each service system in the link needs to be tested, so that when test data is generated, the service system to be tested can be determined from the link according to actual test requirements.
And 240, acquiring test parameters of the service system to be tested, wherein the test parameters are used for representing conditions for generating test data.
The test parameters are conditions for characterizing generation of test data, and may include states of the test data, where the states of the test data correspond to service nodes in different service systems, and the test parameters may also include other parameters, such as a test data type, a test data amount, a test data range, and the like. For the information registration service system, the service node may include two nodes, i.e., an information registration success node and an information registration failure node, and accordingly, the state of the test data may be an information registration success node or an information registration failure node, and the test parameter of the service system to be tested may be determined according to the data state included in the service system.
Step 260, acquiring test data corresponding to the test parameters from a preset database corresponding to the service system to be tested based on the service system to be tested and the test parameters; the preset database stores test data corresponding to the service system to be tested.
After determining the service system to be tested and obtaining the test parameters of the service system to be tested, the test data corresponding to the test parameters can be obtained from the preset database corresponding to the service system to be tested according to the service system to be tested and the corresponding test parameters. Each service system in the link corresponds to a background database, the service systems to be tested can correspond to the preset database one by one, or the service systems to be tested can correspond to a plurality of background databases, that is, the background databases of the service systems to be tested can be associated with the background databases of other service systems. Therefore, the test data can be obtained from the preset database of the service system to be tested based on the test parameters, and the corresponding test data can also be obtained from the preset databases of other service systems.
The preset database stores test data corresponding to the service system to be tested, where the test data in the preset database may be a large amount of test data manually entered in advance on different service systems, may also be a large amount of test data randomly generated by creating a new database, or may be a preset database generated in other manners, which is not specifically limited in this embodiment.
In the embodiment, a service system to be tested is determined from a plurality of service systems in a link; acquiring test parameters of a service system to be tested; and acquiring test data corresponding to the test parameters from a preset database corresponding to the service system to be tested based on the service system to be tested and the test parameters. Compared with the traditional method, the test data corresponding to the service system to be tested is stored in the preset database, and the corresponding test data is obtained from the preset database by running the background program, so that the test data does not need to be manually input into each service system in the link, and the efficiency of generating the test data of the service system to be tested is improved.
In one embodiment, based on the service system to be tested and the test parameters, obtaining the test data corresponding to the test parameters from the preset database corresponding to the service system to be tested includes: and based on the service system to be tested and the test parameters, controlling the database operation script to acquire the test data corresponding to the test parameters from a preset database corresponding to the service system to be tested.
When the test data corresponding to the test parameters are acquired from the preset database corresponding to the service system to be tested based on the service system to be tested and the test parameters, the pre-programmed database operation script is called to run in the background, so that the test data corresponding to the test parameters are acquired from the preset database corresponding to the service system to be tested according to different database operation scripts. The database operation script can be determined according to the type of the corresponding database, and different types of databases can correspond to different sql scripts.
The database operation script may be different scripts written for different service nodes in the service system, and the database operation script may include a database lookup script, a database insertion script, a database update script, and the like, and may also include scripts for performing other operations on the database. The database update script may also include a database delete script, a database modification script, and the like. When the control database operation script obtains the test data corresponding to the test parameters from the preset database corresponding to the service system to be tested, a plurality of operation scripts can be controlled simultaneously, and one operation script can be controlled in sequence.
When the database operation script is written in advance, different database operation scripts can be written according to the corresponding test parameters, and the pre-written database operation script can be stored in the bottom layer XML file. The database operation script in the XML file may be stored according to the following specifications: firstly, the XML file may include a plurality of nodes, and different database operation scripts written according to corresponding test parameters may be classified and placed into different nodes, for example, a database search script is placed into a corresponding < Select > node, a database delete script is placed into a corresponding < delete > node, a database insert script is placed into a corresponding < insert > node, and a database modify script is placed into a corresponding < update > node; secondly, the corresponding database operation script needs to define the data type stored in the preset database in advance, and the data type needs to correspond to the name displayed by the front-end page one to one, for example, if the front-end page is displayed as "male", the data type in the preset database is "1", the front-end page is displayed as "female", and the data type in the preset database is "2"; finally, the corresponding database operation script needs to define the number of fields corresponding to the test parameters in advance, for example, the successful information registration may include four fields: name, gender, customer ID, and registration progress (1 for successful registration, 2 for failed registration).
Further, the corresponding database operation script can be called from the XML file according to the following specifications: the database operation script can be obtained from the corresponding node in the XML file through the test parameter and the node identifier corresponding to the database operation script in the XML file, and then the test parameter is filled in the database operation script and executed.
Under the condition that one operation script is sequentially controlled to obtain test data corresponding to the test parameters from a preset database corresponding to the service system to be tested, optionally, the database operation script can comprise a database searching script; the database lookup script may be preferentially executed, so that the database lookup script is controlled to search the test data corresponding to the test parameter from the preset database corresponding to the service system to be tested based on the service system to be tested and the test parameter.
When the database search script is executed, if... else logic judgment is carried out on the inquired result, and if the inquired result is not null, the inquired result is used as the generated test data. When the test data corresponding to the test parameters are searched in the preset database, the test data stored in the preset database has the corresponding data type, namely the identification information of the test data, so that the corresponding test data can be searched according to the identification information. Taking the information registration service system as an example, the service node may include two nodes, that is, information registration success and information registration failure, and accordingly, the test parameter may be information registration success or information registration failure, in the preset database corresponding to the information registration service system, the identification information of the test data corresponding to the information registration success may be 1, and the identification information of the test data corresponding to the information registration failure may be 2, so that the test data corresponding to the information registration success or the test data corresponding to the information registration failure may be found according to the identification information.
The test data can be displayed on a front-end page of the test data management platform, and the query result can include all test data corresponding to the test parameters; if the query result is null, it indicates that there is no test data corresponding to the test parameters, and then a database insert script needs to be executed. The above database operation script further includes a database insertion script, and when no test data is found, corresponding test data needs to be inserted into the preset database, as shown in fig. 3, which shows a flowchart of a test data generation method provided in an embodiment of the present application, and specifically relates to a possible process of inserting test data into the preset database, where the method may include the following steps:
and step 320, acquiring target test data corresponding to the test parameters based on the test parameters.
And 340, when the test data corresponding to the test parameters are not searched in the preset database corresponding to the service system to be tested, controlling a database insertion script to insert the target test data into the preset database corresponding to the service system to be tested based on the service system to be tested and the test parameters.
When the test data is not found, the corresponding test data needs to be inserted into the preset database, and the test data corresponding to the test parameters needs to be inserted into the preset database. Therefore, when the specific inserted test data needs to be determined, the target test data corresponding to the test parameters needs to be obtained based on the test parameters, and the target test data may be one piece of test data or may include multiple pieces of test data. Therefore, when the test data corresponding to the test parameters are not searched in the preset database corresponding to the service system to be tested, the database insertion script is controlled to insert the target test data into the preset database corresponding to the service system to be tested based on the service system to be tested and the test parameters. Taking the information registration service system as an example, the test parameter is a state of the test data, the state of the test data may be information registration success or information registration failure, and if the state of the test data is information registration success, the target test data determined based on the test parameter may include a name, a gender, a customer ID, and the like.
When target test data corresponding to the test parameters are acquired based on the test parameters, the target test data may be generated by performing number creation through a database insertion script, and specifically, the target test data may include a primary key field and a non-primary key field. The method comprises the steps that a primary key field can be set and generated in a database insertion script, a non-primary key field can be randomly acquired in a preset non-primary key field value table, and a plurality of non-primary key fields are stored in the non-primary key field value table in advance. For example, if the "client ID" is a primary key field, then the generation of a different client ID number may be set in the database insertion script. The name and the gender can be non-primary key fields, so that the name and the gender can be randomly acquired from a preset non-primary key field value table, and if the non-primary key fields are the gender, only two values of male and female can be stored in a gender field value table, so that when a database is executed and a script is inserted, a value can be randomly selected from the gender field value table; if the non-primary key field is 'name', then a batch of surnames and Chinese characters can be manually led in the surname field value table in advance, when the execution database inserts the script, a random combination of surnames and Chinese characters can be taken from the name field value table as a name, and the random combination form of surnames and Chinese characters is not specifically limited. The test data of different business systems are different, so that the rule for inserting the test data through the database insertion script is different.
After target test data are inserted into the preset database, if... else logic judgment can be made on the insertion result again, if the insertion is successful, the database search script is automatically executed to search the test data corresponding to the test parameters from the preset database corresponding to the service system to be tested, and at this time, if the query response time exceeds the preset time, for example, 2 seconds, a user can also be prompted to wait on a front-end page of the test data management platform. If the insertion fails, the errors of the database insertion script can be thrown out to the front-end page for display in the form of try. When the query result is empty and when the front-end page throws an error, the type of the error can be an error prompt that the back-end cannot uniquely indicate that the front-end throws the main key, that is, the main key cannot uniquely identify each line of test data in the preset database, at this time, the rule of inserting the script into the preset database can be perfected, and the main key field which cannot be uniquely processed by the Auto Incremental method can be used. Certainly, the errors thrown out on the front-end page can be of other types, which is not illustrated herein, so that all the occurring errors are analyzed, and the rule of inserting the script into the database is further improved, thereby ensuring the robustness of the test data management platform.
In this embodiment, the database operation script may include a database lookup script and a database insertion script, and the test data corresponding to the test parameter is acquired from the preset database corresponding to the service system to be tested by controlling the database lookup script and the database insertion script, so that the existing preset database is secondarily utilized, the database operation script can be controlled to automatically generate the test data, and the efficiency and accuracy of generating the test data are improved.
In one embodiment, the database operation script further comprises a database update script; based on the service system to be tested and the test parameters, the method for controlling the database operation script to obtain the test data corresponding to the test parameters from the preset database corresponding to the service system to be tested comprises the following steps: and controlling the database updating script to update the test data corresponding to the test parameters in a preset database corresponding to the service system to be tested based on the service system to be tested and the test parameters.
The database updating script can also comprise a database deleting script, a database modifying script and the like, after the test data is obtained through the database searching script and the database inserting script, the test data can be displayed on a front end page of the test data management platform in a table form, the front end page can also trigger a modifying or deleting button to execute the corresponding database operating script, so that the test data corresponding to the test parameters in the preset database corresponding to the service system to be tested can be updated, and the test data can be maintained. For example, if a certain piece of test data in the obtained test data does not belong to data corresponding to the service node where the information registration is successful, the test data may be deleted or modified, and for example, if the service node where the information registration is successful includes two identical pieces of test data, one piece of test data may be deleted; other situations can be included, which are not exemplified herein. The test data is updated through the database updating script, and the accuracy of generating the test data is guaranteed.
In one embodiment, as shown in fig. 4, which shows a flowchart of a test data generation method provided in an embodiment of the present application, specifically, a possible process for determining test parameters, the method may include the following steps:
step 420, acquiring a service system to be tested and a plurality of service nodes corresponding to an upstream service system of the service system to be tested; the service node is used for characterizing the state of the test data.
Step 440, selecting test parameters from the plurality of service nodes.
The test data is circulated from the upstream service system to the downstream service system in the link, so that the test parameters can be determined based on the service system to be tested and a plurality of service nodes corresponding to the upstream service system of the service system to be tested when the test parameters are determined for the service system to be tested. For example, a test parameter is a state of test data, and different service nodes in a service system represent a state of test data. Therefore, all service nodes corresponding to the service system to be tested and the upstream service system of the service system to be tested can be sorted out first, and corresponding test parameters are selected from the service nodes according to actual test requirements.
In this embodiment, a plurality of service nodes corresponding to a service system to be tested and an upstream service system of the service system to be tested are obtained, and a test parameter is selected from the plurality of service nodes. All service nodes of all service systems can be accurately sorted out, so that the test parameters of the service systems to be tested can be accurately selected, and the accuracy of generating test data is improved.
In an embodiment, after the test data corresponding to the test parameter is obtained from the preset database corresponding to the service system to be tested based on the service system to be tested and the test parameter, the service system to be tested may be tested based on the test data. As shown in fig. 5, which shows a flowchart of a test data generation method provided in an embodiment of the present application, specifically, a possible process for testing a business system to be tested based on test data is provided, where the method may include the following steps:
step 520, obtaining a first test result obtained by testing the to-be-tested service system based on the test data.
And 540, verifying the first test result based on the test data to obtain a verification result.
After the test data corresponding to the system to be tested is obtained, the function of the system to be tested may be tested based on the test data, and the function test may include a delete function test, a modify function test, and the like, and may also be other function tests, which is not specifically limited in this embodiment. Specifically, a first test result obtained by testing the to-be-tested service system based on the test data may be obtained, where the first test result is obtained after the to-be-tested function of the to-be-tested service system is triggered, and then the first test result is verified based on the test data to obtain a verification result, where the first test result may be compared with the test data, and the verification result is determined according to the comparison result.
For example, the link system includes A, B, C service systems, where a is the source service system, B is the midstream system, and C is the end service system. If the existing C service system is a service system to be tested, the function to be tested is a deleting function of the C service system, and the test data is the data that the information transferred by the A service system is successfully registered, the deleting button can be triggered on the front-end page of the C service system to delete the test data corresponding to the successful information registration in the preset database corresponding to the C service system, and the obtained test data corresponding to the successful information registration in the new database is a first test result. Then, searching test data corresponding to successful information registration in a new database corresponding to the C service system through the control data search script, judging whether the obtained test data is the same as the first test result, and if the obtained test data is the same as the first test result, if not, indicating that the deletion function of the C service system is normal; otherwise, the deleting function of the C service system is abnormal.
In the embodiment, a first test result obtained by testing the to-be-tested service system based on the test data is obtained; and verifying the first test result based on the test data to obtain a verification result. Because the test data can be generated quickly, the function of the service system to be tested can be tested quickly.
In an embodiment, as shown in fig. 6, fig. 6 is a block diagram of a test data architecture for generating test data according to an embodiment of the present application, and a test data generating method based on the architecture, as shown in fig. 7, which illustrates a flowchart of a test data generating method according to an embodiment of the present application, where the method may include the following steps:
step 701, determining a service system to be tested from a link, wherein the link comprises a plurality of service systems.
Step 702, obtaining a service system to be tested and a plurality of service nodes corresponding to an upstream service system of the service system to be tested.
Step 703, selecting test parameters from the plurality of service nodes.
Step 704, based on the service system to be tested and the test parameters, controlling the database search script to search the test data corresponding to the test parameters from the preset database corresponding to the service system to be tested.
Step 705, obtaining target test data corresponding to the test parameters based on the test parameters.
Step 706, when the test data corresponding to the test parameters is not searched from the preset database corresponding to the service system to be tested, based on the service system to be tested and the test parameters, controlling the database insertion script to insert the target test data into the preset database corresponding to the service system to be tested.
And 707, controlling the database updating script to update the test data corresponding to the test parameters in the preset database corresponding to the service system to be tested based on the service system to be tested and the test parameters.
And 708, acquiring a first test result obtained by testing the to-be-tested service system based on the test data.
And 709, verifying the first test result based on the test data to obtain a verification result.
The implementation principle and technical effect of each step in the test data generation method provided in this embodiment are similar to those in the previous embodiments of the test data generation method, and are not described herein again. The implementation manner of each step in the embodiment of fig. 7 is only an example, and is not limited to this, and the order of each step may be adjusted in practical application as long as the purpose of each step can be achieved.
In the technical scheme provided by the embodiment of the application, compared with the traditional method, the test data corresponding to the service system to be tested is stored in the preset database, and the corresponding test data is obtained from the preset database by running the background program, so that the test data does not need to be manually input into each service system in a link, and the efficiency of generating the test data of the service system to be tested is improved.
It should be understood that although the various steps in the flow charts of fig. 2-7 are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and described, and may be performed in other orders, unless explicitly stated otherwise. Moreover, at least some of the steps in fig. 2-7 may include multiple steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, which are not necessarily performed in sequence, but may be performed in turn or alternately with other steps or at least some of the other steps.
Referring to fig. 8, a block diagram of a test data generating apparatus 800 according to an embodiment of the present application is shown. As shown in fig. 8, the test data generating apparatus 800 may include: a determining module 802, a first obtaining module 804, and a second obtaining module 806, wherein:
a determining module 802, configured to determine a service system to be tested from a link, where the link includes a plurality of service systems.
The first obtaining module 804 is configured to obtain a test parameter of the service system to be tested, where the test parameter is used to characterize a condition for generating test data.
A second obtaining module 806, configured to obtain, based on the service system to be tested and the test parameter, test data corresponding to the test parameter from a preset database corresponding to the service system to be tested; the preset database stores test data corresponding to the service system to be tested.
In an embodiment, the second obtaining module 806 includes an obtaining unit, and the obtaining unit is configured to control the database operation script to obtain, based on the service system to be tested and the test parameter, the test data corresponding to the test parameter from a preset database corresponding to the service system to be tested.
In one embodiment, the database operation script comprises a database lookup script; the obtaining unit is specifically configured to control the database search script to search, based on the service system to be tested and the test parameter, the test data corresponding to the test parameter from the preset database corresponding to the service system to be tested.
In one embodiment, the database operation script further comprises a database insertion script; the acquisition unit is further used for acquiring target test data corresponding to the test parameters based on the test parameters; and when the test data corresponding to the test parameters are not searched in the preset database corresponding to the service system to be tested, controlling the database to insert the script into the preset database corresponding to the service system to be tested based on the service system to be tested and the test parameters, and inserting the target test data.
In one embodiment, the database operation script further comprises a database update script; the acquisition unit is further configured to control the database update script to update the test data corresponding to the test parameter in the preset database corresponding to the service system to be tested based on the service system to be tested and the test parameter.
In an embodiment, the test data generating apparatus 800 further includes a third obtaining module and a selecting module, where:
the third acquisition module is used for acquiring a service system to be tested and a plurality of service nodes corresponding to an upstream service system of the service system to be tested; the service node is used for representing the state of the test data;
and the selection module is used for selecting the test parameters from the plurality of service nodes.
In one embodiment, the test data generating apparatus 800 further includes a fourth obtaining module and a verifying module, wherein:
the fourth acquisition module is used for acquiring a first test result obtained by testing the to-be-tested service system based on the test data;
and the verification module is used for verifying the first test result based on the test data to obtain a verification result.
For the specific definition of the test data generating device, reference may be made to the definition of the test data generating method above, and details are not described here. The modules in the test data generation device can be wholly or partially implemented by software, hardware and a combination thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute the operations of the modules.
In one embodiment, a computer device is provided, which may be a remote server, the internal structure of which may be as shown in fig. 9. The computer device includes a processor, a memory, and a network interface connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The database of the computer device is used for testing data generation data. The network interface of the computer device is used for communicating with an external terminal through a network connection. The computer program is executed by a processor to implement a test data generation method.
Those skilled in the art will appreciate that the architecture shown in fig. 9 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one embodiment of the present application, there is provided a computer device comprising a memory and a processor, the memory having stored therein a computer program, the processor implementing the following steps when executing the computer program:
determining a service system to be tested from a link, wherein the link comprises a plurality of service systems; acquiring test parameters of a service system to be tested, wherein the test parameters are used for representing conditions for generating test data; based on the service system to be tested and the test parameters, obtaining test data corresponding to the test parameters from a preset database corresponding to the service system to be tested; the preset database stores test data corresponding to the service system to be tested.
In one embodiment of the application, the processor when executing the computer program further performs the steps of:
and based on the service system to be tested and the test parameters, controlling the database operation script to acquire the test data corresponding to the test parameters from a preset database corresponding to the service system to be tested.
In one embodiment of the present application, the database operation script comprises a database lookup script;
the processor, when executing the computer program, further performs the steps of:
and based on the service system to be tested and the test parameters, controlling the database to search the script to search the test data corresponding to the test parameters from the preset database corresponding to the service system to be tested.
In one embodiment of the present application, the database operation script further comprises a database insertion script;
the processor, when executing the computer program, further performs the steps of:
acquiring target test data corresponding to the test parameters based on the test parameters; and when the test data corresponding to the test parameters are not searched in the preset database corresponding to the service system to be tested, controlling the database to insert the script into the preset database corresponding to the service system to be tested based on the service system to be tested and the test parameters, and inserting the target test data.
In one embodiment of the present application, the database operation script further comprises a database update script;
the processor, when executing the computer program, further performs the steps of:
and controlling the database updating script to update the test data corresponding to the test parameters in a preset database corresponding to the service system to be tested based on the service system to be tested and the test parameters.
In one embodiment of the application, the processor when executing the computer program further performs the steps of:
acquiring a service system to be tested and a plurality of service nodes corresponding to an upstream service system of the service system to be tested; the service node is used for representing the state of the test data; test parameters are selected from a plurality of service nodes.
In one embodiment of the application, the processor when executing the computer program further performs the steps of:
acquiring a first test result obtained by testing the to-be-tested service system based on the test data; and verifying the first test result based on the test data to obtain a verification result.
The implementation principle and technical effect of the computer device provided by the embodiment of the present application are similar to those of the method embodiment described above, and are not described herein again.
In an embodiment of the application, a computer-readable storage medium is provided, on which a computer program is stored, which computer program, when being executed by a processor, carries out the steps of:
determining a service system to be tested from a link, wherein the link comprises a plurality of service systems; acquiring test parameters of a service system to be tested, wherein the test parameters are used for representing conditions for generating test data; based on the service system to be tested and the test parameters, obtaining test data corresponding to the test parameters from a preset database corresponding to the service system to be tested; the preset database stores test data corresponding to the service system to be tested.
In one embodiment of the application, the computer program when executed by the processor further performs the steps of:
and based on the service system to be tested and the test parameters, controlling the database operation script to acquire the test data corresponding to the test parameters from a preset database corresponding to the service system to be tested.
In one embodiment of the present application, the database operation script comprises a database lookup script;
the computer program when executed by the processor further realizes the steps of:
and based on the service system to be tested and the test parameters, controlling the database to search the script to search the test data corresponding to the test parameters from the preset database corresponding to the service system to be tested.
In one embodiment of the present application, the database operation script further comprises a database insertion script;
the computer program when executed by the processor further realizes the steps of:
acquiring target test data corresponding to the test parameters based on the test parameters; and when the test data corresponding to the test parameters are not searched in the preset database corresponding to the service system to be tested, controlling the database to insert the script into the preset database corresponding to the service system to be tested based on the service system to be tested and the test parameters, and inserting the target test data.
In one embodiment of the present application, the database operation script further comprises a database update script;
the computer program when executed by the processor further realizes the steps of:
and controlling the database updating script to update the test data corresponding to the test parameters in a preset database corresponding to the service system to be tested based on the service system to be tested and the test parameters.
In one embodiment of the application, the computer program when executed by the processor further performs the steps of:
acquiring a service system to be tested and a plurality of service nodes corresponding to an upstream service system of the service system to be tested; the service node is used for representing the state of the test data; test parameters are selected from a plurality of service nodes.
In one embodiment of the application, the computer program when executed by the processor further performs the steps of:
acquiring a first test result obtained by testing the to-be-tested service system based on the test data; and verifying the first test result based on the test data to obtain a verification result.
The implementation principle and technical effect of the computer-readable storage medium provided by this embodiment are similar to those of the above-described method embodiment, and are not described herein again.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above may be implemented by hardware instructions of a computer program, which may be stored in a non-volatile computer-readable storage medium, and when executed, may include the processes of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in the embodiments provided herein may include non-volatile and/or volatile memory, among others. Non-volatile memory can include read-only memory (ROM), Programmable ROM (PROM), Electrically Programmable ROM (EPROM), Electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), Dynamic RAM (DRAM), Synchronous DRAM (SDRAM), Double Data Rate SDRAM (DDRSDRAM), Enhanced SDRAM (ESDRAM), Synchronous Link DRAM (SLDRAM), Rambus Direct RAM (RDRAM), direct bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM).
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above examples only express several embodiments of the present application, and the description thereof is more specific and detailed, but not to be construed as limiting the claims. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (10)

1. A method of test data generation, the method comprising:
determining a service system to be tested from a link, wherein the link comprises a plurality of service systems;
acquiring test parameters of the service system to be tested, wherein the test parameters are used for representing conditions for generating test data;
based on the service system to be tested and the test parameters, controlling a database operation script to acquire test data corresponding to the test parameters from a preset database corresponding to the service system to be tested; the preset database stores test data corresponding to the service system to be tested; the database operation script also comprises a database insertion script;
based on the test parameters, conducting modeling through a database insertion script to generate target test data; the target test data comprises a primary key field and a non-primary key field; the primary key field is set and generated in a database insert script, the non-primary key field is randomly acquired in a preset non-primary key field value table, and a plurality of non-primary key fields are stored in the non-primary key field value table in advance;
when target test data corresponding to the test parameters are not searched in a preset database corresponding to the service system to be tested, controlling the database insertion script to insert the target test data into the preset database corresponding to the service system to be tested based on the service system to be tested and the test parameters;
if the insertion is successful, automatically executing the database operation script to acquire test data corresponding to the test parameters from a preset database corresponding to the service system to be tested; if the insertion fails, the error codes of the database insertion script are classified and translated and displayed on a front-end page.
2. The method of claim 1, wherein the database operation script comprises a database lookup script; the step of controlling a database operation script to acquire test data corresponding to the test parameters from a preset database corresponding to the service system to be tested based on the service system to be tested and the test parameters comprises the following steps:
and controlling the database searching script to search the testing data corresponding to the testing parameters from a preset database corresponding to the service system to be tested based on the service system to be tested and the testing parameters.
3. The method of claim 1, wherein the database operation script further comprises a database update script; the step of controlling a database operation script to acquire test data corresponding to the test parameters from a preset database corresponding to the service system to be tested based on the service system to be tested and the test parameters comprises the following steps:
and controlling the database updating script to update the test data corresponding to the test parameters in a preset database corresponding to the service system to be tested based on the service system to be tested and the test parameters.
4. The method of claim 1, wherein the determining of the test parameters comprises:
acquiring a plurality of service nodes corresponding to the service system to be tested and an upstream service system of the service system to be tested; the service node is used for representing the state of the test data;
and selecting the test parameters from the plurality of service nodes.
5. The method of claim 1, wherein after obtaining the test data corresponding to the test parameter from a preset database corresponding to the business system to be tested based on the business system to be tested and the test parameter, the method comprises:
acquiring a first test result obtained by testing the to-be-tested service system based on the test data;
and verifying the first test result based on the test data to obtain a verification result.
6. A test data generation apparatus, characterized in that the apparatus comprises:
the system comprises a determining module, a judging module and a judging module, wherein the determining module is used for determining a service system to be tested from a link, and the link comprises a plurality of service systems;
the first acquisition module is used for acquiring the test parameters of the service system to be tested, and the test parameters are used for representing the conditions for generating test data;
the second acquisition module is used for controlling a database operation script to acquire test data corresponding to the test parameters from a preset database corresponding to the service system to be tested based on the service system to be tested and the test parameters; the preset database stores test data corresponding to the service system to be tested; the database operation script also comprises a database insertion script; based on the test parameters, generating target test data by performing number making through a database insertion script; the target test data comprises a primary key field and a non-primary key field; the primary key field is set and generated in a database insert script, the non-primary key field is randomly acquired in a preset non-primary key field value table, and a plurality of non-primary key fields are stored in the non-primary key field value table in advance; when target test data corresponding to the test parameters are not searched in a preset database corresponding to the service system to be tested, controlling the database insertion script to insert the target test data into the preset database corresponding to the service system to be tested based on the service system to be tested and the test parameters;
if the insertion is successful, automatically executing the database operation script to acquire test data corresponding to the test parameters from a preset database corresponding to the service system to be tested; if the insertion fails, the error codes of the database insertion script are classified and translated and displayed on a front-end page.
7. The apparatus of claim 6, wherein the database operation script comprises a database lookup script;
the second obtaining module is further configured to control the database search script to search, based on the service system to be tested and the test parameter, test data corresponding to the test parameter from a preset database corresponding to the service system to be tested.
8. The apparatus of claim 6, wherein the second obtaining module is further configured to control the database update script to update the test data corresponding to the test parameter in a preset database corresponding to the service system to be tested based on the service system to be tested and the test parameter.
9. A computer arrangement comprising a memory and a processor, the memory storing a computer program which, when executed by the processor, carries out the steps of the method according to any one of claims 1 to 5.
10. A computer-readable storage medium, characterized in that a computer program is stored thereon, which computer program, when being executed by a processor, carries out the steps of the method according to any one of claims 1 to 5.
CN202210500979.3A 2022-05-10 2022-05-10 Test data generation method, device, equipment and storage medium Active CN114595159B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210500979.3A CN114595159B (en) 2022-05-10 2022-05-10 Test data generation method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210500979.3A CN114595159B (en) 2022-05-10 2022-05-10 Test data generation method, device, equipment and storage medium

Publications (2)

Publication Number Publication Date
CN114595159A CN114595159A (en) 2022-06-07
CN114595159B true CN114595159B (en) 2022-09-02

Family

ID=81821772

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210500979.3A Active CN114595159B (en) 2022-05-10 2022-05-10 Test data generation method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114595159B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2011116471A1 (en) * 2010-03-25 2011-09-29 Mga Aq Inc. Method and system for generating updated test data
CN112163131A (en) * 2020-11-10 2021-01-01 平安普惠企业管理有限公司 Configuration method and device of business data query platform, computer equipment and medium
CA3127343A1 (en) * 2020-08-11 2022-02-11 10353744 Canada Ltd. Test data acquisition method and device, computer equipment and storage medium

Family Cites Families (10)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9734214B2 (en) * 2012-06-28 2017-08-15 Entit Software Llc Metadata-based test data generation
IN2013MU01495A (en) * 2013-04-22 2015-04-17 Tata Consultancy Services Ltd
US10289534B1 (en) * 2015-10-29 2019-05-14 Amdocs Development Limited System, method, and computer program for efficiently automating business flow testing
CN105373474B (en) * 2015-11-10 2018-07-06 中国建设银行股份有限公司 A kind of test method and device for operation system
US10241896B2 (en) * 2016-11-08 2019-03-26 Salesforce, Inc. Formation and manipulation of test data in a database system
CN109726105B (en) * 2018-05-15 2023-11-28 深圳市易行网数字科技有限公司 Test data construction method, device, equipment and storage medium
CN110221967A (en) * 2019-05-20 2019-09-10 深圳壹账通智能科技有限公司 Test data building method, device, computer equipment and storage medium
CN112162915B (en) * 2020-08-27 2024-06-25 杭州大搜车汽车服务有限公司 Test data generation method, device, equipment and storage medium
CN114185770A (en) * 2021-11-22 2022-03-15 招联消费金融有限公司 Method and device for generating test data, computer equipment and storage medium
CN114297052A (en) * 2021-12-13 2022-04-08 上海金仕达软件科技有限公司 Test data generation method and device

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2011116471A1 (en) * 2010-03-25 2011-09-29 Mga Aq Inc. Method and system for generating updated test data
CA3127343A1 (en) * 2020-08-11 2022-02-11 10353744 Canada Ltd. Test data acquisition method and device, computer equipment and storage medium
CN112163131A (en) * 2020-11-10 2021-01-01 平安普惠企业管理有限公司 Configuration method and device of business data query platform, computer equipment and medium

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
基于元数据、业务规则和样本数据的模拟数据生成;曾昭文等;《软件导刊》;20120830(第08期);全文 *
自动化功能测试在数据中心业务系统中的应用;袁凌等;《信息通信》;20200615(第06期);全文 *

Also Published As

Publication number Publication date
CN114595159A (en) 2022-06-07

Similar Documents

Publication Publication Date Title
CN108874661B (en) Test mapping relation library generation method and device, computer equipment and storage medium
CN108492005B (en) Project data processing method and device, computer equipment and storage medium
CN108959067B (en) Method and device for testing search engine and computer readable storage medium
CN110321284B (en) Test data entry method, device, computer equipment and storage medium
CN111984228B (en) Interface document processing method and device, computer equipment and storage medium
CN108415998B (en) Application dependency relationship updating method, terminal, device and storage medium
CN113238924B (en) Chaotic engineering realization method and system in distributed graph database system
CN110362479B (en) System upgrade test method and system
CN113448862B (en) Software version testing method and device and computer equipment
CN110798376A (en) Interface testing method and device, computer equipment and storage medium
CN108399125B (en) Automatic testing method and device, computer equipment and storage medium
CN112363937A (en) Method and device for testing differential coverage rate, computer equipment and storage medium
CN114527974B (en) Method and device for realizing business function of software product and computer equipment
CN113505078B (en) Configuration file updating method, device, equipment and storage medium
CN108897772B (en) Data source supplementing method and device, computer equipment and storage medium
CN108334452B (en) Rule data transfer test method, apparatus, computer device and storage medium
CN113312258A (en) Interface testing method, device, equipment and storage medium
CN114595159B (en) Test data generation method, device, equipment and storage medium
CN109684205B (en) System testing method, device, electronic equipment and storage medium
CN116561003A (en) Test data generation method, device, computer equipment and storage medium
CN115757172A (en) Test execution method and device, storage medium and computer equipment
CN114138734A (en) Web-based version management method facing database and file resource
CN115033481A (en) Method and device for automatic test code generation based on browser access and computer equipment
CN114625751A (en) Data tracing query method and device based on block chain
CN112363933A (en) Automatic verification method and device for word paragraph table, computer equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant