CN111399819A - Data generation method and device, electronic equipment and storage medium - Google Patents

Data generation method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN111399819A
CN111399819A CN202010191648.7A CN202010191648A CN111399819A CN 111399819 A CN111399819 A CN 111399819A CN 202010191648 A CN202010191648 A CN 202010191648A CN 111399819 A CN111399819 A CN 111399819A
Authority
CN
China
Prior art keywords
data
type
description information
target
generating
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202010191648.7A
Other languages
Chinese (zh)
Inventor
尹家露
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Reach Best Technology Co Ltd
Beijing Dajia Internet Information Technology Co Ltd
Original Assignee
Reach Best Technology 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 Reach Best Technology Co Ltd filed Critical Reach Best Technology Co Ltd
Priority to CN202010191648.7A priority Critical patent/CN111399819A/en
Publication of CN111399819A publication Critical patent/CN111399819A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/30Creation or generation of source code

Abstract

The disclosure provides a data generation method, a data generation device, electronic equipment and a storage medium, relates to the technical field of networks and aims to solve the problem that the reliability of analog data generated in the related technology is low. The method comprises the following steps: acquiring interface protocol description information of a target object, wherein the interface protocol description information comprises: one or more data types and data description information corresponding to each data type; respectively calling a data generation function corresponding to each data type to generate one or more target data; combining the one or more target data to generate simulation data of the target object; the data generation function is a function for generating data corresponding to the data type based on the data type; each target data conforms to the data description information of the corresponding data type. The method can be applied in the scene of generating simulation data.

Description

