WO2018223717A1 - Webpage front-end testing method, device, system, apparatus and readable storage medium - Google Patents

Webpage front-end testing method, device, system, apparatus and readable storage medium Download PDF

Info

Publication number
WO2018223717A1
WO2018223717A1 PCT/CN2018/074486 CN2018074486W WO2018223717A1 WO 2018223717 A1 WO2018223717 A1 WO 2018223717A1 CN 2018074486 W CN2018074486 W CN 2018074486W WO 2018223717 A1 WO2018223717 A1 WO 2018223717A1
Authority
WO
WIPO (PCT)
Prior art keywords
tested
test
data
client
access request
Prior art date
Application number
PCT/CN2018/074486
Other languages
French (fr)
Chinese (zh)
Inventor
朱子剑
陈少杰
张文明
Original Assignee
武汉斗鱼网络科技有限公司
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 武汉斗鱼网络科技有限公司 filed Critical 武汉斗鱼网络科技有限公司
Publication of WO2018223717A1 publication Critical patent/WO2018223717A1/en

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/3684Test management for test design, e.g. generating new test cases
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/12Protocols specially adapted for proprietary or special-purpose networking environments, e.g. medical networks, sensor networks, networks in vehicles or remote metering networks
    • H04L67/125Protocols specially adapted for proprietary or special-purpose networking environments, e.g. medical networks, sensor networks, networks in vehicles or remote metering networks involving control of end-device applications over a network
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/34Network arrangements or protocols for supporting network services or applications involving the movement of software or configuration parameters 

Definitions

  • the present invention relates to the field of Internet technologies, and in particular, to a web page front end testing method, apparatus, system, device, and readable storage medium.
  • the web front end is an important branch of Internet technology and plays an extremely important role in interface display and user interaction. With the development of the Internet, more and more back-end business logic is gradually front-end, making the front-end business logic increasingly complex.
  • Another object of the present invention is to provide a web page front end testing device for improving the above problems.
  • the embodiment of the invention provides a webpage front end testing method.
  • the method is applied to a client and a web server that are in communication with each other.
  • the method includes: the client responding to a test instruction, generating access request data, wherein the access request data includes a test identifier for identifying a function to be tested that needs to be tested; and the client sends the access request data
  • the web server is configured to obtain a test case corresponding to the function to be tested according to the test identifier; the web server obtains data to be fed back according to the access request data, wherein the data to be fed back includes Determining a file to be tested corresponding to the test function; the web server generates response data according to the test case and the data to be fed back; the web server sends the response data to the client; the client executes the Respond to the data to get the test results.
  • the step of generating response data according to the test case and the data to be fed back includes:
  • the web server dynamically injects the test case into the data to be fed back to generate response data.
  • the test identifier includes a file identifier to be tested and a function identifier to be tested
  • the step of the web server dynamically injecting the test case into the data to be fed back includes:
  • the web server obtains the corresponding test file from the to-be-reviewed data according to the to-be-tested file identifier; the web server injects the test case according to a business rule corresponding to the to-be-tested function identifier Tell the test file.
  • the step of the client responding to the test instruction and generating the access request data includes:
  • the client obtains service information to be tested corresponding to the test instruction;
  • the client generates a test identifier corresponding to the function to be tested according to the service information to be tested;
  • the client obtains a webpage address corresponding to the webpage server
  • the client generates the access request data according to the webpage address and the test identifier.
  • the step of the client sending the access request data to the web server includes:
  • the step of the client executing the response data to obtain a test result includes:
  • the client loads a webpage corresponding to the response data according to the response data
  • the client starts a function to be tested corresponding to a webpage corresponding to the response data
  • the client runs the to-be-tested file that has been injected with the test case corresponding to the function to be tested, and obtains the test result in the current test environment.
  • the method further includes:
  • the client sends the test result to the web server
  • the web server displays the test results.
  • the embodiment of the present invention further provides a webpage front-end testing method, which is applied to a client that is in communication with a web server, the method comprising: generating access request data in response to a test instruction, wherein the access request data includes being configured to be configured Identify the test identifier of the function to be tested that needs to be tested;
  • the response data is executed to obtain test results.
  • the step of the client responding to the test instruction and generating the access request data includes:
  • the client obtains service information to be tested corresponding to the test instruction;
  • the client generates a test identifier corresponding to the function to be tested according to the service information to be tested;
  • the client obtains a webpage address corresponding to the webpage server
  • the client generates the access request data according to the webpage address and the test identifier.
  • the step of the client sending the access request data to the web server includes:
  • the step of the client executing the response data to obtain a test result includes:
  • the client loads a webpage corresponding to the response data according to the response data
  • the client starts a function to be tested corresponding to a webpage corresponding to the response data
  • the client runs the to-be-tested file that has been injected with the test case corresponding to the function to be tested, and obtains the test result in the current test environment.
  • the method further includes:
  • the client sends the test result to the web server
  • the web server displays the test results.
  • the embodiment of the invention further provides a webpage front end testing method.
  • the method is applied to a web server that is in communication with a client, the method comprising: receiving access request data sent by the client, wherein the access request data includes a test identifier for identifying a function to be tested that needs to be tested Obtaining a test case corresponding to the function to be tested according to the test identifier; obtaining data to be fed back according to the access request data, wherein the data to be fed back includes a file to be tested corresponding to the function to be tested; Testing the use case and the data to be fed back, generating response data; sending the response data to the client to obtain a test result fed back by the client, wherein the test result is executed by the client After generation.
  • the step of generating response data according to the test case and the data to be fed back includes:
  • test case is dynamically injected into the data to be fed back to generate the response data.
  • the test identifier includes a file identifier to be tested and a function identifier to be tested
  • the step of dynamically injecting the test case into the data to be fed back includes:
  • test case into the file to be tested according to a business rule corresponding to the function identifier to be tested.
  • the method further includes:
  • the embodiment of the present invention further provides a webpage front-end testing device, which is applied to a client that is in communication with a web server, and the device includes: an access request data generating module configured to generate access request data in response to the test instruction, wherein the The access request data includes a test identifier configured to identify a function to be tested that needs to be tested; the access request data sending module is configured to send the access request data to the web server such that the web server is according to the test according to the test Identifying a test case corresponding to the function to be tested, so that the web server obtains data to be fed back according to the access request data, wherein the data to be fed back includes a file to be tested corresponding to the function to be tested; And the response data receiving module is configured to receive the response data generated by the web server, and the execution module is configured to execute the response data to obtain a test result.
  • an access request data generating module configured to generate access request data in response to the test instruction, wherein the The access request data includes a test identifier configured to
  • the embodiment of the invention further provides a webpage front end testing device.
  • the device is applied to a webpage server that is in communication with a client, and the device includes: a receiving module, an obtaining module, a generating module, and a sending module.
  • the receiving module is configured to receive the access request data sent by the client, where the access request data includes a test identifier for identifying a function to be tested that needs to be tested.
  • the obtaining module is configured to obtain a test case corresponding to the function to be tested according to the test identifier, and is further configured to obtain data to be fed back according to the access request data, where the data to be fed back includes a function corresponding to the function to be tested The file to be tested.
  • a generating module configured to generate response data according to the test case and the data to be fed back.
  • a sending module configured to send the response data to the client to obtain a test result fed back by the client, where the test result is generated by the client executing the response data.
  • the embodiment of the present invention further provides a webpage front-end testing system, including a client and a webpage server connected to each other, wherein: the client is configured to generate access request data in response to a test instruction, wherein the access request data includes a test identifier configured to identify a function to be tested that needs to be tested; the client configured to send the access request data to the web server; the web server configured to obtain and test a function according to the test identifier Corresponding test case; the web server is configured to obtain data to be fed back according to the access request data, wherein the data to be fed back includes a file to be tested corresponding to the function to be tested; the web server is configured according to the Testing the use case and the data to be fed back to generate response data; the web server is configured to send the response data to the client; the client is configured to execute the response data to obtain a test result.
  • the client is configured to generate access request data in response to a test instruction, wherein the access request data includes a test identifier configured to identify a function to be
  • An embodiment of the present invention further provides an electronic device, where the electronic device includes a memory and a processor, the memory is configured to store executable program code, and the processor is configured to read an executable program stored in the memory.
  • the code causes the electronic device to perform the above web page front end testing method as the client and/or web server.
  • the embodiment of the present invention further provides a readable storage medium, where the readable storage medium stores instructions, when the instruction is run on a computer, causing the computer to execute the webpage front end as the client and the web server testing method.
  • the present invention provides a web page front end testing method, apparatus, system, device and readable storage medium. It can be applied to clients and web servers that are connected to each other.
  • the method includes the client responding to a test instruction to generate access request data, wherein the access request data includes a test identification for identifying a function to be tested that requires testing.
  • the web server obtains a test case corresponding to the function to be tested according to the test identifier. Accurate and fast find the corresponding test case through efficiency. Acquiring the data to be tested according to the access request data, wherein the data to be fed includes a file to be tested corresponding to the function to be tested; and generating response data according to the test case and the data to be fed back. Thereby reducing the high coupling of the data to be fed back and the test case, improving the maintainability of the test case and the test efficiency.
  • FIG. 1 is a schematic diagram showing an application environment of a preferred embodiment of the present invention.
  • FIG. 2 is a block diagram of a web server according to a preferred embodiment of the present invention.
  • FIG. 3 is a flowchart of a webpage front end testing method according to a first embodiment of the present invention.
  • step S101 in FIG. 4 is a flow chart of the sub-steps of step S101 in FIG.
  • FIG. 5 is a flow chart of the sub-steps of step S105 in FIG.
  • FIG. 6 is a flowchart of a method for testing a webpage front end according to a second embodiment of the present invention.
  • FIG. 7 is a block diagram of a webpage front end testing apparatus according to a third embodiment of the present invention.
  • Icons 400-user terminal; 401-client; 100-web server; 300-network; 111-memory; 112-processor; 113-communication unit; 200-web front-end test device; 201-receive module; Module; 203-generating module; 204-sending module.
  • the user terminal 400 and the web server 100 are located in the network 300, and the network 300 includes a wireless network or a wired network. Through the network 300, the user terminal 400 performs data interaction with the web server 100.
  • the web server 100 can be a server or a plurality of servers that perform different tasks.
  • the user terminal 400 may be a mobile terminal device, and may include, for example, a smart phone, a tablet computer, an e-book reader, a laptop portable computer, a car-mounted computer, a wearable mobile terminal, and the like.
  • the client terminal 401 is installed in the user terminal 400, and corresponds to the web server 100 to provide services for the user.
  • the client 401 is in communication with the web server 100.
  • the client 401 can be a browser or other APP that can access the web server 100.
  • the web server 100 includes a web page front end testing device 200, a memory 111, a processor 112, and a communication unit 113.
  • the components of the memory 111, the processor 112, and the communication unit 113 are electrically connected directly or indirectly to each other to implement data transmission or interaction.
  • the components can be electrically connected to one another via one or more communication buses or signal lines.
  • the web page front end testing device 200 includes at least one software function module that can be stored in the memory 111 or in an operating system (OS) of the web server 100 in the form of software or firmware.
  • the processor 112 is configured to execute an executable module stored in the memory 111, such as a software function module, a computer program, and the like included in the webpage front end testing device 200.
  • the memory 111 can be, but not limited to, a random access memory (RAM), a read only memory (ROM), and a programmable read-only memory (PROM). Erasable Programmable Read-Only Memory (EPROM), Electric Erasable Programmable Read-Only Memory (EEPROM), and a storage system that implements data persistence.
  • RAM random access memory
  • ROM read only memory
  • PROM programmable read-only memory
  • EPROM Erasable Programmable Read-Only Memory
  • EEPROM Electric Erasable Programmable Read-Only Memory
  • the memory 111 is used to store programs or data.
  • the communication unit 113 is configured to establish a communication connection between the web server 100 and other communication terminals through the network 300, and is used to send and receive data through the network 300.
  • FIG. 1 is only a schematic structural diagram of the web server 100, and the web server 100 may further include more or less components than those shown in FIG. 1, or have different from that shown in FIG. Configuration.
  • the components shown in Figure 1 can be implemented in hardware, software, or a combination thereof.
  • FIG. 3 is a web page front end testing method provided by a preferred embodiment of the present invention, which is applied to a client 401 and a web server 100 that are connected to each other.
  • the webpage front end testing method includes the following steps:
  • Step S101 the client 401 generates access request data in response to the test instruction.
  • the client 401 acquires data of the loaded webpage and data of various front-end web services from the web server 100 by accessing the request data.
  • the access request data includes a test identifier configured to identify a function to be tested that needs to be tested and a file to be tested corresponding to the function to be tested. It should be noted that the correspondence between the function to be tested and the file to be tested can be preset.
  • the access request data further includes a webpage address corresponding to the webpage server 100 (for example, the webpage address corresponding to the Baidu webpage server 100 is www.baidu.com).
  • the function to be tested may be a function module corresponding to the front-end website service of the webpage.
  • the file to be tested may be a script file that implements the function to be tested, and may be, for example, a front-end javascript script file. As shown in FIG. 4, step S101 includes the following sub-steps:
  • Sub-step S1011 the client 401 obtains the service information to be tested corresponding to the test instruction in response to the test instruction.
  • the test command may be an instruction to trigger testing of one or more front end web services of the web page.
  • the test command may be triggered by the tester via the user terminal 400 or may be triggered according to pre-set rules.
  • the service information to be tested may be service information of a function to be tested corresponding to one or more front-end website services that need to be tested.
  • the service information to be tested includes identification information of the function to be tested and a business rule for implementing the function to be tested.
  • the correspondence between the front-end website service and the service information to be tested may be preset to the user terminal 400.
  • sub-step S1012 the client 401 generates a test identifier corresponding to the function to be tested according to the service information to be tested.
  • the test identifier includes a file identifier to be tested and a function identifier to be tested.
  • the file identifier to be tested may be the name of the file to be tested.
  • the file name to be tested may be demo.js
  • the function identifier to be tested may be the name of the function to be tested.
  • the name of the function to be tested may be DemoController.demoFunction.
  • the client 401 generates a to-be-tested file identifier and a to-be-tested function identifier according to the service information to be tested.
  • Sub-step S1014 the client 401 generates the access request data according to the webpage address and the test identifier.
  • the client 401 accesses the web server 100 through the webpage address to obtain data of loading the webpage and data of various front-end web services, for example, multiple front-end JS script files and front ends corresponding to each front-end web service. CSS style files, jpg, png and other image resource files, which can be acquired from the web server 100 at the same time.
  • the test identifier is configured to identify a function to be tested and a file to be tested that need to be tested by accessing the request data.
  • the access request data may include an access address including a webpage address and a test identifier.
  • step S102 the client 401 sends the access request data to the web server 100.
  • the client 401 can automatically send to the web server 100 after generating the access request data. Specifically, the access request data is transmitted to the web server 100 through the network 300. The flow proceeds to step S103.
  • Step S103 The web server 100 obtains a test case corresponding to the function to be tested according to the test identifier.
  • the web server 100 parses the test identifier in the access request data to obtain the file identifier to be tested and the function identifier to be tested in the test identifier.
  • a Test Case is a set of test inputs, execution conditions, and expected results that are compiled for a particular purpose. There is a corresponding test case for each function to be tested. The correspondence between the test case and the test case and the function to be tested may be pre-stored in the web server 100. Therefore, after the function identifier to be tested is parsed from the test identifier, the test case corresponding to the function to be tested is obtained from the pre-stored test case by using the correspondence between the test case and the function to be tested according to the function identifier to be tested. In this way, by accurately establishing the correspondence between the function to be tested and the test case, and determining the corresponding test case by the function identifier to be tested, the accuracy and efficiency of the test case corresponding to the function to be tested can be improved.
  • step S104 the web server 100 obtains data to be fed back according to the access request data, where the data to be fed back includes a file to be tested corresponding to the function to be tested.
  • the data to be fed back may be feedback to the client 401 for the client 401 to load data of the webpage and data for implementing various front-end web services.
  • the data to be fed back may include, but is not limited to, a file to be tested, a script file corresponding to a function not to be tested, a front end CSS style file, a picture resource file such as jpg, png, and the like.
  • Step S105 the web server 100 generates response data according to the test case and the data to be fed back.
  • the web server 100 dynamically injects the acquired test case into the to-be-feedback data to generate response data.
  • the test case is separated from all the script files.
  • the test case corresponding to the function to be tested is dynamically injected into the data to be fed back, which effectively reduces the coupling degree of the response data, so that the response data is optimized and the client 401 is lightened.
  • the burden of loading response data by dynamically injecting test cases to reduce or even deviate from the test case's dependence on the operating environment, or by dynamically injecting test cases, the test cases can be separated from the operating environment, and test cases can be introduced in any environment, greatly improving the test case maintainability. And test efficiency.
  • step S105 includes the following sub-steps:
  • the web server 100 obtains the corresponding file to be tested from the to-be-feedback data according to the to-be-tested file identifier.
  • the data to be fed includes a script file for implementing each front-end website service, and the file to be tested is found by using the file identifier to be tested from all the script files. It should be noted that even if only one front-end website service is tested, the client 401 needs to access the web server 100 first, and the web server 100 accesses multiple front-end JS script files corresponding to multiple front-end website services.
  • Sub-step S1052 the web server 100 injects the test case into the file to be tested according to a business rule corresponding to the function identifier to be tested.
  • the business rule may be the business logic in the website service implementation process.
  • the business rule of the search service is to display the search interface first, then receive the search content, then search, and finally display the search result.
  • the injection test case can be a script file that adds the test case to the file to be tested.
  • the test case is injected into the file to be tested according to the business rule, and the location of the test case is selected in the file to be tested according to the business rule.
  • the test case of the test search function is injected into the script file that implements the display search interface, so that the file to be tested is executed, when the search interface is displayed, A test case that performs a test search function. This reduces or even eliminates the dependency of test cases on the test environment.
  • the file to be tested in which the test case is not injected in the data to be tested may be replaced with the file to be tested that has been injected into the test case to generate response data.
  • Step S106 the web server 100 sends the response data to the client 401.
  • the web server 100 may send the response data to the client 401 through the network 300.
  • Step S107 the client 401 executes the response data to obtain a test result.
  • the client 401 loads the webpage according to the response data. Start the function to be tested.
  • the test file to be injected with the test case corresponding to the function to be tested may be run to obtain the test result in the current test environment. Alternatively, you can use JavaScript Object Notation for test result collection.
  • step S108 the client 401 sends the test result to the web server 100.
  • the collected test results are sent to the web server 100.
  • the test result in JSON format is sent to the web server 100 via ajax.
  • step S109 the web server 100 displays the test result.
  • the received test result is parsed. Focus on the test results corresponding to different website services.
  • the business logic sequence of the website is also adjusted. It can provide web developers with unified monitoring from micro (single front-end business functions) to macro (full-service business functions at the front end of the website), greatly improving business functions and stability and maintainability of the entire website.
  • the embodiment of the present invention further provides a webpage front-end testing method, which is applied to a client that is in communication with a web server, and the method includes:
  • Step S201 Generate access request data in response to the test instruction, wherein the access request data includes a test identifier configured to identify a function to be tested that needs to be tested. For details, refer to the description of step S101.
  • Step S202 Send the access request data to the webpage server, so that the webpage server obtains a test case corresponding to the function to be tested according to the test identifier, so that the webpage server according to the access request data.
  • Obtaining data to be fed wherein the data to be fed back includes a file to be tested corresponding to the function to be tested; and the test data of the web server and the data to be fed back are generated to generate response data.
  • the description of step S102 to step S105 refer to the description of step S102 to step S105.
  • Step S203 Receive response data generated by the web server.
  • the web server 100 may send the response data to the client 401 through the network 300.
  • Step S204 executing the response data to obtain a test result. For details, refer to the description of step S107.
  • the step of the client responding to the test instruction to generate the access request data includes: the client responding to the test instruction, obtaining service information to be tested corresponding to the test instruction; the client And generating, by the terminal, a test identifier corresponding to the function to be tested according to the service information to be tested; the client acquiring a webpage address corresponding to the webpage server; and the client generating the webpage address and the test identifier according to the webpage address and the test identifier The access request data.
  • the step of the client sending the access request data to the webpage server includes: determining, according to the webpage address included in the access request data, a webpage server corresponding to the webpage address; and establishing a webpage corresponding to the webpage address a communication connection of the server; transmitting the test identifier included in the access request data to the web server.
  • the step of the client executing the response data to obtain a test result includes: the client loading a webpage corresponding to the response data according to the response data; and the client starting corresponding to the response data
  • the webpage corresponds to the function to be tested; the client runs the to-be-tested file that has been injected with the test case corresponding to the function to be tested, and obtains the test result in the current test environment.
  • the client may also send the test result to the web server.
  • the web server displays the test results.
  • the client can implement the test of the front end of the webpage, and can provide web developers with unified monitoring from micro (single front-end business function) to macro (the overall business function of the front-end of the website), greatly improving the business function and the stability of the entire website. Maintainability.
  • the web page front end testing method includes the following steps:
  • Step S201 Receive access request data sent by the client 401, where the access request data includes a test identifier for identifying a function to be tested that needs to be tested.
  • the access request data is parsed, and the test identifier of the function to be tested that needs to be tested is obtained from the access request data.
  • the test identifier includes the file identifier to be tested and the function identifier to be tested.
  • the file identifier to be tested may be the name of the file to be tested.
  • the file name to be tested may be demo.js
  • the function identifier to be tested may be the name of the function to be tested.
  • the name of the function to be tested may be DemoController.demoFunction.
  • the client 401 generates a to-be-tested file identifier and a function identifier to be tested according to the service information to be tested.
  • Step S202 Obtain a test case corresponding to the function to be tested according to the test identifier.
  • the correspondence between the test case and the test case and the function to be tested may be stored in the web server 100 in advance. Therefore, after the function identifier to be tested is parsed from the test identifier, the corresponding test relationship between the test case and the function to be tested is used to obtain a test corresponding to the function to be tested from the plurality of test cases stored in advance according to the function identifier to be tested. Example. This improves the accuracy and efficiency of finding test cases corresponding to the function to be tested.
  • Step S203 Acquire data to be fed back according to the access request data, where the data to be fed back includes a file to be tested corresponding to the function to be tested.
  • the data to be fed back may be feedback to the client 401 for the client 401 to load data of the webpage and data for implementing various front-end web services.
  • the data to be fed back may include, but is not limited to, a file to be tested, a script file corresponding to a function not to be tested, a front end CSS style file, a picture resource file such as jpg, png, and the like.
  • Step S204 Generate response data according to the test case and the data to be fed back.
  • the web server 100 dynamically injects the acquired test case into the to-be-feedback data to generate response data.
  • the test case is separated from all the script files.
  • the test case corresponding to the function to be tested is dynamically injected into the data to be fed back, which effectively reduces the coupling degree of the response data, so that the response data is optimized and the client 401 is lightened.
  • the burden of loading response data reduce or even deviate from the test case's dependence on the operating environment, and realize the introduction of test cases in any environment, which greatly improves the test case maintainability and test efficiency.
  • the method of step S204 may be: obtaining, according to the to-be-tested file identifier, the corresponding file to be tested according to the to-be-tested data identifier; and performing the test according to a service rule corresponding to the to-be-tested function identifier.
  • the use case injects the file to be tested.
  • Step S205 Send the response data to the client 401 to obtain a test result fed back by the client 401, wherein the test result is generated by the client 401 executing the response data.
  • Step S206 displaying the test result.
  • the received test result is parsed. Focus on the test results corresponding to different website services.
  • the business logic sequence of the website is adjusted. It can provide web developers with unified monitoring from micro (single front-end business functions) to macro (full-service business functions at the front end of the website), greatly improving business functions and stability and maintainability of the entire website.
  • FIG. 7 is a webpage front end testing apparatus 200 applied to the web server 100 according to a preferred embodiment of the present invention.
  • the web page front end testing device 200 includes a receiving module 201, an obtaining module 202, a generating module 203, and a sending module 204.
  • the receiving module 201 is configured to receive the access request data sent by the client 401, where the access request data includes a test identifier for identifying a function to be tested that needs to be tested.
  • step S201 can be performed by the receiving module 201.
  • the obtaining module 202 is configured to obtain a test case corresponding to the function to be tested according to the test identifier, and is further configured to obtain data to be fed back according to the access request data, where the data to be fed back includes the function to be tested Corresponding files to be tested.
  • step S202, step S203, step S103, step S104 may be performed by the obtaining module 202.
  • the generating module 203 is configured to generate response data according to the test case and the data to be fed back.
  • step S204 and step S105 may be performed by the generating module 203.
  • the sub-step S1051 and the sub-step S1051 may also be executed by the generating module 203.
  • the manner in which the generating module 203 performs the step S204 or the step S105 may be: dynamically injecting the acquired test case into the data to be fed back to generate response data.
  • the dynamic injection of the test case is performed by: obtaining, according to the to-be-tested file identifier, the corresponding file to be tested from the to-be-reviewed data, and then, according to the service corresponding to the function identifier to be tested. The rule injects the test case into the file to be tested.
  • the sending module 204 is configured to send the response data to the client 401 to obtain a test result fed back by the client 401, where the test result is generated by the client 401 executing the response data. .
  • step S205 and step S106 may be performed by the transmitting module 204.
  • the webpage front end testing apparatus 200 further includes a display module, and the display module is configured to display the test result.
  • step S109 and step S206 may be performed by a presentation module.
  • a webpage front-end testing method, apparatus, system, device, and readable storage medium are provided by embodiments of the present invention.
  • the method is applied to a client and a web server that are in communication with each other.
  • the method includes: the client responds to the test instruction, and generates access request data, where the access request data includes a test identifier for identifying a function to be tested that needs to be tested; and the access request data is sent to the web server;
  • the web server obtains a test case corresponding to the function to be tested according to the test identifier, and obtains data to be fed back according to the access request data, wherein the data to be fed back includes a file to be tested corresponding to the function to be tested; And generating response data according to the test case and the data to be fed back; sending the response data to the client; and the client executing the response data to obtain a test result.
  • the embodiment of the present invention further provides a webpage front-end testing system, including a client and a webpage server connected to each other, wherein: the client is configured to generate access request data in response to a test instruction, wherein the access request data includes a test identifier configured to identify a function to be tested that needs to be tested; the client configured to send the access request data to the web server; the web server configured to obtain and test a function according to the test identifier Corresponding test case; the web server is configured to obtain data to be fed back according to the access request data, wherein the data to be fed back includes a file to be tested corresponding to the function to be tested; the web server is configured according to the Testing the use case and the data to be fed back to generate response data; the web server is configured to send the response data to the client; the client is configured to execute the response data to obtain a test result.
  • the client is configured to generate access request data in response to a test instruction, wherein the access request data includes a test identifier configured to identify a function to be
  • An embodiment of the present invention further provides an electronic device, where the electronic device includes a memory and a processor, the memory is configured to store executable program code, and the processor is configured to read an executable program stored in the memory.
  • the code causes the electronic device to perform the above web page front end testing method as the client and/or web server.
  • the embodiment of the present invention further provides a readable storage medium, where the readable storage medium stores instructions, when the instruction is run on a computer, causing the computer to execute the webpage front end as the client and the web server testing method.
  • the webpage front-end testing method, device, system, device and readable storage medium provided by the embodiment of the invention reduce the coupling degree of the client loading data during the testing process, reduce the dependence of the test case on the testing environment, and improve the testing efficiency. Test cases are also easier to manage and maintain. In turn, the labor cost and time cost of the web front-end testing work are reduced.

Abstract

The present invention provides a webpage front-end testing method, device, system, apparatus, and readable storage medium related to the technical field of Internet technology. The method is applied to a client and a webpage server communicatively connected to each other, and comprises: the client generating access request data in response to a test instruction, wherein the access request data comprises a test identifier used to identify a function to be tested that requires testing; sending the access request data to the webpage server; the webpage server acquiring, according to the test identifier, a test case corresponding to the function to be tested; acquiring, according to the access request data, data to be fed back, wherein the data to be fed back comprises a file to be tested corresponding to the function to be tested; generating response data according to the test case and the data to be fed back; sending the response data to the client; and the client executing the response data to acquire a test result. The present invention reduces coupling of response data, enhances testing accuracy and efficiency, and reduces time and labor costs of testing.

