WO2015176431A1 - 一种测试数据的生成方法及装置 - Google Patents

一种测试数据的生成方法及装置 Download PDF

Info

Publication number
WO2015176431A1
WO2015176431A1 PCT/CN2014/086966 CN2014086966W WO2015176431A1 WO 2015176431 A1 WO2015176431 A1 WO 2015176431A1 CN 2014086966 W CN2014086966 W CN 2014086966W WO 2015176431 A1 WO2015176431 A1 WO 2015176431A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
test data
test
database system
configuration information
Prior art date
Application number
PCT/CN2014/086966
Other languages
English (en)
French (fr)
Inventor
姜志强
孙放宽
王宙
Original Assignee
中兴通讯股份有限公司
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 中兴通讯股份有限公司 filed Critical 中兴通讯股份有限公司
Publication of WO2015176431A1 publication Critical patent/WO2015176431A1/zh

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

Definitions

  • the present invention relates to the field of computer technologies, and in particular, to a method and an apparatus for generating test data.
  • SQL Structured Query Language
  • the database system is complex in structure and the amount of data is usually very large. The data logic between database systems of different services is different, and it takes a lot of time and manpower to construct test data that meets the requirements.
  • the technical problem to be solved by the present invention is to provide a method and a device for generating test data, which are required to solve the problem of generating test data in the prior art, which requires a lot of time and manpower.
  • an embodiment of the present invention provides a method for generating test data, including: acquiring data structure information and data configuration information of each data table in a database system; and according to the data structure information and the data configuration information, The preset number of test data is randomly generated, and the preset number of test data is distinguished from the business function test data of the database system.
  • the data structure information includes a field length of each field in each data table, a field type, and an order of arrangement between the fields.
  • the data configuration information includes a field value range of each field.
  • the acquiring the data structure information and the data configuration information of each data table in the database system specifically includes: acquiring data structure information of each data table by reading a data dictionary of the database system; and reading the database system by reading The service configuration table obtains data configuration information of each of the data tables.
  • the preset number of test data is randomly generated according to the data structure information and the data configuration information, where the preset number of test data is different from the service function test data of the database system, including: The data structure information, the data configuration information, and the data amount of the test data to be generated, the data table to which the test data to be generated belongs is configured, and the value range of the primary key value of the data table to which the test data to be generated belongs is determined. Separating the preset number of test data from the service function test data of the database system; randomly generating a preset according to the data table to which the configured test data belongs and the determined value range of the primary key value Test data for the number of bars.
  • An embodiment of the present invention further provides a device for generating test data, including:
  • An obtaining unit configured to acquire data structure information and data configuration information of each data table in the database system; and the generating unit is configured to randomly generate the preset number according to the data structure information and the data configuration information acquired by the acquiring unit Test data, the preset number of test data is distinguished from the business function test data of the database system.
  • the data structure information includes a field length of each field in each data table, a field type, and an order of arrangement between the fields.
  • the data configuration information includes a field value range of each field in each data table.
  • the acquiring unit is configured to: obtain data structure information of each data table by reading a data dictionary of the database system;
  • the generating unit is configured to: according to the data structure information, the data configuration information, and the data amount of the test data that needs to be generated, configure a data table to which the test data to be generated belongs; and determine the test data to be generated.
  • the value range of the primary key value of the associated data table is to distinguish the test data of the preset number from the service function test data of the database system; according to the data table and the determined location of the configured test data
  • the range of values of the primary key value is randomly generated to generate a predetermined number of test data.
  • the method and device for generating test data provided by the embodiments of the present invention can acquire data structure information and data configuration information of each data table in the database system, and randomly generate preset numbers according to the acquired data structure information and data configuration information. Test the data, so that the generated test data has a certain randomness, and also fully meets the grammar requirements of each field in each data table, so it can generate a large amount of test data in a relatively simple manner, thereby fully verifying the existence of the program development process. Performance defects. And because of the generated test data of the number of presets The business function test data of the database system is effectively distinguished, and the test data of the verification program performance is not misused to verify the business function of the database system, and thus does not affect the reliability of the business function verification.
  • FIG. 1 is a flowchart of a method for generating test data according to an embodiment of the present invention
  • FIG. 2 is a detailed flowchart of a method for generating test data according to an embodiment of the present invention
  • FIG. 3 is a schematic structural diagram of a device for generating test data according to an embodiment of the present invention.
  • an embodiment of the present invention provides a method for generating test data, including:
  • the method for generating test data provided by the embodiment of the present invention can acquire data structure information and data configuration information of each data table in the database system, and randomly generate preset test data according to the acquired data structure information and data configuration information.
  • the generated test data has a certain randomness and fully meets the grammar requirements of each field in each data table, so that a large amount of test data can be generated in a relatively simple manner, thereby fully verifying the performance defects existing in the program development process.
  • the generated test data of the preset number is effectively distinguished from the business function test data of the database system, the test data of the verification program performance is not misused for verifying the business function of the database system, and thus Affect the reliability of business function verification.
  • the database system stores a large amount of data, and various data relationships are usually represented in the form of a large number of data tables. In most cases, an entry in the data table often requires multiple different fields to describe.
  • a student transcript may include the student's student number, name, gender, class, language, math, English, and Political and other fields. Then, the field length of each field, the type of the field, and the order of arrangement between the fields, etc., which describe the relatively fixed features of the fields in the data table, form the data structure information of the data table.
  • the student's student number can be an integer
  • the name can be a string type
  • the gender can be an integer
  • the class can be a string
  • the language, mathematics, English, political scores, etc. can be real numbers.
  • These data structure information can be composed of data
  • the data dictionary written by the provider of the library system is recorded. Therefore, in step S11, the data structure information of each data table can be obtained by reading the data dictionary of the database system.
  • the data configuration information Corresponding to the data structure information is the data configuration information. This part of the information often describes the data characteristics of the data table in the data table, so it is not written in the data dictionary of the database system, but is set in some service configuration table. It can be defined and configured by the user according to the specific application.
  • the data configuration information of each data table may be obtained by reading a service configuration table of the database system.
  • the data configuration information may include a field value range of each field, a field enumeration range, and the like. For example, if the student's grade is in the percentage system, the scores of each subject range from 0 to 100. If the student's grade is 150, the scores of each grade range from 0 to 150. If the student's grades are measured by excellent, good, medium, and poor, then the enumeration range of each subject's grades may be 1, 2, 3, and 4, representing excellent, good, medium, and poor.
  • a predetermined number of test data may be randomly generated according to the data structure information and the data configuration information.
  • the generated test data may also be presented in the form of a test data table.
  • the structure and fields of the test data table correspond to the structure and fields of the corresponding data table in the database system to be tested, and therefore, the The measured database system was well tested.
  • test of the database system needs to perform corresponding tests on the business functions of the database system, but the same is the test, and the requirements for the test data are different.
  • Business function testing requires a small amount of test data, but it must be closely coordinated with business processes and business logic, so it usually takes a lot of time and effort to customize.
  • the test data required by the program performance test has a large amount of data, and the coverage is comprehensive, but the test data itself does not have to strictly match the business process and business logic, so it is much simpler to generate such test data.
  • the embodiment of the present invention separates the data for the program performance test from the business function test data, and generates a large amount of test data specifically adapted for the program performance test, thereby greatly improving The program performance test efficiency.
  • the method for distinguishing the program performance test data from the service function test data may be various, and the embodiment of the present invention does not limit this.
  • the preset number of test data can be distinguished from the service function test data of the database system according to the value range of the primary key value of the generated test data table.
  • randomly generating the preset number of test data according to the data structure information and the data configuration information may specifically include the following steps:
  • the preset test data is randomly generated according to the data table to which the configured test data belongs and the determined value range of the primary key value.
  • the primary key of the data table to which the randomly generated test data belongs may be The value range of the value is determined to start from 810000 and gradually increase, so that the preset number of test data is distinguished from the business function test data of the database system.
  • the test data of the preset number refers to the preset number of entries of the test data to be generated.
  • 500000 is the corresponding preset number, and if the starting value of the primary key value is 810000, then The primary key value of the data table ranges from 810,000 to 1310000.
  • the preset number may be based on a service development trend, and predict the size of the data table after the service is used for several years, so as to configure a more suitable data volume.
  • the method for generating test data includes the following steps:
  • test data file cutting size configures a preset number of test data in the test data table to be generated, a field value range of each field, a field enumeration range, a start value of the primary key value, And parameter configuration such as test data file cutting size.
  • the entire data file is generally divided into several segments.
  • the files are loaded and tested in sequence. Therefore, in this step, the parameter of the test data file cut size can be set in the data configuration table.
  • S104 Read the configuration data in the two tables, and obtain a corresponding data table structure from the data dictionary table, and generate corresponding random strings, random numbers, random dates, etc. according to each field type, size, and order of the table structure. Then, according to the order of each field, an item is spliced, and each field of an item is divided by a binary character. For fields that have a primary key configured and a special constraint, the corresponding test data is also generated according to the configuration.
  • an embodiment of the present invention further provides a device for generating test data.
  • the device includes:
  • the obtaining unit 310 is configured to acquire data structure information and data configuration information of each data table in the database system;
  • the generating unit 312 is configured to randomly generate a preset number of test data according to the data structure information and the data configuration information acquired by the obtaining unit 310, and the preset number of test data and the service function test of the database system The data is differentiated.
  • the acquiring unit 310 can acquire the data structure information and the data configuration information of each data table in the database system, and the generating unit 312 can randomly generate the pre-acquisition according to the acquired data structure information and the data configuration information.
  • Set the test data of the number so that the generated test data has a certain randomness, and also fully meets the grammar requirements of each field in each data table, so it can generate a large amount of test data in a relatively simple manner, thereby fully verifying the program development. Performance defects in the process.
  • the generated test data of the preset number is effectively distinguished from the business function test data of the database system, the test data of the verification program performance is not misused for verifying the business function of the database system, and thus Affect the reliability of business function verification.
  • the data structure information includes a field length of each field in each data table, a field type, and an order of arrangement between the fields.
  • the data configuration information includes a field value range, a field enumeration range, and the like of each field in each data table.
  • the obtaining unit 310 can be specifically configured to:
  • the generating unit 312 can be specifically configured to:
  • the preset test data is randomly generated according to the data table to which the configured test data belongs and the determined value range of the primary key value.
  • the method and device for generating test data can acquire data structure information and data configuration information of each data table in the database system, and randomly generate preset numbers according to the acquired data structure information and data configuration information. Test the data, so that the generated test data has a certain randomness, and also fully meets the grammar requirements of each field in each data table, so it can generate a large amount of test data in a relatively simple manner, thereby fully verifying the existence of the program development process. Performance defects. Moreover, since the generated test data of the preset number is effectively distinguished from the business function test data of the database system, the test data of the verification program performance is not misused for verifying the business function of the database system, and thus Affect the reliability of business function verification.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Debugging And Monitoring (AREA)

