CN109086145B - Data generation method and device and computer storage medium - Google Patents

Data generation method and device and computer storage medium Download PDF

Info

Publication number
CN109086145B
CN109086145B CN201810732151.4A CN201810732151A CN109086145B CN 109086145 B CN109086145 B CN 109086145B CN 201810732151 A CN201810732151 A CN 201810732151A CN 109086145 B CN109086145 B CN 109086145B
Authority
CN
China
Prior art keywords
data
forged
type
generation module
data generation
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201810732151.4A
Other languages
Chinese (zh)
Other versions
CN109086145A (en
Inventor
彭明强
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen 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 Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN201810732151.4A priority Critical patent/CN109086145B/en
Priority to PCT/CN2018/111112 priority patent/WO2020006930A1/en
Publication of CN109086145A publication Critical patent/CN109086145A/en
Application granted granted Critical
Publication of CN109086145B publication Critical patent/CN109086145B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

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

Abstract

The invention discloses a data counterfeiting method, a data counterfeiting device and a computer storage medium, relates to the technical field of information, and mainly aims to effectively reduce generation codes of forged data, reduce generation code redundancy and improve reusability and readability of the generated codes. The method comprises the following steps: when a forged data acquisition request sent by a front end is received, calling a data type analysis module according to a preset standard file to analyze the data type of forged data corresponding to the acquisition request; calling a forged data generation module corresponding to the data type according to the preset specification file, wherein different data types are defined in the preset specification file, and the forged data generation modules respectively corresponding to the different data types are defined in the preset specification file; and generating the fake data by utilizing the called fake data generation module. The invention is suitable for data forgery.

Description

Data generation method and device and computer storage medium
Technical Field
The present invention relates to the field of information technologies, and in particular, to a data falsification method and apparatus, and a computer storage medium.
Background
With the continuous development of information technology, the front end and the background of an application system are usually developed in a separated mode, so that in order to avoid the situation that the front end waits for the background to complete the development of a real interface and then performs an integration test, the coupling between the front end and the background is reduced, and a false service system appears, the false service system can forge data and feed the data back to the front end according to a false development interface of a predetermined interface document, so that the front end can firstly process page display by utilizing the produced forged data, and does not need to wait for the background interface to complete the development of accurate data to feed back to perform page display processing and then perform the integration test.
At present, when a false service system performs data falsification, a series of generation operations are required to be performed on each forged data acquisition request at the front end, and corresponding generation codes are written to generate the requested forged data. However, the generation of the counterfeit data in the above manner results in more generated codes of the counterfeit data, which results in expanded codes, poor reusability, and low readability.
Disclosure of Invention
The invention provides a data counterfeiting method, a data counterfeiting device and a computer storage medium, which mainly aim to effectively reduce the generation codes of the forged data, reduce the redundancy of the generation codes and improve the reusability and readability of the generation codes.
According to a first aspect of the present invention, there is provided a data falsification method applied to a false service system, including:
when a forged data acquisition request sent by a front end is received, calling a data type analysis module according to a preset standard file to analyze the data type of forged data corresponding to the acquisition request;
calling a forged data generation module corresponding to the data type according to the preset specification file, wherein different data types are defined in the preset specification file, and the forged data generation modules respectively corresponding to the different data types are called;
and generating the fake data by utilizing the called fake data generation module.
According to a second aspect of the present invention, there is provided a data falsification apparatus including:
the analysis unit is used for calling a data type analysis module to analyze the data type of the forged data corresponding to the acquisition request according to a preset standard file when the forged data acquisition request sent by the front end is received;
the calling unit is used for calling the forged data generating modules corresponding to the data types according to the preset specification file, the preset specification file defines different data types, and the forged data generating modules corresponding to the different data types respectively;
a generation unit configured to generate the falsification data using the called falsification data generation module.
According to a third aspect of the present invention, there is provided a computer-readable storage medium, having stored thereon a computer program which, when executed by a processor, performs the steps of:
when a forged data acquisition request sent by a front end is received, calling a data type analysis module to analyze the data type of forged data corresponding to the acquisition request according to a preset standard file;
calling a forged data generation module corresponding to the data type according to the preset specification file, wherein different data types are defined in the preset specification file, and the forged data generation modules respectively corresponding to the different data types are defined in the preset specification file;
and generating the fake data by utilizing the called fake data generation module.
According to a fourth aspect of the present invention, there is provided a computer device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, the processor implementing the following steps when executing the program:
when a forged data acquisition request sent by a front end is received, calling a data type analysis module according to a preset standard file to analyze the data type of forged data corresponding to the acquisition request;
calling a forged data generation module corresponding to the data type according to the preset specification file, wherein different data types are defined in the preset specification file, and the forged data generation modules respectively corresponding to the different data types are defined in the preset specification file;
and generating the fake data by utilizing the called fake data generation module.
Compared with the prior art that a series of generating operations are required to be performed on each forged data acquisition request of the front end and the corresponding generated code is written, the data type analysis module can be called to analyze the data type of the forged data corresponding to the acquisition request according to the preset specification file when the forged data acquisition request sent by the front end is received. Meanwhile, the forged data generation modules corresponding to the data types can be called according to the preset specification file, different data types and forged data generation modules corresponding to the different data types are defined in the preset specification file, the called forged data generation modules can be used for generating the forged data, and therefore the fake service system can uniformly process the forged data of the same data type through the forged data generation modules of the same data type without independently processing each forged data, the generated codes of the forged data can be effectively reduced, the generated code redundancy is reduced, and the reusability and readability of the generated codes are improved.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this application, illustrate embodiment(s) of the invention and together with the description serve to explain the invention without limiting the invention. In the drawings:
FIG. 1 is a flow chart of a data falsification method according to an embodiment of the present invention;
FIG. 2 is a flow chart of another data falsification method provided by an embodiment of the present invention;
fig. 3 is a schematic structural diagram illustrating a data falsification apparatus according to an embodiment of the present invention;
FIG. 4 is a schematic structural diagram of another data falsification apparatus according to an embodiment of the present invention;
fig. 5 shows a schematic physical structure diagram of a computer device according to an embodiment of the present invention.
Detailed Description
The invention will be described in detail hereinafter with reference to the accompanying drawings in conjunction with embodiments. It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict.
As background art, currently, when a fake service system performs data falsification, a series of generation operations are required to be performed on each fake data acquisition request at the front end, and a corresponding generation code is written to generate the requested fake data. However, the generation of the counterfeit data in the above manner results in more generated codes of the counterfeit data, which results in expanded codes, poor reusability, and low readability.
In order to solve the above problem, an embodiment of the present invention provides a data falsification method, which is applied to a fake service system, as shown in fig. 1, and the method includes:
101. when a forged data acquisition request sent by a front end is received, a data type analysis module is called according to a preset standard file to analyze the data type of forged data corresponding to the acquisition request.
The preset specification file can be a JSON schema specification file, the JSON schema is a specification for defining a JSON data structure based on a JSON format, the JSON schema specification file is a document which is easy to understand and is readable by human and machines, and a JSON schema front-end developer can know a data object structure returned by a background interface so as to develop own page display. The preset specification file may define a data type parsing module, specifically, the data type parsing module may be predefined in the preset specification file for a technician to develop, and the data types supported by the data type parsing module may be enumerable, and may store 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 counterfeit 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 from the acquisition request by the data type analysis module is an object type, it may be determined that the data type of the forged data requested by the front end is the object type.
It should be noted that, when the user triggers an operation button or a key of the program display page at the front end, the false service system can receive the forged data acquisition request, the front end can acquire the current mode information in the configuration file, and if the current mode information is the false mode, the forged data acquisition request can be generated.
102. And calling a forged data generation module corresponding to the data type according to the preset standard file.
The preset specification file defines different data types and the forged data generation modules corresponding to the different data types respectively. Specifically, the preset specification file may define an empty character type and a corresponding forged data generation module thereof, a boolean type and a corresponding forged data generation module thereof, a number type and a corresponding forged data generation module thereof, a character string type and a corresponding forged data generation module thereof, an array type and a corresponding forged data generation module thereof, an object type and a corresponding forged data generation module thereof, or other customized data types and corresponding forged data generation modules thereof.
For example, if the data type of the forged data requested by the front end is analyzed to be the null character type, the forged data generation module of the null character type may be called according to the preset specification file to generate a null character as the forged data. If the data type of the analyzed forged data requested by the front end is a Boolean type, the Boolean type forged data generation module can be called according to the preset specification file, and true or false is randomly generated to serve as forged data. If the data type of the analyzed forged data requested by the front end is the digital type, the forged data generation module of the digital type can be called according to the preset specification file, and a number is randomly generated to serve as the forged data. If the data type of the analyzed forged data requested by the front end is the character string type, the forged data generation module of the character string type can be called according to the preset specification file, and a character string is randomly generated to serve as the forged data. If the data type of the analyzed forged data requested by the front end is an array type, the forged data generation module of the array type can be called according to the preset specification file to generate an array as forged data. If the data type of the forged data requested by the front end is analyzed to be the object type, the forged data generation module of the object type can be called according to the preset specification file to generate an object as forged data.
103. And generating the fake data by utilizing the called fake data generation module.
Compared with the prior art that a series of generating operations are required to be performed on each forged data acquisition request of the front end and the corresponding generated code is written, the data forging method provided by the embodiment of the invention can call the data type analysis module to analyze the data type of the forged data corresponding to the acquisition request according to the preset specification file when the forged data acquisition request sent by the front end is received. Meanwhile, the forged data generation modules corresponding to the data types can be called according to the preset specification file, different data types and forged data generation modules corresponding to the different data types are defined in the preset specification file, the called forged data generation modules can be used for generating the forged data, and therefore the fake service system can uniformly process the forged data of the same data type through the forged data generation modules of the same data type without independently processing each forged data, the generated codes of the forged data can be effectively reduced, the generated code redundancy is reduced, and the reusability and readability of the generated codes are improved.
Further, in order to better explain the above data falsification process, as a refinement and extension of the above embodiment, another data falsification method is provided in an embodiment of the present invention, as shown in fig. 2, where the method includes:
201. when a forged data acquisition request sent by a front end is received, a data type analysis module is called according to a preset standard file to analyze the data type of forged data corresponding to the acquisition request.
For the embodiment of the present invention, the step of calling a data type analysis module to analyze the data type of the forged data corresponding to the acquisition request according to the preset specification file may specifically include: calling a data type analysis module according to a preset standard file to extract the data type in the data structure carried by the acquisition request; determining the extracted data type as the data type of the counterfeit data. Specifically, the data type parsing module may extract a key-value pair in the data structure, where a key of the key-value pair is "type", and a value of the key-value pair may be the extracted data type.
For example, if the data structure includes key-value pairs: "type": "object", the data type parsing module may extract the value "object" of the key-value pair, and determine "object" as the data type of the forged data, where the forged data type may be an object type; if the data structure includes key-value pairs: "type": and "string", the data type analysis module may extract the value "string" of the key-value pair, and determine "string" as the data type of the forged data, where the forged data type may be a character string type.
202. And searching a forged data generation module identifier corresponding to the data type from the preset specification file.
203. The preset specification file defines different data types, and the different data types respectively correspond to the forged data generation module identifications. The different data types and the forged data generation module identifications respectively corresponding to the different data types may be predefined in the specification file. The forged data generation modules respectively corresponding to the different data types may be developed in advance by a technician, and specifically, may be developed by writing a generation code corresponding to a series of generation operations of data. The counterfeit data generation module identifier may be a name of the counterfeit data generation module, and for example, the boolean counterfeit data generation module identifier may be: the Boolean type defined by the preset specification file and the corresponding mode of the forged data generation module may be:
“Type”:Boolean;“Generatingmodule”:Boolean-Generating module。
203. and calling a forged data generation module corresponding to the data type according to the forged data generation module identification.
For the embodiment of the present invention, in order to invoke 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 false service interface corresponding to the front-end address information; and calling a forged data generation module corresponding to the data type according to the preset specification file by using the false service interface, wherein the false service interface is defined according to an interface document agreed in advance by a front end and a 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 search, from the preset specification file, a fake data generation module identifier corresponding to the data type, 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.
204. And generating the fake data by utilizing the called fake data generation module.
For the embodiment of the present invention, the step 204 may specifically include:
1. and if the data type is a null character type, generating null character forged data by using a null character type forged data generation module. For example, if the data type is a null character type, the generated counterfeit data may be "null" or "null".
2. And if the data type is a Boolean type, generating true or false forged data by using a Boolean type forged data generation module. For example, if the data type is a boolean type, the generated counterfeit data may be "true", "false", "true", or "false".
3. And if the data type is the digital type, generating digital forged data by using a digital forged data generation module. For example, if the data type is a number type, the generated counterfeit data may be "1" or "2" or the like.
4. And if the data type is the character string type, generating character string fake data by using a character string type fake data generation module. For example, if the data type is a string type, the generated falsification data may be "randomtrigng", "randdstring", or the like.
5. If the data type is the array type, calling the data specification defined in the corresponding data specification object item by using the forged data generation module of the array type to generate array forged data. Specifically, the data specification object item may be "items": {
“item1”:{
“type”:“number”
},
“item2”:{
“type”:“number”
}
The data specification objects can be 'item 1' and 'item 2', and 'item 1' and 'item 2' can call a numeric type of fake data generation module to randomly generate '1' and '2'. Therefore, if the data type is a numeric type, the generated falsification data may be "1,2" or the like.
6. If the data type is the object type, a forged data generation module of the object type is utilized to call the data specification defined in the corresponding data specification object attribute to generate object forged data. Specifically, the data specification object property may be "properties": {
“status”:{
“type”:“string”
}
“complete”:{
“type”:“boolean”
}
The data specification object may be "status" and "complete", the "status" part may call a character string type falsification data generation module, the "random generation" and the "complete" part may call a boolean type falsification data generation module, and generate "true", and therefore, if the data type is an object type, the generated falsification data may be { "status": "randomgstring", "complete": true } and the like.
For the embodiment of the present invention, in order to complete the development of the application system as soon as possible, avoid deploying a real test environment, perform an integrated test after the background interface is completed, and save labor cost and time cost, after step 204, the method may further include: and sending the fake data to the front end, so that the front end tests by using the fake data.
205. And when a data forgery and expansion instruction is received, acquiring the newly added data type contained in the data forgery and expansion instruction.
206. And defining the newly added data type and the corresponding forged data generation module into the preset specification file.
In the actual use process, if some user-defined data types exist and technicians develop the forged data generation module of the user-defined data types, the front end may send a data forged expansion instruction containing a newly added data type to the false service system, for example, the newly added data type may be: a phone number data type. The false service system can define the telephone number data type and the corresponding forged data generation module into a preset specification file. For example, after the type of the phone number data is expanded, the following contents may be added to the preset specification file:
{
“type”:“phoneNumber”;
“Generating module”:“phoneNumber-Generating module”
}
in addition, the data type analyzing module can also add a telephone number data type, so that when a forged data acquisition request is received, whether the data type of the forged data is the telephone number data type or not can be analyzed. If the data type of the parsed counterfeit data is the phone number data type, the generated counterfeit data may be "13888888888". Similarly, other custom data types extend into the fake services system in the same manner.
Compared with the prior art that a series of generation operations are required to be performed on each forged data acquisition request at the front end and a corresponding generation code is written, the data type analysis module can be called to analyze the data type of the forged data corresponding to the acquisition request according to the preset specification file when the forged data acquisition request sent by the front end is received. Meanwhile, the forged data generation modules corresponding to the data types can be called according to the preset specification file, different data types and forged data generation modules corresponding to the different data types are defined in the preset specification file, the called forged data generation modules can be used for generating the forged data, and therefore the fake service system can uniformly process the forged data of the same data type through the forged data generation modules of the same data type without independently processing each forged data, the generated codes of the forged data can be effectively reduced, the generated code redundancy is reduced, and the reusability and readability of the generated codes are improved.
Further, as a specific implementation of fig. 1, an embodiment of the present invention provides a data falsification apparatus, as shown in fig. 3, where the apparatus includes: a parsing unit 31, a calling unit 32 and a generating unit 33, which may be part of a fake service system.
The parsing unit 31 may be configured to, when receiving an obtaining request of counterfeit data sent by a front end, invoke a data type parsing module to parse a data type of the counterfeit data corresponding to the obtaining request according to a preset specification file. The parsing unit 31 is a main function module that, when receiving a forged data acquisition request sent by a front end, calls a data type parsing module to parse a data type of forged data corresponding to the acquisition request according to a preset specification file in the device.
The calling unit 32 may be configured to call, according to the preset specification file, the forged data generation modules corresponding to the data types, where the preset specification file defines different data types, and the forged data generation modules respectively corresponding to the different data types; the calling unit 32 is a main functional module of the device that calls a forged data generation module corresponding to the data type according to the preset specification file, and is also a core module.
The generating unit 33 may be configured to generate the falsification data by using the called falsification data generation module. The generation unit 33 is a main functional block that generates the falsification data by using a called falsification data generation block in the present apparatus.
For the embodiment of the present invention, in order to call the forged data generation module corresponding to the data type, the calling unit 32 may be specifically configured to search a forged 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 forged data generation module identifiers corresponding to the different data types, respectively; and calling a forged data generation module corresponding to the data type according to the forged data generation module identifier.
In addition, the calling unit 32 may be specifically configured to extract front-end address information carried by the acquisition request, and call a false service interface corresponding to the front-end address information; and calling a forged data generation module corresponding to the data type according to the preset specification file by using the false service interface, wherein the false service interface is defined according to an interface document agreed in advance by a front end and a background.
For the embodiment of the present invention, in order to analyze the data type of the forged data corresponding to the acquisition request, the analyzing unit 31 may be specifically configured to invoke a data type analyzing module to extract the data type in the data structure carried by the acquisition request according to a preset specification file; and determining the extracted data type as the data type of the forged data.
In a specific application scenario, the generating unit 33 may be specifically configured to generate dummy character forged data by using a dummy character type forged data generating module if the data type is a dummy character type; or if the data type is a Boolean type, generating true or false forged data by using a Boolean type forged data generation module; or if the data type is the digital type, generating digital forged data by using a digital forged data generation module; or if the data type is a character string type, generating character string forged data by using a character string type forged data generation module; or if the data type is the array type, calling the data specification defined in the corresponding data specification object item by using a forged data generation module of the array type to generate array forged data; or if the data type is the object type, calling the data specification defined in the corresponding data specification object attribute by using a forged data generation module of the object type to generate object forged data.
The embodiment of the invention can also support the functions of predefining the preset specification file and expanding the forged data type, and the device also comprises: a defining unit 34 and an obtaining unit 35, as shown in fig. 4.
The defining unit 34 may be configured to define the different data types and the forged data generation modules respectively corresponding to the different data types into the preset specification file. The defining unit 34 is a main functional module that defines the different data types and the forged data generation modules respectively corresponding to the different data types in the preset specification file.
The obtaining unit 35 may be configured to obtain, when a data forgery expansion instruction is received, a new data type included in the data forgery expansion instruction. The acquiring unit 35 is a main function module in the present apparatus, which acquires a newly added data type included in a data forgery expansion instruction when the data forgery expansion instruction is received.
The defining unit 34 may be further configured to define the newly added data type and the forged data generating module corresponding to the newly added data type into the preset specification file. The defining unit 34 is a main function module that defines the newly added data type and the corresponding forged data generation module into the preset specification file in the present device.
For the embodiment of the present invention, in order to complete the development of the application system as soon as possible, avoid deploying a real test environment, perform an integrated test after the background interface is completed, and save the labor cost and the time cost, the apparatus may further include: and a transmitting unit 36.
The sending unit 36 may be configured to send the fake data to the front end, so that the front end performs a test using the fake data. The transmission unit 36 is a device that transmits the falsification data to the front end so that the front end performs a test using the falsification data.
It should be noted that other corresponding descriptions of the functional modules involved in the data falsification apparatus provided in the embodiment of the present invention may refer to the corresponding description of the method shown in fig. 1, and are not described herein again.
Based on the method shown in fig. 1, correspondingly, an embodiment of the present invention further provides a computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the following steps: when a forged data acquisition request sent by a front end is received, calling a data type analysis module according to a preset standard file to analyze the data type of forged data corresponding to the acquisition request; calling a forged data generation module corresponding to the data type according to the preset specification file, wherein different data types are defined in the preset specification file, and the forged data generation modules respectively corresponding to the different data types are called; and generating the fake data by utilizing the called fake data generation module.
Based on the above embodiments of the method shown in fig. 1 and the data falsification apparatus shown in fig. 3, an embodiment of the present invention further provides an entity structure diagram of a computer device, as shown in fig. 5, where the computer device includes: a processor 41, a memory 42, and a computer program stored on the memory 42 and executable on the processor, wherein the memory 42 and the processor 41 are each arranged on a bus 43 and the processor 41 implements the following steps when executing the program: when a forged data acquisition request sent by a front end is received, calling a data type analysis module according to a preset standard file to analyze the data type of forged data corresponding to the acquisition request; calling a forged data generation module corresponding to the data type according to the preset specification file, wherein different data types are defined in the preset specification file, and the forged data generation modules respectively corresponding to the different data types are defined in the preset specification file; and generating the fake data by utilizing the called fake data generation module. The computer device further includes: a bus 43 configured to couple the processor 41 and the memory 42.
According to the technical scheme, when a forged data acquisition request sent by a front end is received, a data type analysis module can be called according to a preset standard file to analyze the data type of forged data corresponding to the acquisition request. Meanwhile, the forged data generation modules corresponding to the data types can be called according to the preset specification file, different data types and forged data generation modules corresponding to the different data types are defined in the preset specification file, the called forged data generation modules can be used for generating the forged data, and therefore the fake service system can uniformly process the forged data of the same data type through the forged data generation modules of the same data type without independently processing each forged data, the generated codes of the forged data can be effectively reduced, the generated code redundancy is reduced, and the reusability and readability of the generated codes are improved.
It will be apparent to those skilled in the art that the modules or steps of the present invention described above may be implemented by a general purpose computing device, they may be centralized on a single computing device or distributed across a network of multiple computing devices, and alternatively, they may be implemented by program code executable by a computing device, such that they may be stored in a storage device and executed by a computing device, and in some cases, the steps shown or described may be performed in an order different than that described herein, or they may be separately fabricated into individual integrated circuit modules, or multiple ones of them may be fabricated into a single integrated circuit module. Thus, the present invention is not limited to any specific combination of hardware and software.
The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention, and various modifications and changes may be made by those skilled in the art. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (9)

1. A data forging method is applied to a false service system, the false service system is used for generating forged data according to a false development interface of a pre-agreed interface document and feeding back the forged data to a front end, so that the front end processes page display by using the forged data to avoid the front end from waiting for a background to finish real interface development and then performing integration test, and the coupling between the front end and the background is reduced, and the method comprises the following steps:
when a forged data acquisition request sent by a front end is received, calling a data type analysis module to analyze the data type of forged data corresponding to the acquisition request according to a preset standard file;
calling a forged data generation module corresponding to the data type according to the preset specification file, wherein different data types are defined in the preset specification file, and the forged data generation modules respectively corresponding to the different data types are used for uniformly generating forged data of the same data type;
generating the counterfeit data by using the called counterfeit data generation module;
the calling of the forged data generation module corresponding to the data type according to the preset specification file comprises the following steps:
searching for a forged data generation module identifier corresponding to the data type from the preset specification file, wherein different data types are defined in the preset specification file, and the forged data generation module identifiers respectively corresponding to the different data types are defined in the preset specification file;
and calling a forged data generation module corresponding to the data type according to the forged data generation module identification.
2. The method according to claim 1, wherein said calling a forged data generation module corresponding to the data type according to the preset specification file comprises:
extracting front-end address information carried by the acquisition request, and calling a false service interface corresponding to the front-end address information;
and calling a forged data generation module corresponding to the data type according to the preset specification file by using the false service interface, wherein the false service interface is defined according to an interface document agreed in advance by a front end and a background.
3. The method according to claim 1, wherein said invoking a data type parsing module to parse the data type of the forged data corresponding to the obtaining request according to a preset specification file comprises:
calling a data type analysis module according to a preset standard file to extract the data type in the data structure carried by the acquisition request;
determining the extracted data type as the data type of the counterfeit data.
4. The method of claim 1, wherein generating the spurious data using the invoked spurious data generation module comprises:
if the data type is a null character type, generating null character forged data by using a null character type forged data generation module; or alternatively
If the data type is a Boolean type, generating true or false forged data by using a Boolean type forged data generation module; or
If the data type is a digital type, generating digital counterfeit data by using a digital type counterfeit data generation module; or
If the data type is a character string type, generating character string forged data by using a character string type forged data generation module; or
If the data type is the array type, calling the data specification defined in the corresponding data specification object item by using a forged data generation module of the array type to generate array forged data; or
If the data type is the object type, the object type forged data generation module is utilized to call the data specification defined in the corresponding data specification object attribute to generate object forged data.
5. The method of claim 1, further comprising:
defining the different data types and the forged data generation modules respectively corresponding to the different data types into the preset specification file;
when a data forgery and expansion instruction is received, acquiring a newly added data type contained in the data forgery and expansion instruction;
and defining the newly added data type and the corresponding forged data generation module into the preset specification file.
6. The method of claim 1, wherein after the generating the spurious data with the invoked spurious data generation module, the method further comprises:
and sending the fake data to the front end, so that the front end performs testing by using the fake data.
7. A data forging device is characterized in that the device is applied to a false service system, the false service system is used for generating forged data according to a false development interface of a pre-agreed interface document and feeding back the forged data to a front end, so that the front end processes page display by utilizing the forged data to avoid the front end from waiting for a background to finish real interface development and then performing integration test, and the coupling between the front end and the background is reduced, and the device comprises:
the analysis unit is used for calling a data type analysis module to analyze the data type of the forged data corresponding to the acquisition request according to a preset standard file when the forged data acquisition request sent by the front end is received;
the calling unit is used for calling a forged data generation module corresponding to the data type according to the preset specification file, different data types are defined in the preset specification file, and the forged data generation modules respectively corresponding to the different data types are used for uniformly generating forged data of the same data type;
a generation unit configured to generate the falsification data using the called falsification data generation module;
the calling unit is specifically configured to search, from the preset specification file, a forged data generation module identifier corresponding to the data type, where different data types are defined in the preset specification file, and forged data generation module identifiers corresponding to the different data types, respectively; and calling a forged data generation module corresponding to the data type according to the forged data generation module identification.
8. 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.
9. A computer arrangement comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the computer program realizes the steps of the method of any one of claims 1 to 6 when executed by the processor.
CN201810732151.4A 2018-07-05 2018-07-05 Data generation method and device and computer storage medium Active CN109086145B (en)

Priority Applications (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
PCT/CN2018/111112 WO2020006930A1 (en) 2018-07-05 2018-10-20 Data forgery method and apparatus, and computer storage medium

Applications Claiming Priority (1)

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

Publications (2)

Publication Number Publication Date
CN109086145A CN109086145A (en) 2018-12-25
CN109086145B true CN109086145B (en) 2023-04-07

Family

ID=64836982

Family Applications (1)

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

Country Status (2)

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

Citations (2)

* 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
CN107608708A (en) * 2017-08-20 2018-01-19 杭州安恒信息技术有限公司 A kind of interface data forges method

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104615667B (en) * 2015-01-13 2018-01-19 联动优势电子商务有限公司 A kind of basic data generation method, test data creation method and its device
US10108535B2 (en) * 2016-07-08 2018-10-23 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
CN106919509B (en) * 2017-03-09 2020-11-24 腾讯科技(深圳)有限公司 Client generation method and device and electronic equipment

Patent Citations (2)

* 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
CN107608708A (en) * 2017-08-20 2018-01-19 杭州安恒信息技术有限公司 A kind of interface data forges method

Also Published As

Publication number Publication date
WO2020006930A1 (en) 2020-01-09
CN109086145A (en) 2018-12-25

Similar Documents

Publication Publication Date Title
CN107844421B (en) Interface testing method and device, computer equipment and storage medium
RU2648966C2 (en) Apparatus and method for processing multiple open api
CN107784552B (en) Information push task execution method and device, computer equipment and storage medium
CN108846753B (en) Method and apparatus for processing data
CN110716783A (en) Front-end page generation and deployment method and device, storage medium and equipment
WO2020006929A1 (en) Data check method and device, and computer storage medium
EP3185145A1 (en) Methods for analyzing web sites using web services and devices thereof
CN110659206A (en) Simulation architecture establishing method, device, medium and electronic equipment based on microservice
CN110597896A (en) Data display method, data display device and terminal equipment
CN110019444B (en) Operation request processing method, device, equipment and system
CN106201865A (en) A kind of application programming interface API method of testing, device and terminal unit
CN109086145B (en) Data generation method and device and computer storage medium
CN113691618B (en) Message notification method, device, message center and storage medium
CN109299948A (en) A kind of red packet sending method, device, wearable device and storage medium
CN111488286B (en) Method and device for independently developing Android modules
CN112732547B (en) Service testing method and device, storage medium and electronic equipment
CN107643978A (en) The method and apparatus of function of application test
CN113051178A (en) Test data construction method, device, equipment and medium
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
CN113821441B (en) Execution method, device, equipment and storage medium based on document test case
CN108845803B (en) Method, device and equipment for updating list view and storage medium
CN115033410A (en) Abnormal link tracking method, system, gateway and storage medium
CN106649388A (en) Information retrieval method and apparatus

Legal Events

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