Data generation method and device, electronic equipment and storage medium
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a data generation method and apparatus, an electronic device, and a storage medium.
Background
Currently, project development includes front-end development and back-end development. To speed up the development process, front-end development and back-end development may be performed in parallel. The front-end development depends on data provided by the back-end, and if the back-end does not develop a corresponding interface, the front-end cannot acquire the data through the interface, which affects the development progress of the front-end. In the case where the front end cannot obtain data through the interface, some example data (called analog data or mock data) is usually written by a human being for use by the development phase of the front end.
However, since the simulation data may have errors in the manual writing process, the reliability of the manually written simulation data is low, resulting in low testing efficiency.
Disclosure of Invention
The present disclosure provides a data generation method, an electronic device, and a storage medium to at least solve a problem of low reliability of analog data generated in the related art. The technical scheme of the disclosure is as follows:
according to a first aspect of the embodiments of the present disclosure, there is provided a data generation method, including:
acquiring interface protocol description information of a target object; the interface protocol description information includes: one or more data types and data description information corresponding to each data type;
respectively calling a data generation function corresponding to each data type to generate one or more target data; wherein each target data conforms to the data description information of the corresponding data type; the data generation function is a function for generating data corresponding to a data type based on the data type;
and combining the one or more target data to generate simulation data of the target object.
In one possible implementation, the interface protocol description information includes permutation order information of the one or more data types;
the step of combining the one or more target data to generate the simulation data of the target object specifically includes:
and combining the one or more target data according to the arrangement sequence information to generate simulation data of the target object.
In a possible implementation manner, the invoking a data generation function corresponding to each data type specifically includes:
acquiring data type information corresponding to one or more data types from the interface protocol description information;
respectively calling a data generating function corresponding to each data type from a data generating function library according to the data type information of each data type;
and the data generation function library comprises data generation functions corresponding to the one or more data types.
In one possible implementation, the one or more data types include at least one of: number type, string type, boolean type.
In a possible implementation manner, the step of respectively calling a data generation function corresponding to each data type to generate one or more target data specifically includes:
generating a random number which accords with data description information corresponding to the digital type under the condition that the data type is the digital type;
generating a random character string which accords with data description information corresponding to the character string type under the condition that the data type is the character string type;
and generating a random Boolean value which accords with the data description information corresponding to the Boolean value type under the condition that the data type is the Boolean value type.
According to a second aspect of the embodiments of the present disclosure, there is provided a data generating apparatus, including an obtaining module and a processing module;
the acquisition module is configured to execute acquisition of interface protocol description information of a target object; the interface protocol description information includes: one or more data types and data description information corresponding to each data type;
the processing module is configured to execute a data generation function which respectively calls each data type to generate one or more target data; wherein each target data conforms to the data description information of the corresponding data type; the data generation function is a function for generating data corresponding to a data type based on the data type;
the processing module is further configured to perform combining the one or more target data to generate simulation data of the target object.
In one possible implementation, the interface protocol description information includes permutation order information of the one or more data types;
the processing module is specifically configured to perform combining the one or more target data according to the ranking order information to generate simulation data of the target object.
In a possible implementation manner, the processing module is specifically configured to execute obtaining, from the interface protocol description information, data type information corresponding to each of one or more data types; calling a data generation function corresponding to each data type from a data generation function library according to the data type information of each data type;
and the data generation function library comprises data generation functions corresponding to the one or more data types.
In one possible implementation, the one or more data types include at least one of: number type, string type, boolean type.
In one possible implementation, the processing module is specifically configured to perform:
generating a random number which accords with data description information corresponding to the digital type under the condition that the data type is the digital type;
generating a random character string which accords with data description information corresponding to the character string type under the condition that the data type is the character string type;
and generating a random Boolean value which accords with the data description information corresponding to the Boolean value type under the condition that the data type is the Boolean value type.
According to a third aspect of the embodiments of the present disclosure, there is provided an electronic apparatus including:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute instructions to implement the data generation method as described in the first aspect above or any one of the possible implementations of the first aspect.
According to a fourth aspect of embodiments of the present disclosure, there is provided a storage medium, wherein instructions that, when executed by a processor of an electronic device, enable the electronic device to perform the data generation method according to the first aspect or any one of the possible implementations of the first aspect.
According to a fifth aspect of embodiments of the present disclosure, there is provided a computer program product, wherein instructions of the computer program product, when executed by a processor of an electronic device, enable the electronic device to perform the data generating method according to the first aspect or any one of the possible implementations of the first aspect.
The technical scheme provided by the embodiment of the disclosure at least brings the following beneficial effects:
according to the scheme, in the process of communication between the front-end protocol and the back-end protocol, simulation data conforming to the protocol is automatically generated according to the data description information of the data type in the appointed content of the interface protocol without manually writing the data, so that the reliability of the appointed protocol can be enhanced, the flow of generating the data can be simplified, and the efficiency of project development is improved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and, together with the description, serve to explain the principles of the disclosure and are not to be construed as limiting the disclosure.
FIG. 1 is a schematic diagram of an implementation environment of a data generation method according to an example embodiment.
FIG. 2 is a flow chart illustrating a method of data generation according to an exemplary embodiment.
FIG. 3 is a block diagram illustrating an electronic device in accordance with an example embodiment.
Fig. 4 is a schematic structural diagram of an electronic device according to an exemplary embodiment.
Detailed Description
In order to make the technical solutions of the present disclosure better understood by those of ordinary skill in the art, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings.
It should be noted that the terms "first," "second," and the like in the description and claims of the present disclosure and in the above-described drawings are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the disclosure described herein are capable of operation in sequences other than those illustrated or otherwise described herein. The implementations described in the exemplary embodiments below are not intended to represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the present disclosure, as detailed in the appended claims.
Some of the nouns or terms referred to in the claims and the specification of the present application will be explained first.
Front end: the Web front end, the APP end, the desktop end and the like all belong to the layer of the user interface.
A rear end: i.e., the server side, means everything that belongs to the layer below the user interface.
Front and rear end interfaces: the front end and the back end are collectively called as data interface for data interaction. The front end typically finishes rendering the front-end page by fetching data through an interface provided by the back end.
Fig. 1 is an architecture diagram illustrating an implementation environment to which the data generation method provided by the embodiment of the present disclosure is applied, as shown in fig. 1, according to an exemplary embodiment. The implementation environment includes an electronic device 01 and a server 02. Wherein, the electronic device 01 and the server 02 may be interconnected and communicate through a network.
The execution subject of the data generation method may be a simulation system (may be referred to as a mock system), and the mock system may be used to generate simulation data (i.e., mock data) for the joint between the electronic device 01 and the server 02. For the mock system, the scheme may be executed on the electronic device 01 or the server 02, which may be determined according to actual usage requirements, and the embodiment of the present disclosure is not limited.
The electronic device 01 may belong to a front end of a project development and the server 02 may belong to a back end of the project development. The electronic device 01 may display a page for interaction, and the server 02 may interact with the database to process corresponding business logic and provide a service interface for the electronic device 01 to call to complete a functional test. In general, the development of the front-end needs to rely on the interface definitions provided by the back-end and the data returned.
The electronic device 01 may be any electronic product that can interact with a user through one or more modes, such as a keyboard, a touch pad, a touch screen, a remote controller, a voice interaction device, or a handwriting device, for example, a mobile phone, a tablet Computer, a palm Computer, a Personal Computer (PC), a wearable device, a smart television, and the like.
The server 02 may be one server, a server cluster composed of a plurality of servers, or a cloud computing service center. The server 02 may include a processor, memory, and a network interface, among others.
It will be understood by those skilled in the art that the foregoing electronic devices and servers are merely exemplary and that other existing or future electronic devices or servers may be suitable for use with the present disclosure and are intended to be included within the scope of the present disclosure and are hereby incorporated by reference.
The following takes an execution subject as a mock system as an example, and the data generation method provided by the embodiment of the disclosure is exemplarily described with reference to the drawings.
Fig. 2 is a flowchart illustrating a data generation method according to an exemplary embodiment, where the data generation method is used in an electronic device, as shown in fig. 2, and the method includes the following steps S21-S23.
In step S21, interface protocol description information of the target object is acquired; the interface protocol description information includes: one or more data types and data description information corresponding to each data type.
To ensure the cooperative communication between the front-end and the back-end (developers), the specification of the interface is generally defined by the front-end and the back-end together, i.e., the front-end and the back-end together define the content of the interface protocol. The interface protocol content may include: the address of the interface, the input parameters of the interface, and the data format (structure) of the output.
In the embodiment of the present disclosure, the target object may be an interface protocol content agreed by a front end and a back end. The interface protocol content may include a plurality of fields, and each field may correspond to data description information of a certain data type.
In the embodiment of the disclosure, the mock system may obtain the interface protocol description information of the target object, and analyze the data description information of which data types are included in the interface protocol description information according to the data description information in the interface protocol description information. For example, the interface protocol description information may include data description information for one or more data types.
In one possible implementation, the one or more data types include at least one of: number type, string type, boolean type. It should be noted that the above data types are merely exemplary lists, and it is understood that, in practical implementation, the one or more data types may also include any other possible data types, such as array types.
For example, the mock system may obtain interface protocol description information of the target object, where the interface protocol description information may include three fields, one of the fields may correspond to data description information of a numeric type, another field may correspond to data description information of a string type, and another field may correspond to data description information of a boolean type.
In an embodiment of the present disclosure, the data description information may include at least one of: data type information, data size information, etc., but may also include any other possible information, which is not limited by the embodiments of the present disclosure. The data description information for different data types may differ.
For example, for a digital type, its data description information may contain data type information "number"; data size information "[ 1,10 ]" for agreeing on a legal number range.
For another example, for a string type, the data description information thereof may include data type information "string"; data size information "maximum length: and 9' is used for appointing a character string length range.
In the embodiment of the present disclosure, the interface protocol content may be described by using one data object (i.e., a protocol content description object), and an example code of the interface protocol description information of the target object is given below.
Figure BDA0002416135190000051
Figure BDA0002416135190000061
Wherein, the ShameData describes the object for the protocol content.
Specifically, in the above protocol content description object, the interface protocol description information includes two fields: a key1 field and a key2 field. The key1 field corresponds to data description information of a number type: the data type is a numeric type and the legal number range is agreed to be [1, 999 ]. The key2 field corresponds to data description information of a string type, the data type is the string type, and the appointed string length range is [0, 9 ].
In step S22, a data generation function corresponding to each data type is called to generate one or more target data; wherein each target data conforms to the data description information of the corresponding data type; the data generation function is a function that generates data corresponding to a data type based on the data type.
In the embodiment of the present disclosure, the data generating function may be a function for generating simulation data for a basic data type. Here, the basic data type may be a numeric type, or a character string type, or a boolean value type.
In a possible implementation manner, the data generating function library may include the one or more data types and a data generating function corresponding to each data type, that is, one data type may correspond to one data generating function.
Illustratively, the number type corresponds to a data generation function, the string type corresponds to a data generation function, and the boolean value type corresponds to a data generation function.
In this case, the step of calling the data generating function corresponding to each data type may specifically include:
acquiring data type information corresponding to one or more data types from the interface protocol description information;
and calling a data generation function corresponding to each data type from the data generation function library according to the data type information of each data type.
Illustratively, in combination with the above example code of the interface protocol description information of the target object, for the key1 in the example code, the calling function corresponding to the number type is as follows:
obj[key1]=mockMethods[shemeData[key1][type]](shemeData[key1])
wherein mocksthods are function set objects, see in particular the example code below. It will be appreciated that for key1 in the example code, shemeData [ key1] [ type ] is number, and the mock system, by calling the function, can generate a random number that conforms to the protocol and assign the random number (i.e., the return value of the calling function) to obj [ key1 ].
It should be noted that the mock system may obtain the data type of the key1 value through the shaamedata, and call a corresponding function in the mockmethods according to the data type.
In the embodiment of the present disclosure, the mock system may first obtain interface protocol description information of the target object, then analyze which data types of data description information are included in the interface protocol description information according to data description information in the interface protocol description information, for the data description information of each data type, the mock system calls a data generation function corresponding to the interface protocol description information, and returns a target data by the called data generation function, where the target data should conform to the data description information of the data type.
Illustratively, the mock system acquires interface protocol description information of a target object, and then determines that the interface protocol description information contains digital data description information and character string data description information according to data description information in the interface protocol description information. For the data description information of the digital type, the mock system calls the corresponding data generation function, and a random value (namely the target data) is returned by the called data generation function, wherein the random value is required to accord with the data description information of the digital type. For the data description information of the character string type, the mock system calls the corresponding data generation function, and a random character string (namely the target data) is returned by the called data generation function, wherein the random character string should accord with the data description information of the character string type.
In a possible implementation manner, the step of calling a data generation function corresponding to each data type respectively to generate one or more target data specifically includes:
(1) under the condition that the data type is the digital type, generating a random number which accords with data description information corresponding to the digital type;
(2) under the condition that the data type is a character string type, generating a random character string which accords with data description information corresponding to the character string type;
(3) and generating a random Boolean value which accords with the data description information corresponding to the Boolean value type under the condition that the data type is the Boolean value type.
For example, for a number type, the target data may be a random number that conforms to the data description information corresponding to the number type, i.e. the random number should be within a predetermined legal number range (e.g., [1,10 ]).
As another example, for a string type, the target data may be a random string that conforms to the data description information corresponding to the string type, i.e., the random string should be within a predetermined string length range (e.g., the maximum string length is 9).
The following exemplary sets forth the function for generating base type data for a base data type, with exemplary code as follows:
Figure BDA0002416135190000071
Figure BDA0002416135190000081
wherein, mockMethods are function set objects.
Function (schema) is a data generating function corresponding to the number type; the mock system can call the function and return the random number of the number type according to the data description information of the number type.
string, function (schema) is a data generating function corresponding to the character string type; the mock system can call the function and return a random character string of the character string type according to the data description information of the character string type.
Function (schema) is a data generating function corresponding to the Boolean value type; the mock system can call the function and return a random boolean value of the boolean type according to the data description information of the boolean type.
In step S23, the one or more target data are combined to generate simulation data of the target object.
In the embodiment of the disclosure, in the case that the front end cannot acquire data through the interface because the back end has not developed a corresponding interface, the mock system may combine one or more target data to obtain some example data (i.e., simulation data) of the target object according to the acquired one or more target data, so as to be used in the development stage of the front end.
In one possible implementation, the interface protocol description information may include permutation order information of one or more data types. In this case, the step of combining the one or more target data to generate the simulation data of the target object specifically includes:
and combining one or more target data according to the arrangement sequence information to generate simulation data of the target object.
In this embodiment of the disclosure, the arrangement order information of the one or more data types may be used to indicate an order in which the data description information corresponding to the one or more data types is arranged.
For example, in conjunction with the example code of the interface protocol description information of the target object described above, the arrangement order information of the one or more data types may be arranged in the arrangement order of keys 1 and keys 2 in the object described below.
Figure BDA0002416135190000082
Figure BDA0002416135190000091
Wherein Obj is the final combined analog data object.
Specifically, in combination with the above example code, the mock system may analyze a type (type) corresponding to each Key in the interface protocol description information of the target object, and call a data generation function of the corresponding type to generate target data (e.g., Key1, Key2, etc.) conforming to the data description information; further, target data corresponding to each field is combined to obtain final analog data and the final analog data is returned for copying or direct use by a user, for example, digital analog data and character string analog data can be used for user identification information in interface display.
In the embodiment of the disclosure, in the process of communication between the front-end protocol and the back-end protocol, the simulation data conforming to the protocol is automatically generated according to the data description information of the data type in the appointed content of the interface protocol without manually writing the data, so that the reliability of the appointed protocol can be enhanced, the flow of generating the data can be simplified, and the efficiency of project development can be improved.
FIG. 3 is a block diagram illustrating an electronic device in accordance with an example embodiment. Referring to fig. 3, the electronic device 50 includes an acquisition module 51 and a processing module 52.
The obtaining module 51 is configured to perform obtaining interface protocol description information of the target object; wherein, the interface protocol description information includes: one or more data types and data description information corresponding to each data type.
The processing module 52 is configured to execute a data generation function for calling each data type respectively, and generate one or more target data; wherein each target data conforms to the data description information of the corresponding data type; the data generation function is a function for generating data corresponding to a data type based on the data type.
The processing module 52 is further configured to perform combining the one or more target data to generate simulated data of the target object.
In one possible implementation, the interface protocol description information includes permutation order information of one or more data types. Accordingly, the processing module 52 is specifically configured to perform combining one or more target data according to the ranking information to generate the simulation data of the target object.
In a possible implementation manner, the processing module 52 is specifically configured to obtain, from the interface protocol description information, data type information corresponding to each of one or more data types; and calling a data generating function corresponding to each data type from the data generating function library according to the data type information of each data type. The data generation function library comprises data generation functions corresponding to one or more data types.
In one possible implementation, the one or more data types include at least one of: number type, string type, boolean type.
In one possible implementation, the processing module 52 is specifically configured to perform:
under the condition that the data type is the digital type, generating a random number which accords with data description information corresponding to the digital type;
under the condition that the data type is a character string type, generating a random character string which accords with data description information corresponding to the character string type;
and generating a random Boolean value which accords with the data description information corresponding to the Boolean value type under the condition that the data type is the Boolean value type.
With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
According to the scheme, in the process of communication between the front-end protocol and the back-end protocol, simulation data conforming to the protocol is automatically generated according to the data description information of the data type in the appointed content of the interface protocol without manually writing the data, so that the reliability of the appointed protocol can be enhanced, the flow of generating the data can be simplified, and the efficiency of project development is improved.
In addition, when the electronic device provided in the above embodiment implements the functions thereof, only the division of the above functional modules is illustrated, and in practical applications, the functions may be distributed by different functional modules according to needs, that is, the internal structure of the electronic device may be divided into different functional modules to implement all or part of the functions described above.
Fig. 4 is a schematic structural diagram of an electronic device according to an exemplary embodiment. The electronic device 100 includes, but is not limited to, a mobile phone, a tablet computer, a notebook computer, a palm computer, a vehicle-mounted terminal, a wearable device, a pedometer, and the like. As shown in fig. 4, electronic device 100 includes, but is not limited to: a processor 101, a memory 102, a display 103, an input unit 104, an output unit 105, a network unit 106, an interface unit 107, a radio frequency unit 108, a power supply 109, a sensor 110, and the like.
It should be noted that the structure of the electronic device 100 shown in fig. 4 does not constitute a limitation to the electronic device 100, and the electronic device 100 may include more or less components than those shown in fig. 4, or may combine some components, or may arrange different components, as will be understood by those skilled in the art.
In the embodiment of the present disclosure, the display 103 is configured to display a shooting preview interface, where the shooting preview interface includes at least one duration label, and one duration label corresponds to one shooting duration.
A processor 101, configured to start capturing a video in response to a user's shooting input on a shooting preview interface, and keep displaying at least one duration label; and responding to a first input of a user to a target time length label in at least one time length label, and carrying out video shooting within a target shooting time length corresponding to the target time length label.
It should be noted that the electronic device 100 can implement each process implemented by the electronic device in the foregoing method embodiments, and can achieve the same technical effect, and for avoiding repetition, detailed descriptions are not repeated here.
The processor 101 is a control center of the electronic device 100, connects various parts of the whole electronic device 100 by various interfaces and lines, and performs various functions of the electronic device 100 and processes data by running or executing software programs and/or modules stored in the memory 102 and calling data stored in the memory 102, thereby performing overall monitoring of the electronic device 100. Processor 101 may include one or more processing units; optionally, the processor 101 may integrate an application processor and a modem processor, wherein the application processor mainly handles operating systems, user interfaces, application programs, and the like, and the modem processor mainly handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 101.
The memory 102 may be used to store software programs as well as various data. The memory 102 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data, a phonebook, etc.) created according to the use of the cellular phone, and the like. Further, the memory 102 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device.
The Display 103 may include a Display panel, which may be configured in the form of a liquid Crystal Display (L acquired Crystal Display, L CD), an Organic light-Emitting Diode (O L ED), or the like.
The input unit 104 may be used to receive audio or video signals. The input Unit 104 may include a Graphics Processing Unit (GPU) that processes image data of still pictures or video obtained by an image capturing device (such as a camera) in a video capturing mode or an image capturing mode, and a microphone. The processed image frames may be displayed on the display 103. The image frames processed by the graphics processor may be stored in the memory 102 (or other storage medium) or transmitted via the radio frequency unit 108 or the network unit 106. The microphone may receive sound and be capable of processing such sound into audio data. The processed audio data may be converted into a format output transmittable to a mobile communication base station via the radio frequency unit 108 in case of the phone call mode.
The input unit 104 may be a user input unit operable to receive input numeric or character information and generate key signal inputs related to user settings and function control of the electronic apparatus 100. Specifically, the user input unit includes a touch panel and other input devices. A touch panel, also referred to as a touch screen, may collect touch operations by a user on or near the touch panel (e.g., operations by a user on or near the touch panel using a finger, a stylus, or any other suitable object or attachment). The touch panel may include two parts of a touch detection device and a touch controller. The touch detection device detects the touch direction of a user, detects a signal brought by touch operation and transmits the signal to the touch controller; the touch controller receives touch information from the touch sensing device, converts the touch information into touch point coordinates, sends the touch point coordinates to the processor 101, receives a command from the processor 101, and executes the command. In addition, the touch panel may be implemented in various types such as a resistive type, a capacitive type, an infrared ray, and a surface acoustic wave. The user input unit may include other input devices in addition to the touch panel. Specifically, the other input devices may include, but are not limited to, a physical keyboard, function keys (such as volume control keys, switch keys, etc.), a trackball, a mouse, and a joystick, which are not described in detail herein.
Further, the touch panel may be overlaid on the display panel, and when the touch panel detects a touch operation thereon or nearby, the touch panel transmits the touch operation to the processor 101 to determine the type of the touch event, and then the processor 101 provides a corresponding visual output on the display panel according to the type of the touch event. The touch panel and the display panel may be used as two independent components to implement the input and output functions of the electronic device 100, or the touch panel and the display panel may be integrated to implement the input and output functions of the electronic device 100, which is not limited herein.
The output unit 105 may be an audio output unit, and may convert audio data received by the radio frequency unit 108 or the network unit 106 or stored in the memory 102 into an audio signal and output as sound. Also, the audio output unit may also provide audio output related to a specific function performed by the electronic apparatus 100 (e.g., a call signal reception sound, a message reception sound, etc.). The audio output unit comprises a loudspeaker, a buzzer, a receiver and the like.
The electronic device 100 provides the user with wireless broadband internet access via the network unit 106, such as assisting the user in e-mailing, browsing web pages, and accessing streaming media.
The interface unit 107 is an interface for connecting an external device to the electronic apparatus 100. For example, the external device may include a wired or wireless headset port, an external power supply (or battery charger) port, a wired or wireless data port, a memory card port, a port for connecting a device having an identification module, an audio input/output (I/O) port, a video I/O port, an earphone port, and the like. The interface unit 107 may be used to receive input (e.g., data information, power, etc.) from an external device and transmit the received input to one or more elements within the electronic apparatus 100 or may be used to transmit data between the electronic apparatus 100 and the external device.
The radio frequency unit 108 may be configured to receive and transmit signals during information transmission and reception or during a call, and specifically, receive downlink data from a base station and then process the received downlink data to the processor 101; in addition, the uplink data is transmitted to the base station. In general, radio frequency unit 108 includes, but is not limited to, an antenna, at least one amplifier, a transceiver, a coupler, a low noise amplifier, a duplexer, and the like. In addition, the radio frequency unit 108 can also communicate with a network and other devices through a wireless communication system.
A power supply 109 (e.g., a battery) may be used to supply power to the various components, and optionally, the power supply 109 may be logically connected to the processor 101 through a power management system, so as to manage charging, discharging, and power consumption through the power management system.
The sensor 110 may include at least one of a light sensor, a motion sensor, and other sensors. Specifically, the light sensor includes an ambient light sensor that adjusts the brightness of the display panel according to the brightness of ambient light, and a proximity sensor that turns off the display panel and/or the backlight when the electronic device 100 is moved to the ear. As one type of motion sensor, an accelerometer sensor can detect the magnitude of acceleration in each direction (generally three axes), detect the magnitude and direction of gravity when stationary, and can be used to identify the posture of an electronic device (such as horizontal and vertical screen switching, related games, magnetometer posture calibration), and vibration identification related functions (such as pedometer, tapping); the sensors 110 may also include a fingerprint sensor, a pressure sensor, an iris sensor, a molecular sensor, a gyroscope, a barometer, a hygrometer, a thermometer, an infrared sensor, etc., which will not be described in detail herein.
In addition, the electronic device 100 includes some functional modules (e.g., a camera) not shown, which are not described herein.
In an exemplary embodiment, the disclosed embodiments also provide a storage medium comprising instructions, such as the memory 102 comprising instructions, executable by the processor 101 of the electronic device 100 to perform the above-described method. Alternatively, the storage medium may be a non-transitory computer readable storage medium, which may be, for example, a Read-Only Memory (ROM), a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
In an exemplary embodiment, the disclosed embodiments also provide a computer program product comprising one or more instructions executable by the processor 101 of the electronic device 100 to perform the above-described method.
It should be noted that the instructions in the storage medium or one or more instructions in the computer program product are executed by the processor 101 to implement the processes of the method embodiments, and the same technical effect can be achieved.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.
It will be understood that the present disclosure is not limited to the precise arrangements described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims (10)