Abstract

本发明提供一种测试数据的生成方法及装置,涉及计算机技术领域,用以解决现有技术中测试数据的生成需要耗费巨大时间和人力的问题。所述方法包括:获取数据库系统中各数据表的数据结构信息和数据配置信息;根据所述数据结构信息和所述数据配置信息,随机生成预设条数的测试数据,所述预设条数的测试数据与所述数据库系统的业务功能测试数据相区分。本发明可用于数据库系统的程序性能测试。

Description

一种测试数据的生成方法及装置 技术领域
本发明涉及计算机技术领域,特别是涉及一种测试数据的生成方法及装置。
背景技术
在数据库系统的开发过程中,SQL(Structured Query Language,结构化查询语言)分布于多个应用模块中,由多个应用开发人员分别编写,由于各开发人员的业务水平和编程习惯都各有不同,因此SQL程序的整体性能难以保证,需要用很多测试数据来测试和验证。但数据库系统结构复杂、数据量通常非常庞大,不同业务的数据库系统之间的数据逻辑不同,需要耗费巨大的时间和人力来构造满足要求的测试数据。
针对相关技术中测试数据的生成需要耗费巨大时间和人力问题,目前尚未提出有效的解决方案。
发明内容
本发明要解决的技术问题是提供一种测试数据的生成方法及装置,用以解决现有技术中测试数据的生成需要耗费巨大时间和人力问题。
为解决上述技术问题,本发明实施例提供一种测试数据的生成方法,包括:获取数据库系统中各数据表的数据结构信息和数据配置信息;根据所述数据结构信息和所述数据配置信息,随机生成预设条数的测试数据,所述预设条数的测试数据与所述数据库系统的业务功能测试数据相区分。
可选的,所述数据结构信息包括各数据表中各字段的字段长度、字段类型和字段之间的排列顺序。
可选的,所述数据配置信息包括各字段的字段取值范围。
具体的,所述获取数据库系统中各数据表的数据结构信息和数据配置信息具体包括:通过读所述数据库系统的数据字典获取所述各数据表的数据结构信息;通过读所述数据库系统的业务配置表获取所述各数据表的数据配置信息。
可选的,根据所述数据结构信息和数据配置信息,随机生成预设条数的测试数据,所述预设条数的测试数据与所述数据库系统的业务功能测试数据相区分包括:根据所述数据结构信息、数据配置信息和需要生成的测试数据的数据量,配置待生成的测试数据所属的数据表;确定待生成的所述测试数据所属的数据表的主键值的取值范围,以将所述预设条数的测试数据与所述数据库系统的业务功能测试数据相区分;根据配置的测试数据所属的数据表和确定的所述主键值的取值范围,随机生成预设条数的测试数据。
本发明实施例还提供一种测试数据的生成装置,包括:
获取单元,设置为获取数据库系统中各数据表的数据结构信息和数据配置信息;生成单元,设置为根据所述获取单元获取的所述数据结构信息和数据配置信息,随机生成预设条数的测试数据,所述预设条数的测试数据与所述数据库系统的业务功能测试数据相区分。
可选的,所述数据结构信息包括各数据表中各字段的字段长度、字段类型和字段之间的排列顺序。
可选的,所述数据配置信息包括各数据表中各字段的字段取值范围。
可选的,所述获取单元设置为:通过读所述数据库系统的数据字典获取所述各数据表的数据结构信息;
通过读所述数据库系统的业务配置表获取所述各数据表的数据配置信息。
可选的,所述生成单元设置为:根据所述数据结构信息、数据配置信息和需要生成的测试数据的数据量,配置待生成的测试数据所属的数据表;确定待生成的所述测试数据所属的数据表的主键值的取值范围,以将所述预设条数的测试数据与所述数据库系统的业务功能测试数据相区分;根据配置的测试数据所属的数据表和确定的所述主键值的取值范围,随机生成预设条数的测试数据。
本发明的实施例提供的测试数据的生成方法及装置,能够获取数据库系统中各数据表的数据结构信息和数据配置信息,并根据获取的数据结构信息和数据配置信息随机生成预设条数的测试数据,这样,生成的测试数据既有一定的随机性,也完全符合各个数据表中各字段的语法要求,因此能够以较为简便的方式产生大量测试数据,从而充分验证程序开发过程中存在的性能缺陷。又由于生成的预设条数的测试数据与所 述数据库系统的业务功能测试数据被有效区分开,这种验证程序性能的测试数据不会被误用于验证数据库系统的业务功能,因此不会影响业务功能验证的可靠性。
附图说明
图1是本发明实施例提供的测试数据的生成方法的一种流程图;
图2是本发明实施例提供的测试数据的生成方法的一种详细流程图;
图3是本发明实施例提供的测试数据的生成装置的一种结构示意图。
具体实施方式
下面结合附图和实施例,对本发明的具体实施方式作进一步详细描述。以下实施例用于说明本发明,但不用来限制本发明的范围。
如图1所示,本发明的实施例提供一种测试数据的生成方法,包括:
S11,获取数据库系统中各数据表的数据结构信息和数据配置信息;
S12,根据所述数据结构信息和所述数据配置信息,随机生成预设条数的测试数据,所述预设条数的测试数据与所述数据库系统的业务功能测试数据相区分。
本发明的实施例提供的测试数据的生成方法,能够获取数据库系统中各数据表的数据结构信息和数据配置信息,并根据获取的数据结构信息和数据配置信息随机生成预设条数的测试数据,这样,生成的测试数据既有一定的随机性,也完全符合各个数据表中各字段的语法要求,因此能够以较为简便的方式产生大量测试数据,从而充分验证程序开发过程中存在的性能缺陷。又由于生成的预设条数的测试数据与所述数据库系统的业务功能测试数据被有效区分开,这种验证程序性能的测试数据不会被误用于验证数据库系统的业务功能,因此不会影响业务功能验证的可靠性。
数据库系统存储着大量的数据,各种数据关系通常以大量的数据表的形式来体现。而多数情况下,数据表中的一个条目往往需要多个不同的字段来描述,例如一份学生成绩单的数据表中可能包括学生的学号、姓名、性别、班级、语文、数学、英语、政治等字段。那么各个字段的字段长度、字段类型以及字段之间的排列顺序等描述数据表中各个字段的相对固定不变的特征的信息就形成了数据表的数据结构信息。例如,学生的学号可以为整型,姓名可以为字符串类型,性别可以为整型,班级可以为字符串型,语文、数学、英语、政治成绩等可以为实数型。这些数据结构信息可以由数据 库系统的提供者编写的数据字典来记录。因此,步骤S11中,具体可以通过读数据库系统的数据字典获取所述各数据表的数据结构信息。
与数据结构信息相对应的是数据配置信息,这部分信息往往描述了数据表中属性可变的数据特征,因此并没有被写在数据库系统的数据字典中,而是被设置在一些业务配置表中,可以由用户自己根据具体应用来定义和配置。在步骤S11中,具体可以通过读所述数据库系统的业务配置表获取所述各数据表的数据配置信息。可选的,数据配置信息可以包括各字段的字段取值范围、字段枚举范围等。例如,如果学生成绩实行的是百分制,则各科成绩的取值范围为0至100,如果学生成绩是150分制的话,那么各科成绩的取值范围就为0至150。如果学生成绩是以优、良、中、差等衡量的话,那么各科成绩的枚举范围就可能是1、2、3、4,分别代表优、良、中、差。
在步骤S11中获取了数据库中各个数据表的数据结构信息和数据配置信息后,在步骤S12中就可以根据所述数据结构信息和所述数据配置信息,随机生成预设条数的测试数据了。生成的这些测试数据也可以以测试数据表的形式呈现,相应的,这个测试数据表的结构和字段与待测试的数据库系统中的相应数据表的结构和字段相对应,因此,能够对该待测的数据库系统进行良好的测试。
需要说明的是,数据库系统的测试除了要进行程序性能的测试外,还需要对该数据库系统的业务功能进行相应的测试,但同样是测试,二者对于测试数据的要求却有所不同。业务功能测试要求的测试数据数据量小,但要与业务流程和业务逻辑严格配合,因此通常需要花费大量的时间和精力去定制。而程序性能测试要求的测试数据数据量大,覆盖全面,但测试数据本身不必严格配合业务流程和业务逻辑,因此生成这样的测试数据要简单得多。本发明的实施例根据业务功能测试与程序性能测试的不同特点,将用于程序性能测试的数据从业务功能测试数据中分离开,大量生成了专门适用于程序性能测试的测试数据,从而大大提高了程序性能测试效率。
具体而言,将程序性能测试数据与业务功能测试数据相区分的方法可以多种多样,本发明的实施例对此不作限制。优选的,在本发明的一个实施例中,可以根据生成的测试数据表的主键值的取值范围,将所述预设条数的测试数据与所述数据库系统的业务功能测试数据相区分。相应的,在步骤S12中,根据所述数据结构信息和数据配置信息,随机生成预设条数的测试数据具体可包括如下步骤:
根据所述数据结构信息、数据配置信息和需要生成的测试数据的数据量,配置待生成的测试数据所属的数据表;
确定待生成的所述测试数据所属的数据表的主键值的取值范围,以将所述预设条数的测试数据与所述数据库系统的业务功能测试数据相区分;
根据配置的测试数据所属的数据表和确定的所述主键值的取值范围,随机生成预设条数的测试数据。
举例说明,在本发明的一个实施例中,假设用于业务功能测试的测试数据表中,主键值的取值范围为10000至20000,那么可以将随机生成的测试数据所属数据表的主键值的取值范围确定为从810000开始,逐步递增,从而将所述预设条数的测试数据与所述数据库系统的业务功能测试数据相区分。其中,预设条数的测试数据是指预先设定的需要生成的测试数据的条目数。例如,对于前述实施例中的学生成绩单数据表,假设需要生成500000个测试数据来验证程序性能,那么500000即为相应的预设条数,如果主键值的起始值为810000,则该数据表的主键值的取值范围为810000至1310000。可选的,该预设条数可以依据业务发展趋势,预测业务使用若干年之后的数据表规模,以便配置出更为适合的数据量。
下面通过具体实施例对本发明提供的测试数据的生成方法进行详细说明。如图2所示,本实施例中,测试数据的生成方法包括如下步骤:
S101.获取数据库系统中各数据表的数据结构信息和数据配置信息;
S102.根据获取的数据结构信息和数据配置信息,配置待生成的测试数据表中测试数据的预设条数、各字段的字段取值范围、字段枚举范围、主键值的起始值、以及测试数据文件切割大小等的参数配置。
需要说明的是,由于系统性能所限,一次性载入过多的测试数据可能会影响系统的处理速度,因此,对于大数据量的测试,一般会将整个数据文件做分割,分成若干段小文件依次进行载入和测试。因此,本步骤中,可以在数据配置表中设置测试数据文件切割大小的参数。可选的,可以以200万各条目作为一个小文件进行文件分割。
S103.通过sql语句将上述参数配置插入数据表配置和字段配置两张表中;
S104.读取上述两张表中的配置数据,并从数据字典表中获取对应的数据表结构,依据表结构的各字段类型、大小、顺序,生成相应的随机字符串、随机数字、随机日期等,再按照各字段顺序拼接成一个条目,一个条目的各字段之间使用二进制字符分割。对于有配置主键及特殊约束的字段,也会依照配置产生相应的测试数据。
相应的,本发明的实施例还提供一种测试数据的生成装置,如图3所示,该装置包括:
获取单元310,设置为获取数据库系统中各数据表的数据结构信息和数据配置信息;
生成单元312,设置为根据获取单元310获取的所述数据结构信息和数据配置信息,随机生成预设条数的测试数据,所述预设条数的测试数据与所述数据库系统的业务功能测试数据相区分。
本发明的实施例提供的测试数据的生成装置,获取单元310能够获取数据库系统中各数据表的数据结构信息和数据配置信息,生成单元312能够根据获取的数据结构信息和数据配置信息随机生成预设条数的测试数据,这样,生成的测试数据既有一定的随机性,也完全符合各个数据表中各字段的语法要求,因此能够以较为简便的方式产生大量测试数据,从而充分验证程序开发过程中存在的性能缺陷。又由于生成的预设条数的测试数据与所述数据库系统的业务功能测试数据被有效区分开,这种验证程序性能的测试数据不会被误用于验证数据库系统的业务功能,因此不会影响业务功能验证的可靠性。
可选的,所述数据结构信息包括各数据表中各字段的字段长度、字段类型和字段之间的排列顺序。所述数据配置信息包括各数据表中各字段的字段取值范围、字段枚举范围等。
具体的,获取单元310可具体设置为:
通过读所述数据库系统的数据字典获取所述各数据表的数据结构信息;
通过读所述数据库系统的业务配置表获取所述各数据表的数据配置信息。
可选的,生成单元312可具体设置为:
根据所述数据结构信息、数据配置信息和需要生成的测试数据的数据量,配置待生成的测试数据所属的数据表;
确定待生成的所述测试数据所属的数据表的主键值的取值范围,以将所述预设条数的测试数据与所述数据库系统的业务功能测试数据相区分;
根据配置的测试数据所属的数据表和确定的所述主键值的取值范围,随机生成预设条数的测试数据。
尽管为示例目的,已经公开了本发明的优选实施例,本领域的技术人员将意识到各种改进、增加和取代也是可能的,因此,本发明的范围应当不限于上述实施例。
工业实用性
本发明的实施例提供的测试数据的生成方法及装置,能够获取数据库系统中各数据表的数据结构信息和数据配置信息,并根据获取的数据结构信息和数据配置信息随机生成预设条数的测试数据,这样,生成的测试数据既有一定的随机性,也完全符合各个数据表中各字段的语法要求,因此能够以较为简便的方式产生大量测试数据,从而充分验证程序开发过程中存在的性能缺陷。又由于生成的预设条数的测试数据与所述数据库系统的业务功能测试数据被有效区分开,这种验证程序性能的测试数据不会被误用于验证数据库系统的业务功能,因此不会影响业务功能验证的可靠性。

