CN114185770A - Method and device for generating test data, computer equipment and storage medium - Google Patents

Method and device for generating test data, computer equipment and storage medium Download PDF

Info

Publication number
CN114185770A
CN114185770A CN202111386569.2A CN202111386569A CN114185770A CN 114185770 A CN114185770 A CN 114185770A CN 202111386569 A CN202111386569 A CN 202111386569A CN 114185770 A CN114185770 A CN 114185770A
Authority
CN
China
Prior art keywords
template
classification
data
scene
field
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.)
Pending
Application number
CN202111386569.2A
Other languages
Chinese (zh)
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.)
Merchants Union Consumer Finance Co Ltd
Original Assignee
Merchants Union Consumer Finance 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 Merchants Union Consumer Finance Co Ltd filed Critical Merchants Union Consumer Finance Co Ltd
Priority to CN202111386569.2A priority Critical patent/CN114185770A/en
Publication of CN114185770A publication Critical patent/CN114185770A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Prevention of errors by analysis, debugging or testing of software
    • G06F11/3668Testing of software
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases

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)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The application relates to a method, an apparatus, a computer device and a storage medium for generating test data. The method comprises the following steps: acquiring a data set corresponding to the test data, and generating a classification template based on a service scene corresponding to the data set, wherein the classification template comprises classification information; acquiring service scene identifications corresponding to the classification information, respectively acquiring field sets corresponding to the service scene identifications, and combining the field sets to obtain a scene template; establishing a corresponding relation between the classification template and the scene template, and combining the classification template and the scene template according to the corresponding relation to obtain a target template, wherein the target template comprises classification information and fields to be filled; and when a test data generation instruction is received, generating test data according to the field to be filled, wherein the test data corresponds to the classification information. By adopting the method, the classification template, the scene template and the field combination can be shared, the dependence of workers on professional service personnel is simplified, the efficiency of test data preprocessing is improved, and the test efficiency is further improved.

Description

生成测试数据的方法、装置、计算机设备和存储介质Method, apparatus, computer equipment and storage medium for generating test data

技术领域technical field

本申请涉及软件测试技术领域,特别是涉及一种生成测试数据的方法、装置、计算机设备和存储介质。The present application relates to the technical field of software testing, and in particular, to a method, apparatus, computer equipment and storage medium for generating test data.

背景技术Background technique

随着软件测试技术的发展,出现了软件测试技术,软件测试是基于测试数据进行的。测试人员在测试过程中需要准备大量的测试数据,通过这些准备的测试数据来对各个业务进行测试,而多数测试人员的知识有限,无法了解世界上所有业务的流程,所以在跨业务系统的数据准备时,需要其他业务测试人员协助,各自的数据准备脚本/操作不能共享。With the development of software testing technology, software testing technology has emerged, and software testing is based on test data. Testers need to prepare a large amount of test data during the testing process, and use these prepared test data to test each business. However, most testers have limited knowledge and cannot understand the processes of all businesses in the world. Therefore, in the cross-business system data When preparing, other business testers are required to assist, and their respective data preparation scripts/operations cannot be shared.

传统技术中,是通过人工手段准备跨领域的测试数据的,且各自的数据准备脚本/操作不能共享。同时由于开发人员、UAT验收人员等工作人员做一些测试验证的时候需要测试数据,而他们对业务的数据流不是很清晰,需要频繁的找业务人员协助造数,导致整体的效率降低。In the traditional technology, cross-domain test data is prepared by manual means, and the respective data preparation scripts/operations cannot be shared. At the same time, because developers, UAT acceptance personnel and other staff need test data when doing some testing and verification, and they are not very clear about the data flow of the business, they need to frequently find business personnel to assist in data creation, resulting in a decrease in overall efficiency.

发明内容SUMMARY OF THE INVENTION

基于此,有必要针对上述技术问题,提供一种能够提供跨领域的生成测试数据的方法、装置、计算机设备和计算机可读存储介质。Based on this, it is necessary to provide a method, an apparatus, a computer device and a computer-readable storage medium for generating test data that can provide cross-domain in response to the above technical problems.

第一方面,本申请提供了一种生成测试数据方法。所述方法包括:In a first aspect, the present application provides a method for generating test data. The method includes:

获取测试数据对应的数据集合,基于所述数据集合对应的业务场景生成分类模板,所述分类模板包括分类信息,所述分类信息用于对业务场景进行分类;acquiring a data set corresponding to the test data, and generating a classification template based on a business scenario corresponding to the data set, where the classification template includes classification information, and the classification information is used to classify the business scenario;

获取所述分类信息对应的业务场景标识,分别获取所述业务场景标识对应的字段集合,组合所述字段集合,得到场景模板,所述场景模板与所述业务场景标识相对应;acquiring the business scenario identifier corresponding to the classification information, respectively acquiring the field sets corresponding to the business scenario identifiers, and combining the field sets to obtain a scenario template, where the scenario template corresponds to the business scenario identifier;

建立所述分类模板与所述场景模板的对应关系,按照所述对应关系组合所述分类模板与所述场景模板,得到目标模板,所述目标模板包括分类信息与待填充字段;establishing a corresponding relationship between the classification template and the scene template, and combining the classification template and the scene template according to the corresponding relationship to obtain a target template, where the target template includes classification information and fields to be filled;

在接收到测试数据生成指令时,按照所述待填充字段生成测试数据,所述测试数据与所述分类信息相对应。When a test data generation instruction is received, test data is generated according to the to-be-filled field, and the test data corresponds to the classification information.

在其中一个实施例中,所述基于所述数据集合对应的业务场景生成分类模板包括:In one embodiment, the generating a classification template based on the business scenario corresponding to the data set includes:

从所述数据集合中获取分类标识与所述分类标识关联的业务描述数据;Obtain the business description data associated with the classification identification and the classification identification from the data set;

基于所述分类标识生成所述分类标识字段,得到所述分类模板的分类标识字段;Generate the classification identification field based on the classification identification to obtain the classification identification field of the classification template;

基于所述分类标识关联的业务描述数据生成所述分类模板的分类描述字段。A category description field of the category template is generated based on the business description data associated with the category identifier.

在其中一个实施例中,所述分类标识字段是基于所述分类标识填充的,所述基于所述分类标识关联的业务描述数据生成所述分类模板的分类描述字段包括:In one embodiment, the classification identification field is filled based on the classification identification, and the generation of the classification description field of the classification template based on the business description data associated with the classification identification includes:

获取所述分类标识对应的账号类型,基于所述账号类型确定所述分类描述字段的字段属性信息;Obtain the account type corresponding to the classification identifier, and determine the field attribute information of the classification description field based on the account type;

根据所述字段属性信息设置所述分类描述字段,得到用于生成所述测试数据的待填充字段。The classification description field is set according to the field attribute information, and the field to be filled for generating the test data is obtained.

在其中一个实施例中,所述按照所述待填充字段生成测试数据包括:In one of the embodiments, the generating test data according to the fields to be filled includes:

获取所述测试数据生成指令携带的测试环境信息和目标分类信息;Obtain the test environment information and target classification information carried by the test data generation instruction;

基于所述测试环境信息生成测试数据对应的测试环境;Generate a test environment corresponding to the test data based on the test environment information;

在所述测试环境中,基于所述目标分类信息获取目标模板,基于所述目标模板的待填充字段,生成所述测试数据。In the test environment, a target template is obtained based on the target classification information, and the test data is generated based on fields to be filled in the target template.

在其中一个实施例中,所述组合所述字段集合的字段,得到场景模板包括:In one embodiment, the combination of the fields of the field set to obtain the scene template includes:

获取所述业务场景标识对应的第一业务需求,基于所述第一业务需求获取基础数据模板,所述基础数据模板是根据第二业务需求生成的;obtaining a first business requirement corresponding to the business scenario identifier, and obtaining a basic data template based on the first business requirement, where the basic data template is generated according to the second business requirement;

将对应于所述第一业务需求获取到的基础数据模板的字段组合,得到第一业务需求对应的场景模板。Combining the fields of the basic data template obtained corresponding to the first business requirement to obtain a scene template corresponding to the first business requirement.

在其中一个实施例中,所述将对应于所述第一业务需求获取到的基础数据模板的字段组合,得到第一业务需求对应的场景模板包括:In one embodiment, the combination of fields of the basic data template obtained corresponding to the first business requirement to obtain the scene template corresponding to the first business requirement includes:

按照所述基础数据模板的字段属性,生成基础数据模板对应的数据,对所述基础数据模板对应的数据进行检测,确定所述基础数据模板对应的数据符合所述基础数据模板的预设条件;和/或,According to the field attributes of the basic data template, the data corresponding to the basic data template is generated, the data corresponding to the basic data template is detected, and it is determined that the data corresponding to the basic data template meets the preset conditions of the basic data template; and / or,

基于所述第一业务需求对应的场景模板获取第一业务需求对应的字段属性,按照所述第一业务需求对应的字段属性,生成第一业务需求对应的数据,对所述第一业务需求对应的数据进行检测,确定所述第一业务需求对应的数据符合所述所第一业务需求对应的场景模板的预设条件。Obtain field attributes corresponding to the first business requirement based on the scene template corresponding to the first business requirement, generate data corresponding to the first business requirement according to the field attributes corresponding to the first business requirement, and generate data corresponding to the first business requirement. It is determined that the data corresponding to the first service requirement meets the preset conditions of the scene template corresponding to the first service requirement.

第二方面,本申请还提供了一种生成测试数据的装置。所述装置包括:In a second aspect, the present application also provides an apparatus for generating test data. The device includes:

分类模板获取模块,用于获取测试数据对应的数据集合,基于所述数据集合对应的业务场景生成分类模板,所述分类模板包括分类信息,所述分类信息用于对业务场景进行分类;a classification template obtaining module, configured to obtain a data set corresponding to the test data, and generate a classification template based on a business scenario corresponding to the data set, where the classification template includes classification information, and the classification information is used to classify the business scenario;

场景模板获取模块,用于获取所述分类信息对应的业务场景标识,分别获取所述业务场景标识对应的字段集合,组合所述字段集合,得到场景模板,所述场景模板与所述业务场景标识相对应;A scenario template obtaining module, configured to obtain the business scenario identifier corresponding to the classification information, obtain the field sets corresponding to the business scenario identifiers respectively, combine the field sets to obtain a scenario template, the scenario template and the business scenario identifier Corresponding;

目标模板生成模块,用于建立所述分类模板与所述场景模板的对应关系,按照所述对应关系组合所述分类模板与所述场景模板,得到目标模板,所述目标模板包括分类信息与待填充字段;A target template generation module, configured to establish a corresponding relationship between the classification template and the scene template, and combine the classification template and the scene template according to the corresponding relationship to obtain a target template, where the target template includes classification information and to-be-to-be fill field;

测试数据生成模块,用于在接收到测试数据生成指令时,按照所述待填充字段生成测试数据,所述测试数据与所述分类信息相对应。The test data generation module is configured to generate test data according to the to-be-filled field when receiving the test data generation instruction, and the test data corresponds to the classification information.

第三方面,本申请还提供了一种计算机设备。所述计算机设备包括存储器和处理器,所述存储器存储有计算机程序,所述处理器执行所述计算机程序时实现以下步骤:In a third aspect, the present application also provides a computer device. The computer device includes a memory and a processor, the memory stores a computer program, and the processor implements the following steps when executing the computer program:

