WO2020006930A1 - Data forgery method and apparatus, and computer storage medium - Google Patents

Data forgery method and apparatus, and computer storage medium Download PDF

Info

Publication number
WO2020006930A1
WO2020006930A1 PCT/CN2018/111112 CN2018111112W WO2020006930A1 WO 2020006930 A1 WO2020006930 A1 WO 2020006930A1 CN 2018111112 W CN2018111112 W CN 2018111112W WO 2020006930 A1 WO2020006930 A1 WO 2020006930A1
Authority
WO
WIPO (PCT)
Prior art keywords
data
type
fake
forged
generation module
Prior art date
Application number
PCT/CN2018/111112
Other languages
French (fr)
Chinese (zh)
Inventor
彭明强
Original Assignee
平安科技(深圳)有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 平安科技(深圳)有限公司 filed Critical 平安科技(深圳)有限公司
Publication of WO2020006930A1 publication Critical patent/WO2020006930A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/543User-generated data transfer, e.g. clipboards, dynamic data exchange [DDE], object linking and embedding [OLE]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing

Definitions

  • the preset specification file defines different data types, and fake data generation modules corresponding to the different data types.
  • the preset specification file may define a null character type and its corresponding forged data generation module, a Boolean type and its corresponding forged data generation module, a number type and its corresponding forged data generation module, a string type, and Its corresponding fake data generating module, array type and its corresponding fake data generating module, object type and its corresponding fake data generating module, or other custom data types and its corresponding fake data generating module.
  • the step 204 may specifically include:
  • a null character forged data generation module is used to generate the null character forged data.
  • the generated fake data may be "null" or "null".
  • the data type is a Boolean type
  • the generated fake data may be "true”, “false”, “true”, or "false”.
  • an embodiment of the present application further provides a computer non-volatile readable storage medium having computer-readable instructions stored thereon.
  • the computer-readable instructions are executed by a processor, Implement the following steps: when receiving a falsified data acquisition request sent by the front end, call a data type analysis module according to a preset specification file to parse the data type of the falsified data corresponding to the acquisition request; and call the data with the data according to the preset specification file
  • Forged data generation module corresponding to the type the preset specification file defines different data types and forged data generation modules corresponding to the different data types respectively; and the called forged data generation module is used to generate the forged data.

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Storage Device Security (AREA)
  • Document Processing Apparatus (AREA)

Abstract

A data forgery method and apparatus, and a computer storage medium, which relate to the field of information technology, and of which main objectives are to be able to effectively reduce generated codes of forged data, reduce the generation of code redundancy, and improve the reusability and readability of generated codes. The method comprises: when a forged data acquisition request sent by a front end is received, calling a data type parsing module according to a preset specification file to parse a data type of forged data corresponding to the acquisition request (101); according to the preset specification file, calling a forged data generation module corresponding to the data type (102), wherein the preset specification file defines different data types, and forged data generation modules separately corresponding to the different data types; utilizing the called forged data generation module to generate the forged data (103). The foregoing method is applicable to data forgery.

Description