Claims (10)

  1. 一种测试数据的生成方法,其中,包括:
    获取数据库系统中各数据表的数据结构信息和数据配置信息;
    根据所述数据结构信息和所述数据配置信息,随机生成预设条数的测试数据;其中,所述预设条数的测试数据与所述数据库系统的业务功能测试数据相区分。
  2. 根据权利要求1所述的方法,其中,所述数据结构信息包括各数据表中各字段的字段长度、字段类型和字段之间的排列顺序。
  3. 根据权利要求1所述的方法,其中,所述数据配置信息包括各字段的字段取值范围。
  4. 根据权利要求1至3中任一项所述的方法,其中,所述获取数据库系统中各数据表的数据结构信息和数据配置信息包括:
    通过读所述数据库系统的数据字典获取所述各数据表的数据结构信息;
    通过读所述数据库系统的业务配置表获取所述各数据表的数据配置信息。
  5. 根据权利要求1至3中任一项所述的方法,其中,根据所述数据结构信息和数据配置信息,随机生成预设条数的测试数据,所述预设条数的测试数据与所述数据库系统的业务功能测试数据相区分包括:
    根据所述数据结构信息、数据配置信息和需要生成的测试数据的数据量,配置待生成的测试数据所属的数据表;
    确定待生成的所述测试数据所属的数据表的主键值的取值范围,以将所述预设条数的测试数据与所述数据库系统的业务功能测试数据相区分;
    根据配置的测试数据所属的数据表和确定的所述主键值的取值范围,随机生成预设条数的测试数据。
  6. 一种测试数据的生成装置,包括:
    获取单元,设置为获取数据库系统中各数据表的数据结构信息和数据配置信息;
    生成单元,设置为根据所述获取单元获取的所述数据结构信息和数据配置信息,随机生成预设条数的测试数据,所述预设条数的测试数据与所述数据库系统的业务功能测试数据相区分。
  7. 根据权利要求6所述的装置,其中,所述数据结构信息包括各数据表中各字段的字段长度、字段类型和字段之间的排列顺序。
  8. 根据权利要求6所述的装置,其中,所述数据配置信息包括各数据表中各字段的字段取值范围。
  9. 根据权利要求6至8中任一项所述的装置,其中,所述获取单元设置为:
    通过读所述数据库系统的数据字典获取所述各数据表的数据结构信息;
    通过读所述数据库系统的业务配置表获取所述各数据表的数据配置信息。
  10. 根据权利要求6至8中任一项所述的装置,其中,所述生成单元设置为:
    根据所述数据结构信息、数据配置信息和需要生成的测试数据的数据量,配置待生成的测试数据所属的数据表;
    确定待生成的所述测试数据所属的数据表的主键值的取值范围,以将所述预设条数的测试数据与所述数据库系统的业务功能测试数据相区分;
    根据配置的测试数据所属的数据表和确定的所述主键值的取值范围,随机生成预设条数的测试数据。