获取测试数据对应的数据集合,基于所述数据集合对应的业务场景生成分类模板,所述分类模板包括分类信息,所述分类信息用于对业务场景进行分类;acquiring a data set corresponding to the test data, and generating a classification template based on a business scenario corresponding to the data set, where the classification template includes classification information, and the classification information is used to classify the business scenario;

获取所述分类信息对应的业务场景标识,分别获取所述业务场景标识对应的字段集合,组合所述字段集合,得到场景模板,所述场景模板与所述业务场景标识相对应;acquiring the business scenario identifier corresponding to the classification information, respectively acquiring the field sets corresponding to the business scenario identifiers, and combining the field sets to obtain a scenario template, where the scenario template corresponds to the business scenario identifier;

建立所述分类模板与所述场景模板的对应关系,按照所述对应关系组合所述分类模板与所述场景模板,得到目标模板,所述目标模板包括分类信息与待填充字段;establishing a corresponding relationship between the classification template and the scene template, and combining the classification template and the scene template according to the corresponding relationship to obtain a target template, where the target template includes classification information and fields to be filled;

在接收到测试数据生成指令时,按照所述待填充字段生成测试数据,所述测试数据与所述分类信息相对应。When a test data generation instruction is received, test data is generated according to the to-be-filled field, and the test data corresponds to the classification information.

第四方面,本申请还提供了一种计算机可读存储介质。所述计算机可读存储介质,其上存储有计算机程序,所述计算机程序被处理器执行时实现以下步骤:In a fourth aspect, the present application also provides a computer-readable storage medium. The computer-readable storage medium has a computer program stored thereon, and when the computer program is executed by the processor, the following steps are implemented:

获取测试数据对应的数据集合,基于所述数据集合对应的业务场景生成分类模板,所述分类模板包括分类信息,所述分类信息用于对业务场景进行分类;acquiring a data set corresponding to the test data, and generating a classification template based on a business scenario corresponding to the data set, where the classification template includes classification information, and the classification information is used to classify the business scenario;

获取所述分类信息对应的业务场景标识,分别获取所述业务场景标识对应的字段集合,组合所述字段集合,得到场景模板,所述场景模板与所述业务场景标识相对应;acquiring the business scenario identifier corresponding to the classification information, respectively acquiring the field sets corresponding to the business scenario identifiers, and combining the field sets to obtain a scenario template, where the scenario template corresponds to the business scenario identifier;

建立所述分类模板与所述场景模板的对应关系,按照所述对应关系组合所述分类模板与所述场景模板,得到目标模板,所述目标模板包括分类信息与待填充字段;establishing a corresponding relationship between the classification template and the scene template, and combining the classification template and the scene template according to the corresponding relationship to obtain a target template, where the target template includes classification information and fields to be filled;

在接收到测试数据生成指令时,按照所述待填充字段生成测试数据,所述测试数据与所述分类信息相对应。When a test data generation instruction is received, test data is generated according to the to-be-filled field, and the test data corresponds to the classification information.

第五方面,本申请还提供了一种计算机程序产品。所述计算机程序产品,包括计算机程序,该计算机程序被处理器执行时实现以下步骤:In a fifth aspect, the present application also provides a computer program product. The computer program product includes a computer program that, when executed by a processor, implements the following steps:

获取测试数据对应的数据集合,基于所述数据集合对应的业务场景生成分类模板,所述分类模板包括分类信息,所述分类信息用于对业务场景进行分类;acquiring a data set corresponding to the test data, and generating a classification template based on a business scenario corresponding to the data set, where the classification template includes classification information, and the classification information is used to classify the business scenario;

获取所述分类信息对应的业务场景标识,分别获取所述业务场景标识对应的字段集合,组合所述字段集合,得到场景模板,所述场景模板与所述业务场景标识相对应;acquiring the business scenario identifier corresponding to the classification information, respectively acquiring the field sets corresponding to the business scenario identifiers, and combining the field sets to obtain a scenario template, where the scenario template corresponds to the business scenario identifier;

建立所述分类模板与所述场景模板的对应关系,按照所述对应关系组合所述分类模板与所述场景模板,得到目标模板,所述目标模板包括分类信息与待填充字段;establishing a corresponding relationship between the classification template and the scene template, and combining the classification template and the scene template according to the corresponding relationship to obtain a target template, where the target template includes classification information and fields to be filled;

在接收到测试数据生成指令时,按照所述待填充字段生成测试数据,所述测试数据与所述分类信息相对应。When a test data generation instruction is received, test data is generated according to the to-be-filled field, and the test data corresponds to the classification information.

上述生成测试数据的方法、装置、计算机设备、存储介质和计算机程序产品,获取测试数据对应的数据集合,基于所述数据集合对应的业务场景生成分类模板,所述分类模板包括分类信息,所述分类信息用于对业务场景进行分类,便于选择复合场景;获取所述分类信息对应的业务场景标识,分别获取所述业务场景标识对应的字段集合,组合所述字段集合,得到场景模板,所述场景模板与所述业务场景标识相对应,提高生产场景模板的效率;建立所述分类模板与所述场景模板的对应关系,按照所述对应关系组合所述分类模板与所述场景模板,得到目标模板,所述目标模板包括分类信息与待填充字段,构建目标模板,实现高效传值;在接收到测试数据生成指令时,按照所述待填充字段生成测试数据,所述测试数据与所述分类信息相对应,在生成测试数据时,按照分类信息选择目标模板,降低用户操作,分类模板、场景模板与字段组合可以跨领域共享,简化使用人员对业务人员的依赖,提高测试数据预处理的效率,进而提升测试效率。The above-mentioned method, device, computer equipment, storage medium and computer program product for generating test data obtain a data set corresponding to the test data, and generate a classification template based on a business scenario corresponding to the data set, wherein the classification template includes classification information, and the classification template includes classification information. The classification information is used to classify the business scenarios, so as to facilitate the selection of composite scenarios; obtain the business scenario identifiers corresponding to the classification information, respectively obtain the field sets corresponding to the business scenario identifiers, and combine the field sets to obtain a scenario template, the The scene template corresponds to the business scene identifier, which improves the efficiency of producing the scene template; establishes the corresponding relationship between the classification template and the scene template, and combines the classification template and the scene template according to the corresponding relationship to obtain the target template, the target template includes classification information and fields to be filled, and a target template is constructed to realize efficient value transfer; when receiving a test data generation instruction, test data is generated according to the fields to be filled, and the test data and the classification Corresponding information, when generating test data, select the target template according to the classification information to reduce user operations, and the combination of classification templates, scene templates and fields can be shared across fields, simplifying the user's dependence on business personnel, and improving the efficiency of test data preprocessing , thereby improving the test efficiency.

附图说明Description of drawings

图1为一个实施例中生成测试数据的方法的应用环境图;1 is an application environment diagram of a method for generating test data in one embodiment;

图2为一个实施例中生成测试数据的方法的流程示意图;2 is a schematic flowchart of a method for generating test data in one embodiment;

图3为一个实施例中生成分类模板的流程示意图;3 is a schematic flowchart of generating a classification template in one embodiment;

图4为另一个实施例中生成分类描述字段的流程示意图;4 is a schematic flowchart of generating a classification description field in another embodiment;

图5为一个实施例中生成场景模板的流程示意图;5 is a schematic flowchart of generating a scene template in one embodiment;

图6为另一个实施例中模板字段检测的流程示意图;6 is a schematic flowchart of template field detection in another embodiment;

图7为一个实施例中生成测试数据的流程示意图;7 is a schematic flow chart of generating test data in one embodiment;

图8为一个实施例中测试人员进行个人数据测试的流程示意图;8 is a schematic flowchart of a tester performing personal data testing in one embodiment;

图9为一个实施例中生成测试数据装置的结构示意图;9 is a schematic structural diagram of an apparatus for generating test data in one embodiment;

图10为一个实施例中计算机设备的内部结构图。Figure 10 is a diagram of the internal structure of a computer device in one embodiment.

具体实施方式Detailed ways

为了使本申请的目的、技术方案及优点更加清楚明白,以下结合附图及实施例,对本申请进行进一步详细说明。应当理解,此处描述的具体实施例仅用以解释本申请,并不用于限定本申请。In order to make the purpose, technical solutions and advantages of the present application more clearly understood, the present application will be described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are only used to explain the present application, but not to limit the present application.

本申请实施例提供的生成测试数据的方法,可以应用于如图1所示的应用环境中。其中,终端102通过网络与服务器104进行通信。数据存储系统可以存储服务器104需要处理的数据。数据存储系统可以集成在服务器104上,也可以放在云上或其他网络服务器上。The method for generating test data provided by the embodiment of the present application can be applied to the application environment shown in FIG. 1 . The terminal 102 communicates with the server 104 through the network. The data storage system may store data that the server 104 needs to process. The data storage system can be integrated on the server 104, or it can be placed on the cloud or other network server.

服务器104获取测试数据对应的数据集合,基于所述数据集合对应的业务场景生成分类模板,所述分类模板包括分类信息,所述分类信息用于对业务场景进行分类;获取所述分类信息对应的业务场景标识,分别获取所述业务场景标识对应的字段集合,组合所述字段集合,得到场景模板,所述场景模板与所述业务场景标识相对应;建立所述分类模板与所述场景模板的对应关系,按照所述对应关系组合所述分类模板与所述场景模板,得到目标模板,所述目标模板包括分类信息与待填充字段;在接收到测试数据生成指令时,按照所述待填充字段生成测试数据,所述测试数据与所述分类信息相对应。其中,终端102可以但不限于是各种个人计算机、笔记本电脑、智能手机、平板电脑、物联网设备和便携式可穿戴设备,物联网设备可为智能音箱、智能电视、智能空调、智能车载设备等。便携式可穿戴设备可为智能手表、智能手环、头戴设备等。服务器104可以用独立的服务器或者是多个服务器组成的服务器集群来实现。The server 104 obtains a data set corresponding to the test data, and generates a classification template based on a business scenario corresponding to the data set, where the classification template includes classification information, and the classification information is used to classify the business scenario; Business scenario identifiers, respectively acquiring the field sets corresponding to the business scenario identifiers, and combining the field sets to obtain a scenario template, where the scenario templates correspond to the business scenario identifiers; establishing a relationship between the classification template and the scenario template Corresponding relationship, combining the classification template and the scene template according to the corresponding relationship to obtain a target template, where the target template includes classification information and fields to be filled; when receiving the test data generation instruction, according to the fields to be filled Test data is generated, the test data corresponding to the classification information. The terminal 102 can be, but is not limited to, various personal computers, notebook computers, smart phones, tablet computers, IoT devices and portable wearable devices, and the IoT devices can be smart speakers, smart TVs, smart air conditioners, smart vehicle-mounted devices, etc. . The portable wearable device may be a smart watch, a smart bracelet, a head-mounted device, or the like. The server 104 can be implemented by an independent server or a server cluster composed of multiple servers.

在一个实施例中,如图2所示,提供了一种生成测试数据的方法,以该方法应用于图1中的服务器104为例进行说明,包括以下步骤:In one embodiment, as shown in FIG. 2, a method for generating test data is provided, and the method is applied to the server 104 in FIG. 1 as an example for description, including the following steps:

步骤202,获取测试数据对应的数据集合,基于数据集合对应的业务场景生成分类模板,分类模板包括分类信息,分类信息用于对业务场景进行分类。Step 202: Acquire a data set corresponding to the test data, and generate a classification template based on a business scenario corresponding to the data set, where the classification template includes classification information, and the classification information is used to classify the business scenario.

