CN113536178A - Page data generation method and device, electronic medium and storage medium - Google Patents
Page data generation method and device, electronic medium and storage medium Download PDFInfo
- Publication number
- CN113536178A CN113536178A CN202110625838.XA CN202110625838A CN113536178A CN 113536178 A CN113536178 A CN 113536178A CN 202110625838 A CN202110625838 A CN 202110625838A CN 113536178 A CN113536178 A CN 113536178A
- Authority
- CN
- China
- Prior art keywords
- page
- data
- forgery
- page data
- interceptor
- 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.)
- Granted
Links
- 238000000034 method Methods 0.000 title claims abstract description 45
- 238000003860 storage Methods 0.000 title claims abstract description 10
- 238000004590 computer program Methods 0.000 claims description 9
- 238000005242 forging Methods 0.000 claims description 8
- 238000012545 processing Methods 0.000 claims description 6
- 230000005540 biological transmission Effects 0.000 claims description 4
- 238000012360 testing method Methods 0.000 abstract description 6
- 229940004975 interceptor Drugs 0.000 description 9
- 238000011161 development Methods 0.000 description 7
- 238000004891 communication Methods 0.000 description 6
- 238000010586 diagram Methods 0.000 description 5
- 238000009877 rendering Methods 0.000 description 4
- 230000009471 action Effects 0.000 description 3
- 230000000694 effects Effects 0.000 description 3
- 230000004807 localization Effects 0.000 description 3
- 230000008569 process Effects 0.000 description 3
- 230000006855 networking Effects 0.000 description 2
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000010276 construction Methods 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 230000006870 function Effects 0.000 description 1
- 238000004519 manufacturing process Methods 0.000 description 1
- 238000012986 modification Methods 0.000 description 1
- 230000004048 modification Effects 0.000 description 1
- 230000003287 optical effect Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/95—Retrieval from the web
- G06F16/958—Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/90—Details of database functions independent of the retrieved data types
- G06F16/95—Retrieval from the web
- G06F16/957—Browsing optimisation, e.g. caching or content distillation
Landscapes
- Engineering & Computer Science (AREA)
- Databases & Information Systems (AREA)
- Theoretical Computer Science (AREA)
- Data Mining & Analysis (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
Abstract
The embodiment of the invention provides a page data generation method, a page data generation device, electronic equipment and a storage medium, wherein the page data generation method comprises the following steps: setting a first interceptor; the first interceptor is used for intercepting a page data request sent by a business page end to a server; determining whether a page data request intercepted by a first interceptor contains data forgery annotation information, if so, acquiring page forgery data corresponding to the page data request from a local resource directory according to a file name contained in the data forgery annotation information; and sending the page forgery data to the service page end so as to render the page by the service page end. The embodiment can forge page data locally without depending on a server, so that the debugging and testing requirements of the page are met.
Description
Technical Field
The present invention relates to the field of computer technologies, and in particular, to a method and an apparatus for generating page data, an electronic device, and a storage medium.
Background
And the data on the page of the APP is acquired from the back-end server through a network request. When a page is newly added to the APP, development and test work of the APP side and the server side needs to be performed. In the development stage of a new page, an APP end engineer and a server end engineer need to define a protocol of page data, usually a character string in a Json format, a server is responsible for producing the character string, and the APP end is responsible for parsing the character string and rendering the character string to a UI element of the page. The APP end and the server end are developed in parallel usually, so that after the APP end completes the construction of the page, the server end does not necessarily complete the development, and the page of the APP end does not have a data source at this time, so that the debugging and the testing of the page cannot be performed, and the development can be continued only after the server is relied on. Therefore, data forgery (hereinafter abbreviated as Mock) needs to be performed without depending on a server, so as to meet the requirement that the APP side performs debugging and testing by using Mock data.
However, there are two types of Mock schemes commonly used at present, the first is a stand-alone Mock data platform, which has the following disadvantages: a large development cost is required; the APP end has access cost; the APP end needs to be used in a networking mode, single-page Mock cannot be conducted, namely all pages can use Mock data if a Mock server is used. The second type uses a bale plucker Mock, such as charles, which has the disadvantages that: bale plucking tools often require high costs; the APP end needs to be used in a networking mode; the functions supported by the bag grabbing tool are few, data are scattered and are not easy to maintain, and additional configuration operation is needed when the mobile phone and the computer are used.
Disclosure of Invention
To solve the problems in the prior art, embodiments of the present invention provide a page data generation method and apparatus, an electronic device, and a storage medium.
In a first aspect, an embodiment of the present invention provides a page data generating method, applied to a terminal device, including:
setting a first interceptor; the first interceptor is used for intercepting a page data request sent by a business page end to a server;
determining whether a page data request intercepted by a first interceptor contains data forgery annotation information, if so, acquiring page forgery data corresponding to the page data request from a local resource directory according to a file name contained in the data forgery annotation information;
and sending the page forgery data to the service page end so as to render the page by the service page end.
Further, the method further comprises:
adding a label in the page data request, wherein the attribute of the label is an Invocation object;
correspondingly, determining whether the page data request intercepted by the first interceptor contains data forgery annotation information specifically includes:
and determining whether the page data request intercepted by the first interceptor contains data forgery annotation information or not based on the Invocation object in the tag.
Further, the method further comprises:
if the fact that the page data request intercepted by the first interceptor does not contain data forgery annotation information is determined, the page data request is transmitted to the second interceptor; the second interceptor is used for requesting the server to obtain the page data corresponding to the page data request.
Further, the obtaining, according to the file name included in the data falsification annotation information, the page falsification data corresponding to the page data request from the local resource directory specifically includes:
and acquiring page forgery data corresponding to the page data request from a json file under a local resource directory according to the json file name contained in the data forgery annotation information.
In a second aspect, an embodiment of the present invention provides a page data generating apparatus, which is applied to a terminal device, and includes:
the setting module is used for setting a first interceptor; the first interceptor is used for intercepting a page data request sent by a business page end to a server;
the judging module is used for determining whether the page data request intercepted by the first interceptor contains data forgery annotation information, and if so, acquiring page forgery data corresponding to the page data request from a local resource directory according to a file name contained in the data forgery annotation information;
and the data returning and forging module is used for sending the page forging data to the service page end so as to render the page by the service page end.
Further, the apparatus further comprises:
the system comprises a configuration module, a data processing module and a data processing module, wherein the configuration module is used for adding a label in a page data request, and the attribute of the label is an Invocation object;
correspondingly, when determining whether the page data request intercepted by the first interceptor includes the data falsification annotation information, the determining module is specifically configured to:
and determining whether the page data request intercepted by the first interceptor contains data forgery annotation information or not based on the Invocation object in the tag.
Further, the apparatus further comprises:
the transmission module is used for transmitting the page data request to a second interceptor if the page data request intercepted by the first interceptor does not contain data forgery annotation information; the second interceptor is used for requesting the server to obtain the page data corresponding to the page data request.
Further, when the determining module obtains the page falsification data corresponding to the page data request from the local resource directory according to the file name included in the data falsification annotation information, the determining module is specifically configured to:
and acquiring page forgery data corresponding to the page data request from a json file under a local resource directory according to the json file name contained in the data forgery annotation information.
In a third aspect, an embodiment of the present invention further provides an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor implements the steps of the page data generation method according to the first aspect when executing the program.
In a fourth aspect, the present invention further provides a non-transitory computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the steps of the page data generating method according to the first aspect.
According to the technical scheme, the page data generation method, the page data generation device, the electronic equipment and the storage medium provided by the embodiment of the invention have the advantages that the first interceptor is arranged in the okhttp network library; the first interceptor is used for intercepting a page data request sent by a business page end to a server, and further determining whether the page data request intercepted by the first interceptor contains data forgery annotation information, if so, acquiring page forgery data corresponding to the page data request from a local resource directory according to a file name contained in the data forgery annotation information; therefore, the page counterfeiting data are sent to the business page end to be used for the business page end to perform page rendering, the embodiment of the invention does not need to rely on a server, the page data are forged locally, the page debugging and testing requirements are performed by using the forged data, and further, the embodiment of the invention can locally and automatically forge the page data, so that only the APP end needs to be developed, the server does not need to be developed and deployed, and the development cost is very low; when an APP developer wants to forge data, the data can be forged by simply adding one piece of data forging annotation information, so that the effects of configuration, localization and single interface forging are really achieved, the data can be opened or closed only through simple configuration without complex operation, and meanwhile, the APP end can be used without a network; the forged data can be uniformly managed and maintained.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to these drawings without creative efforts.
Fig. 1 is a schematic flowchart of a page data generation method according to an embodiment of the present invention;
fig. 2 is an execution flowchart of a page data generation method according to another embodiment of the present invention;
fig. 3 is a schematic diagram of obtaining data falsification annotation information according to an embodiment of the present invention;
fig. 4 is a schematic diagram of obtaining data falsification annotation information according to another embodiment of the present invention;
fig. 5 is a schematic structural diagram of a page data generation apparatus according to an embodiment of the present invention;
fig. 6 is a schematic physical structure diagram of an electronic device according to an embodiment of the invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are some embodiments, but not all embodiments, of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention. The page data generation method provided by the present invention will be explained and explained in detail by specific embodiments.
Fig. 1 is a schematic flowchart of a page data generation method according to an embodiment of the present invention; as shown in fig. 1, the method includes:
step 101: setting a first interceptor; the first interceptor is used for intercepting a page data request sent by a business page end to a server.
In this step, referring to fig. 2, the modules in fig. 2 are explained first:
detail service page: this is a page (i.e. service page) on an APP, and the service is to show a detailed data, called detail for short;
mock interrupt: this is the interceptor (i.e. the first interceptor) of an okhttp used to implement Mock data in this embodiment;
call Server interrupt: this is an okhttp built-in interceptor (i.e., the second interceptor mentioned in the subsequent embodiments) for requesting the backend server.
In this step, it should be noted that the detail service page initiates a network request to the okhttp web library according to the interface configuration statement of the detail service, and the configuration statement of the interface generally includes a url of the request, a method of the request, a parameter and a value of the request, and the like. In this embodiment, one annotation is customized: @ Mock (data falsification annotation information), the json file name under an assets directory can be specified by the annotation in the interface configuration statement of the service, and the data in other configuration statements can be transmitted to an okhttp network library.
Step 102: and determining whether the page data request intercepted by the first interceptor contains data forgery annotation information, if so, acquiring the page forgery data corresponding to the page data request from a local resource directory according to the file name contained in the data forgery annotation information.
In this step, it should be noted that after the Mock Interceptor (first Interceptor) of the okhttp web library obtains the request sent by the service, it analyzes the request, and determines whether there is the data falsification annotation information @ Mock.
If the fact that the page data request intercepted by the first Interceptor contains data forgery annotation information is determined, the Mock Interceptor loads the page data request from the local resource directory according to the json file name specified by @ Mock, obtains the page forgery data corresponding to the page data request, and analyzes the content of the page forgery data to return.
Step 103: and sending the page forgery data to the service page end so as to render the page by the service page end.
In this step, it can be understood that the Mock Interceptor returns the data parsed from the json file to the detail service page, which is the Mock data (i.e. the page falsification data).
Therefore, by adopting the scheme provided by the embodiment, for APP developers to use Mock data, only one @ Mock annotation needs to be simply added to a page data request, and the effects of configuration, localization and single-interface Mock are really achieved.
According to the technical scheme, the page data generation method provided by the embodiment of the invention has the advantages that the first interceptor is arranged in the okhttp web library; the first interceptor is used for intercepting a page data request sent by a business page end to a server, and further determining whether the page data request intercepted by the first interceptor contains data forgery annotation information, if so, acquiring page forgery data corresponding to the page data request from a local resource directory according to a file name contained in the data forgery annotation information; therefore, the page counterfeiting data are sent to the business page end to be used for the business page end to perform page rendering, the embodiment of the invention does not need to rely on a server, the page data are forged locally, the page debugging and testing requirements are performed by using the forged data, and further, the embodiment of the invention can locally and automatically forge the page data, so that only the APP end needs to be developed, the server does not need to be developed and deployed, and the development cost is very low; when an APP developer wants to forge data, the data can be forged by simply adding one piece of data forging annotation information, so that the effects of configuration, localization and single interface forging are really achieved, the data can be opened or closed only through simple configuration without complex operation, and meanwhile, the APP end can be used without a network; the forged data can be uniformly managed and maintained.
On the basis of the foregoing embodiment, in this embodiment, the method further includes:
adding a label in the page data request, wherein the attribute of the label is an Invocation object;
correspondingly, determining whether the page data request intercepted by the first interceptor contains data forgery annotation information specifically includes:
and determining whether the page data request intercepted by the first interceptor contains data forgery annotation information or not based on the Invocation object in the tag.
In this embodiment, referring to fig. 3 and fig. 4, it should be noted that the detail interface configuration statement is to add a custom comment and a value to the interface configuration method of retrofit; the Mock Intercetpor is an interceptor of okhttp, where this annotation and value need to be received and then processed. However, as shown in fig. 3, the annotation information on the retrofit interface configuration method is converted into a Call by the CallAdapter, and is completely lost, and after the Call is executed and reaches the interceptor of the okhttp, only one Request object remains, so that how to obtain the annotation information in the retrofit is a difficult problem. To solve this problem, the new property of retrofit2.5 is used in this embodiment: invocation, so that annotation information can be obtained simply and conveniently; specifically, as shown in fig. 4, OkHttpCall of retrofit adds a tag to a Request when the Request is newly created; the value of the tag is an Invocation object, which contains the interface configuration method and all annotation and parameter lists, so that in the okhttp interceptor, the @ Mock annotation can be taken out only by taking out the tag of the Request object. When a page is opened, the page data generation method provided by the embodiment of the invention can add a label to which interface according to which interface the Mock is required to add, and can give all interfaces of the page the Mock, so that the APP end can independently play a certain page.
On the basis of the above embodiment, in this embodiment, the method further includes:
the method further comprises the following steps:
if the fact that the page data request intercepted by the first interceptor does not contain data forgery annotation information is determined, the page data request is transmitted to the second interceptor; the second interceptor is used for requesting the server to obtain the page data corresponding to the page data request.
In this embodiment, for example, referring to fig. 2, if it is determined that the page data request intercepted by the first Interceptor does not include data falsification annotation information, the page data request is transmitted to the second Interceptor, such as a Call Server interrupt, that is, the Call Server interrupt that requests the backend Server arrives, the second Interceptor (Call Server interrupt) requests the backend Server, and the obtained data is returned to the detail service page, which is real data.
On the basis of the foregoing embodiment, in this embodiment, the acquiring, according to the file name included in the data falsification annotation information, the page falsification data corresponding to the page data request from the local resource directory specifically includes:
and acquiring page forgery data corresponding to the page data request from a json file under a local resource directory according to the json file name contained in the data forgery annotation information.
In this implementation, it can be understood that the comment may be used in the interface configuration statement of the service to specify a json file name in an assets directory, and this data and data in other configuration statements are all transmitted to the okhttp web library, so as to obtain the page falsification data corresponding to the page data request from the json file in the local resource directory.
In order to better understand the present invention, the following examples are further provided to illustrate the present invention, but the present invention is not limited to the following examples.
Step 1: the detail service page initiates a network request to the okhttp network library according to the interface configuration statement of the detail service, and the configuration statement of the interface generally comprises a request url, a request method, a request parameter, a request value and the like. In this embodiment, an annotation is customized: @ Mock, the json file name under an assets directory can be specified by using the annotation in the interface configuration statement of the service, and the data in other configuration statements can be transmitted to an okhttp network library.
Step 2: and (3) after the Mock interrupt of the okhttp network base obtains the request sent by the service, analyzing the request, judging whether the annotation data of the @ Mock exists, if not, going to the next step (3), and if so, going to the next step (5).
And step 3: if the annotation data of @ Mock is not available, the Mock Interreceptor does nothing, and the next Interceptor is continuously called, namely the Call Server Interreceptor of the request background Server is reached.
And 4, step 4: the Call Server interrupt requests the background Server, and returns the acquired data to the detail service page, which is real data.
And 5: if the annotation data of @ Mock exists, the Mock Interreceptor loads the annotation data from the assets directory according to the json file name specified by @ Mock, and analyzes the content of the annotation data to return.
Step 6: and the Mock interrupt returns the data analyzed from the json file to the detail service page, which is the Mock data.
Fig. 5 is a schematic structural diagram of a page data generating apparatus according to an embodiment of the present invention, and as shown in fig. 5, the apparatus includes: a setting module 201, a judging module 202 and a returning counterfeit data module 203, wherein:
the setting module 201 is configured to set a first interceptor; the first interceptor is used for intercepting a page data request sent by a business page end to a server;
the judging module 202 is configured to determine whether a page data request intercepted by a first interceptor includes data forgery annotation information, and if so, obtain page forgery data corresponding to the page data request from a local resource directory according to a file name included in the data forgery annotation information;
and a return-to-counterfeit data module 203, configured to send the page-counterfeit data to the service page end, so that the service page end performs page rendering.
On the basis of the above embodiment, in this embodiment, the apparatus further includes:
the system comprises a configuration module, a data processing module and a data processing module, wherein the configuration module is used for adding a label in a page data request, and the attribute of the label is an Invocation object;
correspondingly, when determining whether the page data request intercepted by the first interceptor includes the data falsification annotation information, the determining module is specifically configured to:
and determining whether the page data request intercepted by the first interceptor contains data forgery annotation information or not based on the Invocation object in the tag.
On the basis of the above embodiment, in this embodiment, the apparatus further includes:
the transmission module is used for transmitting the page data request to a second interceptor if the page data request intercepted by the first interceptor does not contain data forgery annotation information; the second interceptor is used for requesting the server to obtain the page data corresponding to the page data request.
On the basis of the foregoing embodiment, in this embodiment, when the determining module acquires the page falsification data corresponding to the page data request from the local resource directory according to the file name included in the data falsification annotation information, the determining module is specifically configured to:
and acquiring page forgery data corresponding to the page data request from a json file under a local resource directory according to the json file name contained in the data forgery annotation information.
The page data generation apparatus provided in the embodiment of the present invention may be specifically configured to execute the page data generation method in the foregoing embodiment, and the technical principle and the beneficial effect thereof are similar, and reference may be specifically made to the foregoing embodiment, which is not described herein again.
Based on the same inventive concept, an embodiment of the present invention provides an electronic device, which specifically includes the following components, with reference to fig. 6: a processor 301, a memory 302, a communication interface 303, and a communication bus 304;
the processor 301, the communication interface 303 and the memory 302 complete mutual communication through the communication bus 304; the communication interface 303 is used for realizing information transmission between related devices such as modeling software, an intelligent manufacturing equipment module library and the like; the processor 301 is used for calling the computer program in the memory 302, and the processor executes the computer program to implement the method provided by the above method embodiments, for example, the processor executes the computer program to implement the following steps: setting a first interceptor; the first interceptor is used for intercepting a page data request sent by a business page end to a server; determining whether a page data request intercepted by a first interceptor contains data forgery annotation information, if so, acquiring page forgery data corresponding to the page data request from a local resource directory according to a file name contained in the data forgery annotation information; and sending the page forgery data to the service page end so as to render the page by the service page end.
Based on the same inventive concept, yet another embodiment of the present invention further provides a non-transitory computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, is implemented to perform the methods provided by the above method embodiments, for example, setting a first interceptor; the first interceptor is used for intercepting a page data request sent by a business page end to a server; determining whether a page data request intercepted by a first interceptor contains data forgery annotation information, if so, acquiring page forgery data corresponding to the page data request from a local resource directory according to a file name contained in the data forgery annotation information; and sending the page forgery data to the service page end so as to render the page by the service page end.
The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and the parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware. With this understanding in mind, the above-described technical solutions may be embodied in the form of a software product, which can be stored in a computer-readable storage medium, such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods of the various embodiments or some parts of the embodiments.
In addition, in the present invention, terms such as "first" and "second" are used for descriptive purposes only and are not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one such feature. In the description of the present invention, "a plurality" means at least two, e.g., two, three, etc., unless specifically limited otherwise.
Moreover, in the present invention, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
Furthermore, in the description herein, reference to the description of the term "one embodiment," "some embodiments," "an example," "a specific example," or "some examples," etc., means that a particular feature, structure, material, or characteristic described in connection with the embodiment or example is included in at least one embodiment or example of the invention. In this specification, the schematic representations of the terms used above are not necessarily intended to refer to the same embodiment or example. Furthermore, the particular features, structures, materials, or characteristics described may be combined in any suitable manner in any one or more embodiments or examples. Furthermore, various embodiments or examples and features of different embodiments or examples described in this specification can be combined and combined by one skilled in the art without contradiction.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.
Claims (10)
1. A page data generation method is applied to terminal equipment and comprises the following steps:
setting a first interceptor; the first interceptor is used for intercepting a page data request sent by a business page end to a server;
determining whether a page data request intercepted by a first interceptor contains data forgery annotation information, if so, acquiring page forgery data corresponding to the page data request from a local resource directory according to a file name contained in the data forgery annotation information;
and sending the page forgery data to the service page end so as to render the page by the service page end.
2. The page data generation method according to claim 1, further comprising:
adding a label in the page data request, wherein the attribute of the label is an Invocation object;
correspondingly, determining whether the page data request intercepted by the first interceptor contains data forgery annotation information specifically includes:
and determining whether the page data request intercepted by the first interceptor contains data forgery annotation information or not based on the Invocation object in the tag.
3. The page data generation method according to claim 1, further comprising:
if the fact that the page data request intercepted by the first interceptor does not contain data forgery annotation information is determined, the page data request is transmitted to the second interceptor; the second interceptor is used for requesting the server to obtain the page data corresponding to the page data request.
4. The method for generating page data according to claim 1, wherein the obtaining, according to a file name included in the data forgery annotation information, page forgery data corresponding to the page data request from a local resource directory specifically includes:
and acquiring page forgery data corresponding to the page data request from a json file under a local resource directory according to the json file name contained in the data forgery annotation information.
5. A page data generating device is applied to a terminal device and comprises:
the setting module is used for setting a first interceptor; the first interceptor is used for intercepting a page data request sent by a business page end to a server;
the judging module is used for determining whether the page data request intercepted by the first interceptor contains data forgery annotation information, and if so, acquiring page forgery data corresponding to the page data request from a local resource directory according to a file name contained in the data forgery annotation information;
and the data returning and forging module is used for sending the page forging data to the service page end so as to render the page by the service page end.
6. The page data generation apparatus according to claim 5, wherein said apparatus further comprises:
the system comprises a configuration module, a data processing module and a data processing module, wherein the configuration module is used for adding a label in a page data request, and the attribute of the label is an Invocation object;
correspondingly, when determining whether the page data request intercepted by the first interceptor includes the data falsification annotation information, the determining module is specifically configured to:
and determining whether the page data request intercepted by the first interceptor contains data forgery annotation information or not based on the Invocation object in the tag.
7. The page data generation apparatus according to claim 5, wherein said apparatus further comprises:
the transmission module is used for transmitting the page data request to a second interceptor if the page data request intercepted by the first interceptor does not contain data forgery annotation information; the second interceptor is used for requesting the server to obtain the page data corresponding to the page data request.
8. The page data generation apparatus according to claim 5, wherein the determining module, when executing acquiring, from a local resource directory, the page falsification data corresponding to the page data request according to the file name included in the data falsification annotation information, is specifically configured to:
and acquiring page forgery data corresponding to the page data request from a json file under a local resource directory according to the json file name contained in the data forgery annotation information.
9. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the processor implements the steps of the page data generating method according to any one of claims 1 to 4 when executing the program.
10. A non-transitory computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the steps of the page data generation method according to any one of claims 1 to 4.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110625838.XA CN113536178B (en) | 2021-06-04 | 2021-06-04 | Page data generation method and device, electronic medium and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202110625838.XA CN113536178B (en) | 2021-06-04 | 2021-06-04 | Page data generation method and device, electronic medium and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN113536178A true CN113536178A (en) | 2021-10-22 |
CN113536178B CN113536178B (en) | 2024-04-12 |
Family
ID=78095193
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202110625838.XA Active CN113536178B (en) | 2021-06-04 | 2021-06-04 | Page data generation method and device, electronic medium and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113536178B (en) |
Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN105138448A (en) * | 2014-06-05 | 2015-12-09 | 北京畅游天下网络技术有限公司 | Method and device for page test at front end |
AU2017204416A1 (en) * | 2011-01-27 | 2017-07-20 | Amplifier Marketing Pty Limited | Method and system for providing content |
CN106970873A (en) * | 2017-01-10 | 2017-07-21 | 阿里巴巴集团控股有限公司 | Mock method of testings, apparatus and system on line |
CN107368405A (en) * | 2016-05-11 | 2017-11-21 | 腾讯科技(北京)有限公司 | Test system, method of testing, mock platforms, blocker and client |
CN110008117A (en) * | 2019-03-12 | 2019-07-12 | 深圳壹账通智能科技有限公司 | Page test method, device, computer equipment and storage medium |
CN111597110A (en) * | 2020-04-27 | 2020-08-28 | 五八有限公司 | Page testing method and device, electronic equipment and storage medium |
CN112131118A (en) * | 2020-09-25 | 2020-12-25 | 平安国际智慧城市科技股份有限公司 | Mock testing method, Mock testing device, electronic equipment and computer readable storage medium |
CN112487324A (en) * | 2020-10-28 | 2021-03-12 | 贝壳技术有限公司 | Page generation method and device, electronic medium and storage medium |
-
2021
- 2021-06-04 CN CN202110625838.XA patent/CN113536178B/en active Active
Patent Citations (8)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
AU2017204416A1 (en) * | 2011-01-27 | 2017-07-20 | Amplifier Marketing Pty Limited | Method and system for providing content |
CN105138448A (en) * | 2014-06-05 | 2015-12-09 | 北京畅游天下网络技术有限公司 | Method and device for page test at front end |
CN107368405A (en) * | 2016-05-11 | 2017-11-21 | 腾讯科技(北京)有限公司 | Test system, method of testing, mock platforms, blocker and client |
CN106970873A (en) * | 2017-01-10 | 2017-07-21 | 阿里巴巴集团控股有限公司 | Mock method of testings, apparatus and system on line |
CN110008117A (en) * | 2019-03-12 | 2019-07-12 | 深圳壹账通智能科技有限公司 | Page test method, device, computer equipment and storage medium |
CN111597110A (en) * | 2020-04-27 | 2020-08-28 | 五八有限公司 | Page testing method and device, electronic equipment and storage medium |
CN112131118A (en) * | 2020-09-25 | 2020-12-25 | 平安国际智慧城市科技股份有限公司 | Mock testing method, Mock testing device, electronic equipment and computer readable storage medium |
CN112487324A (en) * | 2020-10-28 | 2021-03-12 | 贝壳技术有限公司 | Page generation method and device, electronic medium and storage medium |
Non-Patent Citations (4)
Title |
---|
BLACKJULYWATHCER: "OkHttp源码分析 初识结构篇", pages 1 - 3, Retrieved from the Internet <URL:《https://blog.csdn.net/july7watcher/article/details/89532924》> * |
FENG HUANG 等: "Experimental study on the preload and afterload responses of a pneumatic mock right ventricle", 《2019 IEEE 8TH INTERNATIONAL CONFERENCE ON FLUID POWER AND MECHATRONICS》, pages 1 - 2 * |
任缥缈: "OKHttp系列十二、CallServerInterceptor服务请求拦截器", pages 1, Retrieved from the Internet <URL:《https://blog.csdn.net/haoyuegongzi/article/details/103518037》> * |
孟燕 等: "自动化测试技术中mock框架的建设与应用", 《武汉理工大学学报》, vol. 39, no. 3, pages 364 - 367 * |
Also Published As
Publication number | Publication date |
---|---|
CN113536178B (en) | 2024-04-12 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
Tao et al. | A reusable software component for integrated syntax and semantic validation for services computing | |
US20090282136A1 (en) | Automatic Generation of Web Service client for Web Services Interoperability Testing | |
US8660833B2 (en) | Method, computer program product and apparatus for providing an interactive network simulator | |
CN110221968A (en) | Method for testing software and Related product | |
CN109683998A (en) | Internationalize implementation method, device and system | |
CN107133180A (en) | Method of testing, test device and the storage medium of dynamic page | |
CN113010827B (en) | Page rendering method and device, electronic equipment and storage medium | |
CN111597110B (en) | Page test method and device, electronic equipment and storage medium | |
US10452730B2 (en) | Methods for analyzing web sites using web services and devices thereof | |
CN110659206A (en) | Simulation architecture establishing method, device, medium and electronic equipment based on microservice | |
CN107870989A (en) | webpage generating method and terminal device | |
CN110598135A (en) | Network request processing method and device, computer readable medium and electronic equipment | |
CN109582317A (en) | Method and apparatus for debugging boarding application | |
CN113989058A (en) | Service generation method and device | |
CN111680247B (en) | Local calling method, device and equipment of webpage character strings and storage medium | |
CN113296752A (en) | Method, system, device and storage medium for generating API document | |
CN111951040A (en) | Information sending method and device, electronic equipment and storage medium | |
CN115934537A (en) | Interface test tool generation method, device, equipment, medium and product | |
CN113536178A (en) | Page data generation method and device, electronic medium and storage medium | |
CN109086145B (en) | Data generation method and device and computer storage medium | |
CN113918245A (en) | Data calling method, device, equipment and computer readable storage medium | |
CN112597036A (en) | Universal baffle testing method and device | |
CN108549706A (en) | A kind of processing method and relevant device of webpage | |
CN117632445B (en) | Request processing method and device, task execution method and device | |
CN115422029A (en) | Interface log document generation method and device and computer 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 | ||
TA01 | Transfer of patent application right | ||
TA01 | Transfer of patent application right |
Effective date of registration: 20240129 Address after: Room 102, 1st Floor, Building 1, No. 2 Chuangye Road, Haidian District, Beijing, 100080 Applicant after: Seashell Housing (Beijing) Technology Co.,Ltd. Country or region after: China Address before: 101309 room 24, 62 Farm Road, Erjie village, Yangzhen, Shunyi District, Beijing Applicant before: Beijing fangjianghu Technology Co.,Ltd. Country or region before: China |
|
GR01 | Patent grant | ||
GR01 | Patent grant |