PCT/CN2014/086966 2014-05-23 2014-09-19 一种测试数据的生成方法及装置 WO2015176431A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201410222200.1A CN105095325A (zh) 2014-05-23 2014-05-23 一种测试数据的生成方法及装置
CN201410222200.1 2014-05-23

Publications (1)

Publication Number Publication Date
WO2015176431A1 true WO2015176431A1 (zh) 2015-11-26

Family

ID=54553318

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2014/086966 WO2015176431A1 (zh) 2014-05-23 2014-09-19 一种测试数据的生成方法及装置

Country Status (2)

Country Link
CN (1) CN105095325A (zh)
WO (1) WO2015176431A1 (zh)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110109824A (zh) * 2019-04-09 2019-08-09 平安科技(深圳)有限公司 大数据自动回归测试方法、装置、计算机设备和存储介质
CN112073709A (zh) * 2020-07-27 2020-12-11 武汉旷视金智科技有限公司 测试数据的生成方法、装置及电子设备

Families Citing this family (11)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN106897205B (zh) * 2015-12-18 2021-01-05 创新先进技术有限公司 一种测试数据生成方法及装置
CN105512042B (zh) * 2015-12-22 2018-09-04 广东金赋科技股份有限公司 一种数据库的测试数据的自动生成方法、装置及测试系统
CN106649108A (zh) * 2016-12-13 2017-05-10 北京锐安科技有限公司 测试数据的生成方法及装置
CN108459951B (zh) * 2017-02-21 2022-07-29 腾讯科技(深圳)有限公司 测试方法和装置
CN108563584A (zh) * 2018-05-09 2018-09-21 平安普惠企业管理有限公司 测试数据生成方法、装置、计算机设备及存储介质
CN109753495A (zh) * 2019-01-28 2019-05-14 浪潮软件集团有限公司 一种通用结构化大数据生成方法
CN110263029B (zh) * 2019-05-06 2023-06-23 平安科技(深圳)有限公司 数据库生成测试数据的方法、装置、终端及介质
CN110188037B (zh) * 2019-05-13 2024-01-09 北京一览群智数据科技有限责任公司 一种数据模拟方法及装置
CN110516008A (zh) * 2019-08-14 2019-11-29 北京海致星图科技有限公司 一种构造图平台测试数据的方法
CN110750442B (zh) * 2019-09-06 2022-08-19 深圳平安医疗健康科技服务有限公司 测试用例的生成方法、装置、设备及存储介质
CN111309734B (zh) * 2020-02-20 2023-12-05 第四范式(北京)技术有限公司 自动生成表数据的方法及系统

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2000020529A (ja) * 1998-07-07 2000-01-21 Nec Software Kansai Ltd データウェアハウステストデータ作成装置
CN102968370A (zh) * 2012-11-26 2013-03-13 中国电信股份有限公司云计算分公司 一种测试数据生成方法及装置
CN103186639A (zh) * 2011-12-31 2013-07-03 腾讯科技(北京)有限公司 数据生成方法及系统
US20140007056A1 (en) * 2012-06-28 2014-01-02 Maxim Leizerovich Metadata-based Test Data Generation
CN103810171A (zh) * 2012-11-06 2014-05-21 深圳市金蝶中间件有限公司 生成限定范围的随机测试数据的方法及系统

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102902685B (zh) * 2011-07-27 2016-04-20 阿里巴巴集团控股有限公司 基于数据库的工具系统的测试方法及装置
CN103176894B (zh) * 2011-12-22 2017-06-23 中国银联股份有限公司 一种面向数据库的测试数据自动衍生方法和装置
CN102722537A (zh) * 2012-05-22 2012-10-10 苏州阔地网络科技有限公司 一种数据库测试数据的生成方法及系统

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2000020529A (ja) * 1998-07-07 2000-01-21 Nec Software Kansai Ltd データウェアハウステストデータ作成装置
CN103186639A (zh) * 2011-12-31 2013-07-03 腾讯科技(北京)有限公司 数据生成方法及系统
US20140007056A1 (en) * 2012-06-28 2014-01-02 Maxim Leizerovich Metadata-based Test Data Generation
CN103810171A (zh) * 2012-11-06 2014-05-21 深圳市金蝶中间件有限公司 生成限定范围的随机测试数据的方法及系统
CN102968370A (zh) * 2012-11-26 2013-03-13 中国电信股份有限公司云计算分公司 一种测试数据生成方法及装置

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110109824A (zh) * 2019-04-09 2019-08-09 平安科技(深圳)有限公司 大数据自动回归测试方法、装置、计算机设备和存储介质
CN112073709A (zh) * 2020-07-27 2020-12-11 武汉旷视金智科技有限公司 测试数据的生成方法、装置及电子设备
CN112073709B (zh) * 2020-07-27 2023-04-14 武汉旷视金智科技有限公司 测试数据的生成方法、装置及电子设备

