CN114595159A - 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
CN114595159A
CN114595159A CN202210500979.3A CN202210500979A CN114595159A CN 114595159 A CN114595159 A CN 114595159A CN 202210500979 A CN202210500979 A CN 202210500979A CN 114595159 A CN114595159 A CN 114595159A
Authority
CN
China
Prior art keywords
tested
service system
test data
test
database
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.)
Granted
Application number
CN202210500979.3A
Other languages
Chinese (zh)
Other versions
CN114595159B (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, 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, is adapted to carry 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 storage medium determine a service system to be tested 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. 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, embodiments of the present application will be described in further detail below 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, and it should be noted that an execution subject in the embodiments of the present application may be a computer device, or may also be a test data generation apparatus, and the following method embodiments describe 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 existing paperless job-starting process, the sequence of the business 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 preset database created by creating a new database and randomly generating a large amount of test data, and may also be 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, i.e., an information registration success node and an information registration failure node, and accordingly, the test parameter may be an information registration success or an information registration failure node, and 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 node may be 2, so that the test data corresponding to the information registration success node or the test data corresponding to the information registration failure node 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 test data or may include multiple test data. Therefore, when the test data corresponding to the test parameters are not searched from 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 a different client ID number may be set to be generated 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', a batch of surnames and Chinese characters can be manually led in the surname field value table in advance, when the database is executed and the script is inserted, a random combination of surnames and Chinese characters can be taken from the surname field value table as a name, and the random combination form of surnames and Chinese characters is not particularly limited. The test data for different business systems is different, so the rules for inserting test data by inserting scripts through the database are also 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. Of course, the error thrown out on the front-end page can be of other types, which are not illustrated one by one, so that all the 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 may be included, not just examples. 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 current service system C is a service system to be tested, the function to be tested is a deletion function of the service system C, and the test data is the data that the information transferred by the service system A is successfully registered, the test data corresponding to the successful information registration in the preset database corresponding to the service system C can be deleted by triggering a deletion button on the front-end page of the service system C, and the obtained test data corresponding to the successful information registration in the new database is the 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 business 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 diagrams 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 the preset database corresponding to the service system to be tested.
In one embodiment, the database operation script comprises a database lookup script; the acquisition unit is specifically used for 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 based on the service system to be tested and the test parameters.
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 specific limitations of the test data generation apparatus, reference may be made to the above limitations of the test data generation method, which are not described herein again. 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 operating system and the computer program to run on 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 application, a computer device is provided, the 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 can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can 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 (Synchlink) DRAM (SLDRAM), Rambus (Rambus) direct RAM (RDRAM), direct bused dynamic RAM (DRDRAM), and bused 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 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, obtaining test data corresponding to the test parameters from a preset database corresponding to the service system to be tested; and the preset database stores the test data corresponding to the service system to be tested.
2. The method of claim 1, wherein the obtaining test data corresponding to the test parameters from a preset database corresponding to the business system to be tested based on the business system to be tested and the test parameters comprises:
and 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.
3. The method of claim 2, 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.
4. The method of claim 3, wherein the database operation script further comprises a database insertion script; the step of controlling the search script to search the 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:
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 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.
5. The method of claim 2, 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.
6. 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.
7. The method according to claim 1, after obtaining the test data corresponding to the test parameters from a preset database corresponding to the business system to be tested based on the business system to be tested and the test parameters, 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.
8. 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 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; and the preset database stores test data corresponding to the service system to be tested.
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 7.
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 7.
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 true CN114595159A (en) 2022-06-07
CN114595159B 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 (13)

* 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
US20140007056A1 (en) * 2012-06-28 2014-01-02 Maxim Leizerovich Metadata-based Test Data Generation
US20140317601A1 (en) * 2013-04-22 2014-10-23 Tata Consultancy Services Limited System and method for creating variants in a test database during various test stages
US20170132112A1 (en) * 2015-11-10 2017-05-11 China Construction Bank Corporation Test method and device for business system
US20180129585A1 (en) * 2016-11-08 2018-05-10 Salesforce.Com, Inc. Formation and manipulation of test data in a database system
CN109726105A (en) * 2018-05-15 2019-05-07 平安普惠企业管理有限公司 Test data building method, device, equipment and storage medium
US10289534B1 (en) * 2015-10-29 2019-05-14 Amdocs Development Limited System, method, and computer program for efficiently automating business flow testing
CN110221967A (en) * 2019-05-20 2019-09-10 深圳壹账通智能科技有限公司 Test data building method, 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
CN112162915A (en) * 2020-08-27 2021-01-01 杭州大搜车汽车服务有限公司 Test data generation method, device, equipment and storage medium
CA3127343A1 (en) * 2020-08-11 2022-02-11 10353744 Canada Ltd. Test data acquisition method and device, computer 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 (13)

* 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
US20140007056A1 (en) * 2012-06-28 2014-01-02 Maxim Leizerovich Metadata-based Test Data Generation
US20140317601A1 (en) * 2013-04-22 2014-10-23 Tata Consultancy Services Limited System and method for creating variants in a test database during various test stages
US10289534B1 (en) * 2015-10-29 2019-05-14 Amdocs Development Limited System, method, and computer program for efficiently automating business flow testing
US20170132112A1 (en) * 2015-11-10 2017-05-11 China Construction Bank Corporation Test method and device for business system
US20180129585A1 (en) * 2016-11-08 2018-05-10 Salesforce.Com, Inc. Formation and manipulation of test data in a database system
CN109726105A (en) * 2018-05-15 2019-05-07 平安普惠企业管理有限公司 Test data building method, device, equipment and storage medium
CN110221967A (en) * 2019-05-20 2019-09-10 深圳壹账通智能科技有限公司 Test data building method, device, computer equipment and storage medium
CA3127343A1 (en) * 2020-08-11 2022-02-11 10353744 Canada Ltd. Test data acquisition method and device, computer equipment and storage medium
CN112162915A (en) * 2020-08-27 2021-01-01 杭州大搜车汽车服务有限公司 Test data generation method, device, 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
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

Non-Patent Citations (2)

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

Also Published As

Publication number Publication date
CN114595159B (en) 2022-09-02

Similar Documents

Publication Publication Date Title
CN108874661B (en) Test mapping relation library generation method and device, computer equipment and storage medium
CN109032824A (en) Database method of calibration, device, computer equipment and storage medium
CN108492005B (en) Project data processing method and device, computer equipment and storage medium
CN110321284B (en) Test data entry method, device, computer equipment and storage medium
CN110781070B (en) Big data test verification method and device, computer equipment and storage medium
CN108959067B (en) Method and device for testing search engine and computer readable storage medium
CN108415998B (en) Application dependency relationship updating method, terminal, device and storage medium
CN113448862B (en) Software version testing method and device and computer equipment
CN110362479B (en) System upgrade test method and system
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
CN115033481A (en) Method and device for automatic test code generation based on browser access and computer equipment
CN113312258B (en) Interface testing method, device, equipment and storage medium
CN108897772B (en) Data source supplementing method and device, computer equipment and storage medium
CN112862452A (en) Method and device for executing work order equivalence, computer equipment and storage medium
CN114595159B (en) Test data generation method, device, 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
CN109684205A (en) System detection method, device, electronic equipment and storage medium
CN114138734A (en) Web-based version management method facing database and file resource
CN107229650B (en) Test method and device
CN109299224B (en) Zabbix-based solution query method and device and computer equipment
CN109240906B (en) Database configuration information adaptation method and device, 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