测试数据对应的数据集合,是用于分类场景状态的数据集合。其指的是将待处理数据进行聚合,得到的数据集合符合待处理数据标准,该数据集合用于表示某一对象或者其他具有指代含义的组织或结构。该数据集合可以是某一客户类型的数据集合,也可以是具有某种特征或某种业务的集合,还可以是具体的客户名称或者泛指的客户集合。如果两个客户均具有实时通讯软件的业务,可以将这两个设定为同一类型的客户,有实时通讯软件的业务的客户均可以属于这一类别;进一步地,如果两个客户均属于实时通讯软件这一相同领域,且规模相同,可以将这两个客户设定为同一类型的客户,同一领域与规模的客户也可以属于这一类别;进一步地,如果对于某一具体的客户,也可以按照该客户的各个项目组或者项目类型进行划分,得到具体的数据集合。The data set corresponding to the test data is the data set used to classify the scene state. It refers to aggregating the data to be processed, and the obtained data set conforms to the standard of the data to be processed, and the data set is used to represent an object or other organization or structure with referential meaning. The data set can be a data set of a certain customer type, or a set with a certain characteristic or a certain business, and can also be a specific customer name or a general customer set. If two customers have real-time communication software services, they can be set as the same type of customers, and both customers with real-time communication software services can belong to this category; further, if both customers belong to real-time communication software In the same field of communication software and the same scale, these two customers can be set as the same type of customers, and customers in the same field and scale can also belong to this category; further, if for a specific customer, also It can be divided according to each project group or project type of the customer to obtain a specific data set.

业务场景,指的是在某一领域或某些相关领域中,针对具体的业务的场景,其是实现整体业务系统运行的基础,业务场景可以是具体的用户操作行为,也可以配合经济学上不同领域的业务划分。例如,应用具体的用户操作行为进行划分时,可以将“邮箱用户的实名注册”作为一个业务场景,也可以将“银行用户的实名注册”作为一个业务场景。Business scenarios refer to specific business scenarios in a certain field or some related fields, which are the basis for realizing the operation of the overall business system. Business division in different fields. For example, when applying specific user operation behaviors for classification, "real-name registration of mailbox users" can be used as a business scenario, and "real-name registration of bank users" can also be used as a business scenario.

在一可选地实施例中,生成分类模板的过程,是对业务场景的分类管理,而用于分类管理业务场景的信息就是分类信息,分类信息可以是分类标识,也可以是分类标识相关的描述信息;分类信息是以测试数据对应的数据集合的集合标识为基础的信息,还可以添加该集合标识的描述信息作为分类信息,也可以添加其他待测试的字段,用于表示该字段对应的数据是静态的,无需按照场景生成测试数据。其中,分类信息是按照测试数据对应的数据集合的相关业务设定的。例如:一个集合类别是宽泛的第一客户类别具有实时通讯软件业务和邮箱业务,则第一客户类别对应的业务场景包括实时通讯软件业务和邮箱业务这两方面;另一个某集合类别是客户需要测试的第二客户类别,第二客户类别仅具有“用户注册”与“用户登录”两个业务场景,则第二客户类别集合对应的业务场景是“用户注册”与“用户登录”两个业务场景。In an optional embodiment, the process of generating a classification template is the classification management of business scenarios, and the information used for classifying and managing business scenarios is classification information, and the classification information may be classification identifiers, or may be related to classification identifiers. Description information; classification information is information based on the set identifier of the data set corresponding to the test data. The description information of the set identifier can also be added as the classification information, and other fields to be tested can also be added to indicate the corresponding fields of the field. The data is static, and there is no need to generate test data according to the scenario. The classification information is set according to related services of the data set corresponding to the test data. For example: a set category is a broad first customer category with instant messaging software business and mailbox business, then the business scenario corresponding to the first customer category includes instant messaging software business and mailbox business; another set category is customer needs The second customer category tested, the second customer category only has two business scenarios of "user registration" and "user login", then the business scenarios corresponding to the second customer category set are "user registration" and "user login" two services Scenes.

在一可选地实施例中,生成分类模板的过程,是针对各个客户类型等信息进行填充,该过程奠定结合场景模板的基础,便于选择复合场景,实现场景模板数据的多次复用,通过客户类型等信息,满足定制化需求。In an optional embodiment, the process of generating a classification template is to fill in information such as each customer type, and this process lays a foundation for combining scene templates, which facilitates selection of composite scenes, and realizes multiple reuse of scene template data. Customer type and other information to meet customized needs.

步骤204,获取分类信息对应的业务场景标识,分别获取业务场景标识对应的字段集合,组合字段集合,得到场景模板。Step 204: Acquire a business scenario identifier corresponding to the classification information, respectively acquire a field set corresponding to the business scenario identifier, and combine the field sets to obtain a scenario template.

业务场景标识,是与场景模板相对应的,用于表征具体的业务场景模板。而一个业务场景可以具有多个场景模板,同一业务场景的多个场景模板,可以按照数值进行排序,也可以分别设计相应的名称。设置对应于场景模板的业务场景标识,而不基于业务场景设定场景标识,可以提高细粒度,增强兼容性,针对不同的客户可以设定具有针对性的场景模板,且调度场景模板时,具有高效而便捷的优势,有利于多个场景模板的调试。The business scenario identifier corresponds to the scenario template and is used to represent a specific business scenario template. A business scenario can have multiple scenario templates, and multiple scenario templates of the same business scenario can be sorted according to numerical values, and corresponding names can also be designed. Setting the business scenario ID corresponding to the scenario template instead of setting the scenario ID based on the business scenario can improve fine-grainedness and enhance compatibility. Targeted scenario templates can be set for different customers, and when scheduling scenario templates, there are The advantages of efficiency and convenience are conducive to the debugging of multiple scene templates.

在一可选地实施例中,字段集合,指的是基础数据模板,其是承载基础业务来生成测试数据这一功能的最小单元,提供脚本执行、接口调用、数据库操作等操作功能,是生成业务描述数据的基础数据模板。而业务场景标识对应的字段集合,指的是生成用于生成业务场景标识对应的基础数据模板。进一步地,字段集合是用于生成业务描述数据的基础数据的模板,业务描述数据的基础数据是在单一业务系统上通过单接口调用或单表/依赖的多表操作即可生成的数据,如用户注册后生成的用户数据,用户实名后生成的客户数据、单类别的资信数据;多个业务系统之间强耦合的最小单元数据组合也可以定义为基础业务描述数据。例如:在某一实时通讯软件账号的生成过程中,通过“注册”可以生成账户数据,而“注册”对应于一个或一系列操作指令,其对应的列操作指令整体封装成一个基础数据模板。In an optional embodiment, the field set refers to the basic data template, which is the smallest unit of the function of carrying basic services to generate test data, and provides operation functions such as script execution, interface invocation, database operation, etc. Basic data template for business description data. The field set corresponding to the business scenario identifier refers to generating a basic data template for generating the business scenario identifier. Further, the field set is a template for generating basic data of business description data, and the basic data of business description data is the data that can be generated through a single interface call or a single table/dependent multi-table operation on a single business system, such as User data generated after user registration, customer data generated after user real-name, single-category credit data; the minimum unit data combination with strong coupling between multiple business systems can also be defined as basic business description data. For example: in the process of generating an account of a real-time communication software, account data can be generated through "registration", and "registration" corresponds to one or a series of operation instructions, and the corresponding column operation instructions are encapsulated into a basic data template as a whole.

在一可选地实施例中,组合字段集合,就是将各个基础数据模板进行重组,在重组的过程中,可以选择使用数据清洗的手段去除重复的字段。在一可选地实施例中,可以使用SQL语句、接口调用等数据的基本组合方式,也可以使用多种基本组合方式进行复合,封装得到场景模板。生成场景模板的步骤,是将多个基础数据模板进行组装,形成一个业务链路操作指令,包括一个或多个基础数据模板对应的操作指令。例如:某一实时通讯软件具有存储零钱的属性,可以生成具有零钱的通讯账户,其可以通过一个基础数据模板生成通讯账号的相关数据,通过另一个数据基础模板生成零钱调度的相关数据。可选地,用于生成通讯账号的基础数据模板,可包括“注册”对应的操作指令;用于生成零钱调度的基础模板,可以包括“身份认证”、“绑定银行卡”及“充值”对应的操作指令。In an optional embodiment, combining the field set is to reorganize each basic data template. During the reorganization process, you can choose to use data cleaning to remove duplicate fields. In an optional embodiment, a basic combination of data such as SQL statements and interface calls can be used, or multiple basic combination methods can be used for compounding and encapsulation to obtain a scene template. The step of generating a scene template is to assemble a plurality of basic data templates to form a business link operation instruction, including operation instructions corresponding to one or more basic data templates. For example, a real-time communication software has the property of storing change, and can generate a communication account with change. It can generate the relevant data of the communication account through a basic data template, and generate the relevant data of change scheduling through another data basic template. Optionally, the basic data template used to generate the communication account may include an operation instruction corresponding to "registration"; the basic template used to generate change scheduling may include "identity authentication", "binding bank card" and "recharge". corresponding operating instructions.

在一可选地实施例中,将字段集合作为模板的基础数据,组合字段构建场景模板,提高生产场景模板的效率。进一步地提升模板的复用频率,且可以更好地跨领域地进行数据组合,实现跨领域的数据重组,方便测试人员跨业务场景进行数据测试。In an optional embodiment, the field set is used as the basic data of the template, and the fields are combined to construct a scene template, so as to improve the efficiency of producing the scene template. It further improves the reuse frequency of templates, and can better combine data across fields, realize cross-field data reorganization, and facilitate testers to perform data testing across business scenarios.

步骤206,建立分类模板与场景模板的对应关系,按照对应关系组合分类模板与场景模板,得到目标模板,目标模板包括分类信息与待填充字段。Step 206 , establishing a correspondence between the classification template and the scene template, and combining the classification template and the scene template according to the corresponding relationship to obtain a target template, where the target template includes classification information and fields to be filled.

在一可选地实施例中,建立分类模板与场景模板的对应关系,是可以采用多种实施方式的,其可以使用数据关联的方式,也可以建立数据的依赖关系,还可以使用其他的映射关系,更可以使用组合、聚合等方式。建立分类模板与场景模板的对应关系,使得分类模板与场景模板的数值可以进行传输。In an optional embodiment, the establishment of the corresponding relationship between the classification template and the scene template can be carried out in a variety of ways, which can use data association, or establish data dependencies, and can also use other mappings. relationship, you can use combination, aggregation and other methods. A corresponding relationship between the classification template and the scene template is established, so that the values of the classification template and the scene template can be transmitted.

在一可选地实施例中,按照对应关系组合分类模板与场景模板,可以直接对分类模板与场景模板中的字段进行组合,将组合后的模板作为目标模板,以节约成本;也可以将分类模板与场景模板中的字段传输到另一个数据存储位置,得到一个新的模板,将这一新的模板作为目标模板,有益于增加数据多样性与细粒度,避免出现数据混乱,程序故障。In an optional embodiment, the classification template and the scene template are combined according to the corresponding relationship, and the fields in the classification template and the scene template can be directly combined, and the combined template can be used as the target template to save costs; The fields in the template and scene template are transferred to another data storage location, and a new template is obtained. Using this new template as the target template is beneficial to increase data diversity and fine-grainedness, and avoid data confusion and program failures.

