CN105138448B - A kind of method and apparatus in the head end test page - Google Patents

A kind of method and apparatus in the head end test page Download PDF

Info

Publication number
CN105138448B
CN105138448B CN201410247193.0A CN201410247193A CN105138448B CN 105138448 B CN105138448 B CN 105138448B CN 201410247193 A CN201410247193 A CN 201410247193A CN 105138448 B CN105138448 B CN 105138448B
Authority
CN
China
Prior art keywords
page
test
template
simulation
files
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
CN201410247193.0A
Other languages
Chinese (zh)
Other versions
CN105138448A (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 Changyou Tianxia Network Technologies Co Ltd
Original Assignee
Beijing Changyou Tianxia Network Technologies 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 Changyou Tianxia Network Technologies Co Ltd filed Critical Beijing Changyou Tianxia Network Technologies Co Ltd
Priority to CN201410247193.0A priority Critical patent/CN105138448B/en
Publication of CN105138448A publication Critical patent/CN105138448A/en
Application granted granted Critical
Publication of CN105138448B publication Critical patent/CN105138448B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Debugging And Monitoring (AREA)

Abstract

An embodiment of the present invention provides a kind of method and device of the head end test page, the front and rear end interaction;The method includes:The analog platform parses the simulation files and obtains test simulation data;The file path of the test simulation data and Page Template is sent to template engine;The template engine is used to read the Page Template according to the file path, and according to the test simulation data and the Page Template generation page;Receive the page that the template engine is sent;When receiving test request, the page is tested using the test request.The embodiment of the present invention, in the final required Page Template of head end test generation, reduces byproduct, and the Page Template, so that the exploitation of front end and rear end can carry out parallel, can improve development rate with rear end slitless connection to separate front end and rear end.

Description

A kind of method and apparatus in the head end test page
Technical field
The present invention relates to technical field of internet application, more particularly to a kind of method and one kind in the head end test page In the device of the head end test page.
Background technology
In recent years, self-image, abundant product marketing means, reinforcement and the communication of user are established based on enterprises propagandist The reasons such as convenient webpage channel, it is more and more for the demand of webpage development.Webpage development is to make highly professional webpage, Such as ASP (Active Server Page, Active Server Pages), PHP (Personal Home Page, About You), The dynamic web pages such as JSP (Java Server Pages, Java server-sides webpage).Webpage development is not only webpage art designing and Nei Hold, also relate to domain name registration inquiry, exploitation of function of webpage etc., in order to improve webpage development efficiency, larger tissue and Enterprise, webpage carry out the exploitation of front end and rear end respectively, to improve webpage development efficiency.
At present, there are mainly two types of traditional internet web page development process:
1st, the first is front end according to UI (User Interface, user interface) and UE (User Equipment, user Equipment) static state HTML (Hypertext Markup Language, hypertext markup language) page is made, it consigns to rear end and turns Joint debugging exploitation is carried out into Page Template.Therefore, rear end is required to understand the page structure of front end and code service logic, necessary When need with front-end person who communication cooperate completion cover the page work.
2nd, second is that data-interface is completed in rear end exploitation, and operation project development Page Template is disposed in front end in the machine, together When data-interface and performing environment dependent on rear end, including database, file system, runtime environment or other project systems System interface etc..
Usually after the completion of exploitation, the page of front end and the business function of rear end realize that needs are tested simultaneously, and above two is opened Flow is sent out, front end and rear end are to be required for interdepending, if front end and rear end have a side to go wrong, then the opposing party can It can obtain and accordingly be adjusted.
Such as in the first development process, there are following problems:1), the static HTML page of front end exploitation is not most The production page throughout one's life, it is also necessary to which being changed into rear end after Page Template can just use, therefore workload bigger, and have some pairs Output.2) later maintenance after, the page of final production is reached the standard grade is changed including demand, page revision etc., and front end modification is static After html page, it is also necessary to set page work is repeated in rear end, it is time-consuming and laborious.Particularly with the modification of some details so that whole A process is not quick.3) problem, is susceptible in the rear end cap page, and due to being related in front end and rear end different exploit persons It is higher to link up cost by member.4), behind front end and rear end joint debugging success, the page can just give tester to be tested, therefore open The test job pressure for sending out the later stage is larger.
Therefore, the technical problem that those skilled in the art urgently solve is needed to be exactly at present:It is proposed one kind in front end The mechanism of test page to separate front end and rear end, in the final required Page Template of head end test generation, reduces by-product Product, and the Page Template, so that the exploitation of front end and rear end can carry out parallel, can improve exploitation with rear end slitless connection Speed.
The content of the invention
The embodiment of the present invention is the technical problem to be solved is that a kind of method in the head end test page is provided, to separate Byproduct in the final required Page Template of head end test generation, is reduced in front end and rear end, and the Page Template can with it is rear Slitless connection is held, so that the exploitation of front end and rear end can carry out parallel, improves development rate.
Correspondingly, the embodiment of the present invention additionally provides a kind of device in the head end test page, to ensure the above method Realization and application.
To solve the above-mentioned problems, the invention discloses a kind of method of the head end test page, the front and rear end is handed over Mutually;Include analog platform and template engine in the front end, the template engine is identical with the template engine of the rear end;Institute Stating analog platform includes simulation files and Page Template, and the Page Template has respective file path;
The method includes:
The analog platform parses the simulation files and obtains test simulation data;
The file path of the test simulation data and Page Template is sent to template engine;The template engine is used for The Page Template is read according to the file path, and according to the test simulation data and the Page Template generation page;
Receive the page that the template engine is sent;
When receiving test request, the page is tested using the test request.
Preferably, the analog platform is to develop FED using the front end of meshed network development language node.js exploitations to put down Platform has FED instruments in the FED platforms;The simulation files are simulation mock files, and the analog platform parses the mould The step of intending file acquisition test simulation data includes:
The simulation mock files are parsed using the FED instruments in the FED platforms;
Using the analysis result as test simulation data.
Preferably, the template engine is FreeMarker template engines;It is described by test simulation data and file path The step of being sent to template engine includes:
Create subprocess;
The test simulation data and file path are sent to the FreeMarker templates using the subprocess to draw It holds up.
Preferably, the page is hypertext markup language HTML static pages;It is described when receiving test request, adopt The step of testing the page with the test request includes:
The analog platform receives hypertext transfer protocol HTTP test requests;
The HTML static pages are sent to display according to the HTTP test requests;The display is used for institute HTML static pages are stated to be shown.
Preferably, described when receiving test request, using the test request test the page the step of it Afterwards, further include:
Change the test simulation data in the simulation mock files.
The embodiment of the invention also discloses a kind of device of the head end test page, the front and rear end interaction;Described Front end includes analog platform and template engine, and the template engine is identical with the template engine of the rear end;It is flat in the simulation Platform includes simulation files and Page Template, and the Page Template has respective file path;
The device includes:
Parsing module parses the simulation files for the analog platform and obtains test simulation data;
Sending module, for the file path of the test simulation data and Page Template to be sent to template engine;Institute Template engine is stated for reading the Page Template according to the file path, and according to the test simulation data and page mould Plate generates the page;
Receiving module, for receiving the page that the template engine is sent;
Test module, for when receiving test request, the page to be tested using the test request.
Preferably, the analog platform is to develop FED using the front end of meshed network development language node.js exploitations to put down Platform has FED instruments in the FED platforms;The simulation files are simulation mock files, and the parsing module includes:
Document analysis submodule, for being carried out in the FED platforms using the FED instruments to the simulation mock files Parsing;
Data obtain submodule, for using the analysis result as test simulation data.
Preferably, the template engine is FreeMarker template engines;The sending module includes:
Process creation submodule, for creating subprocess;
Data sending submodule, for the test simulation data and file path to be sent to institute using the subprocess State FreeMarker template engines.
Preferably, the page is hypertext markup language HTML static pages;The test module includes:
Request receiving submodule receives hypertext transfer protocol HTTP test requests for the analog platform;
Page sending submodule, for the HTML static pages to be sent to display according to the HTTP test requests Device;The display is used to the HTML static pages being shown.
Preferably, described device further includes:
Modified module, for changing the test simulation data in the simulation mock files.
Compared with prior art, the embodiment of the present invention includes advantages below:
Rear end for the template engine with compilation facility of Page Template is extracted in the embodiment of the present invention, is provided It is general to front end one, minimize, Page Template code can be compiled and parsed to Page Template as rear end Environment so that generate that final project is required, the Page Template in production environment in front end, and can also carry out further Exploitation and debugging.Front end generation Page Template, can be directly integrated in final projects, with realize rear end without Seam docking.Due to so that front end and rear end exploitation can each other can each irrelevant ground is parallel carries out, improve the page Development rate.In later maintenance, if front end demand change, front end also can stand-alone development and debugging Page Template, be not required to Rely on rear end.Due to front end can stand-alone development and debugging Page Template, therefore eliminate in traditional development process in rear end cap Exploitation link among the page improves the development efficiency of the page.
The embodiment of the present invention is realized the front end (webpage representation part) of project and rear end (data-interface and service logic Realize) exploitation phase separation, respective Exploitation Scope is specified, the two no longer interdepends in exploitation, the specific premise of interface protocol Lower front end and rear end can be developed respectively simultaneously.Just due to this, front end and rear end can be tested respectively in the embodiment of the present invention, For example rear end can be tested just for the data-interface of front end, only need to be ready to test simulation data to front end, and by page Face die plate is imported in actual motion environment and tested, therefore page development is quicker quick, while can be responded faster to Demand changes.
Description of the drawings
Fig. 1 is a kind of traditional webpage development flow diagram;
Fig. 2 is a kind of preferable webpage development flow diagram;
Fig. 3 is a kind of step flow chart of embodiment of the method in the head end test page of the present invention;
Fig. 4 is a kind of flow diagram in the head end test page of the present invention;
Fig. 5 is a kind of structure diagram of device embodiment in the head end test page of the present invention.
Specific embodiment
In order to make the foregoing objectives, features and advantages of the present invention clearer and more comprehensible, it is below in conjunction with the accompanying drawings and specific real Applying mode, the present invention is described in further detail.
With reference to a kind of traditional webpage development flow diagram shown in FIG. 1, front end makes according to user interface UI and UE Static HTML page, then consigns to rear end and changes into Page Template and carry out joint debugging exploitation again, and front end depends critically upon Back end data Interface, therefore be the shortcomings that traditional webpage development flow:
1st, page module can not be multiplexed, once running into demand change, the modification of public module needs manual modification institute successively There is a reference page, when operating cost is cumbersome and easy error;
2nd, in the page can not definition template variable, usually require in the Page Template finally changed into rear end to define some moulds Plate variable basis path, picture path etc., current way is manually replaced in revolving die plate;
The page path accessed when the 3rd, developing is different from the path after really reaching the standard grade, the ground set in the page in link label Location needs to change again when changing into Page Template;
4th, when later stage demand changes, usually way is direct modification Page Template at present, just needs front end developer at this time It needs to have run entire project in the machine, builds environment and deployment operation project, and front end is not usually required to modification back-end code.
To sum up, static HTML page is write in front end, no matter for front end or rear end, exploitation, debugging, demand change It is inconvenient, not quick, unfriendly with later maintenance.
With reference to a kind of preferable webpage development flow diagram shown in Fig. 2, detailed process is as follows:
1st, Page Template is directly write when front end is developed, Page Template when finally delivering rear end need not do any change It is dynamic, with back end interface nature slitless connection;
2nd, entire project need not be run when front end is developed, in this embodiment it is not even necessary to configure rear end environment and check out entire project Code;
3rd, front end does not depend on rear end completely in the process of development, and both sides follow interface protocol isolation exploitation;
4th, during same flow applicable requirements change.
In preferable webpage development flow, reduce intermediate link, development process becomes to be simple and efficient, front end developer Final Page Template is directly exported, directly project end interface effect is responsible for.As a result, the core idea of the embodiment of the present invention it One is, separates front end and rear end, and wherein rear end is responsible for providing data, and displaying interface is responsible in front end.Before rear end need not be concerned about How code is organized, how and how page structure each can irrelevantly be developed each other with user interaction, front end and rear end at end. Page Template is directly write in front end, and exploitation debugging is carried out in front end, it is no longer necessary to which the machine deployment runs entire project.The page Face die plate is desirably integrated into final project, can be with rear end slitless connection, therefore the exploitation of front end and rear end can carry out parallel, no It needs to wait mutually, improves whole development rate.
With reference to Fig. 3, a kind of step flow chart of embodiment of the method in the head end test page of the present invention is shown, it is described Front and rear end interacts;Include analog platform and template engine, the template engine and the template of the rear end in the front end Engine is identical;Include simulation files and Page Template in the analog platform, the Page Template has respective file path;
The method may include steps of:
Step 301, the analog platform parses the simulation files and obtains test simulation data;
In one preferred embodiment of the invention, the front end can include front end exploitation FED instruments, and the simulation is flat Platform is to develop FED platforms using the front end of meshed network development language node.js exploitations, has FED works in the FED platforms Tool;The simulation files are simulation mock files, and the step 301 can include following sub-step:
Sub-step S11 parses the simulation mock files using the FED instruments in the FED platforms;
Sub-step S12, using the analysis result as test simulation data.
In the concrete realization, FED (the The Front-End included using node.js language developments are built in front end Develop Kitchen, front end exploitation) platform and using JAVA language exploitation template engine FED, wherein, the template Engine extracts rear end for the compilation facility of Page Template, is supplied to front end that can compile and parse the page as rear end The environment of template code, therefore front end can directly write that final project is required, the Page Template in production environment, and into Row exploitation and debugging.The FED platforms are that analyzing platform of the FED instruments analog back-end to the Page Template of front end may be employed, The major function of FED platforms is that the Page Template for developing front end is resolved in the environment of no rear end, so as to locate Manage the final page of Page Template conversion.Due to all files, including simulation mock files, Page Template, static file etc. Can be on same machine, therefore change very convenient.After having changed, local machine can be read using FED instruments In file.
FED platforms are write using Node.js language, are the running environment of the Javascript of an analog back-end (system of support includes * nux, Windows etc.) can be handed over system for writing and compiling grade or the Javascript codes of server end It is performed to FED platforms to explain.The business realizing of interaction and instrument with user uses Node.js technologies, can make simulation Mock document definitions become apparent from and conveniently, due to be all using JavaScript language for the developer of front end also more Add close friend, and simple service logic can be also realized in mock files are simulated, with closer truly analog back-end interface Response logic.In addition, create FED platforms using node.js language, the environmental structure also more light weight of analog back-end can be allowed Conveniently, perform speed faster, ensure that development rate.
FED platforms write simple back end interface and related tool for front end, to debug Page Template.Front end can be Under this environment, accessed using real URL (Uniform Resource Locator, uniform resource locator), and can Other server debugging Page Templates are grafted in, for Page Template code using the debugging output of test simulation data, finally may be used Generation and the Page Template of rear end slitless connection.
Page Template is tested using FED instruments, repartitions front end and the rear end division of labor in project development, it is clearly each From Exploitation Scope, project concurrent development efficiency can be improved, reduces the degree of coupling of front end and rear end exploitation;It is developed simultaneously for front end Provide measurable tool platform, be allowed in the case that no back-end realization also can analog back-end interface and data, carry out page mould The test of plate.
By using FED instruments, can reduce (need not use Eclipse to program work the demand of front end development environment Tool, need not run entire project with reference to front end and rear end), improve front end development efficiency, compression exploitation and debugging cost;No Back end interface is relied on, front end is more flexible when developing, and can more be quickly accomplished demand change;Exploitation link is reduced, before raising Developer's code conversion rate is held, reduces development cost;The platform base of page test is constructed, the automation of front end is contributed to survey Examination is realized.
In embodiments of the present invention, front and rear end can link up definite data-interface (including request method, the page in advance Required data format etc. in template), then write data-interface description file (simulation mock files, define data and connect Test simulation data used in the request method of mouth, data format and exploitation and test), test simulation data are needed in the page The data of Dynamic Display (being obtained from rear end in practice), such as:User name, user's head portrait, article content etc..
Specifically, test simulation data are to be write on a kind of set form in simulation mock files.In FED platforms It is read using FED instruments from simulation mock files and parses test simulation data, simulated rear end running environment accordingly, wrapped WEB operations container, back end interface and data, Page Template parsing environment etc. are included, allow front end in a kind of analog development environment It is interior, carry out identical but more convenient with there is rear end program operation and quick exploitation debugging experience.It therefore can be with test page Tester it is the same, and need not pay close attention to rear end service logic realize, can manual modification simulation mock files in test Analogue data realizes the accurate definition to test simulation data, so as to more convenient and be rapidly absorbed in webpage representation Test in.
Step 302, the file path of the test simulation data and Page Template is sent to template engine;The template Engine is used to read the Page Template according to the file path, and is generated according to the test simulation data and Page Template The page;
In one preferred embodiment of the invention, the template engine can be FreeMarker template engines;It is described Step 302 can include following sub-step:
Sub-step S21 creates subprocess;
The test simulation data and file path are sent to the Free by sub-step S22 using the subprocess Marker template engines.
In embodiments of the present invention, it is identical in the FreeMarker templates of front end and the FreeMarker templates of rear end , there is compilation facility for Page Template, be supplied to front end that can compile and parse the ring of Page Template code as rear end Border.
FreeMarker template engines (template engine including being used for Web exploitations) are to make user interface and business number It separates and generates according to (content), it can generate the document of specific format, for the FreeMarker template engines of WEB exploitations Template engine will generate the HTML static pages of a standard.
Subprocess is created between FED platforms and FreeMarker template engines to communicate.Mould will be tested in FED platforms Intend data and file path and FreeMarker template engines are sent to by subprocess, the FreeMarker template engines can be with Analog back-end debugs the behavior of Page Template, according to from simulation mock files the test simulation data that obtain to Page Template into Row compiling generation HTML static pages.
It should be noted that FED platforms communicate with the realization of Java FreeMarker template engines can also use its other party Method, for example using the NPM bags node-java of FED platforms or by creating HTTP service, carried out using http protocol local It communicates or by writing C++ plug-in unit Addon, realizes calling etc. in bottom and JAVA, the embodiment of the present invention does not limit this System.
In practical applications, FreeMarker template engines are still realized for the compiling part of Page Template by Java, It is consistent used in used analytics engine and actual items, it thereby may be ensured that Page Template analysis result with actual rear The analysis result at end is consistent, and rear end can be directly accessed by the Page Template of front end stand-alone development by, which ensuring from bottom, uses, real The slitless connection of existing front and rear end.
It should be noted that can also use Node.js in embodiments of the present invention realizes FreeMarker templates again Engine.Realize the parsing of FreeMarker template engine grammers again using Node.js language, it is completely heavy with Node.js language The new function of realizing FreeMarker, the embodiment of the present invention are not restricted this.
Step 303, the page that the template engine is sent is received;
Step 304, when receiving test request, the page is tested using the test request.
In one preferred embodiment of the invention, the page is hypertext markup language HTML static pages;It is described Step 304 can include following sub-step:
Sub-step S31, the analog platform receive hypertext transfer protocol HTTP test requests;
The HTML static pages are sent to display by sub-step S32 according to the HTTP test requests;The display Device is used to the HTML static pages being shown.
In the concrete realization, after FreeMarker template engines generate HTML static pages, FED can be sent to and put down Platform, and the HTML static pages are tested.
For example, when FED platforms receive HTTP test requests, which can be sent to display, Whether can be normally carried out showing using the display apparatus test HTML static pages.
A kind of flow diagram in the head end test page of the present invention with reference to described in Fig. 4 includes using in front end The FED platforms of node.js language developments and the FreeMarker template engines using JAVA language exploitation, further include in front end There are FED instruments and simulate mock files and the Page Template being stored in specified directory, simulation mock files include mould Intend test data.
Page Template code is directly write according to design drawing and planning document in front end, responsible content show it is relevant all, Including page HTML structure, the interaction logic of related style file and front end is realized, rear end no longer needs modification related to the page Code.Rear end be responsible for service logic realization and front end page needed for data, then read Page Template combined with data Compiling generates the final page, returns to browser end and shows.
Specifically, FED platforms using FED instrument analytic simulation mock files obtain simulation test data after, by itself and The corresponding file path of Page Template is sent to FreeMarker template engines, and the FreeMarker template engines start to simulate Page Template is debugged in rear end, and generation is compiled to Page Template according to the test simulation data obtained from simulation mock files HTML static pages after FreeMarker template engines generate HTML static pages, can be sent to FED platforms and be surveyed Examination.When FED platforms receive HTTP test requests, which is sent to display, using the display Whether test HTML static pages can be normally carried out showing.
In practical applications, the data of rear end can be relied in front end development process.Therefore front end and rear end docking It needs to may require that provisioning interface, and is developed according to the provisioning interface.New front end and the development process of rear end cause interface Agreement is clearer and more definite, allows develop each other and more isolate, the page is absorbed in front end, and data are absorbed in rear end, then more efficient.It is of the invention real Apply example by decoupling and process optimization, project development can be allowed more flexible, front and back end cooperation it is more smooth, and reduce into This, improves efficiency.
In one preferred embodiment of the invention, the simulation files are parsed in the analog platform and obtains test simulation Before the step of data, further include:
Change the test simulation data in the simulation mock files.
When developing Page Template, used data are all the interim test simulation data that voluntarily can flexibly define, And store the simulation mock files of test simulation data and FED platforms and Freemaker template engines etc. be stored in it is same In machine, therefore debugging to different data situation when more easily can change data to meet exploitation in exploitation, without Must data source be changed by rear end to realize debugging again.The page exported when developing simultaneously is all temporary page, is only used for developing It debugs or tests.After the completion of final exploitation, the Page Template only completed can be integrated into project.
Simulation mock files are both the file of required parsing in the embodiment of the present invention, while are also that front and rear end data is connect Mouthful complete definition document, be should long term maintenance and change according to demand be updated, for the newcomer of project team Understand that the front end of projects and back end interface have very great help faster.
In the concrete realization, the simulation mock file edits of FED are fairly simple, and simulation mock file changes can give birth to immediately It imitates, and simulates the test simulation data in mock files to be recycled.Mock files are simulated by the page and number of front end According to separation, more convenient exploitation and debugging, the data pulled out can be reused, at the same simulate mock files be used as before and after The complete description of end interface, makes the developer of front end be easy to understand project, even if replacing developer, it is not required that worry whole A project becomes chaotic.
In the concrete realization, the embodiment of the present invention can also be that " measurable tool platform " is improved in front end.It is described " measurable Tool platform " be can be tester need the data different to webpage representation (form, type, scope when) when change number According to offer more easily method.Such as when doing the limit test of data, when testing more than 100 word of article title field, the page is No display is normal, and conventional method is into management backstage, changes corresponding data source, and then refresh page, which is checked, shows effect, And now only need the data defined in modification simulation mock files;In addition, in some cases data source modification get up can It can more bother.Therefore, the embodiment of the present invention can effectively reduce the consuming of human and material resources, further, since can not It relies on rear end and individually carries out the test job of the page, and more conveniently and quickly.
Specifically, tester directly can change what is exported to analog back-end by changing simulation mock files Test simulation data, and front end page is finally made to show different data, for test.Here " measurable tool platform " refers to The function that entire FED is provided equally has the meaning for improving testing efficiency for test.
Using in the embodiment of the present invention, before Page Template is developed in front end, the developer of front end and the exploitation of rear end Personnel can first consult to determine data-interface in advance, determine that rear end returns to the data lattice of front end page according to the data-interface Formula, and the data-interface appointed is written in simulation mock files.It, can be from simulation when Page Template is developed in front end The simulation test data of analog back-end are obtained in mock files, without joint debugging exploitation could be carried out together with rear end.Due to It is that data-interface is determined using advance negotiation to simulate the process that data are obtained from rear end, therefore the Page Template in front end is most Whole project is required, the Page Template in production environment.
The exploitation of front end page and the exploitation of rear end are parallel, therefore during exploitation front end page, after also carrying out at the same time The exploitation at end, when developing front end page, as a result of Back end data of the simulation mock files as support, thus can be Front end generates the page, and is tested in front end for the page, to the test job of the developer of front end page template Very big facility is brought, so as to which the exploitation of front end page and testing efficiency improve.
In embodiments of the present invention, FED instruments are additionally provided some more practical functions and are developed with more convenient front end.Than Such as automatic hot-restarting application simulation mock files, refresh browser automatically, it is automatic to compile less and coffee-script files Deng plug-in extension mechanism in addition has also been devised, and is incorporated into front end and develops in automatic the build tool Grunt.
In order to which those skilled in the art is made to more fully understand the embodiment of the present invention, said below using specific example It is bright.In project of this example using Java and FreeMarker template engines, FED instruments can be introduced at any time.
It is locally ready to build analog back-end environment using Node.js language, and uses NPM Installing of Command FED:
npm install–g fed
Configuration file is defined, the position of the configuration file can be placed under arbitrary catalogue, as long as its road when starting FED Footpath is passed to parametric form.
Specifically:Configuration file is defined as follows:
The position of Page Template (view), simulation mock files (mock) and static file are respectively specified that in configuration file Catalogue (public) etc., wherein, some static files in static file catalogue (public) includes project, such as HTML File, picture, pattern file, JS files etc..
Start order:
fed server-w-p8910./configs/index.json
Start FED, by browsing http://localhost:8910 carry out accession page.Wherein ,-w parameters refer to monitor File change ,-p8910 are designated ports 8910, and configs/index.json then represents configuration file position.
After the completion of mentioned order, new simulation test data can also be added in mock files are simulated, such as:
Using above-mentioned code, http is asked://localhost:During 8910/index addresses, index.ftl templates are returned As a result, data used when compiling have Title, replacement variable is " hello for the compiling of file!" character string.At this moment can Access address:http://localhost:8910/index sees the analysis result of index.ftl templates.
Using the embodiment of the present invention, lower interface is arranged in front end and rear end in advance, then each each other to develop irrelevantly.Its In, it in the development process of front end, has abandoned that static HTML page is this " by-product ", the code that front end is developed is allowed to be directly becoming Finally " product code ".Front end development environment is simplified, makes front end exploitation debugging more rapid, efficient, reliable, does not depend on rear end Code and data realize real concurrent development.It simulates mock files to describe as unified back end interface, is easier front end It changes hands project, reduces personnel's variable cost.When the page is tested, end page before interface testing that can be by simulating mock files Face improves testing efficiency.
With reference to Fig. 5, show a kind of structure diagram of the device embodiment of the head end test page of the present invention, the front end with Rear end interacts;It can include analog platform and template engine in the front end, the template engine can be with the mould of the rear end Plate engine is identical;In the analog platform can include simulation files and Page Template, the Page Template can have pair Answer file path;
The device can include following module:
Parsing module 501 parses the simulation files for the analog platform and obtains test simulation data;
In one preferred embodiment of the invention, described device can also include following module:
Modified module, for changing the test simulation data in the simulation mock files.
In one preferred embodiment of the invention, the analog platform can be using meshed network development language FED platforms are developed in the front end of node.js exploitations, have FED instruments in the FED platforms;The simulation files can be simulation Mock files, the parsing module 501 can include following submodule:
Document analysis submodule, for being carried out in the FED platforms using the FED instruments to the simulation mock files Parsing;
Data obtain submodule, for using the analysis result as test simulation data.
Sending module 502, for the file path of the test simulation data and Page Template to be sent to template engine; The template engine is used to read the Page Template according to the file path, and according to the test simulation data and the page The template generation page;
In one preferred embodiment of the invention, the template engine can be FreeMarker template engines;It is described Sending module 502 can include following submodule:
Process creation submodule, for creating subprocess;
Data sending submodule, for the test simulation data and file path to be sent to institute using the subprocess State FreeMarker template engines.
Receiving module 503, for receiving the page that the template engine is sent;
Test module 504, for when receiving test request, the page to be tested using the test request.
In one preferred embodiment of the invention, the page is hypertext markup language HTML static pages;It is described Test module 504 can include following submodule:
Request receiving submodule receives hypertext transfer protocol HTTP test requests for the analog platform;
Page sending submodule, for the HTML static pages to be sent to display according to the HTTP test requests Device;The display is used to the HTML static pages being shown.
For device embodiment, since it is basicly similar to embodiment of the method, so description is fairly simple, it is related Part illustrates referring to the part of embodiment of the method.
Each embodiment in this specification is described by the way of progressive, the highlights of each of the examples are with The difference of other embodiment, just to refer each other for identical similar part between each embodiment.
It should be understood by those skilled in the art that, the embodiment of the embodiment of the present invention can be provided as method, apparatus or calculate Machine program product.Therefore, the embodiment of the present invention can be used complete hardware embodiment, complete software embodiment or combine software and The form of the embodiment of hardware aspect.Moreover, the embodiment of the present invention can be used one or more wherein include computer can With in the computer-usable storage medium (including but not limited to magnetic disk storage, CD-ROM, optical memory etc.) of program code The form of the computer program product of implementation.
The embodiment of the present invention be with reference to according to the method for the embodiment of the present invention, terminal device (system) and computer program The flowchart and/or the block diagram of product describes.It should be understood that it can realize flowchart and/or the block diagram by computer program instructions In each flow and/or block and flowchart and/or the block diagram in flow and/or box combination.These can be provided Computer program instructions are set to all-purpose computer, special purpose computer, Embedded Processor or other programmable data processing terminals Standby processor is to generate a machine so that is held by the processor of computer or other programmable data processing terminal equipments Capable instruction generation is used to implement in one flow of flow chart or multiple flows and/or one box of block diagram or multiple boxes The device for the function of specifying.
These computer program instructions, which may also be stored in, can guide computer or other programmable data processing terminal equipments In the computer-readable memory to work in a specific way so that the instruction being stored in the computer-readable memory generates bag The manufacture of command device is included, which realizes in one flow of flow chart or multiple flows and/or one side of block diagram The function of being specified in frame or multiple boxes.
These computer program instructions can be also loaded into computer or other programmable data processing terminal equipments so that Series of operation steps is performed on computer or other programmable terminal equipments to generate computer implemented processing, thus The instruction offer performed on computer or other programmable terminal equipments is used to implement in one flow of flow chart or multiple flows And/or specified in one box of block diagram or multiple boxes function the step of.
Although the preferred embodiment of the embodiment of the present invention has been described, those skilled in the art once know base This creative concept can then make these embodiments other change and modification.So appended claims are intended to be construed to Including preferred embodiment and fall into all change and modification of range of embodiment of the invention.
Finally, it is to be noted that, herein, relational terms such as first and second and the like be used merely to by One entity or operation are distinguished with another entity or operation, without necessarily requiring or implying these entities or operation Between there are any actual relationship or orders.Moreover, term " comprising ", "comprising" or its any other variant meaning Covering non-exclusive inclusion, so that process, method, article or terminal device including a series of elements are not only wrapped Those elements are included, but also including other elements that are not explicitly listed or are further included as this process, method, article Or the element that terminal device is intrinsic.In the absence of more restrictions, it is wanted by what sentence "including a ..." limited Element, it is not excluded that also there are other identical elements in the process including the element, method, article or terminal device.
Above to a kind of method in the head end test page provided by the present invention and a kind of dress in the head end test page It puts, is described in detail, specific case used herein is set forth the principle of the present invention and embodiment, more than The explanation of embodiment is only intended to help the method and its core concept for understanding the present invention;Meanwhile for the general skill of this field Art personnel, thought according to the invention, there will be changes in specific embodiments and applications, in conclusion this Description should not be construed as limiting the invention.