1. A method of generating data, comprising:
acquiring interface protocol description information of a target object; the interface protocol description information includes: one or more data types and data description information corresponding to each data type;
respectively calling a data generation function corresponding to each data type to generate one or more target data; wherein each target data conforms to the data description information of the corresponding data type; the data generation function is a function for generating data corresponding to a data type based on the data type;
and combining the one or more target data to generate simulation data of the target object.
2. The data generation method of claim 1, wherein the interface protocol description information further includes permutation order information of the one or more data types;
the step of combining the one or more target data to generate the simulation data of the target object specifically includes:
and combining the one or more target data according to the arrangement sequence information to generate simulation data of the target object.
3. The data generation method according to claim 1, wherein the calling the data generation function corresponding to each data type specifically includes:
acquiring data type information corresponding to the one or more data types from the interface protocol description information;
respectively calling a data generating function corresponding to each data type from a data generating function library according to the data type information of each data type;
and the data generation function library comprises data generation functions corresponding to the one or more data types.
4. A data generation method according to any one of claims 1 to 3, wherein the one or more data types include at least one of: number type, string type, boolean type.
5. The data generation method according to claim 4, wherein the step of calling the data generation function corresponding to each data type respectively to generate one or more target data specifically includes:
generating a random number which accords with data description information corresponding to the digital type under the condition that the data type is the digital type;
generating a random character string which accords with data description information corresponding to the character string type under the condition that the data type is the character string type;
and generating a random Boolean value which accords with the data description information corresponding to the Boolean value type under the condition that the data type is the Boolean value type.
6. The data generation device is characterized by comprising an acquisition module and a processing module;
the acquisition module is configured to execute acquisition of interface protocol description information of a target object; the interface protocol description information includes: one or more data types and data description information corresponding to each data type;
the processing module is configured to execute a data generation function which respectively calls each data type to generate one or more target data; wherein each target data conforms to the data description information of the corresponding data type; the data generation function is a function for generating data corresponding to a data type based on the data type;
the processing module is further configured to perform combining the one or more target data to generate simulation data of the target object.
7. The data generating apparatus of claim 6, wherein the interface protocol description information comprises permutation order information of the one or more data types;
the processing module is specifically configured to perform combining the one or more target data according to the ranking order information to generate simulation data of the target object.
8. The data generation apparatus according to claim 6, wherein the processing module is specifically configured to perform obtaining data type information of one or more data types from the interface protocol description information; respectively calling a data generating function corresponding to each data type from a data generating function library according to the data type information corresponding to each data type;
and the data generation function library comprises data generation functions corresponding to the one or more data types.
9. An electronic device, comprising:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the data generation method of any of claims 1 to 5.
10. A storage medium in which instructions, when executed by a processor of an electronic device, enable the electronic device to perform a data generation method as claimed in any one of claims 1 to 5.
CN202010191648.7A 2020-03-18 2020-03-18 Data generation method and device, electronic equipment and storage medium Pending CN111399819A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010191648.7A CN111399819A (en) 2020-03-18 2020-03-18 Data generation method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010191648.7A CN111399819A (en) 2020-03-18 2020-03-18 Data generation method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN111399819A true CN111399819A (en) 2020-07-10