在一可选地实施例中,目标模板包括已填充的字段与待填充的字段,而已填充的字段至少用于表征分类信息,也可以用于表征该字段不用于生成测试数据,如果已填充的字段仅用于表征分类信息,则表示该模板中的多数字段是用来生成测试数据的;而如果已填充的字段不但用于表征分类信息还用于表征某些特定信息,则这些特定信息不用于当前正在进行的测试数据流程,并不意味着这些特定信息永远不会参与测试数据流程。由此,更好地控制目标模板对应的测试数据,可以高细粒度把控测试数据的生成过程,实现准确生成测试数据的效果,此外,还可以基于递归的分而治之等策略,快速了解目标模板的各个字段,不论哪个字段出现问题,都可以快速地诊断出来。In an optional embodiment, the target template includes filled fields and fields to be filled, and the filled fields are at least used to represent classification information, and can also be used to represent that the fields are not used to generate test data. The field is only used to represent classification information, which means that most of the fields in the template are used to generate test data; and if the filled fields are not only used to represent classification information but also to represent some specific information, these specific information are not used. Just because the test data process is currently in progress does not mean that this specific information will never be involved in the test data process. As a result, the test data corresponding to the target template can be better controlled, and the generation process of the test data can be controlled in a high-fine-grained manner, so as to achieve the effect of accurately generating the test data. In addition, based on the recursive divide-and-conquer strategy, the target template can be quickly understood. Individual fields, no matter which field has a problem, can be quickly diagnosed.

进一步地,在生成测试数据对应的目标模板之后,并不一定要立刻生成相应的测试数据,而是会将分类模板、场景模板、目标模板中的一个或多个模板存储于数据库等数据存储装置中,在数据存储装置中的目标模板仍然是可以被调试的,用户可以通过终端发送指令,对分类模板、场景模板、目标模板中的一个或多个模板进行设置与调试,以满足客户的需求,尽可能高质量地生成所需的测试数据。在一可选地实施方式中,目标模板还可以绑定用于进行环境数据绑定目标、环境数据清理模板、环境数据还原模板,以便于用户更好地实现目标模板的复用;可选地,环境数据清理模板,用于将生成的数据做删除处理,保障下次还能继续重新生成使用;环境数据还原模板,将测试数据还原都某一种状态。Further, after generating the target template corresponding to the test data, it is not necessary to generate the corresponding test data immediately, but one or more templates in the classification template, the scene template, and the target template are stored in a data storage device such as a database. , the target template in the data storage device can still be debugged, and the user can send instructions through the terminal to set and debug one or more templates in the classification template, scene template, and target template to meet the needs of customers , to generate the required test data as high quality as possible. In an optional implementation manner, the target template can also be bound to be used for environmental data binding targets, environmental data cleaning templates, and environmental data restoration templates, so that users can better reuse target templates; optionally , the environmental data cleaning template is used to delete the generated data to ensure that it can be regenerated and used again next time; the environmental data restoration template is used to restore the test data to a certain state.

步骤208,在接收到测试数据生成指令时,按照待填充字段生成测试数据,测试数据与分类信息相对应。Step 208, when receiving the test data generation instruction, generate test data according to the fields to be filled, and the test data corresponds to the classification information.

在一可选地实施例中,按照待填充字段生成测试数据的过程,是按照待填充字段的字段属性生成的,生成符合字段属性规定的测试数据,字段属性可以是数据某些信息的数据类型与数据长度等;例如:当某一待填充字段是学号、身份证号、电话号等信息时,至少会按照这些信息生成数值型的测试数据,也可以对数据长度做进一步的限定。In an optional embodiment, the process of generating test data according to the field to be filled is generated according to the field attribute of the field to be filled, and the test data that meets the requirements of the field attribute is generated, and the field attribute can be the data type of some information of the data. and data length, etc.; for example: when a field to be filled is student ID, ID number, phone number, etc., at least numerical test data will be generated according to this information, and the data length can be further limited.

在一可选地实施例中,按照待填充字段生成测试数据的过程,是按照待填充字段的字段名等字段标识生成的测试数据的过程,可以按照该字段标识按照对应关系进行映射,并按照映射到的数据生成规则生成测试数据。例如:当某一待填充字段的字段标识表征学号等身份信息,则可以按照对应关系,获取学号等身份信息的测试数据的生成规则,使用这一生成规则,来生成具体的测试数据。In an optional embodiment, the process of generating test data according to the fields to be filled is the process of generating test data according to the field identifiers such as the field names of the fields to be filled, and the mapping can be performed according to the corresponding relationship according to the field identifiers, and according to The data generation rules mapped to generate test data. For example, when the field identifier of a field to be filled represents identity information such as student number, the generation rule of test data for identity information such as student number can be obtained according to the corresponding relationship, and the specific test data can be generated by using this generation rule.

上述生成测试数据方法中,获取测试数据对应的数据集合,基于数据集合对应的业务场景生成分类模板,分类模板包括分类信息,分类信息用于对业务场景进行分类,便于选择复合场景;获取分类信息对应的业务场景标识,分别获取业务场景标识对应的字段集合,组合字段集合,得到场景模板,场景模板与业务场景标识相对应,提高生产场景模板的效率;建立分类模板与场景模板的对应关系,按照对应关系组合分类模板与场景模板,得到目标模板,目标模板包括分类信息与待填充字段,构建目标模板,实现高效传值;在接收到测试数据生成指令时,按照待填充字段生成测试数据,测试数据与分类信息相对应,在生成测试数据时,按照分类信息选择目标模板,降低用户操作,提高生成效率。In the above method for generating test data, a data set corresponding to the test data is obtained, and a classification template is generated based on a business scenario corresponding to the data set, the classification template includes classification information, and the classification information is used to classify the business scenarios, so as to facilitate the selection of compound scenarios; obtain the classification information For the corresponding business scenario identifiers, obtain the field sets corresponding to the business scenario identifiers respectively, and combine the field sets to obtain a scenario template. The scenario templates correspond to the business scenario identifiers to improve the efficiency of producing scenario templates; establish the correspondence between the classification templates and the scenario templates, Combine the classification template and the scene template according to the corresponding relationship to obtain the target template. The target template includes the classification information and the fields to be filled, and the target template is constructed to realize efficient value transfer; when the test data generation instruction is received, the test data is generated according to the fields to be filled. The test data corresponds to the classification information. When generating the test data, a target template is selected according to the classification information, so as to reduce the user operation and improve the generation efficiency.

在一个实施例中,侧重于分类模板的整体构造,如图3所示,基于数据集合对应的业务场景生成分类模板包括:In one embodiment, focusing on the overall structure of the classification template, as shown in Figure 3, generating the classification template based on the business scenario corresponding to the data set includes:

步骤302,从数据集合中获取分类标识与分类标识关联的业务描述数据。Step 302: Acquire the service description data associated with the classification identifier and the classification identifier from the data set.

分类标识,是用于表征分类信息与分类模板,其可以是客户ID等用于标识客户的标识信息,也可以是客户类别ID等用于归纳用户类别的标识信息,标识信息可以是表示本身,也可以包括与标识本身相关联的某些数据或信息;其中,标识可以是字符串、整型、浮点型等数据类型中的一种或多种的组合。The classification identifier is used to characterize classification information and classification templates. It can be identification information such as customer ID used to identify customers, or identification information such as customer category ID used to summarize user categories. The identification information can be the representation itself, It may also include some data or information associated with the identification itself; wherein the identification may be a combination of one or more of the data types such as string, integer, floating point and so on.

在一可选地实施例中,可直接从数据集合中获取分类标识与分类标识关联的业务描述数据;也可以仅从数据集合中获取分类标识,按照分类标识与至少一个业务描述数据的对应关系,获取业务描述数据;进一步地,可以从数据集合中获取多个业务描述数据,并将这些业务描述数据汇聚后,对汇聚后的数据设置分类标识。In an optional embodiment, the classification identifier and the service description data associated with the classification identifier can be directly obtained from the data set; the classification identifier can also be obtained only from the data set, according to the corresponding relationship between the classification identifier and at least one service description data. , to obtain service description data; further, a plurality of service description data may be obtained from the data set, and after these service description data are aggregated, a classification identifier is set for the aggregated data.

步骤304,基于分类标识生成分类标识字段,得到分类模板的分类标识字段。Step 304: Generate a classification identification field based on the classification identification, and obtain a classification identification field of the classification template.

步骤306,基于分类标识关联的业务描述数据,生成分类模板的分类描述字段。Step 306 , based on the business description data associated with the classification identifier, generate a classification description field of the classification template.

分类标识字段与分类描述字段是具有对应关系的,分类标识字段可以对应于多个分类描述字段,而改变分类描述字段的组合方式也可以映射到相应的分类标识字段。分类标识字段与分类描述字段可以有相同点,他们都属于分类模板;分类标识字段与分类描述字段可以具有互补性质,他们可以通过对应关系进行互补。There is a corresponding relationship between the classification identification field and the classification description field. The classification identification field can correspond to multiple classification description fields, and changing the combination of the classification description fields can also be mapped to the corresponding classification identification field. The classification identification field and the classification description field can have the same points, and they all belong to the classification template; the classification identification field and the classification description field can have complementary properties, and they can complement each other through the corresponding relationship.

在一可选地实施例中,基于分类标识与业务描述数据来生成对应字段的过程中,其手段并无具体限定,二者可以是相同的,也可以是不同的。对于具体的实现手段,可以分别按照字段属性,来构建他们各自的字段,也可以按照数据关联、数据嵌套等方式实现这一过程。In an optional embodiment, in the process of generating the corresponding field based on the classification identifier and the service description data, the means is not specifically limited, and the two may be the same or different. For specific implementation methods, they can construct their respective fields according to the field attributes, or realize this process according to data association, data nesting, etc.

本实施例中,通过分类标识与分类描述数据来构建分类模板,而分类标识与分类描述数据既存在相关性,又可以互补,可以提高分类模板的兼容性,跨领域实现数据的复用,支撑高效生成测试数据这一功能。In this embodiment, the classification template is constructed by the classification identification and the classification description data, and the classification identification and the classification description data are both related and complementary, which can improve the compatibility of the classification template, realize the reuse of data across fields, and support This feature to efficiently generate test data.

在一个实施例中,侧重描述分类标识字段与分类描述字段的区别,使得分类模板的结构更清晰,其步骤如图4所示,分类标识字段是基于分类标识填充的,基于分类标识关联的业务描述数据生成分类模板的分类描述字段包括:In one embodiment, emphasis is placed on describing the difference between the classification identification field and the classification description field, so that the structure of the classification template is clearer. The steps are shown in Figure 4. The classification identification field is filled based on the classification identification, and the business associated The taxonomy description fields of the description data generation taxonomy template include:

步骤402,获取分类标识对应的账号类型,基于账号类型确定分类描述字段的字段属性信息。Step 402: Acquire the account type corresponding to the classification identifier, and determine the field attribute information of the classification description field based on the account type.

在一可选地实施例中,获取分类标识对应的账号类型的过程中,按照分类标识与单一账号之间的对应关系,得到对应的数据集合;也可以将多个账号进行归纳,同一类型账号均使用同一个或同一组分类标识;其中,账号类型可以是客户类型。In an optional embodiment, in the process of acquiring the account type corresponding to the classification identifier, a corresponding data set is obtained according to the corresponding relationship between the classification identifier and a single account; it is also possible to summarize multiple accounts, and the same type of account All use the same or the same group of classification identifiers; among them, the account type can be the customer type.