Description

网页前端测试方法、装置、系统、设备及可读存储介质Web front end test method, device, system, device and readable storage medium
相关申请的交叉引用Cross-reference to related applications
本申请要求于2017年06月08日提交中国专利局的申请号为2017104257348,名称为“网页前端测试方法及装置”的中国专利申请的优先权,其全部内容通过引用结合在本申请中。The present application claims priority to Chinese Patent Application No. JP-A No. No. No. No. No. No. No. No. No. No.
技术领域Technical field
本发明涉及互联网技术领域,具体而言,涉及网页前端测试方法、装置、系统、设备及可读存储介质。The present invention relates to the field of Internet technologies, and in particular, to a web page front end testing method, apparatus, system, device, and readable storage medium.
背景技术Background technique
网页前端为互联网技术的重要分支,在界面展示和用户交互方面占据极为重要的地位。随着互联网的发展,越来越多的后端业务逻辑逐步前端化,使得前端业务逻辑日趋复杂。The web front end is an important branch of Internet technology and plays an extremely important role in interface display and user interaction. With the development of the Internet, more and more back-end business logic is gradually front-end, making the front-end business logic increasingly complex.
近些年前端技术日新月异,随之,前端领域也纷纷涌现出各种单元测试方案,如:jasmine、mocha等。这些单元测试方案虽从一定程度上能保证前端代码质量。但均存在将业务功能的测试用例直接耦合在业务代码中,前端业务代码的高耦合度致使前端单元测试用例维护变得异常复杂。In the past few years, the front-end technology has been changing with each passing day. As a result, various unit testing programs have emerged in the front-end field, such as jasmine and mocha. These unit test schemes guarantee the quality of the front-end code to a certain extent. However, there are test cases for business functions directly coupled to the business code. The high degree of coupling of the front-end business code makes the maintenance of the front-end unit test cases extremely complicated.
发明内容Summary of the invention
本发明的目的包括提供一种网页前端测试方法、装置、系统、设备及可读存储介质,用以改善上述问题。It is an object of the present invention to provide a web page front end testing method, apparatus, system, device and readable storage medium for improving the above problems.
本发明的另一目的包括提供一种网页前端测试装置,用以改善上述问题。Another object of the present invention is to provide a web page front end testing device for improving the above problems.
为了实现上述目的,本发明实施例采用的技术方案如下:In order to achieve the above object, the technical solution adopted by the embodiment of the present invention is as follows:
本发明实施例提供一种网页前端测试方法。所述方法应用于相互通信连接的客户端与网页服务器。所述方法包括:所述客户端响应测试指令,生成访问请求数据,其中,所述访问请求数据包括用于标识需要测试的待测试功能的测试标识;所述客户端将所述访问请求数据发送给所述网页服务器;所述网页服务器根据所述测试标识,获得与待测试功能对应的测试用例;所述网页服务器根据访问请求数据,获取待反馈数据,其中,所述待反馈数据包括与所述待测试功能对应的待测试文件;所述网页服务器根据所述测试用例及待反馈数据,生成响应数据;所述网页服务器将所述响应数据发送至所述客户端;所述客户端执行所述响应数据,以得测试结果。The embodiment of the invention provides a webpage front end testing method. The method is applied to a client and a web server that are in communication with each other. The method includes: the client responding to a test instruction, generating access request data, wherein the access request data includes a test identifier for identifying a function to be tested that needs to be tested; and the client sends the access request data The web server is configured to obtain a test case corresponding to the function to be tested according to the test identifier; the web server obtains data to be fed back according to the access request data, wherein the data to be fed back includes Determining a file to be tested corresponding to the test function; the web server generates response data according to the test case and the data to be fed back; the web server sends the response data to the client; the client executes the Respond to the data to get the test results.
可选地,根据所述测试用例及待反馈数据,生成响应数据的步骤包括:Optionally, the step of generating response data according to the test case and the data to be fed back includes:
所述网页服务器将所述测试用例动态的注入所述待反馈数据,以生成响应数据。The web server dynamically injects the test case into the data to be fed back to generate response data.
可选地,所述测试标识包括待测试文件标识及待测试功能标识,所述网页服务器将所述测试用例动态的注入所述待反馈数据的步骤包括:Optionally, the test identifier includes a file identifier to be tested and a function identifier to be tested, and the step of the web server dynamically injecting the test case into the data to be fed back includes:
所述网页服务器根据所述待测试文件标识从所述待反馈数据中获取对应的所述待测试文件;所述网页服务器根据与所述待测试功能标识对应的业务规则将所述测试用例注入所述待测试文件。The web server obtains the corresponding test file from the to-be-reviewed data according to the to-be-tested file identifier; the web server injects the test case according to a business rule corresponding to the to-be-tested function identifier Tell the test file.
可选地,所述客户端响应测试指令,生成访问请求数据的步骤包括:Optionally, the step of the client responding to the test instruction and generating the access request data includes:
所述客户端响应所述测试指令,获得与所述测试指令对应的待测试业务信息;Responding to the test instruction, the client obtains service information to be tested corresponding to the test instruction;
所述客户端根据所述待测试业务信息生成与所述待测试功能对应的测试标识;The client generates a test identifier corresponding to the function to be tested according to the service information to be tested;
所述客户端获取与所述网页服务器对应的网页地址;The client obtains a webpage address corresponding to the webpage server;
所述客户端根据所述网页地址及所述测试标识生成所述访问请求数据。The client generates the access request data according to the webpage address and the test identifier.
可选地,所述客户端将所述访问请求数据发送给所述网页服务器的步骤包括:Optionally, the step of the client sending the access request data to the web server includes:
根据所述访问请求数据中包含的网页地址,确定该网页地址对应的网页服务器;Determining, according to the webpage address included in the access request data, a webpage server corresponding to the webpage address;
建立与所述网页地址对应的网页服务器的通信连接;Establishing a communication connection of the web server corresponding to the webpage address;
将所述访问请求数据中包含的测试标识发送至所述网页服务器。Sending the test identifier included in the access request data to the web server.
可选地,所述客户端执行所述响应数据,以得测试结果的步骤包括:Optionally, the step of the client executing the response data to obtain a test result includes:
所述客户端根据所述响应数据,加载与所述响应数据对应的网页;The client loads a webpage corresponding to the response data according to the response data;
所述客户端启动与所述响应数据对应的网页对应的待测试功能;The client starts a function to be tested corresponding to a webpage corresponding to the response data;
所述客户端运行与所述待测试功能对应的已注入了测试用例的待测试文件,得到当前测试环境下的测试结果。The client runs the to-be-tested file that has been injected with the test case corresponding to the function to be tested, and obtains the test result in the current test environment.
可选地,所述方法还包括:Optionally, the method further includes:
所述客户端将所述测试结果发送至所述网页服务器;The client sends the test result to the web server;
所述网页服务器对所述测试结果进行展示。本发明实施例还提供了一种网页前端测试方法,应用于与网页服务器通信连接的客户端,所述方法包括:响应测试指令,生成访问请求数据,其中,所述访问请求数据包括被配置成标识需要测试的待测试功能的测试标识;The web server displays the test results. The embodiment of the present invention further provides a webpage front-end testing method, which is applied to a client that is in communication with a web server, the method comprising: generating access request data in response to a test instruction, wherein the access request data includes being configured to be configured Identify the test identifier of the function to be tested that needs to be tested;
将所述访问请求数据发送给所述网页服务器,以使所述网页服务器根据根据所述测试标识,获得与待测试功能对应的测试用例;以使所述网页服务器根据访问请求数据,获取待反馈数据,其中,所述待反馈数据包括与所述待测试功能对应的待测试文件;以使所述网页服务器所述测试用例及待反馈数据,生成响应数据;Transmitting the access request data to the webpage server, so that the webpage server obtains a test case corresponding to the function to be tested according to the test identifier, so that the webpage server obtains the feedback to be fed according to the access request data. Data, wherein the data to be fed back includes a file to be tested corresponding to the function to be tested; and the test data of the web server and the data to be fed back are generated to generate response data;
接收所述网页服务器生成的响应数据;Receiving response data generated by the web server;
执行所述响应数据,以得到测试结果。The response data is executed to obtain test results.
可选地,所述客户端响应测试指令,生成访问请求数据的步骤包括:Optionally, the step of the client responding to the test instruction and generating the access request data includes:
所述客户端响应所述测试指令,获得与所述测试指令对应的待测试业务信息;Responding to the test instruction, the client obtains service information to be tested corresponding to the test instruction;
所述客户端根据所述待测试业务信息生成与所述待测试功能对应的测试标识;The client generates a test identifier corresponding to the function to be tested according to the service information to be tested;
所述客户端获取与所述网页服务器对应的网页地址;The client obtains a webpage address corresponding to the webpage server;
所述客户端根据所述网页地址及所述测试标识生成所述访问请求数据。The client generates the access request data according to the webpage address and the test identifier.
可选地,所述客户端将所述访问请求数据发送给所述网页服务器的步骤包括:Optionally, the step of the client sending the access request data to the web server includes:
根据所述访问请求数据中包含的网页地址,确定该网页地址对应的网页服务器;Determining, according to the webpage address included in the access request data, a webpage server corresponding to the webpage address;
建立与所述网页地址对应的网页服务器的通信连接;Establishing a communication connection of the web server corresponding to the webpage address;
将所述访问请求数据中包含的测试标识发送至所述网页服务器。Sending the test identifier included in the access request data to the web server.
可选地,所述客户端执行所述响应数据,以得测试结果的步骤包括:Optionally, the step of the client executing the response data to obtain a test result includes:
所述客户端根据所述响应数据,加载与所述响应数据对应的网页;The client loads a webpage corresponding to the response data according to the response data;
所述客户端启动与所述响应数据对应的网页对应的待测试功能;The client starts a function to be tested corresponding to a webpage corresponding to the response data;
所述客户端运行与所述待测试功能对应的已注入了测试用例的待测试文件,得到当前测试环境下的测试结果。The client runs the to-be-tested file that has been injected with the test case corresponding to the function to be tested, and obtains the test result in the current test environment.
可选地,所述方法还包括:Optionally, the method further includes:
所述客户端将所述测试结果发送至所述网页服务器;The client sends the test result to the web server;
所述网页服务器对所述测试结果进行展示。The web server displays the test results.
本发明实施例还提供一种网页前端测试方法。所述方法应用于与客户端通信连接的网页服务器,所述方法包括:接收所述客户端发送的访问请求数据,其中,所述访问请求数据包括用于标识需要测试的待测试功能的测试标识;根据所述测试标识,获得与待测试功能对应的测试用例;根据访问请求数据,获取待反馈数据,其中,所述待反馈数据包括与所述待测试功能对应的待测试文件;根据所述测试用例及待反馈数据,生成响应数据;将所述响应数据发送至所述客户端,以获得所述客户端反馈的测试结果,其中,所述测试结果由所述客户端执行所述响应数据后生成。The embodiment of the invention further provides a webpage front end testing method. The method is applied to a web server that is in communication with a client, the method comprising: receiving access request data sent by the client, wherein the access request data includes a test identifier for identifying a function to be tested that needs to be tested Obtaining a test case corresponding to the function to be tested according to the test identifier; obtaining data to be fed back according to the access request data, wherein the data to be fed back includes a file to be tested corresponding to the function to be tested; Testing the use case and the data to be fed back, generating response data; sending the response data to the client to obtain a test result fed back by the client, wherein the test result is executed by the client After generation.
可选地,根据所述测试用例及待反馈数据,生成响应数据的步骤包括:Optionally, the step of generating response data according to the test case and the data to be fed back includes:
将所述测试用例动态的注入所述待反馈数据,以生成所述响应数据。The test case is dynamically injected into the data to be fed back to generate the response data.
可选地,所述测试标识包括待测试文件标识及待测试功能标识,将所述测试用例动态的注入所述待反馈数据的步骤包括:Optionally, the test identifier includes a file identifier to be tested and a function identifier to be tested, and the step of dynamically injecting the test case into the data to be fed back includes:
根据所述待测试文件标识从所述待反馈数据中获取对应的所述待测试文件;Obtaining, according to the to-be-tested file identifier, the corresponding file to be tested according to the to-be-tested data;
根据与所述待测试功能标识对应的业务规则将所述测试用例注入所述待测试文件。And loading the test case into the file to be tested according to a business rule corresponding to the function identifier to be tested.
可选地,所述方法还包括:Optionally, the method further includes:
对所述测试结果进行展示。The test results are presented.
本发明实施例还提供了一种网页前端测试装置,应用于与网页服务器通信连接的客户端,该装置包括:访问请求数据生成模块,配置成响应测试指令,生成访问请求数 据,其中,所述访问请求数据包括被配置成标识需要测试的待测试功能的测试标识;访问请求数据发送模块,配置成将所述访问请求数据发送给所述网页服务器,以使所述网页服务器根据根据所述测试标识,获得与待测试功能对应的测试用例;以使所述网页服务器根据访问请求数据,获取待反馈数据,其中,所述待反馈数据包括与所述待测试功能对应的待测试文件;以使所述网页服务器所述测试用例及待反馈数据,生成响应数据;响应数据接收模块,配置成接收所述网页服务器生成的响应数据;执行模块,配置成执行所述响应数据,以得到测试结果。本发明实施例还提供一种网页前端测试装置。所述装置应用于与客户端通信连接的网页服务器,所述装置包括:接收模块、获取模块、生成模块及发送模块。接收模块,用于接收所述客户端发送的访问请求数据,其中,所述访问请求数据包括用于标识需要测试的待测试功能的测试标识。获取模块,用于根据所述测试标识,获得与待测试功能对应的测试用例;及还用于根据访问请求数据,获取待反馈数据,其中,所述待反馈数据包括与所述待测试功能对应的待测试文件。生成模块,用于根据所述测试用例及待反馈数据,生成响应数据。发送模块,用于将所述响应数据发送至所述客户端,以获得所述客户端反馈的测试结果,其中,所述测试结果由所述客户端执行所述响应数据后生成。The embodiment of the present invention further provides a webpage front-end testing device, which is applied to a client that is in communication with a web server, and the device includes: an access request data generating module configured to generate access request data in response to the test instruction, wherein the The access request data includes a test identifier configured to identify a function to be tested that needs to be tested; the access request data sending module is configured to send the access request data to the web server such that the web server is according to the test according to the test Identifying a test case corresponding to the function to be tested, so that the web server obtains data to be fed back according to the access request data, wherein the data to be fed back includes a file to be tested corresponding to the function to be tested; And the response data receiving module is configured to receive the response data generated by the web server, and the execution module is configured to execute the response data to obtain a test result. The embodiment of the invention further provides a webpage front end testing device. The device is applied to a webpage server that is in communication with a client, and the device includes: a receiving module, an obtaining module, a generating module, and a sending module. The receiving module is configured to receive the access request data sent by the client, where the access request data includes a test identifier for identifying a function to be tested that needs to be tested. The obtaining module is configured to obtain a test case corresponding to the function to be tested according to the test identifier, and is further configured to obtain data to be fed back according to the access request data, where the data to be fed back includes a function corresponding to the function to be tested The file to be tested. And a generating module, configured to generate response data according to the test case and the data to be fed back. And a sending module, configured to send the response data to the client to obtain a test result fed back by the client, where the test result is generated by the client executing the response data.
本发明实施例还提供了一种网页前端测试系统,包括相互通信连接的客户端与网页服务器,其中:所述客户端配置成响应测试指令,生成访问请求数据,其中,所述访问请求数据包括被配置成标识需要测试的待测试功能的测试标识;所述客户端配置成将所述访问请求数据发送给所述网页服务器;所述网页服务器配置成根据所述测试标识,获得与待测试功能对应的测试用例;所述网页服务器配置成根据访问请求数据,获取待反馈数据,其中,所述待反馈数据包括与所述待测试功能对应的待测试文件;所述网页服务器配置成根据所述测试用例及待反馈数据,生成响应数据;所述网页服务器配置成将所述响应数据发送至所述客户端;所述客户端配置成执行所述响应数据,以得测试结果。The embodiment of the present invention further provides a webpage front-end testing system, including a client and a webpage server connected to each other, wherein: the client is configured to generate access request data in response to a test instruction, wherein the access request data includes a test identifier configured to identify a function to be tested that needs to be tested; the client configured to send the access request data to the web server; the web server configured to obtain and test a function according to the test identifier Corresponding test case; the web server is configured to obtain data to be fed back according to the access request data, wherein the data to be fed back includes a file to be tested corresponding to the function to be tested; the web server is configured according to the Testing the use case and the data to be fed back to generate response data; the web server is configured to send the response data to the client; the client is configured to execute the response data to obtain a test result.
本发明实施例还提供了一种电子设备,所述电子设备包括存储器和处理器,所述存储器用于存储有可执行程序代码,所述处理器用于读取所述存储器中存储的可执行程序代码以使得所述电子设备作为上述客户端和\或网页服务器执行上述网页前端测试方法。An embodiment of the present invention further provides an electronic device, where the electronic device includes a memory and a processor, the memory is configured to store executable program code, and the processor is configured to read an executable program stored in the memory. The code causes the electronic device to perform the above web page front end testing method as the client and/or web server.
本发明实施例还提供了一种可读存储介质,所述可读存储介质内存储有指令,当所述指令在计算机上运行时,使得计算机作为上述客户端和\或网页服务器执行上述网页前端测试方法。The embodiment of the present invention further provides a readable storage medium, where the readable storage medium stores instructions, when the instruction is run on a computer, causing the computer to execute the webpage front end as the client and the web server testing method.
与现有技术相比,本发明提供的一种网页前端测试方法、装置、系统、设备及可读存储介质。可应用于相互通信连接的客户端与网页服务器。所述方法包括所述客户端响应测 试指令,生成访问请求数据,其中,所述访问请求数据包括用于标识需要测试的待测试功能的测试标识。所述网页服务器根据所述测试标识,获得与待测试功能对应的测试用例。精确及快速的查找到对应的测试用例,通过效率。根据访问请求数据,获取待反馈数据,其中,所述待反馈数据包括与所述待测试功能对应的待测试文件;根据所述测试用例及待反馈数据,生成响应数据。从而减少待反馈数据与测试用例的高度耦合,提高测试用例可维护性以及测试效率。Compared with the prior art, the present invention provides a web page front end testing method, apparatus, system, device and readable storage medium. It can be applied to clients and web servers that are connected to each other. The method includes the client responding to a test instruction to generate access request data, wherein the access request data includes a test identification for identifying a function to be tested that requires testing. The web server obtains a test case corresponding to the function to be tested according to the test identifier. Accurate and fast find the corresponding test case through efficiency. Acquiring the data to be tested according to the access request data, wherein the data to be fed includes a file to be tested corresponding to the function to be tested; and generating response data according to the test case and the data to be fed back. Thereby reducing the high coupling of the data to be fed back and the test case, improving the maintainability of the test case and the test efficiency.
为使本发明的上述目的、特征和优点能更明显易懂,下文特举较佳实施例,并配合所附附图,作详细说明如下。The above described objects, features and advantages of the present invention will become more apparent from the aspects of the appended claims.
附图说明DRAWINGS
为了更清楚地说明本发明实施例的技术方案,下面将对实施例中所需要使用的附图作简单地介绍,应当理解,以下附图仅示出了本发明的某些实施例,因此不应被看作是对范围的限定,对于本领域普通技术人员来讲,在不付出创造性劳动的前提下,还可以根据这些附图获得其他相关的附图。In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the embodiments will be briefly described below. It should be understood that the following drawings show only certain embodiments of the present invention, and therefore It should be seen as a limitation on the scope, and those skilled in the art can obtain other related drawings according to these drawings without any creative work.
图1示出了本发明较佳实施例的应用环境示意图。FIG. 1 is a schematic diagram showing an application environment of a preferred embodiment of the present invention.
图2为本发明较佳实施例提供的网页服务器的方框示意图。2 is a block diagram of a web server according to a preferred embodiment of the present invention.
图3为本发明第一实施例提供的一种网页前端测试方法的流程图。FIG. 3 is a flowchart of a webpage front end testing method according to a first embodiment of the present invention.
图4为图3中步骤S101的子步骤流程图。4 is a flow chart of the sub-steps of step S101 in FIG.
图5为图3中步骤S105的子步骤流程图。FIG. 5 is a flow chart of the sub-steps of step S105 in FIG.
图6为本发明第二实施例提供的一种网页前端测试方法的流程图。FIG. 6 is a flowchart of a method for testing a webpage front end according to a second embodiment of the present invention.
图7本发明第三实施例提供的一种网页前端测试装置的方框示意图。FIG. 7 is a block diagram of a webpage front end testing apparatus according to a third embodiment of the present invention.
图标:400-用户终端;401-客户端;100-网页服务器;300-网络;111-存储器;112-处理器;113-通信单元;200-网页前端测试装置;201-接收模块;202-获取模块;203-生成模块;204-发送模块。Icons: 400-user terminal; 401-client; 100-web server; 300-network; 111-memory; 112-processor; 113-communication unit; 200-web front-end test device; 201-receive module; Module; 203-generating module; 204-sending module.
具体实施方式detailed description
下面将结合本发明实施例中附图,对本发明实施例中的技术方案进行清楚、完整地描述,显然,所描述的实施例仅仅是本发明一部分实施例,而不是全部的实施例。通常在此处附图中描述和示出的本发明实施例的组件可以以各种不同的配置来布置和设计。因此,以下对在附图中提供的本发明的实施例的详细描述并非旨在限制要求保护的本发明的范围,而是仅仅表示本发明的选定实施例。基于本发明的实施例,本领域技术人员在没有做出创造性劳动的前提下所获得的所有其他实施例,都属于本发明保护的范围。The technical solutions in the embodiments of the present invention are clearly and completely described in the following with reference to the accompanying drawings in the embodiments of the present invention. It is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. The components of the embodiments of the invention, which are generally described and illustrated in the figures herein, may be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the invention in the claims All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative efforts are within the scope of the present invention.
应注意到:相似的标号和字母在下面的附图中表示类似项,因此,一旦某一项在一个附图中被定义,则在随后的附图中不需要对其进行进一步定义和解释。同时,在本发明的 描述中,术语“第一”、“第二”等仅用于区分描述,而不能理解为指示或暗示相对重要性。It should be noted that similar reference numerals and letters indicate similar items in the following figures, and therefore, once an item is defined in a drawing, it is not necessary to further define and explain it in the subsequent drawings. Also, in the description of the present invention, the terms "first", "second" and the like are used merely to distinguish a description, and are not to be construed as indicating or implying a relative importance.
本发明下述各实施例如无特别说明均可应用于如图1所示的环境中,如图1所示,用户终端400、网页服务器100位于网络300中,网络300包括无线网络或有线网络,通过网络300,用户终端400与网页服务器100进行数据交互。网页服务器100可以是一个服务器,也可以是多个执行不同任务的服务器。The following embodiments of the present invention can be applied to the environment shown in FIG. 1 without any particular description. As shown in FIG. 1, the user terminal 400 and the web server 100 are located in the network 300, and the network 300 includes a wireless network or a wired network. Through the network 300, the user terminal 400 performs data interaction with the web server 100. The web server 100 can be a server or a plurality of servers that perform different tasks.
于本发明实施例中,用户终端400可以为移动终端设备,例如可以包括智能手机、平板电脑、电子书阅读器、膝上型便携计算机、车载电脑、穿戴式移动终端等等。该用户终端400中安装客户端401,与网页服务器100相对应,为用户提供服务。所述客户端401与所述网页服务器100通信连接。所述客户端401可以是浏览器,也可以为其他可访问网页服务器100的APP。In the embodiment of the present invention, the user terminal 400 may be a mobile terminal device, and may include, for example, a smart phone, a tablet computer, an e-book reader, a laptop portable computer, a car-mounted computer, a wearable mobile terminal, and the like. The client terminal 401 is installed in the user terminal 400, and corresponds to the web server 100 to provide services for the user. The client 401 is in communication with the web server 100. The client 401 can be a browser or other APP that can access the web server 100.
如图2所示,是图1中网页服务器100的方框示意图。所述网页服务器100包括网页前端测试装置200、存储器111、处理器112及通信单元113。2 is a block schematic diagram of the web server 100 of FIG. 1. The web server 100 includes a web page front end testing device 200, a memory 111, a processor 112, and a communication unit 113.
所述存储器111、处理器112以及通信单元113各元件相互之间直接或间接地电性连接,以实现数据的传输或交互。例如,这些元件相互之间可通过一条或多条通讯总线或信号线实现电性连接。所述网页前端测试装置200包括至少一个可以软件或固件(Firmware)的形式存储于所述存储器111中或固化在所述网页服务器100的操作系统(Operating System,OS)中的软件功能模块。所述处理器112用于执行所述存储器111中存储的可执行模块,例如所述网页前端测试装置200所包括的软件功能模块及计算机程序等。The components of the memory 111, the processor 112, and the communication unit 113 are electrically connected directly or indirectly to each other to implement data transmission or interaction. For example, the components can be electrically connected to one another via one or more communication buses or signal lines. The web page front end testing device 200 includes at least one software function module that can be stored in the memory 111 or in an operating system (OS) of the web server 100 in the form of software or firmware. The processor 112 is configured to execute an executable module stored in the memory 111, such as a software function module, a computer program, and the like included in the webpage front end testing device 200.
其中,所述存储器111可以是,但不限于,随机存取存储器(Random Access Memory,RAM),只读存储器(Read Only Memory,ROM),可编程只读存储器(Programmable Read-Only Memory,PROM),可擦除只读存储器(Erasable Programmable Read-Only Memory,EPROM),电可擦除只读存储器(Electric Erasable Programmable Read-Only Memory,EEPROM),实现了数据持久化功能的存储系统等。其中,存储器111用于存储程序或者数据。所述通信单元113用于通过所述网络300建立所述网页服务器100与其它通信终端之间的通信连接,并用于通过所述网络300收发数据。The memory 111 can be, but not limited to, a random access memory (RAM), a read only memory (ROM), and a programmable read-only memory (PROM). Erasable Programmable Read-Only Memory (EPROM), Electric Erasable Programmable Read-Only Memory (EEPROM), and a storage system that implements data persistence. The memory 111 is used to store programs or data. The communication unit 113 is configured to establish a communication connection between the web server 100 and other communication terminals through the network 300, and is used to send and receive data through the network 300.
应当理解的是,图1所示的结构仅为网页服务器100的结构示意图,所述网页服务器100还可包括比图1中所示更多或者更少的组件,或者具有与图1所示不同的配置。图1中所示的各组件可以采用硬件、软件或其组合实现。It should be understood that the structure shown in FIG. 1 is only a schematic structural diagram of the web server 100, and the web server 100 may further include more or less components than those shown in FIG. 1, or have different from that shown in FIG. Configuration. The components shown in Figure 1 can be implemented in hardware, software, or a combination thereof.
请参照图3,是本发明较佳实施例提供的一种网页前端测试方法,应用于相互通信连接的客户端401与网页服务器100。所述网页前端测试方法包括以下步骤:Please refer to FIG. 3 , which is a web page front end testing method provided by a preferred embodiment of the present invention, which is applied to a client 401 and a web server 100 that are connected to each other. The webpage front end testing method includes the following steps:
步骤S101,所述客户端401响应测试指令,生成访问请求数据。Step S101, the client 401 generates access request data in response to the test instruction.
本实施例中,客户端401通过访问请求数据从网页服务器100获取加载网页的数据及 实现各种前端网站服务的数据。所述访问请求数据包括被配置成标识需要测试的待测试功能及与待测试功能对应的待测试文件的测试标识。需要说明的是,待测试功能与待测试文件之间的对应关系可以预先设置。所述访问请求数据还包括网页服务器100对应的网页地址(例如,百度网页服务器100对应的网页地址为www.baidu.com)。待测试功能可以是网页的前端网站服务对应的功能模块。待测试文件可以是实现待测试功能的脚本文件,例如可以是前端javascript脚本文件。如图4所示,步骤S101包括以下子步骤:In this embodiment, the client 401 acquires data of the loaded webpage and data of various front-end web services from the web server 100 by accessing the request data. The access request data includes a test identifier configured to identify a function to be tested that needs to be tested and a file to be tested corresponding to the function to be tested. It should be noted that the correspondence between the function to be tested and the file to be tested can be preset. The access request data further includes a webpage address corresponding to the webpage server 100 (for example, the webpage address corresponding to the Baidu webpage server 100 is www.baidu.com). The function to be tested may be a function module corresponding to the front-end website service of the webpage. The file to be tested may be a script file that implements the function to be tested, and may be, for example, a front-end javascript script file. As shown in FIG. 4, step S101 includes the following sub-steps:
子步骤S1011,所述客户端401响应所述测试指令,获得与所述测试指令对应的待测试业务信息。Sub-step S1011, the client 401 obtains the service information to be tested corresponding to the test instruction in response to the test instruction.
在本实施例中,测试指令可以是触发对网页的一个或多个前端网站服务进行测试的指令。测试指令可以由测试员通过用户终端400触发,也可以是按照预设置的规则触发。待测试业务信息可以是被指定需要被测试的一个或多个前端网站服务对应的待测试功能的业务信息。待测试业务信息包括待测试功能的标识信息及实现待测试功能的业务规则。前端网站服务与待测试业务信息之间的对应关系可以通过预先设置于用户终端400。In this embodiment, the test command may be an instruction to trigger testing of one or more front end web services of the web page. The test command may be triggered by the tester via the user terminal 400 or may be triggered according to pre-set rules. The service information to be tested may be service information of a function to be tested corresponding to one or more front-end website services that need to be tested. The service information to be tested includes identification information of the function to be tested and a business rule for implementing the function to be tested. The correspondence between the front-end website service and the service information to be tested may be preset to the user terminal 400.
子步骤S1012,所述客户端401根据待测试业务信息生成与所述待测试功能对应的测试标识。In sub-step S1012, the client 401 generates a test identifier corresponding to the function to be tested according to the service information to be tested.
在本实施例中,测试标识包括待测试文件标识及待测试功能标识。待测试文件标识可以是待测试文件名称,例如,待测试文件名称可以是demo.js;待测试功能标识可以是待测试功能的名称,例如,待测试功能的名称可以是DemoController.demoFunction。客户端401根据待测试业务信息生成待测试文件标识及待测试功能标识。In this embodiment, the test identifier includes a file identifier to be tested and a function identifier to be tested. The file identifier to be tested may be the name of the file to be tested. For example, the file name to be tested may be demo.js; the function identifier to be tested may be the name of the function to be tested. For example, the name of the function to be tested may be DemoController.demoFunction. The client 401 generates a to-be-tested file identifier and a to-be-tested function identifier according to the service information to be tested.
子步骤S1013,所述客户端401获取与所述网页服务器100对应的网页地址。Sub-step S1013, the client 401 acquires a webpage address corresponding to the webpage server 100.
子步骤S1014,所述客户端401根据所述网页地址及所述测试标识生成所述访问请求数据。Sub-step S1014, the client 401 generates the access request data according to the webpage address and the test identifier.
在本实施例中,客户端401通过网页地址访问网页服务器100以获取加载网页的数据及实现各种前端网站服务的数据,例如,与各项前端网站服务对应的多个前端JS脚本文件、前端CSS样式文件、jpg、png等图片资源文件,这些资源文件在访问时可以同时从网页服务器100中获取。所述测试标识被配置成标识通过访问请求数据需要测试的待测试功能及待测试文件。所述访问请求数据可以包括访问地址,访问地址包括网页地址及测试标识。例如,访问地址可以是baidu.com?testFile=demo.js&testModule=DemoController.demoFunction。In this embodiment, the client 401 accesses the web server 100 through the webpage address to obtain data of loading the webpage and data of various front-end web services, for example, multiple front-end JS script files and front ends corresponding to each front-end web service. CSS style files, jpg, png and other image resource files, which can be acquired from the web server 100 at the same time. The test identifier is configured to identify a function to be tested and a file to be tested that need to be tested by accessing the request data. The access request data may include an access address including a webpage address and a test identifier. For example, the access address can be baidu.com? testFile=demo.js&testModule=DemoController.demoFunction.
步骤S102,客户端401将所述访问请求数据发送给所述网页服务器100。In step S102, the client 401 sends the access request data to the web server 100.
在本实施例中,客户端401可以在生成访问请求数据后自动发送给网页服务器100。具体地,通过网络300将访问请求数据发送给网页服务器100。以便流程进入步骤S103。In this embodiment, the client 401 can automatically send to the web server 100 after generating the access request data. Specifically, the access request data is transmitted to the web server 100 through the network 300. The flow proceeds to step S103.
步骤S103,所述网页服务器100根据所述测试标识,获得与待测试功能对应的测试用例。Step S103: The web server 100 obtains a test case corresponding to the function to be tested according to the test identifier.
在本实施例中,网页服务器100接收访问请求数据后,解析访问请求数据中的测试标识,以获得测试标识中的待测试文件标识及待测试功能标识。测试用例(Test Case)是为某个特殊目标而编制的一组测试输入、执行条件以及预期结果。每一个待测试功能都存在对应的测试用例。测试用例、及测试用例与待测试功能之间的对应关系可以是预先存储在网页服务器100内。因此,当从测试标识中解析出待测试功能标识后,根据待测试功能标识,利用测试用例与待测试功能之间的对应关系从预先存储的测试用例中获取与待测试功能对应的测试用例。这样通过预先建立待测试功能和测试用例之间的对应关系,并可以通过待测试功能标识确定对应的测试用例,可以提高查找与待测试功能对应的测试用例的精确性和效率。In this embodiment, after receiving the access request data, the web server 100 parses the test identifier in the access request data to obtain the file identifier to be tested and the function identifier to be tested in the test identifier. A Test Case is a set of test inputs, execution conditions, and expected results that are compiled for a particular purpose. There is a corresponding test case for each function to be tested. The correspondence between the test case and the test case and the function to be tested may be pre-stored in the web server 100. Therefore, after the function identifier to be tested is parsed from the test identifier, the test case corresponding to the function to be tested is obtained from the pre-stored test case by using the correspondence between the test case and the function to be tested according to the function identifier to be tested. In this way, by accurately establishing the correspondence between the function to be tested and the test case, and determining the corresponding test case by the function identifier to be tested, the accuracy and efficiency of the test case corresponding to the function to be tested can be improved.
步骤S104,所述网页服务器100根据访问请求数据,获取待反馈数据,其中,所述待反馈数据包括与所述待测试功能对应的待测试文件。In step S104, the web server 100 obtains data to be fed back according to the access request data, where the data to be fed back includes a file to be tested corresponding to the function to be tested.
在本实施例中,待反馈数据可以是反馈给客户端401以便客户端401加载网页的数据及实现各种前端网站服务的数据。待反馈数据可以包括,但不限于包括:待测试文件、暂不测试的功能对应的脚本文件、前端CSS样式文件、jpg、png等图片资源文件。In this embodiment, the data to be fed back may be feedback to the client 401 for the client 401 to load data of the webpage and data for implementing various front-end web services. The data to be fed back may include, but is not limited to, a file to be tested, a script file corresponding to a function not to be tested, a front end CSS style file, a picture resource file such as jpg, png, and the like.
步骤S105,所述网页服务器100根据所述测试用例及待反馈数据,生成响应数据。Step S105, the web server 100 generates response data according to the test case and the data to be fed back.
在本实施例中,所述网页服务器100将获取的所述测试用例动态的注入所述待反馈数据,以生成响应数据。测试用例与所有的脚本文件分离,在测试时通过将获取与待测试功能对应的测试用例动态注入待反馈数据中,有效的降低了响应数据的耦合度,使响应数据被优化,减轻客户端401加载响应数据的负担。同时通过动态注入测试用例降低甚至脱离测试用例对运行环境的依赖,或者通过动态注入测试用例可以使测试用例脱离对运行环境的依赖,实现任意环境的测试用例引入,极大地提高测试用例可维护性以及测试效率。可选地,如图5所示,步骤S105包括以下子步骤:In this embodiment, the web server 100 dynamically injects the acquired test case into the to-be-feedback data to generate response data. The test case is separated from all the script files. In the test, the test case corresponding to the function to be tested is dynamically injected into the data to be fed back, which effectively reduces the coupling degree of the response data, so that the response data is optimized and the client 401 is lightened. The burden of loading response data. At the same time, by dynamically injecting test cases to reduce or even deviate from the test case's dependence on the operating environment, or by dynamically injecting test cases, the test cases can be separated from the operating environment, and test cases can be introduced in any environment, greatly improving the test case maintainability. And test efficiency. Optionally, as shown in FIG. 5, step S105 includes the following sub-steps:
子步骤S1051,所述网页服务器100根据所述待测试文件标识从所述待反馈数据中获取对应的所述待测试文件。In the sub-step S1051, the web server 100 obtains the corresponding file to be tested from the to-be-feedback data according to the to-be-tested file identifier.
在本实施例中,待反馈数据中包括实现各个前端网站服务的脚本文件,从所有的脚本文件中通过待测试文件标识查找出待测试文件。需要说明的是,即使只测试一个前端网站服务,客户端401均需先访问网页服务器100,而访问网页服务器100,会同时请求多个前端网站服务对应的多个前端JS脚本文件。In this embodiment, the data to be fed includes a script file for implementing each front-end website service, and the file to be tested is found by using the file identifier to be tested from all the script files. It should be noted that even if only one front-end website service is tested, the client 401 needs to access the web server 100 first, and the web server 100 accesses multiple front-end JS script files corresponding to multiple front-end website services.
子步骤S1052,所述网页服务器100根据与所述待测试功能标识对应的业务规则将所述测试用例注入所述待测试文件。Sub-step S1052, the web server 100 injects the test case into the file to be tested according to a business rule corresponding to the function identifier to be tested.
在本实施例中,业务规则可以是网站服务实现过程中的业务逻辑,例如,搜索服务的业务规则为先显示搜索界面,再接收搜索内容,接着进行搜素,最后显示搜索结果。注入测试用例可以是将测试用例加入待测试文件的脚本文件中。按照业务规则将测试用例注入待测试文件中可以是,根据业务规则在待测试文件中选择加入测试用例的位置。例如,测试搜索功能时,根据搜索服务的业务规则,将测试搜索功能的测试用例注入在实现显示搜索界面的脚本文件之后,使待测试文件在被执行的过程中,当显示了搜索界面后开始执行测试搜索功能的测试用例。这样可减少、甚至是消除测试用例对测试环境的依赖。In this embodiment, the business rule may be the business logic in the website service implementation process. For example, the business rule of the search service is to display the search interface first, then receive the search content, then search, and finally display the search result. The injection test case can be a script file that adds the test case to the file to be tested. The test case is injected into the file to be tested according to the business rule, and the location of the test case is selected in the file to be tested according to the business rule. For example, when testing the search function, according to the business rules of the search service, the test case of the test search function is injected into the script file that implements the display search interface, so that the file to be tested is executed, when the search interface is displayed, A test case that performs a test search function. This reduces or even eliminates the dependency of test cases on the test environment.
在本实施例中,可以使用已注入测试用例的待测试文件替换待反馈数据中没注入测试用例的待测试文件,以生成响应数据。In this embodiment, the file to be tested in which the test case is not injected in the data to be tested may be replaced with the file to be tested that has been injected into the test case to generate response data.
步骤S106,所述网页服务器100将所述响应数据发送至所述客户端401。Step S106, the web server 100 sends the response data to the client 401.
在本实施例中,网页服务器100在生成响应数据后,可以将响应数据通过网络300发送给客户端401。In this embodiment, after generating the response data, the web server 100 may send the response data to the client 401 through the network 300.
步骤S107,所述客户端401执行所述响应数据,以得到测试结果。Step S107, the client 401 executes the response data to obtain a test result.
在本实施例中,客户端401根据响应数据对网页进行加载。启动待测试功能。可以是运行与待测试功能对应的注入了测试用例的待测试文件,以获得当前测试环境下的测试结果。可选地,可以使用JavaScript Object Notation进行测试结果收集。In this embodiment, the client 401 loads the webpage according to the response data. Start the function to be tested. The test file to be injected with the test case corresponding to the function to be tested may be run to obtain the test result in the current test environment. Alternatively, you can use JavaScript Object Notation for test result collection.
步骤S108,所述客户端401将所述测试结果发送至所述网页服务器100。In step S108, the client 401 sends the test result to the web server 100.
在本实施例中,将收集的测试结果发送给网页服务器100。例如,将JSON格式的测试结果通过ajax发送给网页服务器100。In the present embodiment, the collected test results are sent to the web server 100. For example, the test result in JSON format is sent to the web server 100 via ajax.
步骤S109,所述网页服务器100对所述测试结果进行展示。In step S109, the web server 100 displays the test result.
在本实施例中,解析接收到的测试结果。集中展示不同网站服务对应的测试结果。以便对不同网站服务的测试结果进行处理,例如,当测试结果显示一项网站业务的业务逻辑存在逻辑问题,则对该网站也的业务逻辑顺序进行调整等。能够给网站开发人员提供从微观(单项前端业务功能)到宏观(网站前端整体业务功能)的统一监控,极大地提高业务功能和整个网站的稳定性和可维护性。In this embodiment, the received test result is parsed. Focus on the test results corresponding to different website services. In order to process the test results of different website services, for example, when the test results show that there is a logical problem in the business logic of a website business, the business logic sequence of the website is also adjusted. It can provide web developers with unified monitoring from micro (single front-end business functions) to macro (full-service business functions at the front end of the website), greatly improving business functions and stability and maintainability of the entire website.
本发明实施例还提供了一种网页前端测试方法,应用于与网页服务器通信连接的客户端,所述方法包括:The embodiment of the present invention further provides a webpage front-end testing method, which is applied to a client that is in communication with a web server, and the method includes:
步骤S201,响应测试指令,生成访问请求数据,其中,所述访问请求数据包括被配置成标识需要测试的待测试功能的测试标识。详细的,可参见步骤S101的描述。Step S201: Generate access request data in response to the test instruction, wherein the access request data includes a test identifier configured to identify a function to be tested that needs to be tested. For details, refer to the description of step S101.
步骤S202,将所述访问请求数据发送给所述网页服务器,以使所述网页服务器根据根据所述测试标识,获得与待测试功能对应的测试用例;以使所述网页服务器根据访问请求数据,获取待反馈数据,其中,所述待反馈数据包括与所述待测试功能对应 的待测试文件;以使所述网页服务器所述测试用例及待反馈数据,生成响应数据。详细的,可参见步骤S102至步骤S105的描述。Step S202: Send the access request data to the webpage server, so that the webpage server obtains a test case corresponding to the function to be tested according to the test identifier, so that the webpage server according to the access request data. Obtaining data to be fed, wherein the data to be fed back includes a file to be tested corresponding to the function to be tested; and the test data of the web server and the data to be fed back are generated to generate response data. For details, refer to the description of step S102 to step S105.
步骤S203,接收所述网页服务器生成的响应数据。在本实施例中,网页服务器100在生成响应数据后,可以将响应数据通过网络300发送给客户端401。Step S203: Receive response data generated by the web server. In this embodiment, after generating the response data, the web server 100 may send the response data to the client 401 through the network 300.
步骤S204,执行所述响应数据,以得到测试结果。详细的,可参见步骤S107的描述。Step S204, executing the response data to obtain a test result. For details, refer to the description of step S107.
在一种具体实施方式中,所述客户端响应测试指令,生成访问请求数据的步骤包括:所述客户端响应所述测试指令,获得与所述测试指令对应的待测试业务信息;所述客户端根据所述待测试业务信息生成与所述待测试功能对应的测试标识;所述客户端获取与所述网页服务器对应的网页地址;所述客户端根据所述网页地址及所述测试标识生成所述访问请求数据。详细的,可参见步骤S1011至步骤S1013的描述。In a specific implementation manner, the step of the client responding to the test instruction to generate the access request data includes: the client responding to the test instruction, obtaining service information to be tested corresponding to the test instruction; the client And generating, by the terminal, a test identifier corresponding to the function to be tested according to the service information to be tested; the client acquiring a webpage address corresponding to the webpage server; and the client generating the webpage address and the test identifier according to the webpage address and the test identifier The access request data. For details, refer to the description of step S1011 to step S1013.
所述客户端将所述访问请求数据发送给所述网页服务器的步骤包括:根据所述访问请求数据中包含的网页地址,确定该网页地址对应的网页服务器;建立与所述网页地址对应的网页服务器的通信连接;将所述访问请求数据中包含的测试标识发送至所述网页服务器。The step of the client sending the access request data to the webpage server includes: determining, according to the webpage address included in the access request data, a webpage server corresponding to the webpage address; and establishing a webpage corresponding to the webpage address a communication connection of the server; transmitting the test identifier included in the access request data to the web server.
所述客户端执行所述响应数据,以得测试结果的步骤包括:所述客户端根据所述响应数据,加载与所述响应数据对应的网页;所述客户端启动与所述响应数据对应的网页对应的待测试功能;所述客户端运行与所述待测试功能对应的已注入了测试用例的待测试文件,得到当前测试环境下的测试结果。The step of the client executing the response data to obtain a test result includes: the client loading a webpage corresponding to the response data according to the response data; and the client starting corresponding to the response data The webpage corresponds to the function to be tested; the client runs the to-be-tested file that has been injected with the test case corresponding to the function to be tested, and obtains the test result in the current test environment.
所述客户端在得到测试结果后,所述客户端还可以将所述测试结果发送至所述网页服务器。所述网页服务器对所述测试结果进行展示。After the client obtains the test result, the client may also send the test result to the web server. The web server displays the test results.
通过客户端可以实现对网页前端的测试,能够给网站开发人员提供从微观(单项前端业务功能)到宏观(网站前端整体业务功能)的统一监控,极大地提高业务功能和整个网站的稳定性和可维护性。The client can implement the test of the front end of the webpage, and can provide web developers with unified monitoring from micro (single front-end business function) to macro (the overall business function of the front-end of the website), greatly improving the business function and the stability of the entire website. Maintainability.
如图6所示,是本发明较佳实施例提供的一种网页前端测试方法,所述方法应用于网页服务器100,所述网页前端测试方法包括以下步骤:As shown in FIG. 6 , a method for testing a web page front end according to a preferred embodiment of the present invention is applied to a web server 100. The web page front end testing method includes the following steps:
步骤S201,接收所述客户端401发送的访问请求数据,其中,所述访问请求数据包括用于标识需要测试的待测试功能的测试标识。Step S201: Receive access request data sent by the client 401, where the access request data includes a test identifier for identifying a function to be tested that needs to be tested.
在本实施例中,解析访问请求数据,从访问请求数据中获取对需要测试的待测试功能的测试标识。测试标识包括待测试文件标识及待测试功能标识。待测试文件标识可以是待测试文件名称,例如,待测试文件名称可以是demo.js;待测试功能标识可以是待测试功能的名称,例如,待测试功能的名称可以是DemoController.demoFunction。客户端401根据 待测试业务信息生成待测试文件标识及待测试功能标识。In this embodiment, the access request data is parsed, and the test identifier of the function to be tested that needs to be tested is obtained from the access request data. The test identifier includes the file identifier to be tested and the function identifier to be tested. The file identifier to be tested may be the name of the file to be tested. For example, the file name to be tested may be demo.js; the function identifier to be tested may be the name of the function to be tested. For example, the name of the function to be tested may be DemoController.demoFunction. The client 401 generates a to-be-tested file identifier and a function identifier to be tested according to the service information to be tested.
步骤S202,根据所述测试标识,获得与待测试功能对应的测试用例。Step S202: Obtain a test case corresponding to the function to be tested according to the test identifier.
在本实施例中,测试用例、及测试用例与待测试功能之间的对应关系可预先存储在网页服务器100内。因此,当从测试标识中解析出待测试功能标识后,根据待测试功能标识,利用测试用例与待测试功能之间的对应关系从预先存储的多个测试用例中获取与待测试功能对应的测试用例。这样提高查找与待测试功能对应的测试用例的精确性和效率。In this embodiment, the correspondence between the test case and the test case and the function to be tested may be stored in the web server 100 in advance. Therefore, after the function identifier to be tested is parsed from the test identifier, the corresponding test relationship between the test case and the function to be tested is used to obtain a test corresponding to the function to be tested from the plurality of test cases stored in advance according to the function identifier to be tested. Example. This improves the accuracy and efficiency of finding test cases corresponding to the function to be tested.
步骤S203,根据访问请求数据,获取待反馈数据,其中,所述待反馈数据包括与所述待测试功能对应的待测试文件。Step S203: Acquire data to be fed back according to the access request data, where the data to be fed back includes a file to be tested corresponding to the function to be tested.
在本实施例中,待反馈数据可以是反馈给客户端401以便客户端401加载网页的数据及实现各种前端网站服务的数据。待反馈数据可以包括,但不限于包括:待测试文件、暂不测试的功能对应的脚本文件、前端CSS样式文件、jpg、png等图片资源文件。In this embodiment, the data to be fed back may be feedback to the client 401 for the client 401 to load data of the webpage and data for implementing various front-end web services. The data to be fed back may include, but is not limited to, a file to be tested, a script file corresponding to a function not to be tested, a front end CSS style file, a picture resource file such as jpg, png, and the like.
步骤S204,根据所述测试用例及待反馈数据,生成响应数据。Step S204: Generate response data according to the test case and the data to be fed back.
在本实施例中,所述网页服务器100将获取的所述测试用例动态的注入所述待反馈数据,以生成响应数据。测试用例与所有的脚本文件分离,在测试时通过将获取与待测试功能对应的测试用例动态注入待反馈数据中,有效的降低了响应数据的耦合度,使响应数据被优化,减轻客户端401加载响应数据的负担。同时通过动态注入测试用例降低甚至脱离测试用例对运行环境的依赖,实现任意环境的测试用例引入,极大地提高测试用例可维护性以及测试效率。可选地,执行步骤S204的方式可以是根据所述待测试文件标识从所述待反馈数据中获取对应的所述待测试文件;根据与所述待测试功能标识对应的业务规则将所述测试用例注入所述待测试文件。In this embodiment, the web server 100 dynamically injects the acquired test case into the to-be-feedback data to generate response data. The test case is separated from all the script files. In the test, the test case corresponding to the function to be tested is dynamically injected into the data to be fed back, which effectively reduces the coupling degree of the response data, so that the response data is optimized and the client 401 is lightened. The burden of loading response data. At the same time, the dynamic injection test cases reduce or even deviate from the test case's dependence on the operating environment, and realize the introduction of test cases in any environment, which greatly improves the test case maintainability and test efficiency. Optionally, the method of step S204 may be: obtaining, according to the to-be-tested file identifier, the corresponding file to be tested according to the to-be-tested data identifier; and performing the test according to a service rule corresponding to the to-be-tested function identifier. The use case injects the file to be tested.
步骤S205,将所述响应数据发送至所述客户端401,以获得所述客户端401反馈的测试结果,其中,所述测试结果由所述客户端401执行所述响应数据后生成。Step S205: Send the response data to the client 401 to obtain a test result fed back by the client 401, wherein the test result is generated by the client 401 executing the response data.
步骤S206,对所述测试结果进行展示。Step S206, displaying the test result.
在本实施例中,解析接收到的测试结果。集中展示不同网站服务对应的测试结果。以便对不同网站服务的测试结果进行处理,例如,当测试结果显示一项网站业务的业务逻辑存在逻辑问题,则对该网站的业务逻辑顺序进行调整等。能够给网站开发人员提供从微观(单项前端业务功能)到宏观(网站前端整体业务功能)的统一监控,极大地提高业务功能和整个网站的稳定性和可维护性。In this embodiment, the received test result is parsed. Focus on the test results corresponding to different website services. In order to process the test results of different website services, for example, when the test result shows that there is a logical problem in the business logic of a website business, the business logic sequence of the website is adjusted. It can provide web developers with unified monitoring from micro (single front-end business functions) to macro (full-service business functions at the front end of the website), greatly improving business functions and stability and maintainability of the entire website.
请参照图7,是本发明较佳实施例提供的应用于网页服务器100的网页前端测试装置200。网页前端测试装置200包括:接收模块201、获取模块202、生成模块203及发送模块204。Please refer to FIG. 7 , which is a webpage front end testing apparatus 200 applied to the web server 100 according to a preferred embodiment of the present invention. The web page front end testing device 200 includes a receiving module 201, an obtaining module 202, a generating module 203, and a sending module 204.
接收模块201,用于接收所述客户端401发送的访问请求数据,其中,所述访问请求 数据包括用于标识需要测试的待测试功能的测试标识。The receiving module 201 is configured to receive the access request data sent by the client 401, where the access request data includes a test identifier for identifying a function to be tested that needs to be tested.
在本发明实施例中,步骤S201可以由接收模块201执行。In the embodiment of the present invention, step S201 can be performed by the receiving module 201.
获取模块202,用于根据所述测试标识,获得与待测试功能对应的测试用例;及还用于根据访问请求数据,获取待反馈数据,其中,所述待反馈数据包括与所述待测试功能对应的待测试文件。The obtaining module 202 is configured to obtain a test case corresponding to the function to be tested according to the test identifier, and is further configured to obtain data to be fed back according to the access request data, where the data to be fed back includes the function to be tested Corresponding files to be tested.
在本实施例中,步骤S202、步骤S203、步骤S103步骤S104可以由获取模块202执行。In this embodiment, step S202, step S203, step S103, step S104 may be performed by the obtaining module 202.
生成模块203,用于根据所述测试用例及待反馈数据,生成响应数据。The generating module 203 is configured to generate response data according to the test case and the data to be fed back.
在本实施例中,步骤S204及步骤S105可以由生成模块203执行。需要说明的是,子步骤S1051及子步骤S1051也可以由生成模块203执行。生成模块203执行步骤S204或步骤S105的方式可以是将获取的所述测试用例动态的注入所述待反馈数据,以生成响应数据。可选地,所述测试用例动态的注入通过如下方式:根据所述待测试文件标识从所述待反馈数据中获取对应的所述待测试文件,再根据与所述待测试功能标识对应的业务规则将所述测试用例注入所述待测试文件。In this embodiment, step S204 and step S105 may be performed by the generating module 203. It should be noted that the sub-step S1051 and the sub-step S1051 may also be executed by the generating module 203. The manner in which the generating module 203 performs the step S204 or the step S105 may be: dynamically injecting the acquired test case into the data to be fed back to generate response data. Optionally, the dynamic injection of the test case is performed by: obtaining, according to the to-be-tested file identifier, the corresponding file to be tested from the to-be-reviewed data, and then, according to the service corresponding to the function identifier to be tested. The rule injects the test case into the file to be tested.
发送模块204,用于将所述响应数据发送至所述客户端401,以获得所述客户端401反馈的测试结果,其中,所述测试结果由所述客户端401执行所述响应数据后生成。The sending module 204 is configured to send the response data to the client 401 to obtain a test result fed back by the client 401, where the test result is generated by the client 401 executing the response data. .
在本实施例中,步骤S205及步骤S106可以由发送模块204执行。In this embodiment, step S205 and step S106 may be performed by the transmitting module 204.
在本实施例中,网页前端测试装置200还包括展示模块,所述展示模块用于对所述测试结果进行展示。可选地,步骤S109及步骤S206可以由展示模块执行。In this embodiment, the webpage front end testing apparatus 200 further includes a display module, and the display module is configured to display the test result. Optionally, step S109 and step S206 may be performed by a presentation module.
综上所述,本发明实施例提供的一种网页前端测试方法、装置、系统、设备及可读存储介质。所述方法应用于相互通信连接的客户端与网页服务器。所述方法包括:客户端响应测试指令,生成访问请求数据,其中,所述访问请求数据包括用于标识需要测试的待测试功能的测试标识;将所述访问请求数据发送给所述网页服务器;所述网页服务器根据所述测试标识,获得与待测试功能对应的测试用例;根据访问请求数据,获取待反馈数据,其中,所述待反馈数据包括与所述待测试功能对应的待测试文件;根据所述测试用例及待反馈数据,生成响应数据;将所述响应数据发送至所述客户端;所述客户端执行所述响应数据,以得测试结果。降低测试过程中客户端加载数据的耦合度,降低测试用例对测试环境的依赖,提高测试效率。测试用例也更加方便管理维护。进而减少网页前端测试工作的人力成本和时间成本。In summary, a webpage front-end testing method, apparatus, system, device, and readable storage medium are provided by embodiments of the present invention. The method is applied to a client and a web server that are in communication with each other. The method includes: the client responds to the test instruction, and generates access request data, where the access request data includes a test identifier for identifying a function to be tested that needs to be tested; and the access request data is sent to the web server; The web server obtains a test case corresponding to the function to be tested according to the test identifier, and obtains data to be fed back according to the access request data, wherein the data to be fed back includes a file to be tested corresponding to the function to be tested; And generating response data according to the test case and the data to be fed back; sending the response data to the client; and the client executing the response data to obtain a test result. Reduce the coupling degree of the client load data during the test, reduce the dependence of the test case on the test environment, and improve the test efficiency. Test cases are also easier to manage and maintain. In turn, the labor cost and time cost of the web front-end testing work are reduced.
本发明实施例还提供了一种网页前端测试系统,包括相互通信连接的客户端与网页服务器,其中:所述客户端配置成响应测试指令,生成访问请求数据,其中,所述访问请求数据包括被配置成标识需要测试的待测试功能的测试标识;所述客户端配置 成将所述访问请求数据发送给所述网页服务器;所述网页服务器配置成根据所述测试标识,获得与待测试功能对应的测试用例;所述网页服务器配置成根据访问请求数据,获取待反馈数据,其中,所述待反馈数据包括与所述待测试功能对应的待测试文件;所述网页服务器配置成根据所述测试用例及待反馈数据,生成响应数据;所述网页服务器配置成将所述响应数据发送至所述客户端;所述客户端配置成执行所述响应数据,以得测试结果。详细的,可参见上述方法实施例的描述。The embodiment of the present invention further provides a webpage front-end testing system, including a client and a webpage server connected to each other, wherein: the client is configured to generate access request data in response to a test instruction, wherein the access request data includes a test identifier configured to identify a function to be tested that needs to be tested; the client configured to send the access request data to the web server; the web server configured to obtain and test a function according to the test identifier Corresponding test case; the web server is configured to obtain data to be fed back according to the access request data, wherein the data to be fed back includes a file to be tested corresponding to the function to be tested; the web server is configured according to the Testing the use case and the data to be fed back to generate response data; the web server is configured to send the response data to the client; the client is configured to execute the response data to obtain a test result. For details, refer to the description of the above method embodiments.
本发明实施例还提供了一种电子设备,所述电子设备包括存储器和处理器,所述存储器用于存储有可执行程序代码,所述处理器用于读取所述存储器中存储的可执行程序代码以使得所述电子设备作为上述客户端和\或网页服务器执行上述网页前端测试方法。An embodiment of the present invention further provides an electronic device, where the electronic device includes a memory and a processor, the memory is configured to store executable program code, and the processor is configured to read an executable program stored in the memory. The code causes the electronic device to perform the above web page front end testing method as the client and/or web server.
本发明实施例还提供了一种可读存储介质,所述可读存储介质内存储有指令,当所述指令在计算机上运行时,使得计算机作为上述客户端和\或网页服务器执行上述网页前端测试方法。The embodiment of the present invention further provides a readable storage medium, where the readable storage medium stores instructions, when the instruction is run on a computer, causing the computer to execute the webpage front end as the client and the web server testing method.
以上所述,仅为本发明的具体实施方式,但本发明的保护范围并不局限于此,任何熟悉本技术领域的技术人员在本发明揭露的技术范围内,可轻易想到变化或替换,都应涵盖在本发明的保护范围之内。因此,本发明的保护范围应所述以权利要求的保护范围为准。The above is only a specific embodiment of the present invention, but the scope of the present invention is not limited thereto, and any person skilled in the art can easily think of changes or substitutions within the technical scope of the present invention. It should be covered by the scope of the present invention. Therefore, the scope of the invention should be determined by the scope of the claims.
工业实用性Industrial applicability
本发明实施例提供的一种网页前端测试方法、装置、系统、设备及可读存储介质降低测试过程中客户端加载数据的耦合度,降低测试用例对测试环境的依赖,提高测试效率。测试用例也更加方便管理维护。进而减少网页前端测试工作的人力成本和时间成本。The webpage front-end testing method, device, system, device and readable storage medium provided by the embodiment of the invention reduce the coupling degree of the client loading data during the testing process, reduce the dependence of the test case on the testing environment, and improve the testing efficiency. Test cases are also easier to manage and maintain. In turn, the labor cost and time cost of the web front-end testing work are reduced.