Family

ID=71436437

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010191648.7A Pending CN111399819A (en) 2020-03-18 2020-03-18 Data generation method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN111399819A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114385384A (en) * 2021-12-28 2022-04-22 联通智网科技股份有限公司 Application programming interface calling method and related equipment
CN114513264A (en) * 2022-02-16 2022-05-17 西安市科楠科技开发有限公司 Analog data generation device and method for remote sensing satellite

Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120185834A1 (en) * 2011-01-14 2012-07-19 Oracle International Corporation System and method for efficient compilation and invocation of function type calls
CN103049271A (en) * 2012-12-27 2013-04-17 微梦创科网络科技(中国)有限公司 Method and device for automatically generating description document of API (application program interface)
CN108108162A (en) * 2016-11-24 2018-06-01 腾讯科技(深圳)有限公司 Application programming interface generation method and device
CN109086145A (en) * 2018-07-05 2018-12-25 平安科技(深圳)有限公司 Data forge method, apparatus and computer storage medium
CN110275831A (en) * 2019-06-18 2019-09-24 广州华多网络科技有限公司 The mock data verification method and device of protocol interface
CN110430184A (en) * 2019-07-31 2019-11-08 腾讯科技(深圳)有限公司 Digital simulation method, apparatus, computer readable storage medium and computer equipment
CN110489101A (en) * 2019-07-15 2019-11-22 北京字节跳动网络技术有限公司 Interface analogy method, system, medium and electronic equipment