在一可选地实施例中,在确定分类描述字段的字段属性信息的过程中,是按照账号类型对应的业务类型进行数据提取,进而得到相应的字段属性信息,字段属性信息用于在生成测试数据时充当标签或者条件式等限制性数据,以便于用户直接生成各个领域的数据。In an optional embodiment, in the process of determining the field attribute information of the classification description field, data extraction is performed according to the business type corresponding to the account type, and then the corresponding field attribute information is obtained, and the field attribute information is used in the generation test. The data acts as restrictive data such as labels or conditional expressions, so that users can directly generate data in various fields.

步骤404,根据字段属性信息设置分类描述字段,得到用于生成测试数据的待填充字段。Step 404: Set the classification description field according to the field attribute information, and obtain the field to be filled for generating the test data.

本实施例中,按照账号类型设定分类描述字段,可以基于客户类型进行测试,对跨领域的客户而言,可以带来较大便捷性,特别是对于开发人员、UAT验收人员做一些测试验证的时候需要测试数据,而他们对业务的数据流不是很清晰,使用本实施例的技术方案之后,无需频繁的找测试人员协助造数,导致整体的效率较高。In this embodiment, the classification description field is set according to the account type, and testing can be performed based on the customer type, which can bring greater convenience to cross-domain customers, especially for developers and UAT acceptance personnel to do some testing and verification When they need to test data, and they are not very clear about the data flow of the business, after using the technical solution of this embodiment, there is no need to frequently ask testers to assist in data creation, resulting in higher overall efficiency.

在一个实施例中,侧重于场景模板的生成,其使用基础数据模板进行构建,如图5所示,组合字段集合,得到场景模板包括:In one embodiment, focusing on the generation of scene templates, it is constructed using basic data templates, as shown in Figure 5, combining field sets to obtain scene templates including:

步骤502,获取业务场景标识对应的第一业务需求,基于第一业务需求获取基础数据模板,基础数据模板是根据第二业务需求生成的。Step 502: Obtain a first business requirement corresponding to the business scenario identifier, and obtain a basic data template based on the first business requirement, and the basic data template is generated according to the second business requirement.

第一业务需求与第二业务需求,均是针对于具体业务场景而生成的需求,且二者均具有可以共用的基础数据模板。第一业务需求与第二业务需求的区别点在于,第二业务需求对应的场景模板是已经生成的,且第二业务需求对应的场景模板可以被拆解成多个基础数据模板;相对应的,第一业务需求对应的场景模板并未成型。Both the first business requirement and the second business requirement are requirements generated for specific business scenarios, and both have basic data templates that can be shared. The difference between the first business requirement and the second business requirement is that the scene template corresponding to the second business requirement has been generated, and the scene template corresponding to the second business requirement can be disassembled into multiple basic data templates; the corresponding , the scene template corresponding to the first business requirement has not been formed.

在一可选地实施例中,基于第一业务需求获取基础数据模板,是按照第一业务需求中的多个基础数据模板标识获取的;例如:当第一业务需求包括用于表征“注册用户”与“用户实名”的两个基础数据模板标识,按照这两个基础数据模板标识分别获取对应的基础数据模板,在基础数据模板组合之后,就可以获得场景标识对应的场景模板,而该场景模板对应于业务场景标识。In an optional embodiment, acquiring the basic data template based on the first business requirement is obtained according to multiple basic data template identifiers in the first business requirement; ” and “user real name”, the corresponding basic data templates are obtained according to the two basic data template identifiers. After the basic data templates are combined, the scene template corresponding to the scene identifier can be obtained, and the scene Templates correspond to business scenario identifiers.

步骤504,将对应于第一业务需求获取到的基础数据模板的字段组合,得到第一业务需求对应的场景模板。Step 504: Combine the fields of the basic data template obtained corresponding to the first business requirement to obtain a scene template corresponding to the first business requirement.

在一可选地实施例中,基础数据模板的字段是离散的,需要将各个基础数据模板的字段进行组合,才能得到所需的场景模板;在一可选的实施例中,各个基础数据模板存在重复字段的,需要去除重复字段,在基础数据模板的字段组合前、组合中或者组合后,要去除重叠字段。In an optional embodiment, the fields of the basic data template are discrete, and the fields of each basic data template need to be combined to obtain the required scene template; in an optional embodiment, each basic data template If there are duplicate fields, the duplicate fields need to be removed. Before, during or after the field combination of the basic data template, the overlapping fields should be removed.

本实施例中,基于不同的业务需求的场景模板进行复用,使场景模板中的基础数据模板得以再次复用,用户可以自行调节场景模板,实现构建各种业务需求对应的场景模板,从而更好地跨领域复用这些基础数据模板,以更高效生成所需数据。In this embodiment, scene templates based on different business requirements are reused, so that the basic data templates in the scene templates can be reused again, and users can adjust the scene templates by themselves to realize the construction of scene templates corresponding to various business requirements, so as to improve the It is good to reuse these basic data templates across domains to generate the required data more efficiently.

在一个实施例中,如图6所示,侧重于模板字段的检测,将对应于第一业务需求获取到的基础数据模板的字段组合,得到第一业务需求对应的场景模板包括:In one embodiment, as shown in Figure 6, focusing on the detection of template fields, combining the fields of the basic data template obtained corresponding to the first business requirement to obtain the scene template corresponding to the first business requirement includes:

步骤602,按照基础数据模板的字段对应的操作指令,生成基础数据模板对应的数据,对基础数据模板对应的数据进行检测,确定基础数据模板对应的数据符合基础数据模板的预设条件;Step 602, according to the operation instructions corresponding to the fields of the basic data template, generate data corresponding to the basic data template, detect the data corresponding to the basic data template, and determine that the data corresponding to the basic data template meets the preset conditions of the basic data template;

和/或,and / or,

步骤604,基于第一业务需求对应的场景模板获取第一业务需求对应的字段操作指令,按照第一业务需求对应的字段操作指令,生成第一业务需求对应的数据,对第一业务需求对应的数据进行检测,确定第一业务需求对应的数据符合所第一业务需求对应的场景模板的预设条件。Step 604: Obtain field operation instructions corresponding to the first business requirement based on the scene template corresponding to the first business requirement, and generate data corresponding to the first business requirement according to the field operation instructions corresponding to the first business requirement. The data is detected, and it is determined that the data corresponding to the first service requirement meets the preset conditions of the scene template corresponding to the first service requirement.

本实施例中,一方面可以选择按照基础数据模板进行数据检测,另一方面可以使用场景模板进行数据检测,若生成的检测数据符合相应的预设条件,则可以生成场景模板。通过这种手段,本申请可以高细粒度地把控数据调度,可以从基础数据模板与场景模板这两个维度进行分析,如果是基础数据模板出现问题,只需要调试基础数据模板即可,如果只是场景模板出现问题,则只需要调试场景模板以及基础数据模板组合的过程。由此,可以更快捷的调试,以提高测试数据生成的效率。In this embodiment, on the one hand, data detection can be performed according to a basic data template, and on the other hand, a scene template can be used for data detection. If the generated detection data meets corresponding preset conditions, a scene template can be generated. Through this method, the application can control the data scheduling in a high-level and fine-grained manner, and can analyze from the two dimensions of the basic data template and the scene template. If there is a problem with the basic data template, you only need to debug the basic data template. Only if there is a problem with the scene template, you only need to debug the process of combining the scene template and the basic data template. As a result, debugging can be performed more quickly to improve the efficiency of test data generation.

在一个实施例中,如图7所示,按照待填充字段生成测试数据包括:In one embodiment, as shown in FIG. 7 , generating test data according to the fields to be filled includes:

步骤702,获取测试数据生成指令携带的测试环境信息和目标分类信息。Step 702: Acquire test environment information and target classification information carried by the test data generation instruction.

步骤704,基于测试环境信息生成测试数据对应的测试环境。Step 704: Generate a test environment corresponding to the test data based on the test environment information.

在一可选地实施方式中,测试环境是按照测试环境信息进行建模得到的,面向不同配置下的硬件性能和业务系统计算能力的关系;也可以通过集群和建模同步使用的方式,生成测试数据对应的测试环境。In an optional implementation manner, the test environment is obtained by modeling according to the test environment information, and is oriented to the relationship between the hardware performance and the computing power of the business system under different configurations; it can also be generated by synchronous use of clusters and modeling. The test environment corresponding to the test data.

步骤706,在测试环境中,基于目标分类信息获取目标模板,基于目标模板的待填充字段,生成测试数据。Step 706 , in the test environment, obtain the target template based on the target classification information, and generate test data based on the fields to be filled in the target template.

本实施例中,将测试环境信息与目标分类信息进行集成,得到测试数据生成指令,可以通过选择客户类型一键生成,简化了准备数据的复杂性,提升了数据准备的效率,为更高效地进行自动化测试奠定了基础。In this embodiment, the test environment information and the target classification information are integrated to obtain the test data generation instruction, which can be generated with one click by selecting the customer type, which simplifies the complexity of data preparation, improves the efficiency of data preparation, and is more efficient Conducting automated tests lays the groundwork.

上述各实施例均有其对应的侧重点,且各实施例可以自由组合,而为了更好地描述本申请的整体技术方案,将使用一个具体的实施例,于特定的描述场景进行分析与描述。在该实施例中,测试人员在测试过程中需要准备大量的测试数据,来对各个场景进行测试,而测试人员只能快捷高效地对特定领域准备测试数据,但基于跨业务系统的数据准备需要其他业务测试人员协助,各自的数据准备脚本/操作不能共享,而为实现某一测试场景的业务流程,需多个业务系统形成链路,为了业务流程能够走通而在各系统上准备的测试数据,这些测试数据是各个基础业务数据的组合,在这一实施例中,测试数据可以命名为测试场景数据,包括在Mock等平台上配套的案例/规则数据。Each of the above embodiments has its corresponding focus, and each embodiment can be freely combined. In order to better describe the overall technical solution of the present application, a specific embodiment will be used to analyze and describe a specific description scene. . In this embodiment, testers need to prepare a large amount of test data during the testing process to test various scenarios, while testers can only quickly and efficiently prepare test data for specific fields, but data preparation based on cross-business systems requires With the assistance of other business testers, their respective data preparation scripts/operations cannot be shared, and in order to realize the business process of a test scenario, multiple business systems are required to form links, and tests are prepared on each system so that the business process can go through. Data, these test data are the combination of various basic business data, in this embodiment, the test data can be named as test scenario data, including case/rule data matched on platforms such as Mock.

在这一进行数据测试的实施例下,所要解决的难题是:让业务测试人员、开发人员、UAT验收人员能够快速高效的生成各业务场景需要的测试数据。而为了解决这一难题,可以按照客户数据类型管理业务场景,选取场景模板的方式进行管理,而为了方便构建场景模板,可以设置数据基础模板,将数据基础模板作为数据生成脚本式,由此,可以为自动化测试提供测试数据。In this embodiment of data testing, the problem to be solved is to enable business testers, developers, and UAT acceptance personnel to quickly and efficiently generate test data required by various business scenarios. In order to solve this problem, business scenarios can be managed according to the type of customer data and managed by selecting scenario templates. In order to facilitate the construction of scenario templates, a data base template can be set, and the data base template can be used as a data generation script. Test data can be provided for automated tests.

区别于上述实施例对作用的论述,本申请将主要着眼于整体的操作流程与操作方法。该方法包括模板的组建步骤与测试数据的生成步骤两部分,而模板的组建步骤主要包括:定义属于分类模板的客户类型模板,创建基础数据模板,对基础数据模板进行组合得到场景模板,绑定场景模板与客户类型模板得到目标模板的过程。Different from the discussion of the functions in the above-mentioned embodiments, the present application will mainly focus on the overall operation flow and operation method. The method includes two parts: a template building step and a test data generating step, and the template building steps mainly include: defining a customer type template belonging to a classification template, creating a basic data template, combining the basic data templates to obtain a scene template, and binding the template. The process of obtaining the target template from the scene template and the customer type template.

1)基于字段定义客户类型模板。该过程相当于构建分类模板,可以认为是定义基础的客户信息字段,用于管理客户类型关键的测试数据信息,例如:手机号、身份证号、银行卡号、住址等。1) Define customer type template based on fields. This process is equivalent to building a classification template, which can be regarded as defining the basic customer information fields, which are used to manage the key test data information of customer types, such as mobile phone numbers, ID numbers, bank card numbers, and addresses.

2)创建基础数据模板的过程,该过程就是要将业务测试人员平时工作中的数据准备脚本进行模板化,将各业务系统中最小单元业务数据准备的脚本模板化,得到脚本准备模板,脚本准备模板可以认为是原子数据模板,一个原子数据模板可以通过SQL和/或接口调用的方式,聚合多种字段,例如,当基础数据模板对应于“注册用户数据准备”这一流程,基础数据模板可命名为注册数据模板,包括“姓名”参数与“手机号”参数这两个字段;而当基础数据模板对应于“用户实名数据准备”这一流程,基础数据模板可命名为实名数据模板,包括“手机号”参数、“身份证号”参数及“银行卡号”参数这三个字段。2) The process of creating a basic data template. This process is to template the data preparation scripts that the business testers usually work in, and template the scripts for the smallest unit of business data preparation in each business system to obtain a script preparation template and script preparation. Templates can be considered as atomic data templates. An atomic data template can aggregate multiple fields through SQL and/or interface calls. For example, when the basic data template corresponds to the process of "registered user data preparation", the basic data template can be used. Named as registration data template, including the two fields of "name" parameter and "mobile phone number" parameter; and when the basic data template corresponds to the process of "user real-name data preparation", the basic data template can be named as real-name data template, including There are three fields: "Mobile phone number" parameter, "ID card number" parameter and "Bank card number" parameter.

3)对基础数据模板进行组合得到场景模板的过程。这一过程中,是基于业务要求将多个基础数据模板进行组装,做好模板数据间的数据传递,以便于形成一个通用的跨业务链路场景的目标模板,目标模板也是属于脚本模板的,相当于分子模板。如果认为注册数据模板与实名数据模板进行组合,则可以生成一个注册且实名的账户数据来进行数据测试。3) The process of combining basic data templates to obtain scene templates. In this process, multiple basic data templates are assembled based on business requirements, and data transfer between template data is done so as to form a common target template for cross-business link scenarios. The target template is also a script template. Equivalent to a molecular template. If it is considered that the registration data template and the real-name data template are combined, a registered and real-name account data can be generated for data testing.

在得到场景模板之后,还需要对场景模板中的参数件设置,就是将模板中可变的字段信息可以做为可变参数放置在模板参数中,用以生成测试数据或对字段进行调节,传入参数字段名保持和分类模板中定义的参数字段名一致或相对应,以实现数据传输。After the scene template is obtained, it is also necessary to set the parameters in the scene template, that is, the variable field information in the template can be placed in the template parameters as variable parameters to generate test data or adjust the fields. The input parameter field name should be consistent with or correspond to the parameter field name defined in the classification template to realize data transmission.

在设置场景模板中的参数件之后,还可选择调试数据模板,按照场景模板执行:可以直接基于基础数据模板或场景数据模板进行调试,调试正常生成有效且准确的测试数据后,将模板状态置为发布。发布了的模板可以供用户正常的使用,或被分类模板等客户类型模板绑定,得到目标模板。After setting the parameters in the scene template, you can also select the debugging data template and execute according to the scene template: you can directly debug based on the basic data template or the scene data template. After debugging normally generates valid and accurate test data, set the template status to for release. The published templates can be used by users normally, or bound by customer type templates such as classified templates to obtain target templates.

4)绑定场景模板与客户类型模板得到目标模板。主要对各种业务场景的数据进行分类管理,并将客户类型绑定步骤3)中发布了的场景模板,让使用者能够便捷的查找到需要生成的业务场景数据,并快速生成测试数据。4) Bind the scene template and the customer type template to obtain the target template. It mainly classifies and manages the data of various business scenarios, and binds the customer type to the scenario template published in step 3), so that users can easily find the business scenario data that needs to be generated, and quickly generate test data.

在生成目标模板的之前,根据客户类型模板对应的场景模板是否被发布,确定该客户类型模板是否可用,并设置该客户类型模板需要的客户数据字段及其相应的字段属性,例如:标注哪些字段是该客户类型固定的值,不可变更修改,其中,包括一确定客户类型的标识字段,如ID字段。Before generating the target template, according to whether the scene template corresponding to the customer type template is released, determine whether the customer type template is available, and set the customer data fields required by the customer type template and their corresponding field attributes, such as: which fields are marked It is a fixed value of the customer type and cannot be changed, and includes an identification field for determining the customer type, such as an ID field.

在定义客户类型模板的字段属性之后,就可以进行参数设置,对客户类型需要的业务字段进行默认值设置,对唯一确定客户类型的标识字段设置默认值,对其他字段可以设置默认值或一些随机生成值。在客户类型模板的参数设置之后,要将配置好的客户类型模板绑定场景模板,得到目标模板,目标模板还可以根据需求选择是否绑定数据清理模板或数据还原模板。After defining the field properties of the customer type template, you can set the parameters, set the default value for the business fields required by the customer type, set the default value for the identification field that uniquely determines the customer type, and set the default value or some random value for other fields. Generate value. After setting the parameters of the customer type template, bind the configured customer type template to the scene template to obtain the target template. The target template can also choose whether to bind the data cleaning template or the data restoration template according to the requirements.

相对应的,在拥有了目标模板之后,可以生成测试数据,用户所在终端发出测试数据生成指令后,可直接生成所需的测试数据。具体的,生成测试数据的步骤包括:Correspondingly, after having the target template, test data can be generated, and the required test data can be directly generated after the terminal where the user is located sends out the test data generation instruction. Specifically, the steps of generating test data include:

1)用户通过终端进入测试数据生成网页的页面等程序界面,于程序界面选择客户类型,并选择测试环境,可直接将该类型的测试数据在对应的测试环境一键生成。1) The user enters the program interface such as the page of the test data generation webpage through the terminal, selects the customer type on the program interface, and selects the test environment, and can directly generate the test data of this type in the corresponding test environment with one click.

2)如果需要生成批量测试数据时,可以选择客户类型后再设置生成的数据条数批量生成测试数据2) If you need to generate batch test data, you can select the customer type and then set the number of generated data to generate test data in batches

3)改变默认数据生成:如果选择客户类型后,某些可变字段默认值不适合需要调整,可以进入默认字段数据页面进行修改后进行环境数据生成。3) Change the default data generation: If the default value of some variable fields is not suitable for adjustment after selecting the customer type, you can enter the default field data page to modify and then generate environmental data.

4)客户类型数据基于测试环境创建时,是实时显示进度状态以及模板步骤执行情况。如果执行错误,可以方便的基于前端界面查看分析执行失败原因。4) When the customer type data is created based on the test environment, the progress status and the execution of the template steps are displayed in real time. If the execution is wrong, you can easily view the reason for the failure of the analysis execution based on the front-end interface.

由此,在这一实施例中,测试数据可以通过选择客户类型一键生成,简化了数据准备的复杂性,提升了数据准备的效率;测试数据准备脚本共享,解决跨业务系统准备数据的难度;使非业务测试人员(对业务不熟悉的开发人员/UAT验收人员)可以快速生成自己想要的测试数据,为自动化测试脚本执行提供测试数据。Therefore, in this embodiment, test data can be generated by selecting a customer type with one click, which simplifies the complexity of data preparation and improves the efficiency of data preparation; the test data preparation script is shared to solve the difficulty of data preparation across business systems ; Enable non-business testers (developers who are not familiar with the business/UAT acceptance personnel) to quickly generate the test data they want and provide test data for the execution of automated test scripts.

应该理解的是,虽然如上的各实施例所涉及的流程图中的各个步骤按照箭头的指示依次显示,但是这些步骤并不是必然按照箭头指示的顺序依次执行。除非本文中有明确的说明,这些步骤的执行并没有严格的顺序限制,这些步骤可以以其它的顺序执行。而且,如上的各实施例所涉及的流程图中的至少一部分步骤可以包括多个步骤或者多个阶段,这些步骤或者阶段并不必然是在同一时刻执行完成,而是可以在不同的时刻执行,这些步骤或者阶段的执行顺序也不必然是依次进行,而是可以与其它步骤或者其它步骤中的步骤或者阶段的至少一部分轮流或者交替地执行。It should be understood that, although the steps in the flowcharts involved in the above embodiments are sequentially displayed according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, the execution of these steps is not strictly limited to the order, and these steps may be performed in other orders. Moreover, at least a part of the steps in the flowcharts involved in the above embodiments may include multiple steps or multiple stages. These steps or stages are not necessarily executed at the same time, but may be executed at different times. The order of execution of these steps or stages is also not necessarily sequential, but may be performed alternately or alternately with other steps or at least a portion of the steps or stages in the other steps.

基于同样的发明构思,本申请实施例还提供了一种用于实现上述所涉及的生成测试数据的方法的生成测试数据的装置。该装置所提供的解决问题的实现方案与上述方法中所记载的实现方案相似,故下面所提供的一个或多个生成测试数据的装置实施例中的具体限定可以参见上文中对于生成测试数据的方法的限定,在此不再赘述。Based on the same inventive concept, an embodiment of the present application also provides an apparatus for generating test data for implementing the above-mentioned method for generating test data. The implementation solution for solving the problem provided by the device is similar to the implementation solution described in the above method, so the specific limitations in one or more embodiments of the device for generating test data provided below may refer to the above for generating test data. The limitation of the method is not repeated here.

在一个实施例中,如图9所示,提供了一种生成测试数据的装置,该装置包括:分类模板获取模块902、场景模板获取模块904、目标模板生成模块906和测试数据生成模块908:其中:In one embodiment, as shown in FIG. 9, a device for generating test data is provided. The device includes: a classification template acquisition module 902, a scene template acquisition module 904, a target template generation module 906, and a test data generation module 908: in:

分类模板获取模块902,用于获取测试数据对应的数据集合,基于数据集合对应的业务场景生成分类模板,分类模板包括分类信息,分类信息用于对业务场景进行分类;A classification template obtaining module 902, configured to obtain a data set corresponding to the test data, and generate a classification template based on a business scenario corresponding to the data set, where the classification template includes classification information, and the classification information is used to classify the business scenario;

场景模板获取模块904,用于获取分类信息对应的业务场景标识,分别获取业务场景标识对应的字段集合,组合字段集合,得到场景模板,场景模板与业务场景标识相对应;The scene template obtaining module 904 is configured to obtain a business scene identifier corresponding to the classification information, obtain a field set corresponding to the business scene identifier, and combine the field sets to obtain a scene template, and the scene template corresponds to the business scene identifier;