Claims (6)

  1. A kind of 1. method of the head end test page, which is characterized in that the front and rear end interaction;Include simulation in the front end Platform and template engine, the template engine are identical with the template engine of the rear end;Include simulation in the analog platform File and Page Template, the Page Template have respective file path;
    The method includes:
    The analog platform parses the simulation files and obtains test simulation data, and the analog platform is to be opened using meshed network The front end exploitation FED platforms of language node.js exploitations are sent out, there is FED instruments in the FED platforms;The simulation files are mould Intend mock files, the analog platform, which parses the step of simulation files obtain test simulation data, to be included:It is put down in the FED Platform parses the simulation mock files using the FED instruments;Using the analysis result as test simulation data;
    The file path of the test simulation data and Page Template is sent to template engine;The template engine is used for foundation The file path reads the Page Template, and according to the test simulation data and the Page Template generation page;
    Receive the page that the template engine is sent;
    When receiving test request, the page is tested using the test request;
    Change the test simulation data in the simulation mock files.
  2. 2. according to the method described in claim 1, it is characterized in that, the template engine is FreeMarker template engines;Institute Stating the step of test simulation data and file path are sent to template engine includes:
    Create subprocess;
    The test simulation data and file path are sent to by the FreeMarker template engines using the subprocess.
  3. 3. according to the method described in claim 2, it is characterized in that, the page is hypertext markup language HTML static pages Face;It is described when receiving test request, using the test request test the page the step of include:
    The analog platform receives hypertext transfer protocol HTTP test requests;
    The HTML static pages are sent to display according to the HTTP test requests;The display is used for by described in HTML static pages are shown.
  4. A kind of 4. device of the head end test page, which is characterized in that the front and rear end interaction;Include simulation in the front end Platform and template engine, the template engine are identical with the template engine of the rear end;Include simulation in the analog platform File and Page Template, the Page Template have respective file path;
    The device includes:
    Parsing module parses the simulation files for the analog platform and obtains test simulation data, wherein the simulation is flat Platform is to develop FED platforms using the front end of meshed network development language node.js exploitations, has FED works in the FED platforms Tool;The simulation files are simulation mock files, and the parsing module includes:Document analysis submodule, for being put down in the FED Platform parses the simulation mock files using the FED instruments;Data obtain submodule, for by the analysis result As test simulation data;
    Sending module, for the file path of the test simulation data and Page Template to be sent to template engine;The mould Plate engine is used to read the Page Template according to the file path, and is given birth to according to the test simulation data and Page Template Into the page;
    Receiving module, for receiving the page that the template engine is sent;
    Test module, for when receiving test request, the page to be tested using the test request;
    Modified module, for changing the test simulation data in the simulation mock files.
  5. 5. device according to claim 4, which is characterized in that the template engine is FreeMarker template engines;Institute Stating sending module includes:
    Process creation submodule, for creating subprocess;
    Data sending submodule, it is described for being sent to the test simulation data and file path using the subprocess FreeMarker template engines.
  6. 6. device according to claim 5, which is characterized in that the page is hypertext markup language HTML static pages Face;The test module includes:
    Request receiving submodule receives hypertext transfer protocol HTTP test requests for the analog platform;
    Page sending submodule, for the HTML static pages to be sent to display according to the HTTP test requests;Institute Display is stated for the HTML static pages to be shown.
CN201410247193.0A 2014-06-05 2014-06-05 A kind of method and apparatus in the head end test page Active CN105138448B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201410247193.0A CN105138448B (en) 2014-06-05 2014-06-05 A kind of method and apparatus in the head end test page

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201410247193.0A CN105138448B (en) 2014-06-05 2014-06-05 A kind of method and apparatus in the head end test page

Publications (2)

Publication Number Publication Date
CN105138448A CN105138448A (en) 2015-12-09
CN105138448B true CN105138448B (en) 2018-06-05

Family

ID=54723802

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201410247193.0A Active CN105138448B (en) 2014-06-05 2014-06-05 A kind of method and apparatus in the head end test page

Country Status (1)

Country Link
CN (1) CN105138448B (en)

Families Citing this family (38)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107203401B (en) * 2016-03-17 2020-11-06 创新先进技术有限公司 Front-end project construction method, device and system
CN105867944B (en) * 2016-04-19 2019-10-22 郑州宇通客车股份有限公司 Web front end data operation layer and its implementation
CN106250128B (en) * 2016-07-26 2019-12-10 网易(杭州)网络有限公司 Display processing method and device of user interface
CN106250141B (en) * 2016-07-29 2021-12-10 四川天邑康和通信股份有限公司 Design method of WEB UI plug-in
CN106293827B (en) * 2016-08-08 2019-08-16 杭州玳数科技有限公司 A kind of method and system controlling web front-end publication by configuration file
CN106371829B (en) * 2016-08-24 2019-05-17 北京邮电大学 Template framework design method and system based on modularization idea
CN106339226B (en) * 2016-08-26 2019-10-25 南威软件股份有限公司 A kind of methods of exhibiting and page presentation device of Webpage
CN106484394B (en) * 2016-09-13 2019-07-12 厦门兆慧网络科技有限公司 A kind of fast software development system with double engines
CN106453517A (en) * 2016-09-20 2017-02-22 郑州云海信息技术有限公司 Configuration file generation method based on freemarker
CN106775691A (en) * 2016-12-06 2017-05-31 郑州云海信息技术有限公司 A kind of storage management software design for based on front and back end separate
CN108228444B (en) * 2016-12-14 2021-08-17 阿里巴巴集团控股有限公司 Test method and device
CN108241580B (en) * 2016-12-30 2021-11-19 深圳壹账通智能科技有限公司 Client program testing method and terminal
CN108268570B (en) * 2017-01-04 2021-03-16 武汉斗鱼网络科技有限公司 Method and device for developing interface
CN106970873B (en) * 2017-01-10 2021-07-09 创新先进技术有限公司 On-line mock testing method, device and system
CN108959062B (en) * 2017-05-22 2021-06-18 腾讯科技(深圳)有限公司 Webpage element acquisition method and device
CN107197024A (en) * 2017-06-09 2017-09-22 努比亚技术有限公司 Single table access and control method, user terminal, server and storage medium
CN107659455B (en) * 2017-10-16 2020-01-03 武汉斗鱼网络科技有限公司 Method, storage medium, device and system for Mock data of iOS (internet operating system) end
CN109669680A (en) * 2017-10-16 2019-04-23 阿里巴巴集团控股有限公司 The development process method, apparatus and electronic equipment of Web page module
CN107885497A (en) * 2017-11-08 2018-04-06 北京锐安科技有限公司 A kind of webpage front-end method for exhibiting data and device based on form framework
CN108304321A (en) * 2018-01-10 2018-07-20 链家网(北京)科技有限公司 A kind of method, system and device creating front and back end exploitation joint debugging environment
CN108829383A (en) * 2018-05-31 2018-11-16 达飞云贷科技(北京)有限公司 A kind of data processing method and device of interface separation
CN109726108B (en) * 2018-06-04 2023-09-22 成都美满科技有限责任公司 Front-end code testing method, device, system and medium based on analog data
CN109032628A (en) * 2018-06-26 2018-12-18 珠海宏桥高科技有限公司 A kind of method and apparatus of the page of application program and rear end decoupling
CN109189681A (en) * 2018-08-23 2019-01-11 彩讯科技股份有限公司 Data simulation method, client and system based on ajax
CN109062806B (en) * 2018-09-14 2021-03-23 杭州数梦工场科技有限公司 Program testing method, system, device and computer readable storage medium
CN109255114A (en) * 2018-09-17 2019-01-22 四川长虹电器股份有限公司 The system and method for Excel table and legend is generated based on data configuration
CN109634605B (en) * 2018-12-05 2021-11-02 思必驰科技股份有限公司 Simulation data generation method and system for web front end
CN110287096A (en) * 2019-05-20 2019-09-27 深圳壹账通智能科技有限公司 H5 front end page test method, electronic device and computer readable storage medium
CN110516190A (en) * 2019-08-30 2019-11-29 深圳点猫科技有限公司 Generate the method and apparatus of static Web page
CN111381921B (en) * 2020-03-04 2020-10-09 北京东方金信科技有限公司 Front-end and back-end separation system and method based on Ambari
CN111538667A (en) * 2020-04-28 2020-08-14 北京三快在线科技有限公司 Page testing method and device
CN111865679B (en) * 2020-07-14 2021-02-23 北京自如信息科技有限公司 Data simulation method, device, equipment and readable storage medium
CN112256567A (en) * 2020-09-29 2021-01-22 航天科工广信智能技术有限公司 Remote calling simulation and test system
CN112367234B (en) * 2020-10-27 2022-04-29 深圳力维智联技术有限公司 Simulation data generation method, terminal device and computer-readable storage medium
CN112100079B (en) * 2020-11-02 2022-04-12 北京淇瑀信息科技有限公司 Test method and system based on simulation data calling and electronic equipment
CN113536178B (en) * 2021-06-04 2024-04-12 贝壳找房(北京)科技有限公司 Page data generation method and device, electronic medium and storage medium
CN113836460B (en) * 2021-08-13 2022-05-27 深圳市明源云空间电子商务有限公司 mock data control method, equipment terminal and computer readable storage medium
CN113778883A (en) * 2021-09-13 2021-12-10 湖南快乐阳光互动娱乐传媒有限公司 Interface document, test and simulation generation method and device, and computer storage medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102455903A (en) * 2010-10-29 2012-05-16 卓望数码技术(深圳)有限公司 Method for generating user application interface
CN102662993A (en) * 2012-03-14 2012-09-12 北京神州数码思特奇信息技术股份有限公司 A method for providing page data
CN103034504A (en) * 2013-01-05 2013-04-10 湖南经桥网络科技有限公司 Application method and device of template website
CN103631783A (en) * 2012-08-21 2014-03-12 百度在线网络技术(北京)有限公司 Method and system for generating front end page

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20110029899A1 (en) * 2009-08-03 2011-02-03 FasterWeb, Ltd. Systems and Methods for Acceleration and Optimization of Web Pages Access by Changing the Order of Resource Loading

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102455903A (en) * 2010-10-29 2012-05-16 卓望数码技术(深圳)有限公司 Method for generating user application interface
CN102662993A (en) * 2012-03-14 2012-09-12 北京神州数码思特奇信息技术股份有限公司 A method for providing page data
CN103631783A (en) * 2012-08-21 2014-03-12 百度在线网络技术(北京)有限公司 Method and system for generating front end page
CN103034504A (en) * 2013-01-05 2013-04-10 湖南经桥网络科技有限公司 Application method and device of template website