Claims (21)

  1. 一种网页前端测试方法,其特征在于,所述方法应用于相互通信连接的客户端与网页服务器,所述方法包括:A method for testing a web page front end, wherein the method is applied to a client and a web server connected to each other, the method comprising:
    所述客户端响应测试指令,生成访问请求数据,其中,所述访问请求数据包括被配置成标识需要测试的待测试功能的测试标识;The client generates access request data in response to the test instruction, wherein the access request data includes a test identifier configured to identify a function to be tested that needs to be tested;
    所述客户端将所述访问请求数据发送给所述网页服务器;The client sends the access request data to the web server;
    所述网页服务器根据所述测试标识,获得与待测试功能对应的测试用例;The web server obtains a test case corresponding to the function to be tested according to the test identifier;
    所述网页服务器根据访问请求数据,获取待反馈数据,其中,所述待反馈数据包括与所述待测试功能对应的待测试文件;The web server obtains data to be fed back according to the access request data, where the data to be fed back includes a file to be tested corresponding to the function to be tested;
    所述网页服务器根据所述测试用例及待反馈数据,生成响应数据;The web server generates response data according to the test case and the data to be fed back;
    所述网页服务器将所述响应数据发送至所述客户端;Sending, by the web server, the response data to the client;
    所述客户端执行所述响应数据,以得测试结果。The client executes the response data to obtain a test result.
  2. 如权利要求1所述的网页前端测试方法,其特征在于,根据所述测试用例及待反馈数据,生成响应数据的步骤包括:The webpage front-end testing method according to claim 1, wherein the step of generating response data according to the test case and the data to be fed back comprises:
    所述网页服务器将所述测试用例动态的注入所述待反馈数据,以生成响应数据。The web server dynamically injects the test case into the data to be fed back to generate response data.
  3. 如权利要求2所述的网页前端测试方法,其特征在于,所述测试标识包括待测试文件标识及待测试功能标识,所述网页服务器将所述测试用例动态的注入所述待反馈数据的步骤包括:The webpage front-end testing method according to claim 2, wherein the test identifier comprises a file identifier to be tested and a function identifier to be tested, and the web server dynamically injects the test case into the data to be fed back include:
    所述网页服务器根据所述待测试文件标识从所述待反馈数据中获取对应的所述待测试文件;所述网页服务器根据与所述待测试功能标识对应的业务规则将所述测试用例注入所述待测试文件。The web server obtains the corresponding test file from the to-be-reviewed data according to the to-be-tested file identifier; the web server injects the test case according to a business rule corresponding to the to-be-tested function identifier Tell the test file.
  4. 如权利要求1至3任意一项所述的网页前端测试方法,其特征在于,所述客户端响应测试指令,生成访问请求数据的步骤包括:The method for testing a web page front end according to any one of claims 1 to 3, wherein the step of the client responding to the test instruction to generate the access request data comprises:
    所述客户端响应所述测试指令,获得与所述测试指令对应的待测试业务信息;Responding to the test instruction, the client obtains service information to be tested corresponding to the test instruction;
    所述客户端根据所述待测试业务信息生成与所述待测试功能对应的测试标识;The client generates a test identifier corresponding to the function to be tested according to the service information to be tested;
    所述客户端获取与所述网页服务器对应的网页地址;The client obtains a webpage address corresponding to the webpage server;
    所述客户端根据所述网页地址及所述测试标识生成所述访问请求数据。The client generates the access request data according to the webpage address and the test identifier.
  5. 如权利要求1至4任意一项所述的网页前端测试方法,其特征在于,所述客户端将所述访问请求数据发送给所述网页服务器的步骤包括:The method for testing a web page front end according to any one of claims 1 to 4, wherein the step of the client transmitting the access request data to the web server comprises:
    根据所述访问请求数据中包含的网页地址,确定该网页地址对应的网页服务器;Determining, according to the webpage address included in the access request data, a webpage server corresponding to the webpage address;
    建立与所述网页地址对应的网页服务器的通信连接;Establishing a communication connection of the web server corresponding to the webpage address;
    将所述访问请求数据中包含的测试标识发送至所述网页服务器。Sending the test identifier included in the access request data to the web server.
  6. 如权利要求1至4任意一项所述的网页前端测试方法,其特征在于,所述客户端执行所述响应数据,以得测试结果的步骤包括:The method for testing a web page front end according to any one of claims 1 to 4, wherein the step of the client executing the response data to obtain a test result comprises:
    所述客户端根据所述响应数据,加载与所述响应数据对应的网页;The client loads a webpage corresponding to the response data according to the response data;
    所述客户端启动与所述响应数据对应的网页对应的待测试功能;The client starts a function to be tested corresponding to a webpage corresponding to the response data;
    所述客户端运行与所述待测试功能对应的已注入了测试用例的待测试文件,得到当前测试环境下的测试结果。The client runs the to-be-tested file that has been injected with the test case corresponding to the function to be tested, and obtains the test result in the current test environment.
  7. 如权利要求1至6任意一项所述的网页前端测试方法,其特征在于,所述方法还包括:The method for testing a web page front end according to any one of claims 1 to 6, wherein the method further comprises:
    所述客户端将所述测试结果发送至所述网页服务器;The client sends the test result to the web server;
    所述网页服务器对所述测试结果进行展示。The web server displays the test results.
  8. 一种网页前端测试方法,其特征在于,应用于与网页服务器通信连接的客户端,所述方法包括:响应测试指令,生成访问请求数据,其中,所述访问请求数据包括被配置成标识需要测试的待测试功能的测试标识;A method for testing a web page front end, characterized in that it is applied to a client communicatively connected to a web server, the method comprising: generating access request data in response to a test instruction, wherein the access request data comprises being configured to identify that a test is required Test identification of the function to be tested;
    将所述访问请求数据发送给所述网页服务器,以使所述网页服务器根据根据所述测试标识,获得与待测试功能对应的测试用例;以使所述网页服务器根据访问请求数据,获取待反馈数据,其中,所述待反馈数据包括与所述待测试功能对应的待测试文件;以使所述网页服务器所述测试用例及待反馈数据,生成响应数据;Transmitting the access request data to the webpage server, so that the webpage server obtains a test case corresponding to the function to be tested according to the test identifier, so that the webpage server obtains the feedback to be fed according to the access request data. Data, wherein the data to be fed back includes a file to be tested corresponding to the function to be tested; and the test data of the web server and the data to be fed back are generated to generate response data;
    接收所述网页服务器生成的响应数据;Receiving response data generated by the web server;
    执行所述响应数据,以得到测试结果。The response data is executed to obtain test results.
  9. 如权利要求8所述的网页前端测试方法,其特征在于,所述客户端响应测试指令,生成访问请求数据的步骤包括:The webpage front-end testing method according to claim 8, wherein the step of the client responding to the test instruction to generate the access request data comprises:
    所述客户端响应所述测试指令,获得与所述测试指令对应的待测试业务信息;Responding to the test instruction, the client obtains service information to be tested corresponding to the test instruction;
    所述客户端根据所述待测试业务信息生成与所述待测试功能对应的测试标识;The client generates a test identifier corresponding to the function to be tested according to the service information to be tested;
    所述客户端获取与所述网页服务器对应的网页地址;The client obtains a webpage address corresponding to the webpage server;
    所述客户端根据所述网页地址及所述测试标识生成所述访问请求数据。The client generates the access request data according to the webpage address and the test identifier.
  10. 如权利要求8或9任意一项所述的网页前端测试方法,其特征在于,所述客户端将所述访问请求数据发送给所述网页服务器的步骤包括:The method for testing a web page front end according to any one of claims 8 to 9, wherein the step of the client transmitting the access request data to the web server comprises:
    根据所述访问请求数据中包含的网页地址,确定该网页地址对应的网页服务器;Determining, according to the webpage address included in the access request data, a webpage server corresponding to the webpage address;
    建立与所述网页地址对应的网页服务器的通信连接;Establishing a communication connection of the web server corresponding to the webpage address;
    将所述访问请求数据中包含的测试标识发送至所述网页服务器。Sending the test identifier included in the access request data to the web server.
  11. 如权利要求8或9任意一项所述的网页前端测试方法,其特征在于,所述客户端执行所述响应数据,以得测试结果的步骤包括:The method for testing a web page front end according to any one of claims 8 to 9, wherein the step of the client executing the response data to obtain a test result comprises:
    所述客户端根据所述响应数据,加载与所述响应数据对应的网页;The client loads a webpage corresponding to the response data according to the response data;
    所述客户端启动与所述响应数据对应的网页对应的待测试功能;The client starts a function to be tested corresponding to a webpage corresponding to the response data;
    所述客户端运行与所述待测试功能对应的已注入了测试用例的待测试文件,得到当前测试环境下的测试结果。The client runs the to-be-tested file that has been injected with the test case corresponding to the function to be tested, and obtains the test result in the current test environment.
  12. 如权利要求8至11任意一项所述的网页前端测试方法,其特征在于,所述方法还包括:The method for testing a web page front end according to any one of claims 8 to 11, wherein the method further comprises:
    所述客户端将所述测试结果发送至所述网页服务器;The client sends the test result to the web server;
    所述网页服务器对所述测试结果进行展示。The web server displays the test results.
  13. 一种网页前端测试方法,其特征在于,所述方法应用于与客户端通信连接的网页服务器,所述方法包括:A method for testing a web page front end, wherein the method is applied to a web server connected to a client, the method comprising:
    接收所述客户端发送的访问请求数据,其中,所述访问请求数据包括用于标识需要测试的待测试功能的测试标识;Receiving access request data sent by the client, where the access request data includes a test identifier for identifying a function to be tested that needs to be tested;
    根据所述测试标识,获得与待测试功能对应的测试用例;Obtaining a test case corresponding to the function to be tested according to the test identifier;
    根据访问请求数据,获取待反馈数据,其中,所述待反馈数据包括与所述待测试功能对应的待测试文件;Obtaining data to be fed back according to the access request data, where the data to be fed back includes a file to be tested corresponding to the function to be tested;
    根据所述测试用例及待反馈数据,生成响应数据;Generating response data according to the test case and the data to be fed back;
    将所述响应数据发送至所述客户端,以获得所述客户端反馈的测试结果,其中,所述测试结果由所述客户端执行所述响应数据后生成。Sending the response data to the client to obtain a test result fed back by the client, wherein the test result is generated by the client executing the response data.
  14. 如权利要求13所述的网页前端测试方法,其特征在于,根据所述测试用例及待反馈数据,生成响应数据的步骤包括:The method for testing a web page front end according to claim 13, wherein the step of generating response data according to the test case and the data to be fed back comprises:
    将所述测试用例动态的注入所述待反馈数据,以生成所述响应数据。The test case is dynamically injected into the data to be fed back to generate the response data.
  15. 如权利要求14所述的网页前端测试方法,其特征在于,所述测试标识包括待测试文件标识及待测试功能标识,将所述测试用例动态的注入所述待反馈数据的步骤包括:The webpage front-end testing method according to claim 14, wherein the test identifier comprises a file identifier to be tested and a function identifier to be tested, and the step of dynamically injecting the test case into the data to be fed back comprises:
    根据所述待测试文件标识从所述待反馈数据中获取对应的所述待测试文件;Obtaining, according to the to-be-tested file identifier, the corresponding file to be tested according to the to-be-tested data;
    根据与所述待测试功能标识对应的业务规则将所述测试用例注入所述待测试文件。And loading the test case into the file to be tested according to a business rule corresponding to the function identifier to be tested.
  16. 如权利要求13至15任意一项所述的网页前端测试方法,其特征在于,所述方法还包括:The method for testing a web page front end according to any one of claims 13 to 15, wherein the method further comprises:
    对所述测试结果进行展示。The test results are presented.
  17. 一种网页前端测试装置,其特征在于,应用于与网页服务器通信连接的客户端,该装置包括:A webpage front-end testing device is characterized in that it is applied to a client that is in communication with a web server, and the device comprises:
    访问请求数据生成模块,配置成响应测试指令,生成访问请求数据,其中,所述访问请求数据包括被配置成标识需要测试的待测试功能的测试标识;The access request data generating module is configured to generate access request data in response to the test instruction, wherein the access request data includes a test identifier configured to identify a function to be tested that needs to be tested;
    访问请求数据发送模块,配置成将所述访问请求数据发送给所述网页服务器,以使所述网页服务器根据根据所述测试标识,获得与待测试功能对应的测试用例;以使所述网页服务器根据访问请求数据,获取待反馈数据,其中,所述待反馈数据包括与所述待测试功能对应的待测试文件;以使所述网页服务器所述测试用例及待反馈数据,生成响应数据;The access request data sending module is configured to send the access request data to the webpage server, so that the webpage server obtains a test case corresponding to the function to be tested according to the test identifier, so that the webpage server Obtaining data to be tested according to the access request data, wherein the data to be fed back includes a file to be tested corresponding to the function to be tested; and the test case and the data to be fed back are generated by the web server to generate response data;
    响应数据接收模块,配置成接收所述网页服务器生成的响应数据;a response data receiving module configured to receive response data generated by the web server;
    执行模块,配置成执行所述响应数据,以得到测试结果。An execution module configured to execute the response data to obtain a test result.
  18. 一种网页前端测试装置,其特征在于,所述装置应用于与客户端通信连接的网页服务器,所述装置包括:A web page front end testing device, wherein the device is applied to a web server connected to a client, the device comprising:
    接收模块,配置成接收所述客户端发送的访问请求数据,其中,所述访问请求数据包括用于标识需要测试的待测试功能的测试标识;a receiving module, configured to receive the access request data sent by the client, where the access request data includes a test identifier for identifying a function to be tested that needs to be tested;
    获取模块,配置成根据所述测试标识,获得与待测试功能对应的测试用例;及还用于根据访问请求数据,获取待反馈数据,其中,所述待反馈数据包括与所述待测试功能对应的待测试文件;Obtaining a module, configured to obtain a test case corresponding to the function to be tested according to the test identifier, and configured to obtain data to be fed back according to the access request data, where the data to be fed back includes a function corresponding to the function to be tested Test file to be tested;
    生成模块,配置成根据所述测试用例及待反馈数据,生成响应数据;Generating a module, configured to generate response data according to the test case and data to be fed back;
    发送模块,配置成将所述响应数据发送至所述客户端,以获得所述客户端反馈的测试结果,其中,所述测试结果由所述客户端执行所述响应数据后生成。And a sending module, configured to send the response data to the client to obtain a test result fed back by the client, where the test result is generated by the client executing the response data.
  19. 一种网页前端测试系统,其特征在于,包括相互通信连接的客户端与网页服务器,其中:A web page front end testing system, comprising: a client and a web server connected to each other, wherein:
    所述客户端配置成响应测试指令,生成访问请求数据,其中,所述访问请求数据包括被配置成标识需要测试的待测试功能的测试标识;The client is configured to generate access request data in response to the test instruction, wherein the access request data includes a test identifier configured to identify a function to be tested that requires testing;
    所述客户端配置成将所述访问请求数据发送给所述网页服务器;The client is configured to send the access request data to the web server;
    所述网页服务器配置成根据所述测试标识,获得与待测试功能对应的测试用例;The web server is configured to obtain a test case corresponding to the function to be tested according to the test identifier;
    所述网页服务器配置成根据访问请求数据,获取待反馈数据,其中,所述待反馈数据包括与所述待测试功能对应的待测试文件;The web server is configured to obtain data to be fed back according to the access request data, where the data to be fed back includes a file to be tested corresponding to the function to be tested;
    所述网页服务器配置成根据所述测试用例及待反馈数据,生成响应数据;The web server is configured to generate response data according to the test case and the data to be fed back;
    所述网页服务器配置成将所述响应数据发送至所述客户端;The web server is configured to send the response data to the client;
    所述客户端配置成执行所述响应数据,以得测试结果。The client is configured to execute the response data to obtain a test result.
  20. 一种电子设备,其特征在于,所述电子设备包括存储器和处理器,所述存储器用于存储有可执行程序代码,所述处理器用于读取所述存储器中存储的可执行程序代码以使得 所述电子设备作为上述客户端和\或网页服务器执行权利要求1-16任一项所述方法。An electronic device, comprising: a memory for storing executable program code, and a processor for reading executable program code stored in the memory to cause The electronic device performs the method of any one of claims 1-16 as the client and/or web server.
  21. 一种可读存储介质,其特征在于,所述可读存储介质内存储有指令,当所述指令在计算机上运行时,使得计算机作为上述客户端和\或网页服务器执行如权利要求1-16任一项所述方法。A readable storage medium, wherein the readable storage medium stores instructions therein, and when the instructions are run on a computer, causing the computer to perform as the client and/or web server as claimed in claims 1-16 Any of the methods described.
