Summary of the invention
The main purpose of the present invention is to provide a kind of front-end code test method, device, system based on analogue data
And computer storage medium, it is intended under the premise of the efficiency for guaranteeing the test of front-end code test development, improve front-end code test
Authenticity.
To achieve the above object, the present invention provides a kind of front-end code test method based on analogue data;It is described to be based on
The front-end code test method of analogue data is applied to head end test platform, the front-end code test side based on analogue data
Method the following steps are included:
The data access request triggered based on the front-end code in head end test platform is received, the front-end code is obtained
Environmental labels, and according to the environmental labels determine the front-end code current operating environment whether be exploitation environment;
If the current operating environment of the front-end code is exploitation environment, the data access request is sent to data
Analog platform generates the corresponding analog access data of the data access request to simulate on the digital simulation platform;
Wherein, the analog access data are according to the data create-rule that is arranged in the digital simulation platform and described
What the initializaing variable in data access request generated;
The analog access data that digital simulation platform is sent are received, and show the analog access data, so that front end is opened
Hair personnel front-end code according to the analog access data point reuse.
Optionally, the analog access data for receiving digital simulation platform and sending, and show the analog access data,
The step of for front end developer front-end code according to the analog access data point reuse, comprising:
The analog access data that digital simulation platform is sent are received, it will be in the analog access data and preset standard table
Normal data is compared;
If the normal data in the analog access data and preset standard table mismatches, the front-end code is determined not
Meet exploitation standard, and using the analog access data as abnormal analogue data;
The abnormal analogue data is shown, so that front end developer adjustment includes the to be adjusted of the abnormal analogue data
Front-end code.
Optionally, the analog access data for receiving digital simulation platform and sending, by the analog access data and in advance
If after the step of normal data in standard scale is compared, comprising:
If the analog access data are matched with the normal data in preset standard table, determine that the front-end code meets
Exploitation standard, and obtain the access identities for including in the data access request;
The analog access data are associated with the access identities and are saved to predetermined analog table;
If the current operating environment of the front-end code is exploitation environment, the data access request is sent to
The step of digital simulation platform includes:
If the current operating environment of the front-end code is exploitation environment, obtains in the data access request and include
Target access mark;
The target access is identified and is compared with each access identities in the predetermined analog table;
If the target access mark is matched with access identities in the predetermined analog table, the predetermined analog table is obtained
Described in target access identify corresponding target simulation and access data, and show the target simulation access data;
If the target access mark is mismatched with access identities in the predetermined analog table, the data access is asked
It asks and is sent to digital simulation platform.
In addition, to achieve the above object, the front-end code test method based on analogue data that the present invention also provides a kind of;Institute
The front-end code test method based on analogue data is stated applied to digital simulation platform, the front-end code based on analogue data
Test method the following steps are included:
The data access request that receiving front-end test platform is sent, obtains the access mark for including in the data access request
Know;
According to the access identities, the corresponding virtual data interface of the access identities is called, and obtains the virtual number
According to the analog configuration list of interface conjunctionn;
Analog access data are generated according to the data create-rule in the analog configuration list, and by the analog access
Data are sent to head end test platform.
Optionally, the data access request that the receiving front-end test platform is sent, obtains in the data access request
Before the step of access identities for including, comprising:
Node environment is created, and builds web server using express under the node environment;
When detecting that the web server builds completion, prompt information is generated, to prompt front end developer according to pre-
If analog rule configuration generates analog configuration list;
Each analog configuration list that receiving front-end developer uploads, and establish each analog configuration list and institute
The incidence relation of each virtual data interface in web server is stated, to arrange by the analog configuration of the virtual data interface conjunctionn
Table generates analog access data.
Optionally, the data create-rule according in the analog configuration list generates analog access data, and will
The step of analog access data are sent to head end test platform, comprising:
The initializaing variable carried in the data access request is obtained, and determines the types of variables of the initializaing variable;
The corresponding data create-rule of types of variables described in the analog configuration list is obtained, generates and advises by the data
The initializaing variable is then handled, the corresponding analog access data of the data access request are generated;
The analog access data are sent to head end test platform.
In addition, to achieve the above object, the present invention also provides a kind of front-end code test device based on analogue data, institute
Stating the front-end code test device based on analogue data includes:
Determining module is obtained, is asked for receiving the data access triggered based on the front-end code in head end test platform
It asks, obtains the environmental labels of the front-end code, and determine the current operation ring of the front-end code according to the environmental labels
Whether border is exploitation environment;
Sending module is intercepted, if the current operating environment for the front-end code is exploitation environment, by the data
Access request is sent to digital simulation platform, corresponding to simulate the generation data access request on the digital simulation platform
Analog access data;
Wherein, the analog access data are according to the data create-rule that is arranged in the digital simulation platform and described
What the initializaing variable in data access request generated;
Display module is received, the analog access data that analog platform is sent for receiving data, and show that the simulation is visited
Data are asked, for front end developer front-end code according to the analog access data point reuse.
In addition, to achieve the above object, the present invention also provides a kind of front-end code test device based on analogue data, institute
Stating the front-end code test device based on analogue data includes:
It receives and obtains module, for the data access request that receiving front-end test platform is sent, obtain the data access
The access identities for including in request;
It calls and obtains module, for calling the corresponding virtual data interface of the access identities according to the access identities,
And obtain the analog configuration list of the virtual data interface conjunctionn;
Sending module is generated, for generating analog access number according to the data create-rule in the analog configuration list
According to, and the analog access data are sent to head end test platform.
In addition, to achieve the above object, the present invention also provides a kind of front-end code test macro based on analogue data, institute
State the head end test platform and data analog platform that the front-end code test macro based on analogue data includes communication connection;
The head end test platform includes: first memory, first processor and is stored on the first memory simultaneously
The computer program that can be run on the first processor;It is realized when the computer program is executed by first processor following
Step includes:
The data access request triggered based on the front-end code in head end test platform is received, first processor obtains institute
The environmental labels of front-end code are stated, and determine whether the current operating environment of the front-end code is out according to the environmental labels
Hair ring border;
If the current operating environment of the front-end code is exploitation environment, first processor is by the data access request
It is sent to digital simulation platform, generates the corresponding simulation visit of the data access request to simulate on the digital simulation platform
Ask data;
Wherein, the analog access data are according to the data create-rule that is arranged in the digital simulation platform and described
What the initializaing variable in data access request generated;
First processor receives the analog access data that digital simulation platform is sent, and shows the analog access data,
For front end developer front-end code according to the analog access data point reuse;
The digital simulation platform includes: second memory, second processor and is stored on the second memory simultaneously
The computer program that can be run in the second processor;It is realized when the computer program is executed by first processor following
Step includes:
The data access request that second processor receiving front-end test platform is sent, second memory obtain the data and visit
Ask the access identities for including in request;
According to the access identities, second memory calls the corresponding virtual data interface of the access identities, and obtains
The analog configuration list of the virtual data interface conjunctionn;
Second memory generates analog access data according to the data create-rule in the analog configuration list, and by institute
It states analog access data and is sent to head end test platform.
In addition, to achieve the above object, the present invention also provides computer storage mediums;
Computer program, the realization when computer program is executed by processor are stored in the computer storage medium
Such as the step of the above-mentioned front-end code test method based on analogue data.
A kind of front-end code test method, device, system and calculating based on analogue data that the embodiment of the present invention proposes
Machine storage medium is received on head end test platform by front end developer based on the front-end code institute in head end test platform
The data access request of triggering obtains the environmental labels of front-end code, and determines the front-end code according to the environmental labels
Current operating environment whether be exploitation environment;If the current operating environment of the front-end code is exploitation environment, will be described
Data access request is sent to digital simulation platform, according to the access identities in data access request on digital simulation platform, adjusts
With the corresponding virtual data interface of access identities, the number is generated to simulate by the analog configuration list in virtual data interface
According to the corresponding analog access data of access request;Head end test platform receives the analog access data that digital simulation platform is sent,
And show the analog access data, for front end developer front-end code according to the analog access data point reuse.
In the present embodiment by setting digital simulation platform, analog back-end server provides front-end access data, ensure that front end generation
The authenticity of front-end code test is improved while code test development testing efficiency.
Specific embodiment
It should be appreciated that the specific embodiments described herein are merely illustrative of the present invention, it is not intended to limit the present invention.
As shown in Figure 1, the server that Fig. 1 is the hardware running environment that the embodiment of the present invention is related to (is called based on mould
The front-end code test equipment of quasi- data, wherein the front-end code test equipment based on analogue data can be by individual base
It is constituted in the front-end code test device of analogue data, is also possible to be surveyed by other devices and the front-end code based on analogue data
Trial assembly is set combination and is formed) structural schematic diagram.
Server of the embodiment of the present invention refers to a management resource and provides the computer of service for user, is generally divided into file
Server, database server and apps server.The computer or computer system for running the above software are also referred to as
Server.For common PC (personal computer) personal computer, server is in stability, safety, property
Energy etc. requires higher;As shown in Figure 1, the server may include: processor 1001, such as central processing unit
(Central Processing Unit, CPU), network interface 1004, user interface 1003, memory 1005, communication bus
1002, hardware such as chipset, disk system, network etc..Wherein, communication bus 1002 is for realizing the connection between these components
Communication.User interface 1003 may include display screen (Display), input unit such as keyboard (Keyboard), optional user
Interface 1003 can also include standard wireline interface and wireless interface.Network interface 1004 optionally may include having for standard
Line interface, wireless interface (such as Wireless Fidelity WIreless-FIdelity, WIFI interface).Memory 1005 can be high speed with
Machine accesses memory (random access memory, RAM), is also possible to stable memory (non-volatile
), such as magnetic disk storage memory.Memory 1005 optionally can also be the storage dress independently of aforementioned processor 1001
It sets.
Optionally, server can also include camera, RF (Radio Frequency, radio frequency) circuit, sensor, sound
Frequency circuit, WiFi module;Input unit, than display screen, touch screen;Network interface can be blue in blanking wireless interface in addition to WiFi
Tooth, probe, 3G/4G/5G (digital representation of front be cellular mobile communication networks algebra.Which exactly indicate to be generation
Network.English alphabet G indicates generation) internet base station equipment etc..It will be understood by those skilled in the art that showing in Fig. 1
Server architecture out does not constitute the restriction to server, may include than illustrating more or fewer components, or combination
Certain components or different component layouts.
As shown in Figure 1, the computer software product, which is stored in a storage medium, (storage medium: is called computer storage
Medium, computer media, readable medium, readable storage medium storing program for executing, computer readable storage medium are directly medium etc., such as
RAM, magnetic disk, CD) in, including some instructions are used so that a terminal device (can be mobile phone, computer, server, sky
Adjust device or the network equipment etc.) method described in each embodiment of the present invention is executed, as a kind of depositing for computer storage medium
It may include operating system, network communication module, Subscriber Interface Module SIM and computer program in reservoir 1005.
In server shown in Fig. 1, network interface 1004 be mainly used for connect background data base, with background data base into
Row data communication;User interface 1003 is mainly used for connection client, and (client, is called user terminal or terminal, and the present invention is implemented
Example terminal can be also possible to mobile terminal with fixed terminal), data communication is carried out with client;And processor 1001 can be used
In calling the computer program that stores in memory 1005, and execute that following embodiment of the present invention provides based on analogue data
Step in front-end code test method.
It is described in a kind of first embodiment of the front-end code test method based on analogue data of the present invention referring to Fig. 2
Front-end code test method based on analogue data includes:
Step S10, receives the data access request that is triggered based on the front-end code in head end test platform, described in acquisition
The environmental labels of front-end code, and determine whether the current operating environment of the front-end code is exploitation according to the environmental labels
Environment.
In project development process, need in real time to test the code of exploitation, that is, the front end generation in the present embodiment
Code test refers to the test of the front-end code in front-end code development process, and is not the front-end code test before going into operation;At this
In head end test platform, (head end test platform is called front end exploitation test platform to user, it can be understood as opens front end in embodiment
Test terminal during hair) data access request triggered based on the front-end code in head end test platform is received, with root
It determines whether front-end code meets exploitation and require according to the returned data of data access request, is finally completed the test of front-end code.
Specifically, head end test platform receives user (front end developer) based on the front-end code in head end test platform
When the data access request triggered, head end test platform obtains the environmental labels in front-end code, wherein environmental labels refer to
The label of front-end code developer setting, the current running environment of front-end code for identification, for example, being marked in environmental labels
There is the running environment information of current code, record has exploitation environment, test environment and production environment etc. in environmental labels;Front end is surveyed
Examination platform determines whether the current operating environment of front-end code is exploitation environment according to the environmental labels in front-end code.
Step S20 sends out the data access request if the current operating environment of the front-end code is exploitation environment
It send to digital simulation platform, generates the corresponding analog access of the data access request to simulate on the digital simulation platform
Data.
If head end test platform determines that the current operating environment of front-end code is exploitation environment, head end test platform is by institute
It states data access request and is sent to digital simulation platform, that is, user receives based in head end test platform in a production environment
When the data access request that front-end code is triggered, back-end server can be accessed according to data access request, by back-end server
The corresponding access data of data-interface returned data access request, in the current operation ring for determining front-end code in the present embodiment
Border is exploitation environment (back-end server receive not yet), and head end test platform accesses the interception of request, and by the number
Be sent to digital simulation platform according to access request, by digital simulation platform according to the data being arranged in the digital simulation platform
Initializaing variable in create-rule and the data access request generates analog access data.
Simulation generates the corresponding analog access data of data access request.
Step S30 receives the analog access data that digital simulation platform is sent, and shows the analog access data, with
For front end developer front-end code according to the analog access data point reuse.
Head end test platform receives the analog access data that digital simulation platform is sent, and judges received analog access number
According to whether abnormal, wherein judging received analog access data whether Yi Chang step including: head end test platform that visit will be simulated
Ask that data and normal data (normal data is the access data obtained after the correct developing operation of front-end code) are compared, if mould
Quasi- access data are identical as normal data, then analog access data are normal, and front-end code meets exploitation standard testing and passes through, if mould
Quasi- access data and normal data be not identical, then analog access data exception, and it is obstructed that front-end code does not meet exploitation standard testing
It crosses, head end test platform generates prompt information, so that before front end developer is according to prompt information and analog access data point reuse
Hold code.
Further, the step S30 includes:
Step a1 receives the analog access data that digital simulation platform is sent, by the analog access data and pre- bidding
Normal data in quasi- table is compared;
Step b1, if the normal data in the analog access data and preset standard table mismatches, determine it is described before
End code does not meet exploitation standard, and using the analog access data as abnormal analogue data;
Wherein, predetermined analog table is to preset the table that normal data is corresponded to for storing each data access request,
Normal data is the access data obtained after the correct developing operation of front-end code;Preset standard refers to pre-set front-end code
Exploitation standard.
Step c1 shows the abnormal analogue data, so that front end developer adjustment includes the abnormal analogue data
Front-end code to be adjusted.
The number that head end test platform is triggered reception based on the front-end code in head end test platform in the present embodiment
It is intercepted according to access request, and the data access request of interception is sent to digital simulation platform, it is flat with the digital simulation
Simulation generates the corresponding analog access data of the data access request on platform;It is meant to ensure that the test of front-end code test development
Under the premise of efficiency, the authenticity of front-end code test is improved.
On the basis of first embodiment of the invention, further provide that the present invention is based on the surveys of the front-end code of analogue data
The second embodiment of method for testing.
The difference of the present embodiment and first embodiment of the invention is, in the present embodiment by first embodiment with mark number
It saves according to matched analog access data to predetermined analog table, is received again in user based on the front end generation in head end test platform
When the data access request that code is triggered, analog access data can be obtained, from predetermined analog table to avoid mould is repeatedly generated
Quasi- access data, to improve testing efficiency.
Specifically, include: in front-end code test method of the present embodiment based on analogue data
Step S31 receives the analog access data that digital simulation platform is sent, by the analog access data and pre- bidding
Normal data in quasi- table is compared.
Head end test platform receives the analog access data that digital simulation platform is sent, by analog access data and pre- bidding
Normal data in quasi- table is compared, wherein predetermined analog table is preset for storing each data access request pair
Answer the table of normal data, normal data is the access data obtained after the correct developing operation of front-end code, head end test platform
Determine whether front-end code meets exploitation standard according to comparison result.
Step S32 determines the front end if the analog access data are matched with the normal data in preset standard table
Code meets exploitation standard, and obtains the access identities for including in the data access request;
If analog access data are matched with the normal data in preset standard table, determine that the front-end code meets exploitation
Standard (exploitation standard refers to for determining that front-end code is correctly regular), and obtain the access mark for including in data access request
Know.
The analog access data are associated with the access identities and save to predetermined analog table by step S33.
Analog access data are associated with access identities and save to predetermined analog table by head end test platform, wherein default
Simulation table refers to that developer is pre-set for storing the table of correct analog access data, and in front end, developer repeats to survey
When trying identical front-end code, head end test platform can obtain analog access data from predetermined analog table, reduce front end and survey
Try duplicate work in platform.
Specifically, the present embodiment is to step S20 in first embodiment, if the current operating environment of the front-end code is out
The data access request is then sent to digital simulation platform and refined by hair ring border, is obtained head end test platform and is preset mould
The step of obtaining analog access data in quasi- table, specifically:
Step S21 obtains the data access request if the current operating environment of the front-end code is exploitation environment
In include target access mark.
Head end test platform determines that the current operating environment of front-end code is exploitation environment, then obtains in data access request
The target access mark for including.
The target access is identified and is compared with each access identities in the predetermined analog table by step S22;
Target access is identified and is compared with each access identities in the predetermined analog table by head end test platform, with judgement
Whether include the corresponding analogue data of target access mark in predetermined analog table.
Step S23 is obtained described pre- if target access mark is matched with access identities in the predetermined analog table
Data are accessed if simulating target access described in table and identifying corresponding target simulation, and show the target simulation access data.
If the target access mark is matched with access identities in the predetermined analog table, determine to wrap in predetermined analog table
Corresponding analogue data is identified containing target access, head end test platform obtains target access in predetermined analog table and identifies corresponding mesh
Analog access data are marked, and show the target simulation access data, developer checks for front end.
Step S24, if target access mark is mismatched with access identities in the predetermined analog table, by the number
Digital simulation platform is sent to according to access request.
If target access mark is mismatched with access identities in the predetermined analog table, determine not wrap in predetermined analog table
Corresponding analogue data is identified containing target access, data access request is sent to digital simulation platform by head end test platform, by
Simulation generates the corresponding analog access data of data access request on digital simulation platform.
When the analog access data generated in determination being matched with standard value in the present embodiment, by the analog access of generation
Data are added to predetermined analog table, and in user, when testing for the front-end code, head end test platform can be from pre- again
Analog access data are obtained in table if simulating, and are reduced duplicate work in head end test platform, are avoided repeatedly from digital simulation
Identical data are obtained on platform.
Further, referring to Fig. 3, the third for proposing the front-end code test method the present invention is based on analogue data is implemented
Example, the present embodiment is to apply the data processing step on simulation generating platform, described in the present embodiment based on simulation number
According to front-end code test method include:
Step S40, the data access request that receiving front-end test platform is sent, obtains in the data access request and includes
Access identities.
Before the present embodiment step S40, comprising:
Step a2 creates node environment, and builds web server using express under the node environment;
Step b2 generates prompt information, when detecting that the web server builds completion to prompt front end exploit person
Member configures according to predetermined analog rule and generates analog configuration list;
Step c2, each analog configuration list that receiving front-end developer uploads, and establish each analog configuration
The incidence relation of each virtual data interface in list and the web server, to pass through the mould of the virtual data interface conjunctionn
Quasi- configured list generates analog access data.
(Node.js is exactly the JavaScript for operating in server-side to installation node.js in the present embodiment.Node.js is
The running environment of one Javascript, Node.js are the Javascript running environment an of rear end, and front end developer exists
The Javascript code that server end is write under node.js environment gives Node.js to explain and execute) to complete node ring
The creation in border, and (express is the node.js project frame of an open source to installation express, and front end is opened under node environment
Originator can build a Web project using express, and the http-server creation of Web has been integrated in express, has been asked
The summation functions such as file management and the processing of Session) web server is built, the web server conduct of completion will be built
The frame of digital simulation platform.
Front end developer then generates prompt information after the frame of digital simulation platform is installed, to prompt front end to open
Hair personnel generate analog configuration according to predetermined analog rule (predetermined analog rule refers to pre-set mock.js rule) configuration
List, that is, when the frame of digital simulation platform builds completion, front end developer configures according to predetermined analog rule and generates simulation
The step of configured list includes: to carry out data-interface definition first (at this point, rear end is in development process during rear end is developed
In, there is no complete for the data process method of rear end), and the data-interface of definition is supplied to front end, front end is according to definition
Data-interface generates related words segment value using mock.js rule in configuration file, specifically, simulation is configured in configuration file
Configured list (analog configuration list is called mock configured list) is that difference is configured in the mock configured list in configuration file
Mock configure class, mock configuration class list each mock configuration class in be arranged different methods for generate it is different
Mock service.
When in front end, the analog configuration list configuration of developer is completed, front end developer carries out analog configuration list
It uploads, and establishes the incidence relation of each virtual data interface in each analog configuration list and the web server, obtain data mould
Quasi- platform.
Further, step c2, each analog configuration list that receiving front-end developer uploads, and establish each described
In analog configuration list and the web server the step of incidence relation of each virtual data interface after, further includes:
The request of mock configuration change can be triggered in developer, receives the request of mock configuration change, and obtain mock configuration
The change information for including in change request, according to the data information in the change information update mock configuration class list.That is, opening
Originator reconfigures mock class, can carry out the generation of analogue data, the present embodiment according to newly-generated mock class
In, realize that business demand clarification stage H5 can carry out designing in clarification, and then reduce the additional workload of coding stage.
In received data access request on digital simulation platform, digital simulation platform mouth can be connect by virtual data
The associated analog configuration list of mouth generates analog access data, and specifically, digital simulation platform generates the step of analog access data
Suddenly include:
Step S40, the data access request that receiving front-end test platform is sent, obtains in the data access request and includes
Access identities.
The data access request that digital simulation platform receiving front-end test platform is sent, obtains in the data access request
The access identities for including, wherein access identities refer to the identification information for uniquely determining data access request.
Step S50 calls the corresponding virtual data interface of the access identities according to the access identities, and obtains institute
State the analog configuration list of virtual data interface conjunctionn.
Digital simulation platform calls the corresponding virtual data interface of web server access identities according to access identities, and obtains
Take the analog configuration list of the virtual data interface conjunctionn.
Step S60 generates analog access data according to the data create-rule in the analog configuration list, and will be described
Analog access data are sent to head end test platform.
Digital simulation platform is dynamically generated analog access data: example according to the data create-rule in analog configuration list
Such as, different indemnity rules, exploitation is arranged in insurance proceeds data-interface, front end developer in insurance proceeds data-interface in advance
Person inputs initializaing variable in the process of development and triggers access request, and digital simulation platform receives access request and obtains access and asks
The access identities of the initializaing variable and access request that include in asking, digital simulation platform call corresponding virtual according to access identities
Data-interface, digital simulation platform obtain the indemnity rule of virtual data interface conjunctionn, and are selected according to the type of initializaing variable
Corresponding indemnity rule simulation generates the corresponding indemnity amount of money of test data, that is, the initial change of the carrying in insurance proceeds request
Amount is 100 yuan of insured amount, and according to the data create-rule in analog configuration list, the simulation indemnity amount of generation is 10000
The initializaing variable of member, the carrying in insurance proceeds request is 500 yuan of insured amount, and the data in analog configuration list generate rule
Then, the simulation indemnity amount of generation is 50000 yuan;And the analog access data are sent to head end test platform.
Further, the step S60 includes:
Step a2 obtains the initializaing variable carried in the data access request, and determines the variable of the initializaing variable
Type;
Step b2 obtains the corresponding data create-rule of types of variables described in the analog configuration list, by the number
The initializaing variable is handled according to create-rule, generates the corresponding analog access data of the data access request;
The analog access data are sent to head end test platform by step c2.
Analog testing platform connects on digital simulation platform according to pre-set analog configuration table in the present embodiment
When receiving data access request, digital simulation platform calls the access identities corresponding according to the access identities in access request
Virtual data interface, and obtain the analog configuration list of the virtual data interface conjunctionn, to generate analog access data, and
The analog access data are sent to head end test platform, it is in the present embodiment, raw in mock configuration class list setting data
At rule, the relevance of data is increased, that is, developer can configure in class in mock classifies different data, with
So that the mock analogue data and test data that generate have relevance, finally make that there is logic between the analogue data generated
Property, more meet truthful data.
In addition, the embodiment of the present invention also proposes a kind of front-end code test device based on analogue data, institute referring to Fig. 4
Stating the front-end code test device based on analogue data includes:
Determining module 10 is obtained, is asked for receiving the data access triggered based on the front-end code in head end test platform
It asks, obtains the environmental labels of the front-end code, and determine the current operation ring of the front-end code according to the environmental labels
Whether border is exploitation environment;
Sending module 20 is intercepted, if the current operating environment for the front-end code is exploitation environment, by the number
It is sent to digital simulation platform according to access request, generates the data access request pair to simulate on the digital simulation platform
The analog access data answered;
Wherein, the analog access data are according to the data create-rule that is arranged in the digital simulation platform and described
What the initializaing variable in data access request generated;
Display module 30 is received, the analog access data that analog platform is sent for receiving data, and show the simulation
Data are accessed, for front end developer front-end code according to the analog access data point reuse.
Optionally, the reception display module 30, further includes:
Comparing unit is received, the analog access data that analog platform is sent for receiving data, by the analog access number
It is compared according to the normal data in preset standard table;
Abnormality determination unit, if being mismatched for the normal data in the analog access data and preset standard table,
Determine that the front-end code does not meet exploitation standard, and using the analog access data as abnormal analogue data;
Abnormal show unit, for showing the abnormal analogue data, so that front end developer adjustment is comprising described different
The front-end code to be adjusted of normal analogue data.
Optionally, the reception display module 30, further includes:
Matching acquiring unit is sentenced if matching for the analog access data with the normal data in preset standard table
The fixed front-end code meets exploitation standard, and obtains the access identities for including in the data access request;
Data saving unit, for being associated with and saving to predetermined analog with the access identities by the analog access data
Table;
The interception sending module 20, further includes:
Acquiring unit obtains the data and visits if the current operating environment for the front-end code is exploitation environment
Ask the target access mark for including in request;
Comparing unit is compared for identifying the target access with each access identities in the predetermined analog table;
Display unit is matched, if being matched for target access mark with access identities in the predetermined analog table,
It obtains target access described in the predetermined analog table and identifies corresponding target simulation access data, and show the target simulation
Access data;
Request transmitting unit, if being mismatched for target access mark with access identities in the predetermined analog table,
The data access request is then sent to digital simulation platform.
It obtains target access described in the predetermined analog table and identifies corresponding target simulation access data, and described in display
Target simulation accesses data, for front end developer front-end code according to target simulation access data point reuse.
In addition, the embodiment of the present invention also proposes a kind of front-end code test device based on analogue data, institute referring to Fig. 5
Stating the front-end code test device based on analogue data includes:
It receives and obtains module 40, for the data access request that receiving front-end test platform is sent, obtain the data and visit
Ask the access identities for including in request;
It calls and obtains module 50, for calling the corresponding virtual data of the access identities to connect according to the access identities
Mouthful, and obtain the analog configuration list of the virtual data interface conjunctionn;
Sending module 60 is generated, for generating analog access number according to the data create-rule in the analog configuration list
According to, and the analog access data are sent to head end test platform.
Optionally, the front-end code test device based on analogue data further include:
Module is built in creation, for creating node environment, and is built web using express under the node environment and is taken
Business device;
Configuration module is prompted, for generating prompt information when detecting that the web server builds completion, with prompt
Front end developer configures according to predetermined analog rule and generates analog configuration list;
Relating module is received, for each analog configuration list that receiving front-end developer uploads, and establishes each institute
The incidence relation of each virtual data interface in analog configuration list and the web server is stated, to connect by the virtual data
The associated analog configuration list of mouth generates analog access data.
Optionally, the generation sending module 60, comprising:
Determination unit is obtained, for obtaining the initializaing variable carried in the data access request, and is determined described initial
The types of variables of variable;
Generation unit is simulated, generates rule for obtaining the corresponding data of types of variables described in the analog configuration list
Then, the initializaing variable is handled by the data create-rule, generates the corresponding analog access data of the data access request;
Data transmission unit, for the analog access data to be sent to head end test platform.
Wherein, the step of each Implement of Function Module of the front-end code test device based on analogue data can refer to this hair
Each embodiment of the bright front-end code test method based on analogue data, details are not described herein again.
In addition, the embodiment of the present invention also proposes a kind of front-end code test macro based on analogue data, it is described to be based on mould
The front-end code test macro of quasi- data includes the head end test platform and data analog platform of communication connection;
The head end test platform includes: first memory, first processor and is stored on the first memory simultaneously
The computer program that can be run on the first processor;It is realized when the computer program is executed by first processor following
Step includes:
The data access request triggered based on the front-end code in head end test platform is received, first processor obtains institute
The environmental labels of front-end code are stated, and determine whether the current operating environment of the front-end code is out according to the environmental labels
Hair ring border;
If the current operating environment of the front-end code is exploitation environment, first processor is by the data access request
It is sent to digital simulation platform, generates the corresponding simulation visit of the data access request to simulate on the digital simulation platform
Ask data;
First processor receives the analog access data that digital simulation platform is sent, and shows the analog access data,
For front end developer front-end code according to the analog access data point reuse;
The digital simulation platform includes: second memory, second processor and is stored on the second memory simultaneously
The computer program that can be run in the second processor;It is realized when the computer program is executed by first processor following
Step includes:
The data access request that second processor receiving front-end test platform is sent, second memory obtain the data and visit
Ask the access identities for including in request;
According to the access identities, second memory calls the corresponding virtual data interface of the access identities, and obtains
The analog configuration list of the virtual data interface conjunctionn;
Second memory generates analog access data according to the data create-rule in the analog configuration list, and by institute
It states analog access data and is sent to head end test platform.
In addition, the embodiment of the present invention also proposes a kind of computer storage medium.
Computer program, the realization when computer program is executed by processor are stored in the computer storage medium
Operation in front-end code test method provided by the above embodiment based on analogue data.
It should be noted that, in this document, relational terms such as first and second and the like are used merely to a reality
Body/operation/object is distinguished with another entity/operation/object, without necessarily requiring or implying these entity/operations/
There are any actual relationship or orders between object;The terms "include", "comprise" or its any other variant meaning
Covering non-exclusive inclusion, so that the process, method, article or the system that include a series of elements not only include that
A little elements, but also including other elements that are not explicitly listed, or further include for this process, method, article or
The intrinsic element of system.In the absence of more restrictions, the element limited by sentence "including a ...", is not arranged
Except there is also other identical elements in process, method, article or the system for including the element.
The serial number of the above embodiments of the invention is only for description, does not represent the advantages or disadvantages of the embodiments.
Through the above description of the embodiments, those skilled in the art can be understood that above-described embodiment side
Method can be realized by means of software and necessary general hardware platform, naturally it is also possible to by hardware, but in many cases
The former is more preferably embodiment.Based on this understanding, technical solution of the present invention substantially in other words does the prior art
The part contributed out can be embodied in the form of software products, which is stored in one as described above
In storage medium (such as ROM/RAM, magnetic disk, CD), including some instructions are used so that terminal device (it can be mobile phone,
Computer, server, air conditioner or network equipment etc.) execute method described in each embodiment of the present invention.
The above is only a preferred embodiment of the present invention, is not intended to limit the scope of the invention, all to utilize this hair
Equivalent structure or equivalent flow shift made by bright specification and accompanying drawing content is applied directly or indirectly in other relevant skills
Art field, is included within the scope of the present invention.