Also Published As

Publication number Publication date
CN105138448A (en) 2015-12-09

Similar Documents

Publication Publication Date Title
CN105138448B (en) A kind of method and apparatus in the head end test page
Di Lucca et al. Reverse engineering Web applications: the WARE approach
Di Lucca et al. An approach for reverse engineering of web-based applications
Dukhanov et al. Design virtual learning labs for courses in computational science with use of cloud computing technologies
CN104778033B (en) The construction method and device of a kind of building software
Syaifudin et al. A proposal of Android programming learning assistant system with implementation of basic application learning
CN107885497A (en) A kind of webpage front-end method for exhibiting data and device based on form framework
Zirkelbach et al. On the modernization of ExplorViz towards a microservice architecture
CN107239271A (en) Develop document structure tree method and device
CN103942099A (en) Parallel task execution method and device based on Hive
Cerny et al. Microvision: Static analysis-based approach to visualizing microservices in augmented reality
de Oliveira et al. Developer assistance tools for creating native mobile applications accessible to visually impaired people: A systematic review
Carromeu et al. Component-based architecture for e-Gov web systems development
Griffiths et al. A simple method & tool for web engineering
Queirós et al. Orchestration of e-learning services for automatic evaluation of programming exercises
Cook A web-integrated environment for component-based software reasoning
Sun et al. Lessons learned in Web site architectures for public utilities
Derr Ns-3 web-based user interface: Power grid communications planning and modeling tool
Hariyanto The Design of Adaptive Learning System Based on the Collaboration of m-Learning and e-Learning Platform
Pham Developing the Whole Communities–Whole Health app known as Hornsense: an experience report
Mohajeri A Portfolio Display of Software Development Mastery
Sharath Real world deployments of AI-assisted tools for compilation error repair and program retrieval
Letouze et al. A web academic project manager based on mvc evolutionary acquisition irpm
Basso et al. Towards a web modeling environment for a model driven engineering approach
Abedmouleh et al. Specification of Visual Instructional Design Languages Dedicated to Learning Management Systems.

Legal Events

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