目标模板生成模块906,用于建立分类模板与场景模板的对应关系,按照对应关系组合分类模板与场景模板,得到目标模板,目标模板包括分类信息与待填充字段;The target template generation module 906 is configured to establish a corresponding relationship between the classification template and the scene template, and combine the classification template and the scene template according to the corresponding relationship to obtain a target template, where the target template includes classification information and fields to be filled;

测试数据生成模块908,用于在接收到测试数据生成指令时,按照待填充字段生成测试数据,测试数据与分类信息相对应。The test data generation module 908 is configured to generate test data according to the fields to be filled when receiving the test data generation instruction, and the test data corresponds to the classification information.

在一个可选地实施例中,分类模板获取模块902包括:数据提取单元、第一标识字段获取单元、标识描述字段获取单元,其中:In an optional embodiment, the classification template obtaining module 902 includes: a data extraction unit, a first identification field obtaining unit, and an identification description field obtaining unit, wherein:

数据提取单元,用于从数据集合中获取分类标识与分类标识关联的业务描述数据;a data extraction unit, used to obtain the business description data associated with the classification identifier and the classification identifier from the data set;

第一标识字段获取单元,用于基于分类标识生成分类标识字段,得到分类模板的分类标识字段;a first identification field obtaining unit, configured to generate a classification identification field based on the classification identification, and obtain the classification identification field of the classification template;

标识描述字段获取单元,用于基于分类标识关联的业务描述数据生成分类模板的分类描述字段。The identification description field obtaining unit is used for generating the classification description field of the classification template based on the business description data associated with the classification identification.

在一个可选地实施例中,标识描述字段获取单元包括:属性获取子单元和字段设置子单元;In an optional embodiment, the identification description field acquisition unit includes: an attribute acquisition subunit and a field setting subunit;

属性获取子单元,用于获取分类标识对应的账号类型,基于账号类型确定分类描述字段的字段属性信息;The attribute obtaining subunit is used to obtain the account type corresponding to the classification identifier, and determine the field attribute information of the classification description field based on the account type;

字段设置子单元,用于根据字段属性信息设置分类描述字段,得到用于生成测试数据的待填充字段。The field setting subunit is used to set the classification description field according to the field attribute information, and obtain the field to be filled for generating the test data.

在一个可选地实施例中,测试数据生成模块908包括:指令获取单元、环境生成单元和测试数据生成单元,其中:In an optional embodiment, the test data generation module 908 includes: an instruction acquisition unit, an environment generation unit and a test data generation unit, wherein:

指令获取单元,用于获取测试数据生成指令携带的测试环境信息和目标分类信息;The instruction acquisition unit is used to acquire the test environment information and target classification information carried by the test data generation instruction;

环境生成单元,用于基于测试环境信息生成测试数据对应的测试环境;The environment generation unit is used to generate the test environment corresponding to the test data based on the test environment information;

测试数据生成单元,用于在测试环境中,基于目标分类信息获取目标模板,基于目标模板的待填充字段,生成测试数据。The test data generating unit is used to obtain the target template based on the target classification information in the test environment, and generate test data based on the fields to be filled in the target template.

在一个可选地实施例中,场景模板获取模块904包括,业务需求获取单元和场景模板组合单元,其中:In an optional embodiment, the scene template obtaining module 904 includes a business requirement obtaining unit and a scene template combining unit, wherein:

业务需求获取单元,用于获取业务场景标识对应的第一业务需求,基于第一业务需求获取基础数据模板,基础数据模板是根据第二业务需求生成的;a business requirement obtaining unit, configured to obtain a first business requirement corresponding to the business scenario identifier, and obtain a basic data template based on the first business requirement, and the basic data template is generated according to the second business requirement;

场景模板组合单元,用于将对应于第一业务需求获取到的基础数据模板的字段组合,得到第一业务需求对应的场景模板。The scene template combining unit is configured to combine the fields of the basic data template obtained corresponding to the first business requirement to obtain the scene template corresponding to the first business requirement.

在一个可选地实施例中,场景模板组合单元包括:第一检测子单元,和/或,第二检测子单元;其中,In an optional embodiment, the scene template combining unit includes: a first detection subunit, and/or a second detection subunit; wherein,

第一检测子单元,用于按照基础数据模板的字段操作指令,生成基础数据模板对应的数据,对基础数据模板对应的数据进行检测,确定基础数据模板对应的数据符合基础数据模板的预设条件;和/或,The first detection subunit is used to generate data corresponding to the basic data template according to the field operation instructions of the basic data template, to detect the data corresponding to the basic data template, and to determine that the data corresponding to the basic data template meets the preset conditions of the basic data template ;and / or,

第二检测子单元,用于基于第一业务需求对应的场景模板获取第一业务需求对应的操作指令,按照第一业务需求对应的操作指令,生成第一业务需求对应的数据,对第一业务需求对应的数据进行检测,确定第一业务需求对应的数据符合所第一业务需求对应的场景模板的预设条件。The second detection sub-unit is configured to obtain an operation instruction corresponding to the first service requirement based on the scene template corresponding to the first service requirement, generate data corresponding to the first service requirement according to the operation instruction corresponding to the first service requirement, and perform an analysis on the first service requirement. The data corresponding to the demand is detected, and it is determined that the data corresponding to the first business demand meets the preset conditions of the scene template corresponding to the first business demand.

上述生成测试数据的装置中的各个模块可全部或部分通过软件、硬件及其组合来实现。上述各模块可以硬件形式内嵌于或独立于计算机设备中的处理器中,也可以以软件形式存储于计算机设备中的存储器中,以便于处理器调用执行以上各个模块对应的操作。Each module in the above-mentioned apparatus for generating test data may be implemented in whole or in part by software, hardware, and combinations thereof. The above modules can be embedded in or independent of the processor in the computer device in the form of hardware, or stored in the memory in the computer device in the form of software, so that the processor can call and execute the operations corresponding to the above modules.

在一个实施例中,提供了一种计算机设备,该计算机设备可以是服务器,其内部结构图可以如图10所示。该计算机设备包括通过系统总线连接的处理器、存储器和网络接口。其中,该计算机设备的处理器用于提供计算和控制能力。该计算机设备的存储器包括非易失性存储介质和内存储器。该非易失性存储介质存储有操作系统、计算机程序和数据库。该内存储器为非易失性存储介质中的操作系统和计算机程序的运行提供环境。该计算机设备的数据库用于存储测试数据,和/或,存储模板,存储的模板用于生成测试数据。该计算机设备的网络接口用于与外部的终端通过网络连接通信。该计算机程序被处理器执行时以实现一种生成测试数据的方法。In one embodiment, a computer device is provided, and the computer device may be a server, and its internal structure diagram may be as shown in FIG. 10 . The computer device includes a processor, memory, and a network interface connected by a system bus. Among them, the processor of the computer device is used to provide computing and control capabilities. The memory of the computer device includes non-volatile storage media and internal memory. The nonvolatile storage medium stores an operating system, a computer program, and a database. The internal memory provides an environment for the execution of the operating system and computer programs in the non-volatile storage medium. The database of the computer device is used to store test data, and/or, to store templates, and the stored templates are used to generate test data. The network interface of the computer device is used to communicate with an external terminal through a network connection. The computer program, when executed by a processor, implements a method of generating test data.

本领域技术人员可以理解,图10中示出的结构,仅仅是与本申请方案相关的部分结构的框图,并不构成对本申请方案所应用于其上的计算机设备的限定,具体的计算机设备可以包括比图中所示更多或更少的部件,或者组合某些部件,或者具有不同的部件布置。Those skilled in the art can understand that the structure shown in FIG. 10 is only a block diagram of a partial structure related to the solution of the present application, and does not constitute a limitation on the computer equipment to which the solution of the present application is applied. Include more or fewer components than shown in the figures, or combine certain components, or have a different arrangement of components.

在一个实施例中,还提供了一种计算机设备,包括存储器和处理器,存储器中存储有计算机程序,该处理器执行计算机程序时实现上述各方法实施例中的步骤。In one embodiment, a computer device is also provided, including a memory and a processor, where a computer program is stored in the memory, and the processor implements the steps in the foregoing method embodiments when the processor executes the computer program.

在一个实施例中,提供了一种计算机可读存储介质,其上存储有计算机程序,该计算机程序被处理器执行时实现上述各方法实施例中的步骤。In one embodiment, a computer-readable storage medium is provided, on which a computer program is stored, and when the computer program is executed by a processor, implements the steps in the foregoing method embodiments.

在一个实施例中,提供了一种计算机程序产品,包括计算机程序,该计算机程序被处理器执行时实现上述各方法实施例中的步骤。In one embodiment, a computer program product is provided, including a computer program, which implements the steps in each of the above method embodiments when the computer program is executed by a processor.

需要说明的是,本申请所涉及的用户信息(包括但不限于用户设备信息、用户个人信息等)和数据(包括但不限于用于分析的数据、存储的数据、展示的数据等),均为经用户授权或者经过各方充分授权的信息和数据。It should be noted that the user information (including but not limited to user equipment information, user personal information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved in this application are all Information and data authorized by the user or fully authorized by the parties.

本领域普通技术人员可以理解实现上述实施例方法中的全部或部分流程,是可以通过计算机程序来指令相关的硬件来完成,所述的计算机程序可存储于一非易失性计算机可读取存储介质中,该计算机程序在执行时,可包括如上述各方法的实施例的流程。其中,本申请所提供的各实施例中所使用的对存储器、数据库或其它介质的任何引用,均可包括非易失性和易失性存储器中的至少一种。非易失性存储器可包括只读存储器(Read-OnlyMemory,ROM)、磁带、软盘、闪存、光存储器、高密度嵌入式非易失性存储器、阻变存储器(ReRAM)、磁变存储器(Magnetoresistive Random Access Memory,MRAM)、铁电存储器(Ferroelectric Random Access Memory,FRAM)、相变存储器(Phase Change Memory,PCM)、石墨烯存储器等。易失性存储器可包括随机存取存储器(Random Access Memory,RAM)或外部高速缓冲存储器等。作为说明而非局限,RAM可以是多种形式,比如静态随机存取存储器(Static Random Access Memory,SRAM)或动态随机存取存储器(Dynamic RandomAccess Memory,DRAM)等。本申请所提供的各实施例中所涉及的数据库可包括关系型数据库和非关系型数据库中至少一种。非关系型数据库可包括基于区块链的分布式数据库等,不限于此。本申请所提供的各实施例中所涉及的处理器可为通用处理器、中央处理器、图形处理器、数字信号处理器、可编程逻辑器、基于量子计算的数据处理逻辑器等,不限于此。Those of ordinary skill in the art can understand that all or part of the processes in the methods of the above embodiments can be implemented by instructing relevant hardware through a computer program, and the computer program can be stored in a non-volatile computer-readable storage In the medium, when the computer program is executed, it may include the processes of the above-mentioned method embodiments. Wherein, any reference to a memory, a database or other media used in the various embodiments provided in this application may include at least one of a non-volatile memory and a volatile memory. Non-volatile memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash memory, optical memory, high-density embedded non-volatile memory, resistive memory (ReRAM), magnetic variable memory (Magnetoresistive Random Memory) Access Memory, MRAM), Ferroelectric Random Access Memory (FRAM), Phase Change Memory (Phase Change Memory, PCM), graphene memory, etc. Volatile memory may include random access memory (Random Access Memory, RAM) or external cache memory, and the like. By way of illustration and not limitation, the RAM may be in various forms, such as static random access memory (Static Random Access Memory, SRAM) or dynamic random access memory (Dynamic Random Access Memory, DRAM). The database involved in the various embodiments provided in this application may include at least one of a relational database and a non-relational database. The non-relational database may include a blockchain-based distributed database, etc., but is not limited thereto. The processors involved in the various embodiments provided in this application may be general-purpose processors, central processing units, graphics processors, digital signal processors, programmable logic devices, data processing logic devices based on quantum computing, etc., and are not limited to this.

