CN112631910A - Front-end testing method and device, computer equipment and storage medium - Google Patents

Front-end testing method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN112631910A
CN112631910A CN202011528258.0A CN202011528258A CN112631910A CN 112631910 A CN112631910 A CN 112631910A CN 202011528258 A CN202011528258 A CN 202011528258A CN 112631910 A CN112631910 A CN 112631910A
Authority
CN
China
Prior art keywords
interface
data request
preset
mock environment
data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202011528258.0A
Other languages
Chinese (zh)
Inventor
史金伟
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Puhui Enterprise Management Co Ltd
Original Assignee
Ping An Puhui Enterprise Management 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 Ping An Puhui Enterprise Management Co Ltd filed Critical Ping An Puhui Enterprise Management Co Ltd
Priority to CN202011528258.0A priority Critical patent/CN112631910A/en
Publication of CN112631910A publication Critical patent/CN112631910A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites

Abstract

The embodiment of the application belongs to the field of research and development testing, and relates to a front-end testing method, a front-end testing device, computer equipment and a storage medium, wherein the method comprises the steps of receiving a testing instruction to generate a data request, wherein the data request comprises an interface to be tested and an access parameter; reading a preset mock environment identifier according to the interface to be tested, and reading the mock environment address when the identifier is a first identifier; the mock environment is a preset server for storing interface simulation data, wherein the interface simulation data and the access participation preset corresponding relation; sending the data request to the mock environment according to the mock environment address; and receiving interface simulation data corresponding to the access parameters, returned by the mock environment in response to the data request. The real scene is simulated by presetting the interface simulation data corresponding to the input parameters and returning the corresponding interface simulation data according to different input parameters, so that the test effectiveness is improved, the front-end test can be still performed when the back-end server is abnormal, and the test process is accelerated.

Description