Also Published As

Publication number Publication date
CN105095325A (zh) 2015-11-25

Similar Documents

Publication Publication Date Title
WO2015176431A1 (zh) 一种测试数据的生成方法及装置
CN107957957B (zh) 测试用例的获取方法和装置
US8209658B2 (en) Method of creating signatures for classifying program failures
US9454467B2 (en) Method and apparatus for mining test coverage data
CN106919612B (zh) 一种上线结构化查询语言脚本的处理方法及装置
US9460069B2 (en) Generation of test data using text analytics
US11036479B2 (en) Devices, systems, and methods of program identification, isolation, and profile attachment
CN108491326B (zh) 测试行为重组方法、装置及存储介质
CN111159016A (zh) 一种规范检测方法及装置
CN115827895A (zh) 一种漏洞知识图谱处理方法、装置、设备及介质
US10339035B2 (en) Test DB data generation apparatus
CN110737689A (zh) 数据标准符合性检测方法、装置、系统及存储介质
US20150143342A1 (en) Functional validation of software
WO2015039793A1 (en) Derivation of generalized test cases
CN111309586A (zh) 一种命令测试方法、装置及其存储介质
CN114328276A (zh) 测试用例生成方法和装置,显示测试用例的方法和装置
US20210365487A1 (en) Word Library Management Method and Apparatus for input Method
CN103164335A (zh) 检查单元测试质量的方法和系统
Rahman Anti-patterns in infrastructure as code
US11947530B2 (en) Methods and systems to automatically generate search queries from software documents to validate software component search engines
CN113672233B (zh) 一种基于Redfish的服务器带外管理方法、装置及设备
CN114238733A (zh) 关键信息提取方法及装置、计算机存储介质、电子设备
US9305117B2 (en) String generation tool
CN113342632A (zh) 仿真数据自动化处理方法、装置、电子设备及存储介质
CN113448869A (zh) 测试用例生成的方法、装置、电子设备及计算机可读介质

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 14892593

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 14892593

Country of ref document: EP

Kind code of ref document: A1