以上实施例的各技术特征可以进行任意的组合,为使描述简洁,未对上述实施例中的各个技术特征所有可能的组合都进行描述,然而,只要这些技术特征的组合不存在矛盾,都应当认为是本说明书记载的范围。The technical features of the above embodiments can be combined arbitrarily. In order to make the description simple, all possible combinations of the technical features in the above embodiments are not described. However, as long as there is no contradiction in the combination of these technical features It is considered to be the range described in this specification.

以上所述实施例仅表达了本申请的几种实施方式,其描述较为具体和详细,但并不能因此而理解为对本申请专利范围的限制。应当指出的是,对于本领域的普通技术人员来说,在不脱离本申请构思的前提下,还可以做出若干变形和改进,这些都属于本申请的保护范围。因此,本申请的保护范围应以所附权利要求为准。The above-mentioned embodiments only represent several embodiments of the present application, and the descriptions thereof are relatively specific and detailed, but should not be construed as a limitation on the scope of the patent of the present application. It should be pointed out that for those skilled in the art, without departing from the concept of the present application, several modifications and improvements can be made, which all belong to the protection scope of the present application. Therefore, the scope of protection of the present application should be determined by the appended claims.

Claims (10)

1. A method of generating test data, the method comprising:
acquiring a data set corresponding to test data, and generating a classification template based on a service scene corresponding to the data set, wherein the classification template comprises classification information, and the classification information is used for classifying the service scene;
acquiring service scene identifications corresponding to the classification information, respectively acquiring field sets corresponding to the service scene identifications, and combining the field sets to obtain a scene template, wherein the scene template corresponds to the service scene identifications;
establishing a corresponding relation between the classification template and the scene template, and combining the classification template and the scene template according to the corresponding relation to obtain a target template, wherein the target template comprises classification information and fields to be filled;
and when a test data generation instruction is received, generating test data according to the field to be filled, wherein the test data corresponds to the classification information.
2. The method of claim 1, wherein generating a classification template based on the traffic scenario corresponding to the data set comprises:
acquiring a classification identifier and service description data associated with the classification identifier from the data set;
generating the classification identification field based on the classification identification to obtain the classification identification field of the classification template;
and generating a classification description field of the classification template based on the service description data associated with the classification identification.
3. The method of claim 2, wherein the class identifier field is populated based on the class identifier, and wherein generating the class description field of the class template based on the traffic description data associated with the class identifier comprises:
acquiring an account type corresponding to the classification identification, and determining field attribute information of the classification description field based on the account type;
and setting the classification description field according to the field attribute information to obtain a field to be filled for generating the test data.
4. The method of claim 1, wherein generating test data according to the field to be filled comprises:
acquiring test environment information and target classification information carried by the test data generation instruction;
generating a test environment corresponding to the test data based on the test environment information;
and in the test environment, acquiring a target template based on the target classification information, and generating the test data based on the field to be filled of the target template.
5. The method of any of claims 1 to 4, wherein the combining the field sets to obtain the scene template comprises:
acquiring a first service requirement corresponding to the service scene identifier, and acquiring a basic data template based on the first service requirement, wherein the basic data template is generated according to a second service requirement;
and combining the fields of the basic data template acquired corresponding to the first service requirement to obtain a scene template corresponding to the first service requirement.
6. The method according to claim 5, wherein the combining fields of the basic data template acquired corresponding to the first service requirement to obtain the scene template corresponding to the first service requirement includes:
generating data corresponding to the basic data template according to the operation instruction corresponding to the field of the basic data template, detecting the data corresponding to the basic data template, and determining that the data corresponding to the basic data template meets the preset condition of the basic data template; and/or the presence of a gas in the gas,
acquiring a field operation instruction corresponding to a first service requirement based on the scene template corresponding to the first service requirement, generating data corresponding to the first service requirement according to the field operation instruction corresponding to the first service requirement, detecting the data corresponding to the first service requirement, and determining that the data corresponding to the first service requirement meets the preset condition of the scene template corresponding to the first service requirement.
7. An apparatus for generating test data, the apparatus comprising:
the classification template acquisition module is used for acquiring a data set corresponding to the test data and generating a classification template based on a service scene corresponding to the data set, wherein the classification template comprises classification information, and the classification information is used for classifying the service scene;
a scene template obtaining module, configured to obtain service scene identifiers corresponding to the classification information, respectively obtain field sets corresponding to the service scene identifiers, and combine the field sets to obtain a scene template, where the scene template corresponds to the service scene identifiers;
the target template generation module is used for establishing a corresponding relation between the classification template and the scene template, and combining the classification template and the scene template according to the corresponding relation to obtain a target template, wherein the target template comprises classification information and fields to be filled;
and the test data generation module is used for generating test data according to the field to be filled when a test data generation instruction is received, wherein the test data corresponds to the classification information.
8. A computer device comprising a memory and a processor, the memory storing a computer program, characterized in that the processor, when executing the computer program, implements the steps of the method of any of claims 1 to 6.
9. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the method of any one of claims 1 to 6.
10. A computer program product comprising a computer program, characterized in that the computer program realizes the steps of the method of any one of claims 1 to 6 when executed by a processor.
CN202111386569.2A 2021-11-22 2021-11-22 Method and device for generating test data, computer equipment and storage medium Pending CN114185770A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111386569.2A CN114185770A (en) 2021-11-22 2021-11-22 Method and device for generating test data, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111386569.2A CN114185770A (en) 2021-11-22 2021-11-22 Method and device for generating test data, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114185770A true CN114185770A (en) 2022-03-15

Family

ID=80541144

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111386569.2A Pending CN114185770A (en) 2021-11-22 2021-11-22 Method and device for generating test data, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114185770A (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114595159A (en) * 2022-05-10 2022-06-07 太平金融科技服务(上海)有限公司 Test data generation method, device, equipment and storage medium
CN114647621A (en) * 2022-03-31 2022-06-21 中国银行股份有限公司 Batch processing method and device for test data
CN115098502A (en) * 2022-06-24 2022-09-23 平安银行股份有限公司 Data table creating method and device, terminal equipment and readable storage medium
CN116089296A (en) * 2023-02-07 2023-05-09 中国建设银行股份有限公司 Business logic testing method, device, computer equipment and storage medium
CN117194253A (en) * 2023-09-11 2023-12-08 易方达基金管理有限公司 Method and system for generating test data of service scene

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150227452A1 (en) * 2014-02-12 2015-08-13 Wipro Limited System and method for testing software applications
CN110188030A (en) * 2019-04-08 2019-08-30 平安科技(深圳)有限公司 Method and device for generating test data, computer equipment, and storage medium
CN110597728A (en) * 2019-09-20 2019-12-20 中国银行股份有限公司 Method, device and system for constructing test data
CN113220782A (en) * 2021-04-30 2021-08-06 土巴兔集团股份有限公司 Method, device, equipment and medium for generating multivariate test data source
CN113448869A (en) * 2021-07-16 2021-09-28 建信金融科技有限责任公司 Method and device for generating test case, electronic equipment and computer readable medium

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20150227452A1 (en) * 2014-02-12 2015-08-13 Wipro Limited System and method for testing software applications
CN110188030A (en) * 2019-04-08 2019-08-30 平安科技(深圳)有限公司 Method and device for generating test data, computer equipment, and storage medium
CN110597728A (en) * 2019-09-20 2019-12-20 中国银行股份有限公司 Method, device and system for constructing test data
CN113220782A (en) * 2021-04-30 2021-08-06 土巴兔集团股份有限公司 Method, device, equipment and medium for generating multivariate test data source
CN113448869A (en) * 2021-07-16 2021-09-28 建信金融科技有限责任公司 Method and device for generating test case, electronic equipment and computer readable medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
李国新;罗省贤;: "一种自动化测试技术的研究与实现", 电子测试, no. 08, 5 August 2008 (2008-08-05) *

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114647621A (en) * 2022-03-31 2022-06-21 中国银行股份有限公司 Batch processing method and device for test data
CN114595159A (en) * 2022-05-10 2022-06-07 太平金融科技服务(上海)有限公司 Test data generation method, device, equipment and storage medium
CN115098502A (en) * 2022-06-24 2022-09-23 平安银行股份有限公司 Data table creating method and device, terminal equipment and readable storage medium
CN116089296A (en) * 2023-02-07 2023-05-09 中国建设银行股份有限公司 Business logic testing method, device, computer equipment and storage medium
CN117194253A (en) * 2023-09-11 2023-12-08 易方达基金管理有限公司 Method and system for generating test data of service scene
CN117194253B (en) * 2023-09-11 2024-04-19 易方达基金管理有限公司 Method and system for generating test data of service scene

Similar Documents

Publication Publication Date Title
CN114185770A (en) Method and device for generating test data, computer equipment and storage medium
CN112380213B (en) Information acquisition method and device, computer equipment and storage medium
CN111221726A (en) A test data generation method, device, storage medium and intelligent device
CN107665171B (en) Automatic regression testing method and device
CN111061733B (en) Data processing method, device, electronic equipment and computer readable storage medium
CN110321273A (en) A kind of business statistical method and device
CN110377522A (en) The test method for scene of trading, calculates equipment and medium at device
CN106648556A (en) Front end and back end integrated development testing method and device
CN109740129B (en) Report generation method, device and equipment based on blockchain and readable storage medium
CN108460068A (en) Method, apparatus, storage medium and the terminal that report imports and exports
CN110069376A (en) Several method, apparatus, storage medium and computer equipment are made in a kind of association
CN114372006A (en) Test case automatic generation method, system, computer equipment and storage medium
CN107733710A (en) Construction method, device, computer equipment and the storage medium of link call relation
CN107273250B (en) Testing method and device of electronic insurance policy automatic underwriting system
CN107357721B (en) Method and device for testing system
CN114648323A (en) Business scenario-oriented call chain processing method, device and medium
CN114116801A (en) Data list checking method and device
CN107679766A (en) A kind of gunz task dynamic redundancy dispatching method and device
CN117290255A (en) Batch interface performance test method based on Python and Locut frameworks
CN115037577B (en) Intelligent gateway service management platform
CN113238966B (en) Report platform front end testing method, device, equipment and storage medium
CN106330484A (en) Log generation method and device
CN116126819A (en) System log processing method, device and medium
CN115130002A (en) Recommendation request processing method and device, computer equipment and storage medium
CN114416805A (en) Data checking 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
CB02 Change of applicant information

Country or region after: China

Address after: 518000 Room 201, building A, No. 1, Qian Wan Road, Qianhai Shenzhen Hong Kong cooperation zone, Shenzhen, Guangdong (Shenzhen Qianhai business secretary Co., Ltd.)

Applicant after: Zhaolian Consumer Finance Co.,Ltd.

Address before: 518000 Room 201, building A, No. 1, Qian Wan Road, Qianhai Shenzhen Hong Kong cooperation zone, Shenzhen, Guangdong (Shenzhen Qianhai business secretary Co., Ltd.)

Applicant before: MERCHANTS UNION CONSUMER FINANCE Co.,Ltd.

Country or region before: China

CB02 Change of applicant information