Front-end testing method and device, computer equipment and storage medium
Technical Field
The present application relates to the field of research and development testing technologies, and in particular, to a front-end testing method and apparatus, a computer device, and a storage medium.
Background
Software development projects mostly adopt a front-end and back-end separation mode to accelerate project development periods, when development codes are deployed in a test environment and enter a test link, page display depends on a back-end server interface, and meanwhile, the back-end server can call interfaces and data of other systems when data processing is carried out. Once other systems are abnormal, the back-end server cannot normally return data, or the back-end server itself is abnormal, so that the interface cannot return, page display is affected, and a front-end test process is blocked.
Disclosure of Invention
An object of the embodiments of the present application is to provide a front-end testing method, apparatus, computer device, and storage medium, so as to solve the problem that a front-end test is blocked.
In order to solve the above technical problem, an embodiment of the present application provides a front end testing method, which adopts the following technical solutions:
receiving a test instruction to generate a data request, wherein the data request comprises an interface to be tested and an access parameter;
reading a preset mock environment identifier according to the interface to be tested, and reading the mock environment address when the identifier is a first identifier; the mock environment is a preset server for storing interface simulation data, wherein the interface simulation data and the access participation preset corresponding relation;
sending the data request to the mock environment according to the mock environment address;
and receiving interface simulation data corresponding to the access parameters, returned by the mock environment in response to the data request.
Further, the step of receiving the test instruction to generate a data request, where the data request includes an interface and a reference, further includes:
and randomly generating a data request according to a preset interface sequence to be tested and a preset reference sequence.
Further, reading a preset mock environment identifier according to the interface to be tested, and reading the mock environment address when the identifier is a first identifier; the mock environment is a preset server for storing interface simulation data, wherein the step of entering the preset corresponding relation by the interface simulation data further comprises the following steps:
reading the state of a preset corresponding interface of a back-end server according to the interface to be tested, and sending the data request to the back-end server when the corresponding interface is in a first state;
and receiving response data returned by the back-end server in response to the data request.
Further, reading a state of a preset corresponding interface of the back-end server according to the interface to be tested, and when the corresponding interface is in the first state, sending the data request to the back-end server, after the step of:
and when the corresponding interface is in a second state, setting the mock environment identifier as a first identifier.
Further, after the step of receiving the interface simulation data corresponding to the input references returned by the mock environment in response to the data request, the method further includes:
and displaying a front-end page according to the interface simulation data.
In order to solve the above technical problem, an embodiment of the present application further provides a front end testing apparatus, which adopts the following technical scheme:
the generating module is used for receiving a test instruction to generate a data request, wherein the data request comprises an interface to be tested and an input parameter;
the reading module is used for reading a preset mock environment identifier according to the interface to be tested, and reading the mock environment address when the identifier is a first identifier; the mock environment is a preset server for storing interface simulation data, wherein the interface simulation data and the access participation preset corresponding relation;
the first sending module is used for sending the data request to the mock environment according to the mock environment address;
and the first receiving module is used for receiving interface simulation data corresponding to the input parameter, returned by the mock environment in response to the data request.
Further, the generating module includes:
and the first generation submodule is used for randomly generating a data request according to a preset interface sequence to be tested and a preset reference sequence.
Further, the front end testing device further comprises:
the second sending module is used for reading the state of a preset corresponding interface of the back-end server according to the interface to be detected, and sending the data request to the back-end server when the corresponding interface is in the first state;
and the second receiving module is used for receiving response data returned by the back-end server in response to the data request.
Further, the front end testing device further comprises:
and the first setting module is used for setting the mock environment identifier as a first identifier when the corresponding interface is in the second state.
Further, the front end testing device further comprises:
and the display module is used for displaying the front-end page according to the interface simulation data.
In order to solve the above technical problem, an embodiment of the present application further provides a computer device, which adopts the following technical solutions:
a computer device comprising a memory having computer readable instructions stored therein and a processor which when executed implements the steps of the front end testing method of any of claims 1 to 5.
A computer readable storage medium having computer readable instructions stored thereon which, when executed by a processor, implement the steps of the foregoing front-end testing method.
In order to solve the above technical problem, an embodiment of the present application further provides a computer-readable storage medium, which adopts the following technical solutions:
a computer readable storage medium having computer readable instructions stored thereon which, when executed by a processor, implement the steps of the foregoing front-end testing method.
Compared with the prior art, the embodiment of the application mainly has the following beneficial effects: receiving a test instruction to generate a data request, wherein the data request comprises an interface to be tested and an access parameter; reading a preset mock environment identifier according to the interface to be tested, and reading the mock environment address when the identifier is a first identifier; the mock environment is a preset server for storing interface simulation data, wherein the interface simulation data and the access participation preset corresponding relation; sending the data request to the mock environment according to the mock environment address; and receiving interface simulation data corresponding to the access parameters, returned by the mock environment in response to the data request. The real scene is simulated by presetting the interface simulation data corresponding to the input parameters and returning the corresponding interface simulation data according to different input parameters, so that the test effectiveness is improved, the front-end test can be still performed when the back-end server is abnormal, and the test process is accelerated.
Drawings
In order to more clearly illustrate the solution of the present application, the drawings needed for describing the embodiments of the present application will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present application, and that other drawings can be obtained by those skilled in the art without inventive effort.
FIG. 1 is an exemplary system architecture diagram in which the present application may be applied;
FIG. 2 is a flow diagram of one embodiment of a front end testing method according to the present application;
FIG. 3 is a flow diagram of one embodiment of a front end test method;
FIG. 4 is a schematic block diagram of one embodiment of a front end test apparatus according to the present application;
FIG. 5 is a schematic block diagram of one embodiment of a computer device according to the present application.
Detailed Description
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs; the terminology used in the description of the application herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application; the terms "including" and "having," and any variations thereof, in the description and claims of this application and the description of the above figures are intended to cover non-exclusive inclusions. The terms "first," "second," and the like in the description and claims of this application or in the above-described drawings are used for distinguishing between different objects and not for describing a particular order.
Reference herein to "an embodiment" means that a particular feature, structure, or characteristic described in connection with the embodiment can be included in at least one embodiment of the application. The appearances of the phrase in various places in the specification are not necessarily all referring to the same embodiment, nor are separate or alternative embodiments mutually exclusive of other embodiments. It is explicitly and implicitly understood by one skilled in the art that the embodiments described herein can be combined with other embodiments.
In order to make the technical solutions better understood by those skilled in the art, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the accompanying drawings.
As shown in fig. 1, the system architecture 100 may include terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 serves as a medium for providing communication links between the terminal devices 101, 102, 103 and the server 105. Network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
The user may use the terminal devices 101, 102, 103 to interact with the server 105 via the network 104 to receive or send messages or the like. The terminal devices 101, 102, 103 may have various communication client applications installed thereon, such as a web browser application, a shopping application, a search application, an instant messaging tool, a mailbox client, social platform software, and the like.
The terminal devices 101, 102, 103 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, e-book readers, MP3 players (Moving Picture experts Group Audio Layer III, mpeg compression standard Audio Layer 3), MP4 players (Moving Picture experts Group Audio Layer IV, mpeg compression standard Audio Layer 4), laptop portable computers, desktop computers, and the like.
The server 105 may be a server providing various services, such as a background server providing support for pages displayed on the terminal devices 101, 102, 103.
It should be noted that the front-end testing method provided by the embodiments of the present application generally consists ofServer/terminal devicePerforming, accordingly, front-end test equipment is typically providedServer/terminal deviceIn (1).
It should be understood that the number of terminal devices, networks, and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
With continued reference to FIG. 2, a flow diagram of one embodiment of a method of front end testing is shown, in accordance with the present application. The front-end testing method comprises the following steps:
step S201, receiving a test instruction to generate a data request, where the data request includes an interface to be tested and an entry parameter.
In this embodiment, an electronic device (such as that shown in FIG. 1) on which the front-end test method operatesServer/terminal Terminal equipment) The test instruction may be received through a wired connection or a wireless connection. It should be noted that the wireless connection means may include, but is not limited to, a 3G/4G connection, a WiFi connection, a bluetooth connection, a WiMAX connection, a Zigbee connection, a uwb (ultra wideband) connection, and other wireless connection means now known or developed in the future.
With the development of internet technology, the requirement on timeliness of project development is higher, and in order to increase the development speed, a front-end and back-end separation mode is usually adopted to accelerate the project development cycle, and structurally, the project development cycle is a B/S structure or a C/S structure, that is, the front end is a browser or a client, and the back end is a server. The application refers to the front end including the case that the front end is a browser and a client. The user makes a data request to the server through the browser interface or the client, displays a result returned by the server, and the back-end server processes the data request and returns a processing result to the front-end.
The interface here refers to a virtual channel between two modules in a software system for data interaction based on a certain rule, and the input parameter is input. For example, module a requests that module B return weather data on day 10/month 1 of 2020 through interface C, then the data request of module a includes interface C and entry date 10/month 1 of 2020. The interface C is a preset virtual channel for transmitting weather data.
The test instruction can be written in the test script file, the test script file is operated, and the test instruction is sent to the client. Or the tester inputs an instruction as a test instruction on a user interaction interface of the client, and the client responds to the test instruction to generate a data request. The data request includes the interface to be tested and the entry parameter.
Step S202, reading a preset mock environment identifier according to the interface to be tested, and reading the mock environment address when the identifier is a first identifier; the mock environment is a preset server for storing interface simulation data, wherein the interface simulation data and the access participation preset corresponding relation.
In this embodiment, a mock environment identifier is read, and the mock environment is a preset server in which interface simulation data is stored. The Mock environment is set so that when front-end and back-end separated development is adopted, the front end completes code development and needs to test the display effect, and when the back-end development is not completed or abnormal, the front-end test is carried out in a data simulation mode. In this way, the process of project development is accelerated. The interface simulation data stored on the mock environment server is in preset corresponding relation with the access participants.
And S203, sending the data request to the mock environment according to the mock environment address.
The Mock environment is a preset server which saves interface simulation data, the Mock environment identification is a preset identification bit which represents an interface data source, the value is 0 and 1, when the Mock environment identification is 1, namely when the Mock environment is a first identification, the Mock environment identification represents that the interface simulation data in the Mock environment is used for responding to a data request, and according to a Mock environment address, the front end sends the data request to the Mock environment.
And step S204, receiving interface simulation data corresponding to the access parameter, returned by the mock environment in response to the data request.
In the embodiment of the application, the interface simulation data stored on the mock environment server is in a preset corresponding relation with the access parameter, for example, the client requests the interface 1 data, the mock environment server responds to the data request, and the data of the interface 1 corresponding to the access parameter is logically judged and returned according to the access parameter of the interface 1. The same interface, different input parameters and different returned data simulate a real scene, and test effectiveness is provided.
The method comprises the steps of generating a data request by receiving a test instruction, wherein the data request comprises an interface to be tested and an input parameter; reading a preset mock environment identifier according to the interface to be tested, and reading the mock environment address when the identifier is a first identifier; the mock environment is a preset server for storing interface simulation data, wherein the interface simulation data and the access participation preset corresponding relation; sending the data request to the mock environment according to the mock environment address; and receiving interface simulation data corresponding to the access parameters, returned by the mock environment in response to the data request. The real scene is simulated by presetting the interface simulation data corresponding to the input parameters and returning the corresponding interface simulation data according to different input parameters, so that the test effectiveness is improved, the front-end test can be still performed when the back-end server is abnormal, and the test process is accelerated.
In some optional implementation manners of this embodiment, in step S201, the electronic device may further perform the following steps:
and randomly generating a data request according to a preset interface sequence to be tested and a preset reference sequence.
In the embodiment of the application, an interface sequence to be tested and a reference sequence are preset, the interface sequence to be tested comprises all interfaces to be tested between a front-end server and a back-end server, and the reference sequence refers to input parameters of each interface to be tested. And randomly appointing one of the interface sequence to be tested and the reference sequence to generate a data request. For example python can be implemented using random functions. The random appointed interface and the input parameter are tested, so that the real scene is automatically simulated, manual intervention is not needed, and the testing efficiency is improved.
In some optional implementations, before step S202, the electronic device may perform the following steps:
step S301, reading the state of a preset corresponding interface of a back-end server according to the interface to be tested, and sending the data request to the back-end server when the corresponding interface is in a first state;
step S302, according to the response data returned by the back-end server in response to the data request.
The back-end server mentioned in the embodiments of the present application refers to a system that is integrated with the front-end to implement a specific function. And the back-end server calls a preset data processing program to process according to the data request and returns a processing result. The Mock environment server has no data processing program and only defines each interface and the data returned by the entries. Before reading the mock environment identifier, the front end reads the state of the interface of the back-end server, receives the message returned by the back-end server by sending the message to the interface of the back-end server, analyzes the message returned by the back-end server, judges whether the interface is normal or not, sends a data request to the back-end server when the interface state is normal, and receives the data responded by the back-end server for displaying the page to test the page. When the interface is in the first state, namely in the normal state, the simulation data of the mock environment is not used, but the real data of the back-end server is used, so that the effectiveness of the test is favorably improved. When the back-end server interface is normal, the mock environment identifier is set as a second identifier to indicate that the back-end server is normal, the mock environment server interface is closed, and the interface simulation data test is not used.
When a test instruction is received, the state of the corresponding interface of the rear-end server is read, the data of the rear-end server is used when the state is normal, and the mock environment server is used when the state is abnormal, so that the data can be conveniently switched with each other, and the test process is accelerated.
In some optional implementations, after step S301, the electronic device may perform the following steps:
and when the corresponding interface is in a second state, setting the mock environment identifier as a first identifier.
In the embodiment of the application, when the interface of the back-end server is in the second state, the back-end server sends the message to the back-end server, receives the message returned by the back-end server, and judges whether the interface of the back-end server is normal or not, or when the returned message is overtime, the interface of the back-end server is judged to be abnormal. Namely, when the back-end server interface is abnormal, the mock environment identifier is set as a first identifier. Local persistent storage is adopted: setitem (), which represents simulated data that is a mock environment in response to a data request later.
In some optional implementations, after step S204, the electronic device may perform the following steps:
and displaying a front-end page according to the interface simulation data.
In the embodiment of the application, after the front end receives the interface simulation data, the interface simulation data is displayed according to the front end page design, so that a tester can conveniently observe the vision, the compatibility and whether the interface is normal.
The application is operational with numerous general purpose or special purpose computing system environments or configurations. For example: personal computers, server computers, hand-held or portable devices, tablet-type devices, multiprocessor systems, microprocessor-based systems, set top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, distributed computing environments that include any of the above systems or devices, and the like. The application may be described in the general context of computer-executable instructions, such as program modules, being executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc. that perform particular tasks or implement particular abstract data types. The application may also be practiced in distributed computing environments where tasks are performed by remote processing devices that are linked through a communications network. In a distributed computing environment, program modules may be located in both local and remote computer storage media including memory storage devices.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware associated with computer readable instructions, which can be stored in a computer readable storage medium, and when executed, the processes of the embodiments of the methods described above can be included. The storage medium may be a non-volatile storage medium such as a magnetic disk, an optical disk, a Read-Only Memory (ROM), or a Random Access Memory (RAM).
It should be understood that, although the steps in the flowcharts of the figures are shown in order as indicated by the arrows, the steps are not necessarily performed in order as indicated by the arrows. The steps are not performed in the exact order shown and may be performed in other orders unless explicitly stated herein. Moreover, at least a portion of the steps in the flow chart of the figure may include multiple sub-steps or multiple stages, which are not necessarily performed at the same time, but may be performed at different times, which are not necessarily performed in sequence, but may be performed alternately or alternately with other steps or at least a portion of the sub-steps or stages of other steps.
With further reference to fig. 4, as an implementation of the method shown in fig. 2, the present application provides an embodiment of a front-end testing apparatus, which corresponds to the embodiment of the method shown in fig. 2, and which can be applied to various electronic devices.
As shown in fig. 4, the front end test apparatus 400 according to this embodiment includes: the device comprises a generating module 401, a reading module 402, a first sending module 403 and a first receiving module 404. Wherein:
the generating module is used for receiving a test instruction to generate a data request, wherein the data request comprises an interface to be tested and an input parameter;
the reading module is used for reading a preset mock environment identifier according to the interface to be tested, and reading the mock environment address when the identifier is a first identifier; the mock environment is a preset server for storing interface simulation data, wherein the interface simulation data and the access participation preset corresponding relation;
the first sending module is used for sending the data request to the mock environment according to the mock environment address;
and the first receiving module is used for receiving interface simulation data corresponding to the input parameter, returned by the mock environment in response to the data request.
In this embodiment, a data request is generated by receiving a test instruction, where the data request includes an interface to be tested and an entry parameter; reading a preset mock environment identifier according to the interface to be tested, and reading the mock environment address when the identifier is a first identifier; the mock environment is a preset server for storing interface simulation data, wherein the interface simulation data and the access participation preset corresponding relation; sending the data request to the mock environment according to the mock environment address; and receiving interface simulation data corresponding to the access parameters, returned by the mock environment in response to the data request. The real scene is simulated by presetting the interface simulation data corresponding to the input parameters and returning the corresponding interface simulation data according to different input parameters, so that the test effectiveness is improved, the front-end test can be still performed when the back-end server is abnormal, and the test process is accelerated.
In some optional implementations of this embodiment, the generating module includes:
and the first generation submodule is used for randomly generating a data request according to a preset interface sequence to be tested and a preset reference sequence.
In some optional implementations of this embodiment, the front-end testing apparatus further includes:
the second sending module is used for reading the state of a preset corresponding interface of the back-end server according to the interface to be detected, and sending the data request to the back-end server when the corresponding interface is in the first state;
and the second receiving module is used for receiving response data returned by the back-end server in response to the data request.
In some optional implementations of this embodiment, the front-end testing apparatus further includes:
and the first setting module is used for setting the mock environment identifier as a first identifier when the corresponding interface is in the second state.
In some optional implementations of this embodiment, the front-end testing apparatus further includes:
and the display module is used for displaying the front-end page according to the interface simulation data. .
In order to solve the technical problem, an embodiment of the present application further provides a computer device. Referring to fig. 5, fig. 5 is a block diagram of a basic structure of a computer device according to the present embodiment.
The computer device 5 comprises a memory 51, a processor 52, a network interface 53 communicatively connected to each other via a system bus. It is noted that only a computer device 5 having components 51-53 is shown, but it is understood that not all of the shown components are required to be implemented, and that more or fewer components may be implemented instead. As will be understood by those skilled in the art, the computer device is a device capable of automatically performing numerical calculation and/or information processing according to a preset or stored instruction, and the hardware includes, but is not limited to, a microprocessor, an Application Specific Integrated Circuit (ASIC), a Programmable Gate Array (FPGA), a Digital Signal Processor (DSP), an embedded device, and the like.
The computer device can be a desktop computer, a notebook, a palm computer, a cloud server and other computing devices. The computer equipment can carry out man-machine interaction with a user through a keyboard, a mouse, a remote controller, a touch panel or voice control equipment and the like.
The memory 51 includes at least one type of readable storage medium including a flash memory, a hard disk, a multimedia card, a card type memory (e.g., SD or DX memory, etc.), a Random Access Memory (RAM), a Static Random Access Memory (SRAM), a Read Only Memory (ROM), an Electrically Erasable Programmable Read Only Memory (EEPROM), a Programmable Read Only Memory (PROM), a magnetic memory, a magnetic disk, an optical disk, etc. In some embodiments, the memory 51 may be an internal storage unit of the computer device 5, such as a hard disk or a memory of the computer device 5. In other embodiments, the memory 51 may also be an external storage device of the computer device 5, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), and the like, which are provided on the computer device 5. Of course, the memory 51 may also comprise both an internal storage unit of the computer device 5 and an external storage device thereof. In this embodiment, the memory 51 is generally used for storing an operating system installed in the computer device 5 and various application software, such as computer readable instructions of a front-end testing method. Further, the memory 51 may also be used to temporarily store various types of data that have been output or are to be output.
The processor 52 may be a Central Processing Unit (CPU), controller, microcontroller, microprocessor, or other data Processing chip in some embodiments. The processor 52 is typically used to control the overall operation of the computer device 5. In this embodiment, the processor 52 is configured to execute computer-readable instructions stored in the memory 51 or process data, for example, execute computer-readable instructions of the front-end testing method.
The network interface 53 may comprise a wireless network interface or a wired network interface, and the network interface 53 is generally used for establishing communication connections between the computer device 5 and other electronic devices.
The method comprises the steps of generating a data request by receiving a test instruction, wherein the data request comprises an interface to be tested and an input parameter; reading a preset mock environment identifier according to the interface to be tested, and reading the mock environment address when the identifier is a first identifier; the mock environment is a preset server for storing interface simulation data, wherein the interface simulation data and the access participation preset corresponding relation; sending the data request to the mock environment according to the mock environment address; and receiving interface simulation data corresponding to the access parameters, returned by the mock environment in response to the data request. The real scene is simulated by presetting the interface simulation data corresponding to the input parameters and returning the corresponding interface simulation data according to different input parameters, so that the test effectiveness is improved, the front-end test can be still performed when the back-end server is abnormal, and the test process is accelerated.
The present application further provides another embodiment, which is to provide a computer-readable storage medium storing computer-readable instructions executable by at least one processor to cause the at least one processor to perform the steps of the front-end testing method as described above.
The method comprises the steps of generating a data request by receiving a test instruction, wherein the data request comprises an interface to be tested and an input parameter; reading a preset mock environment identifier according to the interface to be tested, and reading the mock environment address when the identifier is a first identifier; the mock environment is a preset server for storing interface simulation data, wherein the interface simulation data and the access participation preset corresponding relation; sending the data request to the mock environment according to the mock environment address; and receiving interface simulation data corresponding to the access parameters, returned by the mock environment in response to the data request. The real scene is simulated by presetting the interface simulation data corresponding to the input parameters and returning the corresponding interface simulation data according to different input parameters, so that the test effectiveness is improved, the front-end test can be still performed when the back-end server is abnormal, and the test process is accelerated.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present application may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal device (such as a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present application.
It is to be understood that the above-described embodiments are merely illustrative of some, but not restrictive, of the broad invention, and that the appended drawings illustrate preferred embodiments of the invention and do not limit the scope of the invention. This application is capable of embodiments in many different forms and is provided for the purpose of enabling a thorough understanding of the disclosure of the application. Although the present application has been described in detail with reference to the foregoing embodiments, it will be apparent to one skilled in the art that the present application may be practiced without modification or with equivalents of some of the features described in the foregoing embodiments. All equivalent structures made by using the contents of the specification and the drawings of the present application are directly or indirectly applied to other related technical fields and are within the protection scope of the present application.

Claims (10)

1. A front end test method, comprising the steps of:
receiving a test instruction to generate a data request, wherein the data request comprises an interface to be tested and an access parameter;
reading a preset mock environment identifier according to the interface to be tested, and reading the mock environment address when the identifier is a first identifier; the mock environment is a preset server for storing interface simulation data, wherein the interface simulation data and the access participation preset corresponding relation;
sending the data request to the mock environment according to the mock environment address;
and receiving interface simulation data corresponding to the access parameters, returned by the mock environment in response to the data request.
2. The front-end test method of claim 1, wherein the step of generating a data request by receiving the test command, the data request including an interface and an entry parameter further comprises:
and randomly generating a data request according to a preset interface sequence to be tested and a preset reference sequence.
3. The front-end testing method of claim 1, characterized in that, a preset mock environment identifier is read according to the interface to be tested, and when the identifier is a first identifier, the mock environment address is read; the mock environment is a preset server for storing interface simulation data, wherein the step of entering the preset corresponding relation by the interface simulation data further comprises the following steps:
reading the state of a preset corresponding interface of a back-end server according to the interface to be tested, and sending the data request to the back-end server when the corresponding interface is in a first state;
and receiving response data returned by the back-end server in response to the data request.
4. The front-end testing method according to claim 3, wherein after the step of reading a preset state of a corresponding interface of a back-end server according to the interface to be tested, and when the corresponding interface is in a first state, sending the data request to the back-end server, the method comprises:
and when the corresponding interface is in a second state, setting the mock environment identifier as a first identifier.
5. The front-end testing method of claim 1, wherein after the step of receiving the interface simulation data corresponding to the input references returned by the mock environment in response to the data request, the method further comprises:
and displaying a front-end page according to the interface simulation data.
6. A front end test device, comprising:
the generating module is used for receiving a test instruction to generate a data request, wherein the data request comprises an interface to be tested and an input parameter;
the reading module is used for reading a preset mock environment identifier according to the interface to be tested, and reading the mock environment address when the identifier is a first identifier; the mock environment is a preset server for storing interface simulation data, wherein the interface simulation data and the access participation preset corresponding relation;
the first sending module is used for sending the data request to the mock environment according to the mock environment address;
and the first receiving module is used for receiving interface simulation data corresponding to the input parameter, returned by the mock environment in response to the data request.
7. The front-end test device of claim 6, wherein the generating module comprises:
and the first generation submodule is used for randomly generating a data request according to a preset interface sequence to be tested and a preset reference sequence.
8. The front end test device of claim 6, further comprising:
the second sending module is used for reading the state of a preset corresponding interface of the back-end server according to the interface to be detected, and sending the data request to the back-end server when the corresponding interface is in the first state;
and the second receiving module is used for receiving response data returned by the back-end server in response to the data request.
9. A computer device comprising a memory having computer readable instructions stored therein and a processor which when executed implements the steps of the front end testing method of any of claims 1 to 5.
10. A computer readable storage medium having computer readable instructions stored thereon which, when executed by a processor, implement the steps of the front end testing method of any of claims 1 to 5.
CN202011528258.0A 2020-12-22 2020-12-22 Front-end testing method and device, computer equipment and storage medium Pending CN112631910A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011528258.0A CN112631910A (en) 2020-12-22 2020-12-22 Front-end testing method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011528258.0A CN112631910A (en) 2020-12-22 2020-12-22 Front-end testing method and device, computer equipment and storage medium

Publications (1)

Publication Number Publication Date
CN112631910A true CN112631910A (en) 2021-04-09

Family

ID=75321421

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011528258.0A Pending CN112631910A (en) 2020-12-22 2020-12-22 Front-end testing method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN112631910A (en)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113656435A (en) * 2021-08-20 2021-11-16 北京神州新桥科技有限公司 Transaction data query method, electronic device and storage medium
CN113821449A (en) * 2021-11-22 2021-12-21 浙江口碑网络技术有限公司 System testing method and device and electronic equipment
CN113836460A (en) * 2021-08-13 2021-12-24 深圳市明源云空间电子商务有限公司 mock data control method, equipment terminal and computer readable storage medium
CN114936104A (en) * 2022-07-19 2022-08-23 杭州玖玖盾信息科技有限公司 Analog data processing method, device, equipment and storage medium
CN116627849A (en) * 2023-07-24 2023-08-22 中邮消费金融有限公司 System test method, device, equipment and storage medium
CN116795723A (en) * 2023-08-21 2023-09-22 建信金融科技有限责任公司 Chain unit test processing method and device and computer equipment

Cited By (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113836460A (en) * 2021-08-13 2021-12-24 深圳市明源云空间电子商务有限公司 mock data control method, equipment terminal and computer readable storage medium
CN113656435A (en) * 2021-08-20 2021-11-16 北京神州新桥科技有限公司 Transaction data query method, electronic device and storage medium
CN113656435B (en) * 2021-08-20 2023-09-01 北京神州新桥科技有限公司 Transaction data query method, electronic device and storage medium
CN113821449A (en) * 2021-11-22 2021-12-21 浙江口碑网络技术有限公司 System testing method and device and electronic equipment
CN114936104A (en) * 2022-07-19 2022-08-23 杭州玖玖盾信息科技有限公司 Analog data processing method, device, equipment and storage medium
CN116627849A (en) * 2023-07-24 2023-08-22 中邮消费金融有限公司 System test method, device, equipment and storage medium
CN116627849B (en) * 2023-07-24 2024-01-26 中邮消费金融有限公司 System test method, device, equipment and storage medium
CN116795723A (en) * 2023-08-21 2023-09-22 建信金融科技有限责任公司 Chain unit test processing method and device and computer equipment
CN116795723B (en) * 2023-08-21 2023-11-21 建信金融科技有限责任公司 Chain unit test processing method and device and computer equipment

Similar Documents

Publication Publication Date Title
CN112631910A (en) Front-end testing method and device, computer equipment and storage medium
CN113452579B (en) H5 page loading method and device, computer equipment and storage medium
CN112416458A (en) Preloading method and device based on ReactNative, computer equipment and storage medium
CN113259342A (en) Login verification method, device, computer equipment and medium
CN112631911A (en) Automatic testing method and device, computer equipment and storage medium
CN105808307B (en) Page display method and device
CN114095567A (en) Data access request processing method and device, computer equipment and medium
CN113536185A (en) Application page loading method, storage medium and related equipment thereof
US20220245208A1 (en) Method for switching skin of mini-program page, and electronic device
CN115794437A (en) Calling method and device of microservice, computer equipment and storage medium
CN112910741B (en) Interface testing method and device, computer equipment and storage medium
CN116661936A (en) Page data processing method and device, computer equipment and storage medium
CN115712422A (en) Form page generation method and device, computer equipment and storage medium
CN112131092A (en) Page debugging method and device
CN114995914A (en) Picture data processing method and device, computer equipment and storage medium
CN112632192A (en) Node maintenance method and device, computer equipment and medium
CN112416455A (en) Data processing method, device, terminal and storage medium
CN111552898A (en) Flowchart drawing method and device based on Html5, computer equipment and storage medium
CN110765610A (en) PDM (product data management) integration method and device, computer equipment and storage medium
CN112328940A (en) Method and device for embedding transition page into webpage, computer equipment and storage medium
CN115222545A (en) Message modular processing method and device, computer equipment and storage medium
CN116467145A (en) Page performance data acquisition method and device, computer equipment and storage medium
CN116860644A (en) Automatic test method, device, computer equipment and storage medium
CN114238466A (en) Message pushing method and device, computer equipment and storage medium
CN115687120A (en) Service line full link testing method, device, equipment and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination