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

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

Info

Publication number
CN111399819B
CN111399819B CN202010191648.7A CN202010191648A CN111399819B CN 111399819 B CN111399819 B CN 111399819B CN 202010191648 A CN202010191648 A CN 202010191648A CN 111399819 B CN111399819 B CN 111399819B
Authority
CN
China
Prior art keywords
data
type
description information
generating
target
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
CN202010191648.7A
Other languages
Chinese (zh)
Other versions
CN111399819A (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.)
Beijing Dajia Internet Information Technology Co Ltd
Original Assignee
Beijing Dajia Internet Information 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 Beijing Dajia Internet Information Technology Co Ltd filed Critical Beijing Dajia Internet Information Technology Co Ltd
Priority to CN202010191648.7A priority Critical patent/CN111399819B/en
Publication of CN111399819A publication Critical patent/CN111399819A/en
Application granted granted Critical
Publication of CN111399819B publication Critical patent/CN111399819B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

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

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • User Interface Of Digital Computer (AREA)

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 analog data generated in related technologies is low in reliability. 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 generating 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 a 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 to a scene for generating analog data.

Description

Data generation method, device, electronic equipment and storage medium
Technical Field
The disclosure relates to the field of computer technology, and in particular, to a data generation method, a data generation device, electronic equipment and a storage medium.
Background
Currently, project development includes front-end development and back-end development. In order to accelerate development progress, front-end development and back-end development may be performed in parallel. Front-end development depends on the 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 typically written manually for use by the development stage of the front-end.
However, since analog data may have errors in the manual writing process, the reliability of the manually written analog data is low, resulting in low test efficiency.
Disclosure of Invention
The present disclosure provides a data generation method, an electronic device, and a storage medium, to at least solve the problem of low reliability of analog data generated in the related art. The technical scheme of the present disclosure is as follows:
According to a first aspect of an embodiment of the present disclosure, there is provided a data generating 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 generating function corresponding to each data type to generate one or more target data; wherein, each target data accords with 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 one possible implementation manner, the calling the data generating 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;
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;
The data generating function library comprises data generating 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 value type.
In one possible implementation manner, the step of generating one or more target data by respectively calling the data generating functions corresponding to each data type specifically includes:
generating a random number conforming to data description information corresponding to the digital type under the condition that the data type is the digital type;
Generating a random character string conforming to data description information corresponding to the character string type under the condition that the data type is the character string type;
and under the condition that the data type is a Boolean value type, generating a random Boolean value which accords with the data description information corresponding to the Boolean value type.
According to a second aspect of embodiments of the present disclosure, there is provided a data generating apparatus, including an acquisition module and a processing module;
The acquisition module is configured to execute the interface protocol description information of the acquisition 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 corresponding to each data type to generate one or more target data; wherein, each target data accords with 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 simulated data for 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 arrangement order information to generate simulation data of the target object.
In one possible implementation manner, the processing module is specifically configured to obtain data type information corresponding to one or more data types from the interface protocol description information; 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;
The data generating function library comprises data generating 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 value type.
In one possible implementation, the processing module is specifically configured to perform:
generating a random number conforming to data description information corresponding to the digital type under the condition that the data type is the digital type;
Generating a random character string conforming to data description information corresponding to the character string type under the condition that the data type is the character string type;
and under the condition that the data type is a Boolean value type, generating a random Boolean value which accords with the data description information corresponding to the Boolean value type.
According to a third aspect of embodiments of the present disclosure, there is provided an electronic device, comprising:
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 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, which when executed by a processor of an electronic device, enables the electronic device to perform the data generation method as described above in 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, which when executed by a processor of an electronic device, enables the electronic device to perform the data generation method as described above in 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, the simulation data conforming to the protocol is automatically generated according to the data description information of the data types in the interface protocol contract content, and the data is not required to be written manually, so that the reliability of the contract 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 disclosure and together with the description, serve to explain the principles of the disclosure and do not constitute an undue limitation on the disclosure.
Fig. 1 is a schematic diagram of an implementation environment of a data generation method according to an exemplary embodiment.
Fig. 2 is a flow chart illustrating a data generation method according to an exemplary embodiment.
Fig. 3 is a block diagram of an electronic device, according to an example embodiment.
Fig. 4 is a schematic diagram of an electronic device according to an exemplary embodiment.
Detailed Description
In order to enable those skilled in the art to better understand the technical solutions of the present disclosure, the technical solutions of 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 foregoing figures are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments of the disclosure described herein may be capable of operation in sequences other than those illustrated or described herein. The implementations described in the following exemplary examples are not representative of all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with some aspects of the present disclosure as detailed in the accompanying claims.
The following is a first explanation of some of the terms or expressions referred to in the claims and specification of the present application.
Front end: all of the Web front end, APP end, desktop end and the like belong to the layer of the user interface.
The rear end: i.e. server side, refers to everything that belongs to this layer under the user interface.
Front and rear interfaces: the front end and the back end perform data interaction is also called as a data interface. The front-end typically obtains data through an interface provided by the back-end to complete rendering of the front-end page.
Fig. 1 is an architecture diagram of an implementation environment according to an exemplary embodiment, and as shown in fig. 1, a data generating method provided in an embodiment of the present disclosure is applied to the implementation environment. 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 via a network.
The execution subject of the data generation method may be an analog system (may be referred to as a mock system) that may be used to generate analog data (i.e., mock data) of a joint call between the electronic device 01 and the server 02. For the mock system, the solution may be executed on the electronic device 01 or the server 02, and may specifically be determined according to actual use requirements, which is not limited by the embodiments of the disclosure.
The electronic device 01 may belong to a front end of the 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 the corresponding business logic and provide a service interface for the electronic device 01 to call to complete the functional test. Typically, development of the front end requires reliance on interface definitions provided by the back end, as well as the data returned.
The electronic device 01 may be any electronic product that can perform man-machine interaction with a user through one or more modes of a keyboard, a touch pad, a touch screen, a remote controller, a voice interaction or handwriting device, such as a mobile phone, a tablet computer, a palm top computer, a personal computer (Personal Computer, PC), a wearable device, a smart television, and the like.
The server 02 may be a server, a server cluster formed by a plurality of servers, or a cloud computing service center. The server 02 may include a processor, memory, network interfaces, and the like.
Those skilled in the art will appreciate that the above-described electronic devices and servers are merely examples, and that other existing or future-occurring electronic devices or servers, as applicable to the present disclosure, are intended to be within the scope of the present disclosure and are incorporated herein by reference.
The data generating method provided by the embodiment of the present disclosure is exemplarily described below with reference to the respective drawings by taking an execution body as a mock system.
Fig. 2 is a flowchart illustrating a data generation method according to an exemplary embodiment, which is used in an electronic device as shown in fig. 2, and includes the following steps S21 to S23.
In step S21, the 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 collaborative communication between the front end and the back end (developer), the front end and the back end together generally define the interface specification, i.e., the front end and the back end together define the interface protocol content. 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 interface protocol contents agreed for the front end and the 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 acquire the interface protocol description information of the target object, and analyze which data types of data description information 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 value type. It should be noted that the above data types are merely exemplary, and it is understood that in actual 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 field 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 value type.
In an embodiment of the present disclosure, the data description information may include at least one of the following: data type information, data size information, etc., may of course also include any other possible information, and embodiments of the present disclosure are not limited in this regard. The data description information of different data types may be different.
For example, for a digital type, its data description information may contain data type information "number"; data size information "[1, 10]", is used to agree on a legal number range.
For another example, for a string type, its data description information may contain data type information "string"; data size information "maximum length: 9 "for specifying a string length range.
In the embodiment of the present disclosure, the above-mentioned interface protocol content may be described by a data object (i.e., a protocol content description object), and example codes of interface protocol description information of a target object are given below.
Wherein SHAMEDATA is a protocol content description object.
Specifically, in the protocol content description object, the interface protocol description information includes two fields: a key1 field and a key2 field. The key1 field corresponds to digital type data description information: the data type is a numeric type and the agreed legal numeric range is [1, 999]. The key2 field is corresponding to the data description information of the character string type, the data type is the character string type, and the length range of the contracted character string is 0, 9.
In step S22, a data generating function corresponding to each data type is called respectively to generate one or more target data; wherein, each target data accords with 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 an embodiment of the present disclosure, the data generating function may be a function for generating analog data for a base data type. Here, the base data type may be a digital type, or a character string type, or a boolean value type.
In one possible implementation, the data generating function library may include 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 one data generation function, the string type corresponds to one data generation function, and the Boolean value type corresponds to one 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 the data generating function corresponding to each data type from the data generating function library according to the data type information of each data type.
Exemplary, in combination with the example code of the interface protocol description information of the target object, for key1 in the example code, the call function corresponding to the number type is as follows:
obj[key1]=mockMethods[shemeData[key1][type]](shemeData[key1])
wherein mockMethods is a function set object, see in particular example code below. It will be appreciated that for key1, SHEMEDATA [ key1] [ type ] in the example code as number, the mock system may generate a random number that conforms to the protocol by calling the function, 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 SHAMEDATA, and call the corresponding function in mockMethtods according to the data type.
In the embodiment of the disclosure, the mock system may first acquire the interface protocol description information of the target object, then analyze, according to the data description information in the interface protocol description information, which data description information of the data types is included in the interface protocol description information, and call the corresponding data generation function for each data type of the data description information, and return, by the called data generation function, a target data, where the target data should conform to the data description information of the data type.
Illustratively, the mock system acquires the interface protocol description information of the target object, and then determines that the interface protocol description information contains digital type data description information and character string type data description information according to the 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 generating function, and the called data generating function returns a random value (namely the target data) which is supposed 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 generating function, and the called data generating function returns a random character string (namely the target data) which is in accordance with the data description information of the character string type.
In one possible implementation manner, the step of generating one or more target data by calling the data generating function corresponding to each data type includes:
(1) Under the condition that the data type is a 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 the data description information corresponding to the character string type;
(3) And under the condition that the data type is a Boolean value type, generating a random Boolean value which accords with the data description information corresponding to the Boolean value type.
For example, for a number type, the target data may be a random number that matches the data description information corresponding to the number type, i.e., the random number should be within a agreed legal number range (e.g., [1,10 ]).
As another example, for the string type, the target data may be a random string that matches the data description information corresponding to the string type, that is, the random string should be within a predetermined string length range (for example, the maximum string length is 9).
The following exemplary functions for generating base type data for base data types are given, with example code as follows:
wherein mockMethods is a function set object.
Number function (shema) is a data generation function corresponding to the digital type; the mock system may call the function to return a random number of the digital type based on the data description information of the digital type.
String function (shema) is a data generation function corresponding to the character string type; the mock system may call the function to return a random string of string type based on the data description of string type.
Boolean function (shema) is a data generation function corresponding to the Boolean value type; the mock system may call the function and return a random boolean value of the boolean value type based on the data description information of the boolean value type.
In step S23, the one or more pieces of target data are combined to generate simulation data of the target object.
In the embodiment of the disclosure, in a 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 according to the acquired one or more target data to obtain some example data (i.e., analog data) of the target object for use in a development stage of the front end.
In one possible implementation, the interface protocol description information may include ordering 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 an embodiment of the disclosure, the arrangement order information of the one or more data types may be used to indicate an order of arrangement of the data description information corresponding to the one or more data types.
For example, in connection with the example code of interface protocol description information of the target object, the arrangement order information of the one or more data types may be arranged according to the arrangement order of key1 and key2 in the object described below.
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 generating function of the corresponding type to generate target data (e.g., key1, key2, etc.) conforming to the data description information; further, the target data corresponding to each field is combined to obtain final analog data and returned for the user to copy or directly use, 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 communicating the front-end protocol and the back-end protocol, according to the data description information of the data type in the interface protocol appointed content, the analog data conforming to the protocol is automatically generated 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.
Fig. 3 is a block diagram of an electronic device, according to an example embodiment. Referring to fig. 3, the electronic device 50 includes an acquisition module 51 and a processing module 52.
The acquisition module 51 is configured to execute the interface protocol description information of the acquisition 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 that respectively invokes each data type to generate one or more target data; wherein, each target data accords with 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.
The processing module 52 is further configured to perform combining the one or more target data to generate simulated data for the target object.
In one possible implementation, the interface protocol description information includes arrangement 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 simulated data for the target object.
In one possible implementation, the processing module 52 is specifically configured to obtain, from the interface protocol description information, data type information corresponding to each of the one or more data types; and calling the 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 one or more data generation functions corresponding to the data types.
In one possible implementation, the one or more data types include at least one of: number type, string type, boolean value type.
In one possible implementation, the processing module 52 is specifically configured to perform:
Under the condition that the data type is a 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 the data description information corresponding to the character string type;
And under the condition that the data type is a Boolean value type, generating a random Boolean value which accords with the data description information corresponding to the Boolean value type.
The specific manner in which the various modules perform the operations in the apparatus of the above embodiments have been described in detail in connection with the embodiments of the method, and will not be described in detail herein.
According to the scheme, 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 types in the interface protocol contract content, and the data is not required to be written manually, so that the reliability of the contract 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 used as an example, and in practical application, the above functional allocation may be implemented by different functional modules according to needs, that is, the internal structure of the electronic device is divided into different functional modules, so as to implement all or part of the functions described above.
Fig. 4 is a schematic diagram of an electronic device according to an exemplary embodiment. Electronic device 100 includes, but is not limited to, a cell phone, tablet, notebook, palm top, car terminal, wearable device, pedometer, etc. As shown in fig. 4, the electronic device 100 includes, but is not limited to: processor 101, memory 102, display 103, input unit 104, output unit 105, network unit 106, interface unit 107, radio frequency unit 108, power supply 109, and sensor 110, etc.
It should be noted that, as those skilled in the art will appreciate, the structure of the electronic device 100 shown in fig. 4 does not constitute a limitation of 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 have a different arrangement of components.
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 for starting shooting video in response to a shooting input of a user on a shooting preview interface, and keeping displaying at least one duration tab; and responding to the first input of the user to the target time length label in the at least one time length label, and shooting the video in the target shooting time length corresponding to the target time length label.
It should be noted that, the above electronic device 100 can implement each process implemented by the electronic device in the above method embodiment, and achieve the same technical effects, and detailed descriptions thereof are omitted to avoid repetition.
The processor 101 is a control center of the electronic device 100, connects various parts of the entire electronic device 100 using 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. The processor 101 may include one or more processing units; alternatively, the processor 101 may integrate an application processor that primarily handles operating systems, user interfaces, applications, etc., with a modem processor that primarily 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 storage program area and a storage data area, wherein the storage program area may store an operating system, an application program (such as a sound playing function, an image playing function, etc.) required for at least one function, and the like; the storage data area may store data (such as audio data, phonebook, etc.) created according to the use of the handset, etc. In addition, 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 is used to display information input by a user or information provided to the user. The display 103 may include a display panel, which may be configured in the form of a Liquid crystal display (Liquid CRYSTAL DISPLAY, LCD), an Organic Light-Emitting Diode (OLED), or the like.
The input unit 104 may be used to receive audio or video signals. The input unit 104 may include a graphics processor (Graphics Processing Unit, GPU) and a microphone, the graphics processor processing image data of still pictures or video obtained by an image capturing device (e.g., a camera) in a video capturing mode or an image capturing mode. The processed image frames may be displayed on the display 103. The image frames processed by the graphics processor may be stored in memory 102 (or other storage medium) or transmitted via radio frequency unit 108 or network unit 106. The microphone may receive sound and may be capable of processing such sound into audio data. The processed audio data may be converted in the case of a telephone call mode into a format output that may be transmitted to a mobile communication base station via the radio frequency unit 108.
The input unit 104 may be a user input unit operable to receive input numeric or character information and to generate key signal inputs related to user settings and function control of the electronic device 100. Specifically, the user input unit includes a touch panel and other input devices. Touch panels, also known as touch screens, may collect touch operations on or near a user (e.g., operations of the user on or near the touch panel using any suitable object or accessory such as a finger, stylus, etc.). The touch panel may include two parts, a touch detection device and a touch controller. The touch detection device detects the touch azimuth 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 detection device, converts the touch information into touch point coordinates, sends the touch point coordinates to the processor 101, and receives and executes commands sent by the processor 101. In addition, the touch panel may be implemented in various types such as resistive, capacitive, infrared, and surface acoustic wave. The user input unit may include other input devices in addition to the touch panel. In particular, other input devices may include, but are not limited to, physical keyboards, function keys (e.g., volume control keys, switch keys, etc.), trackballs, mice, levers, and so forth, 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 thereabout, the touch panel is transferred to the processor 101 to determine the type of touch event, and then the processor 101 provides a corresponding visual output on the display panel according to the type of 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 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 that 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 (e.g., a call signal reception sound, a message reception sound, etc.) related to a specific function performed by the electronic device 100. The audio output unit includes a speaker, a buzzer, a receiver, and the like.
The electronic device 100 provides wireless broadband internet access to users via the network element 106, such as helping users to email, browse web pages, access streaming media, and the like.
The interface unit 107 is an interface to which an external device is connected to the electronic apparatus 100. For example, the external devices may include a wired or wireless headset port, an external power (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 an external device.
The radio frequency unit 108 may be used for receiving and transmitting signals during the process of receiving and transmitting information or communication, specifically, receiving downlink data from the base station, and then processing the downlink data for the processor 101; and, the uplink data is transmitted to the base station. Typically, the 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 may also communicate with networks and other devices via a wireless communication system.
A power supply 109 (e.g., a battery) may be used to power 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 perform functions of managing charging, discharging, and power consumption management 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 and a proximity sensor, wherein the ambient light sensor can adjust the brightness of the display panel according to the brightness of ambient light, and the proximity sensor can turn off the display panel and/or the backlight when the electronic device 100 is moved to the ear. As one of the motion sensors, the accelerometer sensor can detect the acceleration in all directions (generally three axes), and can detect the gravity and direction when stationary, and can be used for recognizing the gesture of the electronic equipment (such as horizontal and vertical screen switching, related games, magnetometer gesture calibration), vibration recognition related functions (such as pedometer and knocking), and the like; the sensor 110 may further 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 are not described herein.
In addition, the electronic device 100 includes some functional modules (e.g., a camera) that are not shown, and will not be described herein.
In an exemplary embodiment, the disclosed embodiments also provide a storage medium including instructions, such as memory 102 including instructions, executable by processor 101 of 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, read-Only Memory (ROM), random-access Memory (Random Access Memory, RAM), CD-ROM, magnetic tape, floppy disk, 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, when the instructions in the storage medium or one or more instructions in the computer program product are executed by the processor 101, the processes of the foregoing method embodiments are implemented, and the same technical effects can be achieved, so that repetition is avoided, and further description is omitted here.
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 adaptations, 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 is to be understood that the present disclosure is not limited to the precise arrangements and instrumentalities shown in the drawings, and that various modifications and changes may be effected without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims (8)

1. A data generation method, comprising:
Acquiring interface protocol description information of a target object; the interface protocol description information includes: one or more data types, data description information corresponding to each data type, arrangement sequence information of each data type, and data size information of each data type; the one or more data types include at least one of: number type, string type, boolean value type; the data size information corresponding to the number type is used for indicating the range of the preset compliance number; the data size information corresponding to the character string type is used for indicating the length range of the pre-agreed character string;
Respectively calling a data generating function corresponding to each data type to generate one or more target data; wherein, each target data accords with the data description information of the corresponding data type and the data size 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 target data generated for the number type is in the range of the preset compliance number, and the target data generated for the character string type is in the range of the length of the preset character string;
And combining the one or more target data according to the arrangement sequence information to generate simulation data of the target object.
2. The method for generating data according to claim 1, wherein the calling the data generating function corresponding to each data type specifically comprises:
Acquiring data type information corresponding to each of the one or more data types from the interface protocol description information;
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;
The data generating function library comprises data generating functions corresponding to the one or more data types.
3. The method for generating data according to claim 1 or 2, wherein the step of generating one or more target data by calling a data generating function corresponding to each data type, respectively, specifically comprises:
generating a random number conforming to data description information corresponding to the digital type under the condition that the data type is the digital type;
Generating a random character string conforming to data description information corresponding to the character string type under the condition that the data type is the character string type;
and under the condition that the data type is a Boolean value type, generating a random Boolean value which accords with the data description information corresponding to the Boolean value type.
4. The data generation device is characterized by comprising an acquisition module and a processing module;
The acquisition module is configured to execute the interface protocol description information of the acquisition target object; the interface protocol description information includes: one or more data types, data description information corresponding to each data type, arrangement sequence information of each data type, and data size information of each data type; the one or more data types include at least one of: number type, string type, boolean value type; the data size information corresponding to the number type is used for indicating the range of the preset compliance number; the data size information corresponding to the character string type is used for indicating the length range of the pre-agreed character string;
The processing module is configured to execute a data generation function corresponding to each data type to generate one or more target data; wherein, each target data accords with the data description information of the corresponding data type and the data size 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 target data generated for the number type is in the range of the preset compliance number, and the target data generated for the character string type is in the range of the length of the preset character string;
the processing module is further configured to perform combining the one or more target data according to the arrangement order information to generate simulated data of the target object.
5. The data generation device of claim 4, wherein the processing module is specifically configured to perform obtaining data type information for one or more data types from the interface protocol description information; 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;
The data generating function library comprises data generating functions corresponding to the one or more data types.
6. The data generating apparatus according to claim 4 or 5, wherein the processing module is specifically configured to perform:
generating a random number conforming to data description information corresponding to the digital type under the condition that the data type is the digital type;
Generating a random character string conforming to data description information corresponding to the character string type under the condition that the data type is the character string type;
and under the condition that the data type is a Boolean value type, generating a random Boolean value which accords with the data description information corresponding to the Boolean value type.
7. 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 one of claims 1 to 3.
8. A storage medium, characterized in that instructions in the storage medium, when executed by a processor of an electronic device, enable the electronic device to perform the data generation method of any one of claims 1 to 3.
CN202010191648.7A 2020-03-18 2020-03-18 Data generation method, device, electronic equipment and storage medium Active CN111399819B (en)

Priority Applications (1)

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

Applications Claiming Priority (1)

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

Publications (2)

Publication Number Publication Date
CN111399819A CN111399819A (en) 2020-07-10
CN111399819B true CN111399819B (en) 2024-04-30

Family

ID=71436437

Family Applications (1)

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

Country Status (1)

Country Link
CN (1) CN111399819B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114385384B (en) * 2021-12-28 2023-11-21 联通智网科技股份有限公司 Application programming interface calling method and related equipment
CN114513264B (en) * 2022-02-16 2024-01-30 西安市科楠科技开发有限公司 Device and method for generating simulation data of remote sensing satellite
CN114741285A (en) * 2022-03-30 2022-07-12 阿波罗智联(北京)科技有限公司 Method, device, electronic equipment and computer program product for processing data

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8555264B2 (en) * 2011-01-14 2013-10-08 Oracle International Corporation System and method for efficient compilation and invocation of function type calls

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
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

Also Published As

Publication number Publication date
CN111399819A (en) 2020-07-10

Similar Documents

Publication Publication Date Title
CN111049979B (en) Application sharing method, electronic equipment and computer readable storage medium
CN109768926B (en) Data processing method, terminal equipment and computer readable storage medium
CN111399819B (en) Data generation method, device, electronic equipment and storage medium
CN112084747B (en) Resource management method and device, electronic equipment and storage medium
CN109240577B (en) Screen capturing method and terminal
CN109885257B (en) Disk file reading and writing method and device
CN108984066B (en) Application icon display method and mobile terminal
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
CN108616772B (en) Bullet screen display method, terminal and server
CN110096203B (en) Screenshot method and mobile terminal
CN111143002A (en) Application sharing method, electronic equipment and computer readable storage medium
CN109495638B (en) Information display method and terminal
WO2021143669A1 (en) Method for acquiring configuration information and electronic device
WO2021208890A1 (en) Screen capturing method and electronic device
CN107765954B (en) Application icon updating method, mobile terminal and server
CN111163449B (en) Application sharing method, first electronic device and computer-readable storage medium
CN113407169B (en) Software development method and device
CN110505660B (en) Network rate adjusting method and terminal equipment
CN109597546B (en) Icon processing method and terminal equipment
CN109063079B (en) Webpage labeling method and electronic equipment
CN105335434B (en) Log management method and device and electronic equipment
CN111752688B (en) Data acquisition method and device, electronic equipment and storage medium
CN111447598B (en) Interaction method and display device
CN111163227B (en) Sharing 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
GR01 Patent grant
GR01 Patent grant