PCT/CN2018/074486 2017-06-08 2018-01-29 Webpage front-end testing method, device, system, apparatus and readable storage medium WO2018223717A1 (en)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN201710425734.8 2017-06-08
CN201710425734.8A CN107256195B (en) 2017-06-08 2017-06-08 Webpage front-end test method and device

Publications (1)

Publication Number Publication Date
WO2018223717A1 true WO2018223717A1 (en) 2018-12-13

Family

ID=60023027

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2018/074486 WO2018223717A1 (en) 2017-06-08 2018-01-29 Webpage front-end testing method, device, system, apparatus and readable storage medium

Country Status (2)

Country Link
CN (1) CN107256195B (en)
WO (1) WO2018223717A1 (en)

Families Citing this family (22)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN107256195B (en) * 2017-06-08 2019-01-29 武汉斗鱼网络科技有限公司 Webpage front-end test method and device
CN109857628A (en) * 2017-11-30 2019-06-07 北京高德云图科技有限公司 Dynamic UI business end code method for testing performance and device
CN109871312B (en) * 2017-12-05 2022-08-12 航天信息股份有限公司 Interface testing method, device, equipment and readable storage medium
CN110347577B (en) * 2018-04-04 2024-04-09 阿里巴巴集团控股有限公司 Page testing method, device and equipment thereof
CN109359050A (en) * 2018-11-15 2019-02-19 北京奇虎科技有限公司 Webpage test method, device and system
CN109656829A (en) * 2018-12-24 2019-04-19 西安四叶草信息技术有限公司 Test method and device based on docker
CN110008117A (en) * 2019-03-12 2019-07-12 深圳壹账通智能科技有限公司 Page test method, device, computer equipment and storage medium
CN110008118B (en) * 2019-03-13 2023-03-10 深圳壹账通智能科技有限公司 Page data testing method and device, computer equipment and storage medium
CN110046101B (en) * 2019-04-15 2022-08-19 腾讯音乐娱乐科技(深圳)有限公司 Page automatic testing method and device and computer storage medium
CN110321287A (en) * 2019-06-20 2019-10-11 北京奇艺世纪科技有限公司 A kind of detection method of server capability, device and electronic equipment
CN110502444B (en) * 2019-08-28 2023-08-18 北京达佳互联信息技术有限公司 Testing method and testing device for image processing algorithm
CN110765001B (en) * 2019-09-06 2023-04-07 赛诺贝斯(北京)营销技术股份有限公司 Modularized automatic test method and device for application system
CN110633219B (en) * 2019-09-24 2023-09-08 网易(杭州)网络有限公司 Page test method and device, storage medium and electronic equipment
CN111030894B (en) * 2020-01-07 2022-01-18 燕东科技(广东)有限公司 Front-end testing method of distributed communication system
CN111597110B (en) * 2020-04-27 2024-02-27 五八有限公司 Page test method and device, electronic equipment and storage medium
CN111767217B (en) * 2020-06-24 2024-02-02 中国工商银行股份有限公司 JS unit test case generation method and device
CN111984539A (en) * 2020-08-25 2020-11-24 北京微步在线科技有限公司 Automatic testing method and device for webpage front end
CN112328470A (en) * 2020-10-22 2021-02-05 中国建设银行股份有限公司 Automatic operation and maintenance testing method, device, equipment and storage medium
CN112269739A (en) * 2020-10-26 2021-01-26 广州华多网络科技有限公司 Webpage testing method and device, equipment and medium thereof
CN113434378B (en) * 2021-06-30 2023-09-05 北京百度网讯科技有限公司 Webpage stability detection method and device, electronic equipment and readable storage medium
CN113448691B (en) * 2021-08-30 2021-11-05 天津市天房科技发展股份有限公司 Interaction method and device for front-end JavaScript and local Java application
CN115567564B (en) * 2022-12-06 2023-09-08 东方空间(西安)宇航技术有限公司 Method, device, system and equipment for testing aerospace equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103377127A (en) * 2012-04-28 2013-10-30 阿里巴巴集团控股有限公司 Development testing system, testing method and device for webpage product
WO2014195115A1 (en) * 2013-06-04 2014-12-11 International Business Machines Corporation Web service testing
CN105159833A (en) * 2015-09-30 2015-12-16 努比亚技术有限公司 Automatic testing device and method
CN107256195A (en) * 2017-06-08 2017-10-17 武汉斗鱼网络科技有限公司 Webpage front-end method of testing and device

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104461903B (en) * 2014-12-26 2017-07-28 北京奇虎科技有限公司 The method and apparatus of test client based on browser
CN105260299A (en) * 2015-09-17 2016-01-20 安一恒通(北京)科技有限公司 Method, device, and system for software test

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103377127A (en) * 2012-04-28 2013-10-30 阿里巴巴集团控股有限公司 Development testing system, testing method and device for webpage product
WO2014195115A1 (en) * 2013-06-04 2014-12-11 International Business Machines Corporation Web service testing
CN105159833A (en) * 2015-09-30 2015-12-16 努比亚技术有限公司 Automatic testing device and method
CN107256195A (en) * 2017-06-08 2017-10-17 武汉斗鱼网络科技有限公司 Webpage front-end method of testing and device

Also Published As

Publication number Publication date
CN107256195B (en) 2019-01-29
CN107256195A (en) 2017-10-17

Similar Documents

Publication Publication Date Title
WO2018223717A1 (en) Webpage front-end testing method, device, system, apparatus and readable storage medium
CN110708346B (en) Information processing system and method
CN107622135B (en) Method and apparatus for displaying information
US10003671B2 (en) Capturing and replaying application sessions using resource files
CN109684188B (en) Test method and device
CN109359194B (en) Method and apparatus for predicting information categories
CN110502699B (en) Method and device for acquiring information
RU2753450C1 (en) Method and device for fast order processing
US20170308513A1 (en) Techniques for web framework detection
CN110908922A (en) Application program testing method and device
CN107451163B (en) Animation display method and device
CN111431767A (en) Multi-browser resource synchronization method and device, computer equipment and storage medium
CN113535577B (en) Application testing method and device based on knowledge graph, electronic equipment and medium
US20190166214A1 (en) Method and apparatus for pushing information
CN111783010B (en) Webpage blank page monitoring method, device, terminal and storage medium
CN110442806B (en) Method and apparatus for recognizing image
CN112131092A (en) Page debugging method and device
CN111338928A (en) Chrome-based browser testing method and device
CN111666201A (en) Regression testing method, device, medium and electronic equipment
CN114840379A (en) Log generation method, device, server and storage medium
CN109324822B (en) PWA (public warning assistant) item detection method, computer-readable storage medium and terminal device
CN109756393B (en) Information processing method, system, medium, and computing device
CN109889402B (en) Method and apparatus for generating information
CN111767486A (en) Method, device, electronic equipment and computer readable medium for displaying page
CN108459890B (en) Interface display method and device for application

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 18814104

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 18814104

Country of ref document: EP

Kind code of ref document: A1