Patent Citations (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20120185834A1 (en) * 2011-01-14 2012-07-19 Oracle International Corporation System and method for efficient compilation and invocation of function type calls
CN103049271A (en) * 2012-12-27 2013-04-17 微梦创科网络科技(中国)有限公司 Method and device for automatically generating description document of API (application program interface)
CN108108162A (en) * 2016-11-24 2018-06-01 腾讯科技(深圳)有限公司 Application programming interface generation method and device
CN109086145A (en) * 2018-07-05 2018-12-25 平安科技(深圳)有限公司 Data forge method, apparatus and computer storage medium
CN110275831A (en) * 2019-06-18 2019-09-24 广州华多网络科技有限公司 The mock data verification method and device of protocol interface
CN110489101A (en) * 2019-07-15 2019-11-22 北京字节跳动网络技术有限公司 Interface analogy method, system, medium and electronic equipment
CN110430184A (en) * 2019-07-31 2019-11-08 腾讯科技(深圳)有限公司 Digital simulation method, apparatus, computer readable storage medium and computer equipment

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114385384A (en) * 2021-12-28 2022-04-22 联通智网科技股份有限公司 Application programming interface calling method and related equipment
CN114385384B (en) * 2021-12-28 2023-11-21 联通智网科技股份有限公司 Application programming interface calling method and related equipment
CN114513264A (en) * 2022-02-16 2022-05-17 西安市科楠科技开发有限公司 Analog data generation device and method for remote sensing satellite
CN114513264B (en) * 2022-02-16 2024-01-30 西安市科楠科技开发有限公司 Device and method for generating simulation data of remote sensing satellite

Similar Documents

Publication Publication Date Title
CN109768926B (en) Data processing method, terminal equipment and computer readable storage medium
CN109885257B (en) Disk file reading and writing method and device
CN112084747B (en) Resource management method and device, electronic equipment and storage medium
CN111222063A (en) Rich text rendering method and device, electronic equipment and storage medium
CN111049980A (en) Application sharing method, electronic equipment and computer readable storage medium
CN109495638B (en) Information display method and terminal
CN108984066B (en) Application icon display method and mobile terminal
CN111163449B (en) Application sharing method, first electronic device and computer-readable storage medium
CN112231144A (en) Data processing method and device and electronic equipment
CN110505660B (en) Network rate adjusting method and terminal equipment
CN111399819A (en) Data generation method and device, electronic equipment and storage medium
CN111061404A (en) Control method and first electronic device
CN105335434B (en) Log management method and device and electronic equipment
CN107765954B (en) Application icon updating method, mobile terminal and server
CN113407169A (en) Software development method and device
CN111163227B (en) Sharing method and electronic equipment
CN111200648B (en) Service calling method, device, terminal equipment and storage medium
CN109889568B (en) Data export method, server and system
CN111522613A (en) Screen capturing method and electronic equipment
CN111050223A (en) Bullet screen information processing method and electronic equipment
CN111309390A (en) Method for acquiring configuration information and electronic equipment
CN111601035B (en) Image processing method and electronic equipment
CN111045588B (en) Information viewing method and electronic equipment
CN111475141B (en) Method and device for generating list and electronic equipment
CN111416955B (en) Video call method and electronic equipment

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