数据伪造方法、装置及计算机存储介质Data forgery method, device and computer storage medium
本申请要求与2018年7月5日提交中国专利局、申请号为2018107321514、申请名称为“数据伪造方法、装置及计算机存储介质”的中国专利申请的优先权,其全部内容通过引用结合在申请中。This application claims priority from a Chinese patent application filed with the Chinese Patent Office on July 5, 2018, with application number 2018107321514, and with the application name "Data Forgery Method, Device and Computer Storage Medium", the entire contents of which are incorporated in the application by reference in.
技术领域Technical field
本申请涉及信息技术领域,尤其是涉及一种数据伪造方法、装置及计算机存储介质。The present application relates to the field of information technology, and in particular, to a method and device for forging data and a computer storage medium.
背景技术Background technique
随着信息技术的不断发展,应用系统的前端和后台通常采用分离方式开发,为了避免前端等待后台完成真实的接口开发再进行集成测试,降低前端和后台的耦合性,虚假服务系统随之出现,虚假服务系统可以根据预先约定的接口文档的虚假开发接口,伪造数据并反馈给前端,使得前端可以先利用生产的伪造数据处理页面展示,无需等待后台接口开发完成反馈准确数据进行页面展示处理,再进行集成测试。With the continuous development of information technology, the front-end and back-end of the application system are usually developed in a separate way. In order to avoid the front-end waiting for the background to complete the development of the real interface and then perform integration testing to reduce the coupling of the front-end and back-end, false service systems have emerged. The fake service system can fake data and feed it back to the front end according to the fake development interface of the pre-appointed interface document, so that the front end can use the produced fake data to process the page display first, without waiting for the background interface development to complete and feedback the accurate data for page display processing. Perform integration tests.
目前,虚假服务系统在进行数据伪造时,针对前端的每个伪造数据获取请求都需要进行一系列的生成操作,编写对应的生成代码,才能生成请求的伪造数据。然而,通过上述方式生成伪造数据,会造成伪造数据的生成代码较多,导致代码膨胀,复用性差,可读性低。At present, when a fake service system performs data forgery, a series of generation operations are required for each forged data acquisition request on the front end, and corresponding generation code is written to generate the requested forged data. However, generating fake data in the above manner will result in more generated codes for the fake data, resulting in code expansion, poor reusability, and low readability.
发明内容Summary of the invention
本申请提供了一种数据伪造方法、装置及计算机存储介质,主要在于能够有效减少伪造数据的生成代码,减少生成代码冗余、提升生成代码的复用性以及可读性。The present application provides a data forgery method, device, and computer storage medium, which are mainly capable of effectively reducing the generated code of forged data, reducing the redundancy of the generated code, and improving the reusability and readability of the generated code.
根据本申请的第一个方面,提供一种数据伪造方法,应用于虚假服务系统,包括:According to a first aspect of the present application, a data forgery method is provided and applied to a fake service system, including:
当接收到前端发送的伪造数据获取请求时,根据预设规范文件调用数据类型解析模块解析所述获取请求对应伪造数据的数据类型;When receiving a falsified data acquisition request sent by the front end, calling a data type analysis module according to a preset specification file to analyze the data type of the falsified data corresponding to the acquisition request;
根据所述预设规范文件调用与所述数据类型对应的伪造数据生成模块,所述预设规范文件定义有不同数据类型,以及所述不同数据类型分别对应的伪造数据生成模块;Calling a fake data generation module corresponding to the data type according to the preset specification file, the preset specification file defines different data types, and the fake data generation modules corresponding to the different data types, respectively;
利用调用的伪造数据生成模块生成所述伪造数据。The forged data is generated by using the called forged data generation module.
根据本申请的第二个方面,提供一种数据伪造装置,包括:According to a second aspect of the present application, a data forgery device is provided, including:
解析单元,用于当接收到前端发送的伪造数据获取请求时,根据预设规范文件调用数据类型解析模块解析所述获取请求对应伪造数据的数据类型;A parsing unit, configured to, when receiving a falsified data acquisition request sent by the front end, call a data type analysis module according to a preset specification file to parse a data type of the falsified data corresponding to the fetch request;
调用单元,用于根据所述预设规范文件调用与所述数据类型对应的伪造数据生成模块,所述预设规范文件定义有不同数据类型,以及所述不同数据类型分别对应的伪造数据生成模块;An invoking unit for invoking a fake data generation module corresponding to the data type according to the preset specification file, the preset specification file defines different data types, and the fake data generation modules corresponding to the different data types respectively ;
生成单元,用于利用调用的伪造数据生成模块生成所述伪造数据。A generating unit is configured to generate the forged data by using the called forged data generating module.
根据本申请的第三个方面,提供一种计算机非易失性可读存储介质,其上存储有计算机可读指令,该计算机可读指令被处理器执行时实现以下步骤:According to a third aspect of the present application, a computer non-volatile readable storage medium is provided, on which computer-readable instructions are stored, and when the computer-readable instructions are executed by a processor, the following steps are implemented:
当接收到前端发送的伪造数据获取请求时,根据预设规范文件调用数据类型解析模块解析所述获取请求对应伪造数据的数据类型;根据所述预设规范文件调用与所述数据类型对应的伪造数据生成模块,所述预设规范文件定义有不同数据类型,以及所述不同数据类型分别对应的伪造数据生成模块;利用调用的伪造数据生成模块生成所述伪造数据。When receiving a falsified data acquisition request sent by the front end, a data type analysis module is invoked to analyze the data type of the falsified data corresponding to the acquisition request according to a preset specification file; A data generation module, the preset specification file defines different data types, and fake data generation modules corresponding to the different data types respectively; and the called fake data generation module is used to generate the fake data.
根据本申请的第四个方面,提供一种计算机设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机可读指令,所述处理器执行所述计算机可读指令时实现以下步骤:According to a fourth aspect of the present application, a computer device is provided, including a memory, a processor, and computer-readable instructions stored on the memory and executable on the processor. When the processor executes the computer-readable instructions, Implement the following steps:
当接收到前端发送的伪造数据获取请求时,根据预设规范文件调用数据类型解析模块解析所述获取请求对应伪造数据的数据类型;根据所述预设规范文件调用与所述数据类型对应的伪造数据生成模块,所述预设规范文件定义有不同数据类型,以及所述不同数据类型分别对应的伪造数据生成模块;利用调用的伪造数据生成模块生成所述伪造数据。When receiving a falsified data acquisition request sent by the front end, a data type analysis module is invoked to analyze the data type of the falsified data corresponding to the acquisition request according to a preset specification file; and a falsification corresponding to the data type is invoked according to the preset specification file. A data generation module, the preset specification file defines different data types, and fake data generation modules corresponding to the different data types respectively; and the called fake data generation module is used to generate the fake data.
本申请提供的一种数据伪造方法、装置及计算机存储介质,与目前针对前端的每个伪造数据获取请求都需要进行一系列的生成操作,编写对应的生成代码相比,本申请在接收到前端发送的伪造数据获取请求时,能够根据预设规范文件调用数据类型解析模块解析所述获取请求对应伪造数据的数据类型。与此同时,能够根据所述预设规范文件调用与所述数据类型对应的伪造数据生成模块,所述预设规范文件定义有不同数据类型,以及所述不同数据类型分别对应的伪造数据生成模块,并能够利用调用的伪造数据生成模块生成所述伪造数据,从而能够实现虚假服务系统通过同一数据类型的伪造数据生成模块对同一数据类型的伪造数据进行统一处理,无需针对每个伪造数据进行单独处理,进而能够有效减少伪造数据的生成代码,减少生成代码冗余、提升生成代码的复用性以及可读性。A data forgery method, device, and computer storage medium provided by the present application. Compared with the current need for a series of generation operations for each forged data acquisition request of the front end, compared with writing corresponding generation code, the present application receives a front end When sending a falsified data acquisition request, a data type analysis module can be called according to a preset specification file to analyze the data type of the falsified data corresponding to the acquisition request. At the same time, a fake data generation module corresponding to the data type can be called according to the preset specification file, the preset specification file defines different data types, and the fake data generation modules corresponding to the different data types respectively And can use the called forged data generation module to generate the forged data, thereby enabling the fake service system to uniformly process the forged data of the same data type through the forged data generation module of the same data type, without the need for each forged data separately Processing can further effectively reduce the generated code of falsified data, reduce the redundancy of generated code, and improve the reusability and readability of generated code.
附图说明BRIEF DESCRIPTION OF THE DRAWINGS
此处所说明的附图用来提供对本申请的进一步理解,构成本申请的一部分,本申请的示意性实施例及其说明用于解释本申请,并不构成对本申请的不当限定。在附图中:The drawings described herein are used to provide a further understanding of the present application and constitute a part of the present application. The schematic embodiments of the present application and the descriptions thereof are used to explain the present application and do not constitute an improper limitation on the present application. In the drawings:
图1示出了本申请实施例提供的一种数据伪造方法流程图;FIG. 1 shows a flowchart of a data forgery method provided by an embodiment of the present application;
图2示出了本申请实施例提供的另一种数据伪造方法流程图;FIG. 2 shows a flowchart of another data forgery method provided by an embodiment of the present application;
图3示出了本申请实施例提供的一种数据伪造装置的结构示意图;3 is a schematic structural diagram of a data forgery device according to an embodiment of the present application;
图4示出了本申请实施例提供的另一种数据伪造装置的结构示意图;4 is a schematic structural diagram of another data forgery device according to an embodiment of the present application;
图5示出了本申请实施例提供的一种计算机设备的实体结构示意图。FIG. 5 is a schematic structural diagram of a computer device according to an embodiment of the present application.
具体实施方式detailed description
下文中将参考附图并结合实施例来详细说明本申请。需要说明的是,在不冲突的情况下,本申请中的实施例及实施例中的特征可以相互组合。Hereinafter, the present application will be described in detail with reference to the drawings and embodiments. It should be noted that, in the case of no conflict, the embodiments in the present application and the features in the embodiments can be combined with each other.
如背景技术,目前,虚假服务系统在进行数据伪造时,针对前端的每个伪造数据获取请求都需要进行一系列的生成操作,编写对应的生成代码,才能生成请求的伪造数据。然而,通过上述方式生成伪造数据,会造成伪造数据的生成代码较多,导致代码膨胀,复用性差,可读性低。For example, at present, when a fake service system performs data falsification, a series of generation operations are required for each falsified data acquisition request of the front end, and corresponding generation code is written to generate the requested falsified data. However, generating fake data in the above manner will result in more generated codes for the fake data, resulting in code expansion, poor reusability, and low readability.
为了解决上述问题,本申请实施例提供了一种数据伪造方法,应用于虚假服务系统,如图1所示,所述方法包括:In order to solve the above problem, an embodiment of the present application provides a data forgery method, which is applied to a fake service system. As shown in FIG. 1, the method includes:
101、当接收到前端发送的伪造数据获取请求时,根据预设规范文件调用数据类型解析模块解析所述获取请求对应伪造数据的数据类型。101. When a falsified data acquisition request sent by a front end is received, a data type analysis module is called to analyze a data type of the falsified data corresponding to the acquisition request according to a preset specification file.
其中,所述预设规范文件可以为JSON Schema规范文件,JSON Schema是基于JSON格式定义JSON数据结构的规范,它是一个易于理解的人类和机器都可读的文档,使用JSON schema前端开发人员即可知晓后台接口返回的数据对象结构,进而开发自己的页面展示。所述预设规范文件可以定义有数据类型解析模块,具体地,所述数据类型解析模块可以为技术人员开发完预定义在所述预设规范文件中的,所述数据类型解析模块所支持的数据类型可以是可枚举的,可以保存不同数据类型的数据。所述数据类型解析模块可以提取所述获取请求中的数据类型,作为所述伪造数据的数据类型。所述数据类型可以为空字符类型、布尔类型、字符串类型、数组类型、对象类型,或者其他自定义的数据类型。例如,所述数据类型解析模块从所述获取请求中提取出的数据类型为对象类型,则可以确认前端请求的伪造数据的数据类型为对象类型。The preset specification file may be a JSON Schema specification file. JSON Schema is a specification that defines a JSON data structure based on the JSON format. It is an easy-to-understand human- and machine-readable document. You can know the data object structure returned by the background interface, and then develop your own page display. The preset specification file may define a data type parsing module. Specifically, the data type parsing module may be developed for technicians to predefine in the preset specification file, the data type parsing module supports Data types can be enumerable and can hold data of different data types. The data type analysis module may extract a data type in the acquisition request as a data type of the falsified data. The data type may be a null character type, a Boolean type, a string type, an array type, an object type, or other custom data types. For example, if the data type extracted by the data type analysis module from the acquisition request is an object type, it may be confirmed that the data type of the fake data requested by the front end is an object type.
需要说明的是,当用户触发前端的计算机可读指令展示页面的操作按钮或者按键时,虚假服务系统能够接收到伪造数据获取请求,前端可以获取配置文件中的当前模式信息,若当前模式信息为虚假模式,则可以生成伪造数据获取请求。It should be noted that when the user triggers the front-end computer-readable instructions to display the operation buttons or keys of the page, the fake service system can receive a falsified data acquisition request, and the front-end can obtain the current mode information in the configuration file. If the current mode information is False mode can generate falsified data acquisition requests.
102、根据所述预设规范文件调用与所述数据类型对应的伪造数据生成模块。102. Call a forged data generation module corresponding to the data type according to the preset specification file.
其中,所述预设规范文件定义有不同数据类型,以及所述不同数据类型分别对应的伪造数据生成模块。具体地,所述预设规范文件可以定义有空字符类型及其对应的伪造数据生成模块,布尔类型及其对应的伪造数据生成模块,数字类型及其对应的伪造数据生成模块,字符串类型及其对应的伪造数据生成模块,数组类型及其对应的伪造数据生成模块,对象类型及其对应的伪造数据生成模块,或者其他自定义的数据类型及其对应的伪造数据生成模块。The preset specification file defines different data types, and fake data generation modules corresponding to the different data types. Specifically, the preset specification file may define a null character type and its corresponding forged data generation module, a Boolean type and its corresponding forged data generation module, a number type and its corresponding forged data generation module, a string type, and Its corresponding fake data generating module, array type and its corresponding fake data generating module, object type and its corresponding fake data generating module, or other custom data types and its corresponding fake data generating module.
例如,若解析出前端请求的伪造数据的数据类型为空字符类型,则可以根据预设规范文件调用空字符类型的伪造数据生成模块,以生成一个空字符作为伪造数据。若解析出前端请求的伪造数据的数据类型为布尔类型,则可以根据预设规范文件调用布尔类型的伪造数据生成模块,随机生成“真”或者“假”作为伪造数据。若解析出前端请求的伪造数据的数据类型为数字类型,则可以根据预设规范文件调用数字类型的伪造数据生成模块,以随机生成一个数字作为伪造数据。若解析出前端请求的伪造数据的数据类型为字符串类型,则可以根据预设规范文件调用字符串类型的伪造数据生成模块,以随机生成一个字符串作为伪造数据。若解析出前端请求的伪造数据的数据类型为数组类型,则可以根据预设规范文件调用数组类型的伪造数据生成模块,以生成一个数组作为伪造数据。若解析出前端请求的伪造数据的数据类型为对象类型,则可以根据预设规范文件调用对象类型的伪造数据生成模块,以生成一个对象作为伪造数据。For example, if the data type of the forged data requested by the front end is parsed as a null character type, a dummy data generation module of a null character type may be called according to a preset specification file to generate a null character as the fake data. If the data type of the bogus data requested by the front end is parsed, the boolean data generation module may be called according to a preset specification file, and “true” or “false” may be randomly generated as the bogus data. If the data type of the forged data requested by the front end is parsed, the digital type forged data generation module can be called according to a preset specification file, and a number is randomly generated as the forged data. If the data type of the forged data requested by the front end is parsed, the forged data generation module of the string type can be called according to a preset specification file, and a character string is randomly generated as the forged data. If the data type of the forged data requested by the front end is parsed, the forged data generation module of the array type may be called according to a preset specification file to generate an array as the forged data. If the data type of the forged data requested by the front end is parsed, the forged data generation module of the object type may be called according to a preset specification file to generate an object as the forged data.
103、利用调用的伪造数据生成模块生成所述伪造数据。103. Generate the forged data by using the called forged data generation module.
本申请实施例提供的一种数据伪造方法,与目前针对前端的每个伪造数据获取请求都需要进行一系列的生成操作,编写对应的生成代码相比,本申请实施例在接收到前端发送的伪造数据获取请求时,能够根据预设规范文件调用数据类型解析模块解析所述获取请求对应伪造数据的数据类型。与此同时,能够根据所述预设规范文件调用与所述数据类型对应的伪造数据生成模块,所述预设规范文件定义有不同数据类型,以及所述不同数据类型分别对应的伪造数据生成模块,并能够利用调用的伪造数据生成模块生成所述伪造数据,从而能够实现虚假服务系统通过同一数据类型的伪造数据生成模块对同一数据类型的伪造数据进行统一处理,无需针对每个伪造数据进行单独处理,进而能够有效减少伪造数据的生成代码,减少生成代码冗余、提升生成代码的复用性以及可读性。A data forgery method provided by the embodiment of the present application requires a series of generation operations for each falsified data acquisition request of the front end. Compared with writing a corresponding generation code, the embodiment of the present application When a falsified data acquisition request is made, a data type analysis module can be called according to a preset specification file to analyze the data type of the falsified data corresponding to the acquisition request. At the same time, a fake data generation module corresponding to the data type can be called according to the preset specification file, the preset specification file defines different data types, and the fake data generation modules corresponding to the different data types respectively And can use the called forged data generation module to generate the forged data, thereby enabling the fake service system to uniformly process the forged data of the same data type through the forged data generation module of the same data type, without the need for each forged data separately Processing can further effectively reduce the generated code of falsified data, reduce the redundancy of generated code, and improve the reusability and readability of generated code.
进一步的,为了更好的说明上述数据伪造的过程,作为对上述实施例的细化和扩展,本申请实施例提供了另一种数据伪造方法,如图2所示,所述方法包括:Further, in order to better explain the above-mentioned data forgery process, as a refinement and extension of the foregoing embodiment, an embodiment of the present application provides another data forgery method. As shown in FIG. 2, the method includes:
201、当接收到前端发送的伪造数据获取请求时,根据预设规范文件调用数据类型解析模块解析所述获取请求对应伪造数据的数据类型。201. When a falsified data acquisition request sent by a front end is received, a data type analysis module is called according to a preset specification file to parse a data type of the falsified data corresponding to the acquisition request.
对于本申请实施例,所述根据预设规范文件调用数据类型解析模块解析所述获取请求对应伪造数据的数据类型的步骤,具体可以包括:根据预设规范文件调用数据类型解析模块提取所述获取请求携带的数据结构中的数据类型;将提取的数据类型确定为所述伪造数据的数据类型。具体地,所述数据类型解析模块可以提取数据结构中的键值对,键值对的键为“type”,其键值对的值即可为提取的数据类型。For the embodiment of the present application, the step of invoking the data type analysis module according to a preset specification file to parse the data type of the falsified data corresponding to the acquisition request may specifically include calling the data type analysis module to extract the acquisition according to the preset specification file. The data type in the data structure carried in the request; determining the extracted data type as the data type of the fake data. Specifically, the data type analysis module may extract key-value pairs in a data structure, and the key of the key-value pair is "type", and the value of the key-value pair may be the extracted data type.
例如,若所述数据结构包括键值对:“type”:“object”,则所述数据类型解析模块可以提取键值对的值“object”,将“object”确定为伪造数据的数据类型,所述伪造数据类型可以为对象类型;若所述数据结构包括键值对:“type”:“string”,则所述数据类型解析模块可以提取键值对的值“string”,将“string”确定为伪造数据的数据类型,所述伪造数据类型可以为字符串类型。For example, if the data structure includes a key-value pair: "type": "object", the data type parsing module may extract a value "object" of the key-value pair and determine "object" as the data type of the fake data, The forged data type may be an object type; if the data structure includes a key-value pair: "type": "string", the data type parsing module may extract the value of the key-value pair "string" and convert the "string" Determined as the data type of the forged data, the forged data type may be a string type.
202、从所述预设规范文件中查找与所述数据类型对应的伪造数据生成模块标识。202. Find a forged data generation module identifier corresponding to the data type from the preset specification file.
其中,所述预设规范文件定义有不同数据类型,以及所述不同数据类型分别对应的伪造数据生成模块标识。所述不同数据类型,以及所述不同数据类型分别对应的伪造数据生成模块标识可以为预先定义到所述规范文件中的。所述不同数据类型分别对应的伪造数据生成模块可以为技术人员预先开发的,具体地,可以为通过编写数据一系列生成操作对应的生成代码开发的。所述伪造数据生成模块标识可以为伪造数据生成模块的名称,如布尔类型的伪造数据生成模块标识可以为:Boolean-Generating module,所述预设规范文件定义的布尔类型以及对应的伪造数据生成模块的方式可以为:The preset specification file defines different data types, and the fake data generation module identifiers corresponding to the different data types, respectively. The different data types and the identifiers of the fake data generation modules corresponding to the different data types may be predefined in the specification file. The forged data generating modules corresponding to the different data types may be developed in advance by a technician, specifically, may be developed for generating code corresponding to a series of generating operations for writing data. The forged data generation module identifier may be the name of the forged data generation module. For example, the boolean type forged data generation module identifier may be: Boolean-Generating module, the Boolean type defined by the preset specification file and the corresponding forged data generation module. The way can be:
“Type”:Boolean;“Generating module”:Boolean-Generating module。"Type": Boolean; "Generating module": Boolean-Generating module.
203、根据所述伪造数据生成模块标识调用与所述数据类型对应的伪造数据生成模块。203: Call a forged data generation module corresponding to the data type according to the forged data generation module identification.
对于本申请实施例,为了调用与所述数据类型对应的伪造数据生成模块,所述方法还可以包括:提取所述获取请求携带的前端地址信息,并调用与所述前端地址信息对应的虚假服务接口;利用所述虚假服务接口根据所述预设规范文件调用与所述数据类型对应的伪造数据生成模块,所述虚假服务接口为根据前端和后台预先约定的接口文档定义的。所述前端地址信息和所述虚假服务接口之间的对应关系可以为预先定义的。具体地,可以利用所述虚假服务接口从所述预设规范文件中查找与所述数据类型对应的伪造数据生成模块标识,以调用与所述数据类型对应的伪造数据生成模块。所述接口文档可以包括预先约定的请求字段信息、返回字段信息、数据类型字段信息等。例如,所述前端地址信息为http://abc.123.456:789/A,前端请求的伪造数据的数据类型为字符串类型,则可以调用虚假服务接口1,并利用虚假服务接口1从所述预设规范文件中查找与字符串类型的伪造数据生成模块标识,以调用字符串的伪造数据生成模块,生成一个随机长度的字符串作为 反馈给前端的伪造数据。For the embodiment of the present application, in order to call a fake data generation module corresponding to the data type, the method may further include: extracting front-end address information carried by the acquisition request, and calling a fake service corresponding to the front-end address information An interface; using the fake service interface to call a fake data generation module corresponding to the data type according to the preset specification file, the fake service interface is defined according to an interface document agreed in advance by the front end and the background. The correspondence between the front-end address information and the fake service interface may be predefined. Specifically, the fake service interface may be used to find the identifier of the fake data generation module corresponding to the data type from the preset specification file, so as to call the fake data generation module corresponding to the data type. The interface document may include pre-agreed request field information, return field information, data type field information, and the like. For example, if the front-end address information is http: //abc.123.456: 789 / A, and the data type of the fake data requested by the front-end is a string type, then the fake service interface 1 can be called, and the fake service interface 1 can be used from the The preset specification file searches for the identity of the forged data generation module of the character string type, and invokes the forged data generation module of the character string to generate a random-length character string as feedback to the front-end forged data.
204、利用调用的伪造数据生成模块生成所述伪造数据。204. Generate the forged data by using the called forged data generation module.
对于本申请实施例,所述步骤204具体可以包括:For the embodiment of the present application, the step 204 may specifically include:
1、若所述数据类型为空字符类型,则利用空字符类型的伪造数据生成模块生成空字符伪造数据。例如,所述数据类型为空字符类型,则生成的伪造数据可以为“null”或者为“空”。1. If the data type is a null character type, a null character forged data generation module is used to generate the null character forged data. For example, if the data type is a null character type, the generated fake data may be "null" or "null".
2、若所述数据类型为布尔类型,则利用布尔类型的伪造数据生成模块生成真或假的伪造数据。例如,所述数据类型为布尔类型,则生成的伪造数据可以为“真”、“假”、“true”或者“false”。2. If the data type is a Boolean type, use a Boolean type forged data generation module to generate true or false forged data. For example, if the data type is a Boolean type, the generated fake data may be "true", "false", "true", or "false".
3、若所述数据类型为数字类型,则利用数字类型的伪造数据生成模块生成数字伪造数据。例如,所述数据类型为数字类型,则生成的伪造数据可以为“1”或者“2”等。3. If the data type is a digital type, digital forged data generation module is used to generate digital forged data. For example, if the data type is a numeric type, the generated fake data may be "1" or "2".
4、若所述数据类型为字符串类型,则利用字符串类型的伪造数据生成模块生成字符串伪造数据。例如,所述数据类型为字符串类型,则生成的伪造数据可以为“randomstring”、“randstring”等。4. If the data type is a character string type, use a character string type forged data generation module to generate character string forged data. For example, if the data type is a string type, the generated fake data may be "randomstring", "randstring", and so on.
5、若所述数据类型为数组类型,则利用数组类型的伪造数据生成模块调用对应的数据规范对象项目中定义的数据规范生成数组伪造数据。具体地,所述数据规范对象项目可5. If the data type is an array type, use the array-type fake data generation module to call the data specification defined in the corresponding data specification object item to generate the array fake data. Specifically, the data specification object item may be
Figure PCTCN2018111112-appb-000001
Figure PCTCN2018111112-appb-000001
数据规范对象可以为“item1”和“item2”,“item1”和“item2”可以调用数字类型的伪造数据生成模块,随机生成“1”、“2”。因此,若所述数据类型为数字类型,则生成的伪造数据可以为“1,2”等。The data specification objects can be "item1" and "item2". "Item1" and "item2" can call digital-type fake data generation modules to randomly generate "1" and "2". Therefore, if the data type is a digital type, the generated fake data may be “1, 2” and the like.
6、若所述数据类型为对象类型,则利用对象类型的伪造数据生成模块,调用对应的数据规范对象属性中定义的数据规范生成对象伪造数据。具体地,所述数据规范对象属性6. If the data type is an object type, use a fake data generation module of the object type to call the data specification defined in the corresponding data specification object attribute to generate the object fake data. Specifically, the data specification object attribute
Figure PCTCN2018111112-appb-000002
Figure PCTCN2018111112-appb-000002
Figure PCTCN2018111112-appb-000003
Figure PCTCN2018111112-appb-000003
数据规范对象可以为“status”和“complete”,“status”部分可以调用字符串类型的伪造数据生成模块,随机生成“randomstring”,“complete”部分可以调用布尔型的伪造数据生成模块,生成“true”,因此,若所述数据类型为对象类型,则生成的伪造数据可以为{“status”:“randomstring”,“complete”:true}等。The data specification objects can be "status" and "complete". The "status" part can call a string-type fake data generation module to randomly generate "randomstring", and the "complete" part can call a boolean fake data generation module to generate " "true", so if the data type is an object type, the generated fake data can be {"status": "randomstring", "complete": true}, etc.
对于本申请实施例,为了能够尽快完成应用系统的开发,避免部署真实测试环境,以及等待后台接口完成后进行集成测试,节约人力成本和时间成本,所述步骤204之后,所述方法还可以包括:将所述伪造数据发送给所述前端,使得所述前端利用所述伪造数据进行测试。For the embodiment of the present application, in order to complete the development of the application system as soon as possible, avoid the deployment of a real test environment, and wait for the background interface to complete the integration test, saving labor costs and time costs. After step 204, the method may further include: : Sending the forged data to the front end, so that the front end uses the forged data for testing.
205、当接收到数据伪造扩展指令时,获取所述数据伪造扩展指令包含的新增的数据类型。205. When a data forgery extension instruction is received, obtain a newly added data type included in the data forgery extension instruction.
206、将所述新增的数据类型及其对应的伪造数据生成模块定义到所述预设规范文件中。206. Define the newly added data type and its corresponding forged data generation module into the preset specification file.
在实际使用过程中,若存在一些自定义的数据类型,且技术人员开发完自定义的数据类型的伪造数据生成模块后,前端可以向虚假服务系统发送包含的新增的数据类型的数据伪造扩展指令,例如新增的数据类型可以为:电话号码数据类型。虚假服务系统可以将电话号码数据类型及其对应的伪造数据生成模块定义到预设规范文件中。例如,在扩展电话号码数据类型后,预设规范文件中可以增加如下内容:In the actual use process, if there are some custom data types, and the technical staff has developed a fake data generation module of the custom data type, the front end can send a data forgery extension of the newly added data type to the fake service system. Instructions, such as the new data type can be: phone number data type. The fake service system can define the phone number data type and its corresponding forged data generation module into a preset specification file. For example, after expanding the phone number data type, the following can be added to the preset specification file:
Figure PCTCN2018111112-appb-000004
Figure PCTCN2018111112-appb-000004
此外,所述数据类型解析模块也可以新增电话号码数据类型,从而在接收到伪造数据获取请求时,能够解析出伪造数据的数据类型是否为电话号码数据类型。若解析出伪造数据的数据类型为电话号码数据类型,则生成的伪造数据可以为“13888888888”。同理地,其他自定义的数据类型以相同方式扩展到虚假服务系统中。In addition, the data type analysis module may also add a phone number data type, so that when a forged data acquisition request is received, whether the data type of the forged data is a phone number data type or not. If the data type of the forged data is parsed as a phone number data type, the generated forged data may be "13888888888". Similarly, other custom data types are extended to the fake service system in the same way.
本申请实施例提供的另一种数据伪造方法,与目前针对前端的每个伪造数据获取请求都需要进行一系列的生成操作,编写对应的生成代码相比,本申请实施例在接收到前端发 送的伪造数据获取请求时,能够根据预设规范文件调用数据类型解析模块解析所述获取请求对应伪造数据的数据类型。与此同时,能够根据所述预设规范文件调用与所述数据类型对应的伪造数据生成模块,所述预设规范文件定义有不同数据类型,以及所述不同数据类型分别对应的伪造数据生成模块,并能够利用调用的伪造数据生成模块生成所述伪造数据,从而能够实现虚假服务系统通过同一数据类型的伪造数据生成模块对同一数据类型的伪造数据进行统一处理,无需针对每个伪造数据进行单独处理,进而能够有效减少伪造数据的生成代码,减少生成代码冗余、提升生成代码的复用性以及可读性。Another data forgery method provided by the embodiment of the present application requires a series of generation operations for each falsified data acquisition request of the front end, and writing a corresponding generation code. Compared with the method of writing the corresponding generation code, the embodiment of the present application When obtaining a falsified data request, the data type analysis module can be called according to a preset specification file to analyze the data type of the falsified data corresponding to the fetch request. At the same time, a fake data generation module corresponding to the data type can be called according to the preset specification file, the preset specification file defines different data types, and the fake data generation modules corresponding to the different data types respectively And can use the called forged data generation module to generate the forged data, thereby enabling the fake service system to uniformly process the forged data of the same data type through the forged data generation module of the same data type, without the need for each forged data separately Processing can further effectively reduce the generated code of falsified data, reduce the redundancy of generated code, and improve the reusability and readability of generated code.
进一步地,作为图1的具体实现,本申请实施例提供了一种数据伪造装置,如图3所示,所述装置包括:解析单元31、调用单元32和生成单元33,所述装置具体可以为虚假服务系统的一部分。Further, as a specific implementation of FIG. 1, an embodiment of the present application provides a data forgery device. As shown in FIG. 3, the device includes: a parsing unit 31, a calling unit 32, and a generating unit 33. The device may specifically Part of a false service system.
所述解析单元31,可以用于当接收到前端发送的伪造数据获取请求时,根据预设规范文件调用数据类型解析模块解析所述获取请求对应伪造数据的数据类型。所述解析单元31是本装置中当接收到前端发送的伪造数据获取请求时,根据预设规范文件调用数据类型解析模块解析所述获取请求对应伪造数据的数据类型的主要功能模块。The parsing unit 31 may be configured to, when receiving a falsified data acquisition request sent by the front end, call a data type analysis module according to a preset specification file to analyze the data type of the falsified data corresponding to the fetch request. The parsing unit 31 is a main function module in the device that, when receiving a falsified data acquisition request sent by the front end, calls a data type analysis module according to a preset specification file to analyze the data type of the falsified data corresponding to the fetch request.
所述调用单元32,可以用于根据所述预设规范文件调用与所述数据类型对应的伪造数据生成模块,所述预设规范文件定义有不同数据类型,以及所述不同数据类型分别对应的伪造数据生成模块;所述调用单元32是本装置中根据所述预设规范文件调用与所述数据类型对应的伪造数据生成模块的主要功能模块,也是核心模块。The calling unit 32 may be configured to call a fake data generation module corresponding to the data type according to the preset specification file. The preset specification file defines different data types, and the different data types correspond to Forged data generation module; the invoking unit 32 is a main function module of the device that invokes a forged data generation module corresponding to the data type according to the preset specification file, and is also a core module.
所述生成单元33,可以用于利用调用的伪造数据生成模块生成所述伪造数据。所述生成单元33是本装置中利用调用的伪造数据生成模块生成所述伪造数据的主要功能模块。The generating unit 33 may be configured to generate the forged data by using a called forged data generating module. The generating unit 33 is a main function module for generating the forged data by using the called forged data generating module in the device.
对于本申请实施例,为了调用与所述数据类型对应的伪造数据生成模块,所述调用单元32,具体可以用于从所述预设规范文件中查找与所述数据类型对应的伪造数据生成模块标识,所述预设规范文件定义有不同数据类型,以及所述不同数据类型分别对应的伪造数据生成模块标识;根据所述伪造数据生成模块标识调用与所述数据类型对应的伪造数据生成模块。For the embodiment of the present application, in order to call a fake data generating module corresponding to the data type, the calling unit 32 may be specifically configured to find a fake data generating module corresponding to the data type from the preset specification file. Identification, the preset specification file defines different data types, and identifiers of forged data generation modules corresponding to the different data types; and invokes a forged data generation module corresponding to the data type according to the forged data generation module identification.
此外,所述调用单元32,具体还可以用于提取所述获取请求携带的前端地址信息,并调用与所述前端地址信息对应的虚假服务接口;利用所述虚假服务接口根据所述预设规范文件调用与所述数据类型对应的伪造数据生成模块,所述虚假服务接口为根据前端和后台预先约定的接口文档定义的。In addition, the invoking unit 32 may be specifically configured to extract the front-end address information carried by the acquisition request, and invoke a fake service interface corresponding to the front-end address information; using the fake service interface according to the preset specification The file calls a fake data generation module corresponding to the data type, and the fake service interface is defined according to an interface document agreed in advance by the front end and the background.
对于本申请实施例,为了解析所述获取请求对应伪造数据的数据类型,所述解析单元31,具体可以用于据预设规范文件调用数据类型解析模块提取所述获取请求携带的数据结 构中的数据类型;将提取的数据类型确定为所述伪造数据的数据类型。For the embodiment of the present application, in order to analyze the data type of the falsified data corresponding to the acquisition request, the parsing unit 31 may be specifically configured to call a data type analysis module according to a preset specification file to extract the data structure carried in the acquisition request. Data type; determining the extracted data type as the data type of the fake data.
在具体应用场景中,所述生成单元33,具体可以用于若所述数据类型为空字符类型,则利用空字符类型的伪造数据生成模块生成空字符伪造数据;或者若所述数据类型为布尔类型,则利用布尔类型的伪造数据生成模块生成真或假的伪造数据;或者若所述数据类型为数字类型,则利用数字类型的伪造数据生成模块生成数字伪造数据;或者若所述数据类型为字符串类型,则利用字符串类型的伪造数据生成模块生成字符串伪造数据;或者若所述数据类型为数组类型,则利用数组类型的伪造数据生成模块调用对应的数据规范对象项目中定义的数据规范生成数组伪造数据;或者若所述数据类型为对象类型,则利用对象类型的伪造数据生成模块,调调用对应的数据规范对象属性中定义的数据规范生成对象伪造数据。In a specific application scenario, the generating unit 33 may be specifically configured to generate a null character forged data by using a dummy data generation module if the data type is a null character type; or if the data type is Boolean Type, use a boolean forged data generation module to generate true or false forged data; or if the data type is a digital type, use a digital type forged data generation module to generate digital forged data; or if the data type is For a character string type, use a forged data generation module of the character string type to generate forged string data; or if the data type is an array type, use the forged data generation module of the array type to call data defined in the corresponding data specification object item Generate array-forged data in a standard manner; or if the data type is an object type, use a data-forgery generation module of the object type to call the data specification defined in the corresponding data specification object attribute to generate the object-forged data.
本申请实施例还可以支持预定义预设规范文件和扩展伪造数据类型的功能,所述装置还包括:定义单元34和获取单元35,如图4所示。The embodiments of the present application can also support the functions of pre-defined preset specification files and extended forged data types. The device further includes a definition unit 34 and an acquisition unit 35, as shown in FIG. 4.
所述定义单元34,可以用于将所述不同数据类型,以及所述不同数据类型分别对应的伪造数据生成模块定义到所述预设规范文件中。所述定义单元34是本装置中将所述不同数据类型,以及所述不同数据类型分别对应的伪造数据生成模块定义到所述预设规范文件中的主要功能模块。The definition unit 34 may be configured to define the different data types and the fake data generation modules corresponding to the different data types into the preset specification file. The definition unit 34 is a main function module in the device that defines the different data types and the fake data generation modules corresponding to the different data types to the preset specification file.
所述获取单元35,可以用于当接收到数据伪造扩展指令时,获取所述数据伪造扩展指令包含的新增的数据类型。所述获取单元35是本装置中当接收到数据伪造扩展指令时,获取所述数据伪造扩展指令包含的新增的数据类型的主要功能模块。The acquiring unit 35 may be configured to acquire a new data type included in the data forgery extension instruction when the data forgery extension instruction is received. The acquiring unit 35 is a main function module for acquiring a new data type included in the data forgery extension instruction when the data forgery extension instruction is received in the device.
所述定义单元34,还可以用于将所述新增的数据类型及其对应的伪造数据生成模块定义到所述预设规范文件中。所述定义单元34是本装置中将所述新增的数据类型及其对应的伪造数据生成模块定义到所述预设规范文件中的主要功能模块。The definition unit 34 may be further configured to define the newly added data type and its corresponding fake data generation module into the preset specification file. The definition unit 34 is a main functional module in the device that defines the newly added data type and its corresponding forged data generation module to the preset specification file.
对于本申请实施例,为了能够尽快完成应用系统的开发,避免部署真实测试环境,以及等待后台接口完成后进行集成测试,节约人力成本和时间成本,所述装置还可以包括:发送单元36。For the embodiment of the present application, in order to be able to complete the development of the application system as soon as possible, avoid the deployment of a real test environment, and wait for the background interface to complete the integration test, saving labor costs and time costs, the device may further include a sending unit 36.
所述发送单元36,可以用于将所述伪造数据发送给所述前端,使得所述前端利用所述伪造数据进行测试。所述发送单元36是本装置中将所述伪造数据发送给所述前端,使得所述前端利用所述伪造数据进行测试。The sending unit 36 may be configured to send the forged data to the front end, so that the front end uses the forged data for testing. The sending unit 36 sends the forged data to the front end in the device, so that the front end uses the forged data for testing.
需要说明的是,本申请实施例提供的一种数据伪造装置所涉及各功能模块的其他相应描述,可以参考图1所示方法的对应描述,在此不再赘述。It should be noted that, for other corresponding descriptions of the functional modules involved in the data forgery device provided in the embodiment of the present application, reference may be made to the corresponding description of the method shown in FIG. 1, and details are not described herein again.
基于上述如图1所示方法,相应的,本申请实施例还提供了一种计算机非易失性可读 存储介质,其上存储有计算机可读指令,该计算机可读指令被处理器执行时实现以下步骤:当接收到前端发送的伪造数据获取请求时,根据预设规范文件调用数据类型解析模块解析所述获取请求对应伪造数据的数据类型;根据所述预设规范文件调用与所述数据类型对应的伪造数据生成模块,所述预设规范文件定义有不同数据类型,以及所述不同数据类型分别对应的伪造数据生成模块;利用调用的伪造数据生成模块生成所述伪造数据。Based on the method shown in FIG. 1, correspondingly, an embodiment of the present application further provides a computer non-volatile readable storage medium having computer-readable instructions stored thereon. When the computer-readable instructions are executed by a processor, Implement the following steps: when receiving a falsified data acquisition request sent by the front end, call a data type analysis module according to a preset specification file to parse the data type of the falsified data corresponding to the acquisition request; and call the data with the data according to the preset specification file Forged data generation module corresponding to the type, the preset specification file defines different data types and forged data generation modules corresponding to the different data types respectively; and the called forged data generation module is used to generate the forged data.
基于上述如图1所示方法和如图3所示数据伪造装置的实施例,本申请实施例还提供了一种计算机设备的实体结构图,如图5所示,该计算机设备包括:处理器41、存储器42、及存储在存储器42上并可在处理器上运行的计算机可读指令,其中存储器42和处理器41均设置在总线43上所述处理器41执行所述计算机可读指令时实现以下步骤:当接收到前端发送的伪造数据获取请求时,根据预设规范文件调用数据类型解析模块解析所述获取请求对应伪造数据的数据类型;根据所述预设规范文件调用与所述数据类型对应的伪造数据生成模块,所述预设规范文件定义有不同数据类型,以及所述不同数据类型分别对应的伪造数据生成模块;利用调用的伪造数据生成模块生成所述伪造数据。该计算机设备还包括:总线43,被配置为耦接处理器41及存储器42。Based on the foregoing embodiment of the method shown in FIG. 1 and the data forgery device shown in FIG. 3, an embodiment of the present application further provides a physical structure diagram of a computer device. As shown in FIG. 5, the computer device includes a processor 41. A memory 42, and computer-readable instructions stored on the memory 42 and executable on a processor, wherein the memory 42 and the processor 41 are both provided on a bus 43 when the processor 41 executes the computer-readable instructions Implement the following steps: when receiving a falsified data acquisition request sent by the front end, call a data type analysis module according to a preset specification file to parse the data type of the falsified data corresponding to the acquisition request; and call the data with the data according to the preset specification file Forged data generation module corresponding to the type, the preset specification file defines different data types and forged data generation modules corresponding to the different data types respectively; and the called forged data generation module is used to generate the forged data. The computer device further includes a bus 43 configured to be coupled to the processor 41 and the memory 42.
通过本申请的技术方案,在接收到前端发送的伪造数据获取请求时,能够根据预设规范文件调用数据类型解析模块解析所述获取请求对应伪造数据的数据类型。与此同时,能够根据所述预设规范文件调用与所述数据类型对应的伪造数据生成模块,所述预设规范文件定义有不同数据类型,以及所述不同数据类型分别对应的伪造数据生成模块,并能够利用调用的伪造数据生成模块生成所述伪造数据,从而能够实现虚假服务系统通过同一数据类型的伪造数据生成模块对同一数据类型的伪造数据进行统一处理,无需针对每个伪造数据进行单独处理,进而能够有效减少伪造数据的生成代码,减少生成代码冗余、提升生成代码的复用性以及可读性。According to the technical solution of the present application, upon receiving a falsified data acquisition request sent by the front end, a data type analysis module can be called according to a preset specification file to analyze the data type of the falsified data corresponding to the acquisition request. At the same time, a fake data generation module corresponding to the data type can be called according to the preset specification file, the preset specification file defines different data types, and the fake data generation modules corresponding to the different data types respectively And can use the called forged data generation module to generate the forged data, thereby enabling the fake service system to uniformly process the forged data of the same data type through the forged data generation module of the same data type, without the need for each forged data separately Processing can further effectively reduce the generated code of falsified data, reduce the redundancy of generated code, and improve the reusability and readability of generated code.
显然,本领域的技术人员应该明白,上述的本申请的各模块或各步骤可以用通用的计算装置来实现,它们可以集中在单个的计算装置上,或者分布在多个计算装置所组成的网络上,可选地,它们可以用计算装置可执行的计算机可读指令代码来实现,从而,可以将它们存储在存储装置中由计算装置来执行,并且在某些情况下,可以以不同于此处的顺序执行所示出或描述的步骤,或者将它们分别制作成各个集成电路模块,或者将它们中的多个模块或步骤制作成单个集成电路模块来实现。这样,本申请不限制于任何特定的硬件和软件结合。Obviously, those skilled in the art should understand that the above-mentioned modules or steps of the present application may be implemented by a general-purpose computing device, and they may be concentrated on a single computing device or distributed on a network composed of multiple computing devices. Above, optionally, they may be implemented with computer-readable instruction code executable by a computing device, so that they may be stored in a storage device and executed by the computing device, and in some cases, may be different from this. The steps shown or described are performed in sequence, either by making them into individual integrated circuit modules, or by making multiple modules or steps into a single integrated circuit module. As such, this application is not limited to any particular combination of hardware and software.
以上所述仅为本申请的优选实施例而已,并不用于限制本申请,对于本领域的技术人员来说,本申请可以有各种更改和变化。凡在本申请的精神和原则之内,所作的任何修改、等同替换、改进等,均应包括在本申请的保护范围之内。The above description is only a preferred embodiment of the present application, and is not intended to limit the present application. For those skilled in the art, the present application may have various modifications and changes. Any modification, equivalent replacement, or improvement made within the spirit and principle of this application shall be included in the protection scope of this application.

Claims (20)

  1. 一种数据伪造方法,其特征在于,应用于虚假服务系统,包括:A data forgery method, which is characterized in that it is applied to a fake service system and includes:
    当接收到前端发送的伪造数据获取请求时,根据预设规范文件调用数据类型解析模块解析所述获取请求对应伪造数据的数据类型;When receiving a falsified data acquisition request sent by the front end, calling a data type analysis module according to a preset specification file to analyze the data type of the falsified data corresponding to the acquisition request;
    根据所述预设规范文件调用与所述数据类型对应的伪造数据生成模块,所述预设规范文件定义有不同数据类型,以及所述不同数据类型分别对应的伪造数据生成模块;Calling a fake data generation module corresponding to the data type according to the preset specification file, the preset specification file defines different data types, and the fake data generation modules corresponding to the different data types, respectively;
    利用调用的伪造数据生成模块生成所述伪造数据。The forged data is generated by using the called forged data generation module.
  2. 根据权利要求1所述的方法,其特征在于,所述根据所述预设规范文件调用与所述数据类型对应的伪造数据生成模块,包括:The method according to claim 1, wherein the invoking a fake data generation module corresponding to the data type according to the preset specification file comprises:
    从所述预设规范文件中查找与所述数据类型对应的伪造数据生成模块标识,所述预设规范文件定义有不同数据类型,以及所述不同数据类型分别对应的伪造数据生成模块标识;Searching for a fake data generation module identifier corresponding to the data type from the preset specification file, the preset specification file defines different data types, and the fake data generation module identifiers corresponding to the different data types respectively;
    根据所述伪造数据生成模块标识调用与所述数据类型对应的伪造数据生成模块。Calling a forged data generation module corresponding to the data type according to the forged data generation module identification.
  3. 根据权利要求1所述的方法,其特征在于,所述根据所述预设规范文件调用与所述数据类型对应的伪造数据生成模块,包括:The method according to claim 1, wherein the invoking a fake data generation module corresponding to the data type according to the preset specification file comprises:
    提取所述获取请求携带的前端地址信息,并调用与所述前端地址信息对应的虚假服务接口;Extracting the front-end address information carried in the acquisition request, and calling a fake service interface corresponding to the front-end address information;
    利用所述虚假服务接口根据所述预设规范文件调用与所述数据类型对应的伪造数据生成模块,所述虚假服务接口为根据前端和后台预先约定的接口文档定义的。Use the fake service interface to call a fake data generation module corresponding to the data type according to the preset specification file. The fake service interface is defined according to an interface document agreed in advance by the front end and the background.
  4. 根据权利要求1所述的方法,其特征在于,所述根据预设规范文件调用数据类型解析模块解析所述获取请求对应伪造数据的数据类型,包括:The method according to claim 1, wherein the calling a data type analysis module according to a preset specification file to parse a data type of the falsified data corresponding to the acquisition request comprises:
    根据预设规范文件调用数据类型解析模块提取所述获取请求携带的数据结构中的数据类型;Calling a data type analysis module according to a preset specification file to extract a data type in a data structure carried by the acquisition request;
    将提取的数据类型确定为所述伪造数据的数据类型。The extracted data type is determined as the data type of the fake data.
  5. 根据权利要求1所述的方法,其特征在于,所述利用调用的伪造数据生成模块生成所述伪造数据,包括:The method according to claim 1, wherein the generating the forged data by using a called forged data generation module comprises:
    若所述数据类型为空字符类型,则利用空字符类型的伪造数据生成模块生成空字符伪造数据;或者If the data type is a null character type, a null character forged data generation module is used to generate the null character forged data; or
    若所述数据类型为布尔类型,则利用布尔类型的伪造数据生成模块生成真或假的伪造 数据;或者If the data type is a Boolean type, using a Boolean type forged data generating module to generate true or false forged data; or
    若所述数据类型为数字类型,则利用数字类型的伪造数据生成模块生成数字伪造数据;或者If the data type is a digital type, using a digital type forged data generating module to generate digital forged data; or
    若所述数据类型为字符串类型,则利用字符串类型的伪造数据生成模块生成字符串伪造数据;或者If the data type is a character string type, using a character string type forged data generating module to generate character string forged data; or
    若所述数据类型为数组类型,则利用数组类型的伪造数据生成模块调用对应的数据规范对象项目中定义的数据规范生成数组伪造数据;或者If the data type is an array type, using the array-type fake data generation module to call the data specification defined in the corresponding data specification object item to generate the array fake data; or
    若所述数据类型为对象类型,则利用对象类型的伪造数据生成模块,调调用对应的数据规范对象属性中定义的数据规范生成对象伪造数据。If the data type is an object type, the forged data generation module of the object type is used to invoke the data specification defined in the corresponding data specification object attribute to generate the object forged data.
  6. 根据权利要求1所述的方法,其特征在于,所述方法还包括:The method according to claim 1, further comprising:
    将所述不同数据类型,以及所述不同数据类型分别对应的伪造数据生成模块定义到所述预设规范文件中;Defining the different data types and the fake data generation modules corresponding to the different data types into the preset specification file;
    当接收到数据伪造扩展指令时,获取所述数据伪造扩展指令包含的新增的数据类型;When a data forgery extension instruction is received, acquiring a new data type included in the data forgery extension instruction;
    将所述新增的数据类型及其对应的伪造数据生成模块定义到所述预设规范文件中。The newly added data type and its corresponding forged data generation module are defined in the preset specification file.
  7. 根据权利要求1所述的方法,其特征在于,所述利用调用的伪造数据生成模块生成所述伪造数据之后,所述方法还包括:The method according to claim 1, wherein after generating the forged data by using the called forged data generation module, the method further comprises:
    将所述伪造数据发送给所述前端,使得所述前端利用所述伪造数据进行测试。Sending the forged data to the front end so that the front end uses the forged data for testing.
  8. 一种数据伪造装置,其特征在于,包括:A data forgery device, comprising:
    解析单元,用于当接收到前端发送的伪造数据获取请求时,根据预设规范文件调用数据类型解析模块解析所述获取请求对应伪造数据的数据类型;A parsing unit, configured to, when receiving a falsified data acquisition request sent by the front end, call a data type analysis module according to a preset specification file to parse a data type of the falsified data corresponding to the fetch request;
    调用单元,用于根据所述预设规范文件调用与所述数据类型对应的伪造数据生成模块,所述预设规范文件定义有不同数据类型,以及所述不同数据类型分别对应的伪造数据生成模块;An invoking unit for invoking a fake data generation module corresponding to the data type according to the preset specification file, the preset specification file defines different data types, and the fake data generation modules corresponding to the different data types respectively ;
    生成单元,用于利用调用的伪造数据生成模块生成所述伪造数据。A generating unit is configured to generate the forged data by using the called forged data generating module.
  9. 根据权利要求8所述的装置,其特征在于,所述调用单元,具体用于从所述预设规范文件中查找与所述数据类型对应的伪造数据生成模块标识,所述预设规范文件定义有不同数据类型,以及所述不同数据类型分别对应的伪造数据生成模块标识;根据所述伪造数据生成模块标识调用与所述数据类型对应的伪造数据生成模块。The device according to claim 8, wherein the calling unit is specifically configured to find a fake data generation module identifier corresponding to the data type from the preset specification file, and the preset specification file defines There are different data types, and identifiers of the fake data generation modules corresponding to the different data types respectively; and according to the identifiers of the fake data generation modules, a fake data generation module corresponding to the data type is called.
  10. 根据权利要求8所述的装置,其特征在于,所述调用单元,具体还用于提取所述获取请求携带的前端地址信息,并调用与所述前端地址信息对应的虚假服务接口;利用所 述虚假服务接口根据所述预设规范文件调用与所述数据类型对应的伪造数据生成模块,所述虚假服务接口为根据前端和后台预先约定的接口文档定义的。The device according to claim 8, wherein the calling unit is further configured to extract the front-end address information carried by the acquisition request, and call a fake service interface corresponding to the front-end address information; using the The fake service interface calls a fake data generation module corresponding to the data type according to the preset specification file, and the fake service interface is defined according to an interface document agreed in advance by the front end and the background.
  11. 根据权利要求8所述的装置,其特征在于,所述解析单元,具体用于据预设规范文件调用数据类型解析模块提取所述获取请求携带的数据结构中的数据类型;将提取的数据类型确定为所述伪造数据的数据类型。The apparatus according to claim 8, wherein the parsing unit is specifically configured to call a data type parsing module to extract a data type in a data structure carried by the acquisition request according to a preset specification file; and to extract the data type A data type of the fake data is determined.
  12. 根据权利要求8所述的装置,其特征在于,所述生成单元,具体用于若所述数据类型为空字符类型,则利用空字符类型的伪造数据生成模块生成空字符伪造数据;或者若所述数据类型为布尔类型,则利用布尔类型的伪造数据生成模块生成真或假的伪造数据;或者若所述数据类型为数字类型,则利用数字类型的伪造数据生成模块生成数字伪造数据;或者若所述数据类型为字符串类型,则利用字符串类型的伪造数据生成模块生成字符串伪造数据;或者若所述数据类型为数组类型,则利用数组类型的伪造数据生成模块调用对应的数据规范对象项目中定义的数据规范生成数组伪造数据;或者若所述数据类型为对象类型,则利用对象类型的伪造数据生成模块,调调用对应的数据规范对象属性中定义的数据规范生成对象伪造数据。The device according to claim 8, wherein the generating unit is specifically configured to generate a null character forged data by using a null character type forged data generation module if the data type is a null character type; or If the data type is a Boolean type, a boolean forged data generation module is used to generate true or false forged data; or if the data type is a digital type, a digital type forged data generation module is used to generate digital forged data; or if If the data type is a string type, then use the forged data generation module of the string type to generate string forged data; or if the data type is an array type, use the array type forged data generation module to call the corresponding data specification object The data specification defined in the project generates array falsified data; or if the data type is an object type, a fake data generation module of the object type is used to call the data specification defined in the corresponding data specification object attribute to generate the object fake data.
  13. 根据权利要求8所述的装置,其特征在于,所述装置还包括:The apparatus according to claim 8, further comprising:
    定义单元,用于将所述不同数据类型,以及所述不同数据类型分别对应的伪造数据生成模块定义到所述预设规范文件中;A definition unit, configured to define the different data types and the fake data generation modules corresponding to the different data types into the preset specification file;
    获取单元,用于当接收到数据伪造扩展指令时,获取所述数据伪造扩展指令包含的新增的数据类型;An obtaining unit, configured to obtain a new data type included in the data forgery extension instruction when the data forgery extension instruction is received;
    所述定义单元,还用于将所述新增的数据类型及其对应的伪造数据生成模块定义到所述预设规范文件中。The definition unit is further configured to define the newly added data type and its corresponding forged data generation module into the preset specification file.
  14. 根据权利要求8所述的装置,其特征在于,所述装置还包括:发送单元,用于将所述伪造数据发送给所述前端,使得所述前端利用所述伪造数据进行测试。The device according to claim 8, further comprising: a sending unit, configured to send the forged data to the front end, so that the front end uses the forged data for testing.
  15. 一种计算机非易失性可读存储介质,其上存储有计算机可读指令,其特征在于,所述计算机可读指令被处理器执行时实现数据伪造方法,包括:A computer non-volatile readable storage medium having computer readable instructions stored thereon, characterized in that when the computer readable instructions are executed by a processor, a data falsification method is implemented, including:
    当接收到前端发送的伪造数据获取请求时,根据预设规范文件调用数据类型解析模块解析所述获取请求对应伪造数据的数据类型;根据所述预设规范文件调用与所述数据类型对应的伪造数据生成模块,所述预设规范文件定义有不同数据类型,以及所述不同数据类型分别对应的伪造数据生成模块;利用调用的伪造数据生成模块生成所述伪造数据。When receiving a falsified data acquisition request sent by the front end, a data type analysis module is invoked to analyze the data type of the falsified data corresponding to the acquisition request according to a preset specification file; and a falsification corresponding to the data type is invoked according to the preset specification file. A data generation module, the preset specification file defines different data types, and fake data generation modules corresponding to the different data types respectively; and the called fake data generation module is used to generate the fake data.
  16. 根据权利要求15所述的计算机非易失性可读存储介质,其特征在于,所述计算 机可读指令被处理器执行时实现所述根据所述预设规范文件调用与所述数据类型对应的伪造数据生成模块,包括:The computer non-volatile readable storage medium according to claim 15, characterized in that, when the computer-readable instructions are executed by a processor, the calling according to the preset specification file corresponding to the data type is called. Fake data generation module, including:
    从所述预设规范文件中查找与所述数据类型对应的伪造数据生成模块标识,所述预设规范文件定义有不同数据类型,以及所述不同数据类型分别对应的伪造数据生成模块标识;根据所述伪造数据生成模块标识调用与所述数据类型对应的伪造数据生成模块。Searching for a fake data generation module identifier corresponding to the data type from the preset specification file, where the preset specification file defines different data types, and the fake data generation module identifiers corresponding to the different data types, respectively; The forged data generation module identifies calling a forged data generation module corresponding to the data type.
  17. 根据权利要求15所述的计算机非易失性可读存储介质,其特征在于,所述计算机可读指令被处理器执行时实现所述根据所述预设规范文件调用与所述数据类型对应的伪造数据生成模块,包括:The computer non-volatile readable storage medium according to claim 15, characterized in that, when the computer-readable instructions are executed by a processor, the calling according to the preset specification file corresponding to the data type is called. Fake data generation module, including:
    提取所述获取请求携带的前端地址信息,并调用与所述前端地址信息对应的虚假服务接口;利用所述虚假服务接口根据所述预设规范文件调用与所述数据类型对应的伪造数据生成模块,所述虚假服务接口为根据前端和后台预先约定的接口文档定义的。Extracting the front-end address information carried by the acquisition request, and calling a fake service interface corresponding to the front-end address information; using the fake service interface to call a fake data generation module corresponding to the data type according to the preset specification file The fake service interface is defined according to an interface document agreed in advance by the front end and the background.
  18. 一种计算机设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机可读指令,其特征在于,所述计算机可读指令被处理器执行时实现数据伪造方法,包括:A computer device includes a memory, a processor, and computer-readable instructions stored on the memory and executable on the processor, and is characterized in that when the computer-readable instructions are executed by the processor, a method of forging data is implemented, including:
    当接收到前端发送的伪造数据获取请求时,根据预设规范文件调用数据类型解析模块解析所述获取请求对应伪造数据的数据类型;根据所述预设规范文件调用与所述数据类型对应的伪造数据生成模块,所述预设规范文件定义有不同数据类型,以及所述不同数据类型分别对应的伪造数据生成模块;利用调用的伪造数据生成模块生成所述伪造数据。When receiving a falsified data acquisition request sent by the front end, a data type analysis module is invoked to analyze the data type of the falsified data corresponding to the acquisition request according to a preset specification file; and a falsification corresponding to the data type is invoked according to the preset specification file. A data generation module, the preset specification file defines different data types, and fake data generation modules corresponding to the different data types respectively; and the called fake data generation module is used to generate the fake data.
  19. 根据权利要求18所述的计算机设备,其特征在于,所述处理器执行所述计算机可读指令时实现所述根据所述预设规范文件调用与所述数据类型对应的伪造数据生成模块,包括:The computer device according to claim 18, wherein when the processor executes the computer-readable instructions, the processor is configured to call the fake data generation module corresponding to the data type according to the preset specification file, comprising: :
    从所述预设规范文件中查找与所述数据类型对应的伪造数据生成模块标识,所述预设规范文件定义有不同数据类型,以及所述不同数据类型分别对应的伪造数据生成模块标识;根据所述伪造数据生成模块标识调用与所述数据类型对应的伪造数据生成模块。Searching for a fake data generation module identifier corresponding to the data type from the preset specification file, where the preset specification file defines different data types, and the fake data generation module identifiers corresponding to the different data types, respectively; The forged data generation module identifies calling a forged data generation module corresponding to the data type.
  20. 根据权利要求18所述的计算机设备,其特征在于,所述处理器执行所述计算机可读指令时实现所述根据所述预设规范文件调用与所述数据类型对应的伪造数据生成模块,包括:The computer device according to claim 18, wherein when the processor executes the computer-readable instructions, the processor is configured to call the fake data generation module corresponding to the data type according to the preset specification file, comprising: :
    提取所述获取请求携带的前端地址信息,并调用与所述前端地址信息对应的虚假服务接口;利用所述虚假服务接口根据所述预设规范文件调用与所述数据类型对应的伪造数据生成模块,所述虚假服务接口为根据前端和后台预先约定的接口文档定义的。Extracting the front-end address information carried by the acquisition request, and calling a fake service interface corresponding to the front-end address information; using the fake service interface to call a fake data generation module corresponding to the data type according to the preset specification file The fake service interface is defined according to an interface document agreed in advance by the front end and the background.
PCT/CN2018/111112 2018-07-05 2018-10-20 Data forgery method and apparatus, and computer storage medium WO2020006930A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201810732151.4A CN109086145B (en) 2018-07-05 2018-07-05 Data generation method and device and computer storage medium
CN201810732151.4 2018-07-05

Publications (1)

Publication Number Publication Date
WO2020006930A1 true WO2020006930A1 (en) 2020-01-09

Family

ID=64836982

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/111112 WO2020006930A1 (en) 2018-07-05 2018-10-20 Data forgery method and apparatus, and computer storage medium

Country Status (2)

Country Link
CN (1) CN109086145B (en)
WO (1) WO2020006930A1 (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111399819B (en) * 2020-03-18 2024-04-30 北京达佳互联信息技术有限公司 Data generation method, device, electronic equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103631783A (en) * 2012-08-21 2014-03-12 百度在线网络技术(北京)有限公司 Method and system for generating front end page
CN104615667A (en) * 2015-01-13 2015-05-13 联动优势电子商务有限公司 Basic data generation method and device and test data generation method and device
CN106776324A (en) * 2016-12-19 2017-05-31 广州酷狗计算机科技有限公司 Interface test method and device
CN106919509A (en) * 2017-03-09 2017-07-04 腾讯科技(深圳)有限公司 A kind of client generation method, device and electronic equipment
US20180011780A1 (en) * 2016-07-08 2018-01-11 Accenture Global Solutions Limited Web application test script generation to test software functionality

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107608708B (en) * 2017-08-20 2020-05-01 杭州安恒信息技术股份有限公司 Interface data counterfeiting method

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103631783A (en) * 2012-08-21 2014-03-12 百度在线网络技术(北京)有限公司 Method and system for generating front end page
CN104615667A (en) * 2015-01-13 2015-05-13 联动优势电子商务有限公司 Basic data generation method and device and test data generation method and device
US20180011780A1 (en) * 2016-07-08 2018-01-11 Accenture Global Solutions Limited Web application test script generation to test software functionality
CN106776324A (en) * 2016-12-19 2017-05-31 广州酷狗计算机科技有限公司 Interface test method and device
CN106919509A (en) * 2017-03-09 2017-07-04 腾讯科技(深圳)有限公司 A kind of client generation method, device and electronic equipment

Also Published As

Publication number Publication date
CN109086145B (en) 2023-04-07
CN109086145A (en) 2018-12-25

Similar Documents

Publication Publication Date Title
WO2020006929A1 (en) Data check method and device, and computer storage medium
CN107861713B (en) Data calling method and device and computer readable storage medium
WO2019085079A1 (en) Interface test method and apparatus, computer device and storage medium
US11537606B2 (en) Solution for implementing computing service based on structured query language statement
WO2019019361A1 (en) Method and apparatus for processing data of database, computer device, and storage medium
WO2019154353A1 (en) System running parameter query method, matching method and apparatus, and node device
CN108846753B (en) Method and apparatus for processing data
WO2019019645A1 (en) Method and apparatus for executing information pushing task, and computer device and storage medium
CN108667840B (en) Injection vulnerability detection method and device
WO2017059717A1 (en) Identification method and system for user information in social network
US10452730B2 (en) Methods for analyzing web sites using web services and devices thereof
WO2021217846A1 (en) Interface data processing method and apparatus, and computer device and storage medium
JP2010501914A (en) Email form engine for mobile devices
CN110659206A (en) Simulation architecture establishing method, device, medium and electronic equipment based on microservice
WO2021249356A1 (en) Form data verification method, system, server, and user terminal
CN111144402A (en) OCR recognition accuracy calculation method, device, equipment and storage medium
WO2022267769A1 (en) Method and apparatus for generating graph data
WO2020006930A1 (en) Data forgery method and apparatus, and computer storage medium
CN112732547B (en) Service testing method and device, storage medium and electronic equipment
WO2017008654A1 (en) Deserialization method and apparatus
CN115934537A (en) Interface test tool generation method, device, equipment, medium and product
WO2022127005A1 (en) Application intention response method and apparatus, device, storage medium and program product
US10671505B2 (en) System and method for monitoring service
CN114338094B (en) Method and device for acquiring request header information, electronic equipment and readable medium
CN109558326B (en) Test method and device

Legal Events

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

Ref document number: 18925107

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18925107

Country of ref document: EP

Kind code of ref document: A1