CN113326188A - Browser testing method and device - Google Patents

Browser testing method and device Download PDF

Info

Publication number
CN113326188A
CN113326188A CN202110585100.5A CN202110585100A CN113326188A CN 113326188 A CN113326188 A CN 113326188A CN 202110585100 A CN202110585100 A CN 202110585100A CN 113326188 A CN113326188 A CN 113326188A
Authority
CN
China
Prior art keywords
browser
test
instruction
file
information
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202110585100.5A
Other languages
Chinese (zh)
Inventor
阳巍巍
徐征磊
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Wodong Tianjun Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Jingdong Century Trading Co Ltd, Beijing Wodong Tianjun Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN202110585100.5A priority Critical patent/CN113326188A/en
Publication of CN113326188A publication Critical patent/CN113326188A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3684Test management for test design, e.g. generating new test cases
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3668Software testing
    • G06F11/3672Test management
    • G06F11/3688Test management for test execution, e.g. scheduling of test suites
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/958Organisation or management of web site content, e.g. publishing, maintaining pages or automatic linking

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Databases & Information Systems (AREA)
  • Data Mining & Analysis (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention discloses a browser testing method and device, and relates to the technical field of computers. One embodiment of the method comprises: monitoring a test instruction executed by a first browser to generate an instruction information file; executing a test instruction on the second browser according to the instruction information file; and comparing a first report file of the first browser with a second report file of the second browser to determine a test result, wherein the first report file is generated by executing the test instruction on the first browser, and the second report file is generated by executing the test instruction on the second browser. According to the embodiment, a plurality of browsers can be tested simultaneously, an automatic script does not need to be compiled, repetitive work is reduced, time cost and test cost required by testing are reduced, the testing efficiency of the browsers is improved, and all functions can be tested.

Description

Browser testing method and device
Technical Field
The invention relates to the technical field of computers, in particular to a browser testing method and device.
Background
The existing schemes for testing the compatibility of multiple browsers have three types: the method comprises the steps of respectively testing a plurality of browsers manually; the second scheme is to test partial functions by compiling an automatic script; and the third scheme is to record the automatic script and debug the recorded automatic script to test the browser.
In the process of implementing the invention, the inventor finds that at least the following problems exist in the prior art:
the first scheme has large repetitive workload and high labor cost; the second scheme can only test partial functions, cannot test all the functions, and needs to test after the functions are on-line, so that the maintenance cost is high; and the third scheme has high research and development cost and long research and development time.
Disclosure of Invention
In view of this, embodiments of the present invention provide a method and an apparatus for testing a browser, which can test multiple browsers simultaneously, do not need to compile an automation script, reduce repetitive work, reduce time cost and test cost required for testing, improve browser test efficiency, and test all functions.
To achieve the above object, according to an aspect of an embodiment of the present invention, a browser testing method is provided.
A browser testing method includes: monitoring a test instruction executed by a first browser to generate an instruction information file; executing the test instruction to a second browser according to the instruction information file; and comparing a first report file of the first browser with a second report file of the second browser to determine a test result, wherein the first report file is generated by executing the test instruction on the first browser, and the second report file is generated by executing the test instruction on the second browser.
Optionally, the monitoring a test instruction executed by the first browser to generate an instruction information file includes: and monitoring mouse and/or keyboard operation events of the first browser, and analyzing the monitored operation events to generate the instruction information file.
Optionally, the analyzing the monitored operation event to generate the instruction information file includes: analyzing the monitored operation events to determine the type of the test instruction, acquiring one or more information of a unique identifier of an element operated by the test instruction, a path of the element, text information of the element and relative coordinates of dragging, and generating the instruction information file according to the type of the test instruction and the acquired one or more information.
Optionally, the number of the second browsers is one or more; the executing the test instruction to the second browser according to the instruction information file comprises: sending the instruction information file to the second browser; analyzing the instruction information file at the second browser to obtain the type of the test instruction executed on the second browser and one or more information of unique identification of an element operated by the test instruction, a path of the element, text information of the element and relative coordinates of dragging; and executing a corresponding test instruction on the second browser according to the type of the test instruction and the one or more information, and generating the second report file.
Optionally, the first report file and the second report file include test information of one or more nodes of a browser; the comparing the first report file of the first browser and the second report file of the second browser to determine a test result includes: and comparing the test information of the same node corresponding to the first report file and the second report file according to the node, wherein if the test information of all the same nodes of the first browser and the second browser is consistent, the test result passes.
Optionally, a listener is used to monitor the test instruction executed by the first browser, and the instruction information file is a json format file.
According to another aspect of the embodiments of the present invention, a browser testing apparatus is provided.
A browser testing apparatus, comprising: the instruction information file generating module is used for monitoring a test instruction executed by the first browser so as to generate an instruction information file; the test instruction execution module is used for executing the test instruction to the second browser according to the instruction information file; and the report file comparison module is used for comparing a first report file of the first browser with a second report file of the second browser to determine a test result, wherein the first report file is generated by executing the test instruction on the first browser, and the second report file is generated by executing the test instruction on the second browser.
Optionally, the instruction information file generating module is further configured to: and monitoring mouse and/or keyboard operation events of the first browser, and analyzing the monitored operation events to generate the instruction information file.
Optionally, the instruction information file generating module is further configured to: analyzing the monitored operation events to determine the type of the test instruction, acquiring one or more information of a unique identifier of an element operated by the test instruction, a path of the element, text information of the element and relative coordinates of dragging, and generating the instruction information file according to the type of the test instruction and the acquired one or more information.
Optionally, the number of the second browsers is one or more; the test instruction execution module is further configured to: sending the instruction information file to the second browser; analyzing the instruction information file at the second browser to obtain the type of the test instruction executed on the second browser and one or more information of unique identification of an element operated by the test instruction, a path of the element, text information of the element and relative coordinates of dragging; and executing a corresponding test instruction on the second browser according to the type of the test instruction and the one or more information, and generating the second report file.
Optionally, the first report file and the second report file include test information of one or more nodes of a browser; the report file comparison module is further used for: and comparing the test information of the same node corresponding to the first report file and the second report file according to the node, wherein if the test information of all the same nodes of the first browser and the second browser is consistent, the test result passes.
Optionally, a listener is used to monitor the test instruction executed by the first browser, and the instruction information file is a json format file.
According to yet another aspect of an embodiment of the present invention, an electronic device is provided.
An electronic device, comprising: one or more processors; the memory is used for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors are enabled to realize the browser testing method provided by the embodiment of the invention.
According to yet another aspect of an embodiment of the present invention, a computer-readable medium is provided.
A computer readable medium, on which a computer program is stored, the computer program, when being executed by a processor, implements the browser testing method provided by the embodiments of the present invention.
One embodiment of the above invention has the following advantages or benefits: monitoring a test instruction executed by a first browser to generate an instruction information file; executing a test instruction on the second browser according to the instruction information file; and comparing a first report file of the first browser with a second report file of the second browser to determine a test result, wherein the first report file is generated by executing the test instruction on the first browser, and the second report file is generated by executing the test instruction on the second browser. The method can test a plurality of browsers simultaneously, does not need to compile automatic scripts, reduces repetitive work, reduces time cost and test cost required by the test, improves the test efficiency of the browsers, and can test all functions.
Further effects of the above-mentioned non-conventional alternatives will be described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
FIG. 1 is a schematic diagram of the main steps of a browser testing method according to one embodiment of the present invention;
FIG. 2 is a flow diagram of browser testing according to one embodiment of the present invention;
FIG. 3 is a schematic flow diagram of generating an instruction information file according to one embodiment of the invention;
FIG. 4 is a flow diagram of comparing report files, according to one embodiment of the present invention;
FIG. 5 is a schematic diagram of the main modules of a browser testing device according to one embodiment of the present invention;
FIG. 6 is an exemplary system architecture diagram in which embodiments of the present invention may be employed;
fig. 7 is a schematic block diagram of a computer system suitable for use in implementing a terminal device or server of an embodiment of the invention.
Detailed Description
Exemplary embodiments of the present invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
As shown in fig. 1, the browser testing method according to an embodiment of the present invention mainly includes the following steps S101 to S103.
Step S101: and monitoring a test instruction executed by the first browser to generate an instruction information file.
Monitoring a test instruction executed by the first browser to generate an instruction information file, which may include: and monitoring mouse and/or keyboard operation events of the first browser, and analyzing the monitored operation events to generate an instruction information file.
Analyzing the monitored operation event to generate an instruction information file, which may include: analyzing the monitored operation events to determine the type of the test instruction, acquiring one or more information of unique identification of an element operated by the test instruction, a path of the element, text information of the element and relative coordinates of dragging, and generating an instruction information file according to the type of the test instruction and the acquired one or more information.
The listener may listen for test instructions executed by the first browser.
The first browser may be a browser operated by a human.
Step S102: and executing the test instruction to the second browser according to the instruction information file.
The number of the second browsers is one or more; executing the test instruction to the second browser according to the instruction information file may include: sending the instruction information file to a second browser; analyzing the instruction information file in the second browser to obtain the type of the test instruction executed on the second browser and one or more information of unique identification of an element operated by the test instruction, a path of the element, text information of the element and relative coordinates of dragging; and executing the corresponding test instruction to the second browser according to the type of the test instruction and the one or more kinds of information, and generating a second report file.
The instruction information file may be a json format file.
And the second browser executes the test instruction through the instruction information file.
Step S103: and comparing a first report file of the first browser with a second report file of the second browser to determine a test result, wherein the first report file is generated by executing the test instruction on the first browser, and the second report file is generated by executing the test instruction on the second browser.
The first and second report files may include test information for one or more nodes of the browser.
In one embodiment, the test results indicate the compatibility of the browser under test.
And comparing the first report file of the first browser with the second report file of the second browser to determine a test result, specifically, if the comparison of the test information in the first report file and the test information in the second report file is consistent, the compatibility test of the second browser passes, otherwise, the compatibility test does not pass.
Comparing the first report file of the first browser with the second report file of the second browser to determine the test result may include: and comparing the test information of the same node corresponding to the first report file and the second report file according to the node, and if the test information of all the same nodes of the first browser and the second browser is consistent, the test result passes. Specifically, if the test information of the nodes corresponding to the first report file and the second report file are both compared and consistent, the compatibility test of the second browser passes, otherwise, the compatibility test fails.
FIG. 2 is a flow diagram of browser testing, according to one embodiment of the present invention.
As shown in fig. 2, in the browser testing method according to the embodiment of the present invention, browsers to be tested are added to a pool to be tested, where the browsers to be tested include a first browser (i.e., browser a in fig. 3) and a second browser (i.e., browser B1, browser B2, and browser B3 in fig. 3); manually triggering mouse and/or keyboard operation events, executing a test instruction on a first browser, executing a test action (namely the test instruction) on a webpage to be tested, and generating a first report file; analyzing the monitored operation events by monitoring mouse and/or keyboard operation events of the first browser to generate an instruction information file; sending the instruction information file to a second browser, receiving the instruction information file by the second browser through an agent information receiver, analyzing the instruction information file into a web driver instruction and executing a corresponding test instruction to generate a second report file; and comparing the first report file of the first browser with the second report file of the second browser to determine the test result. The instruction information file can be a json format file, the listener can be a json mouse listener (namely, the global event monitoring agent in fig. 2), the web driver is a Ruby library developed based on Ruby language, and can use chrome, firefox and IE browsers to perform web test, and can simulate a user to click a link, fill a form, click a button and the like.
Fig. 3 is a flow diagram of generating an instruction information file according to an embodiment of the invention.
As shown in fig. 3, a monitor monitors mouse and/or keyboard operation events of a first browser, parses the monitored operation events to determine the type of a test instruction, obtains one or more information of a unique identifier of an element operated by the test instruction (i.e., id of the element), a path of the element (i.e., xpath of the element), text information of the element (i.e., text of the element), and relative coordinates of dragging, and generates an instruction information file according to the type of the test instruction and the obtained one or more information. Specifically, the type of the test instruction may include a single click type, a sliding type, a text box input type, and the like, and when an operation event is monitored, the type of the test instruction is determined, if the type of the test instruction is the single click type, a unique identifier of an element operated by the test instruction, a path of the element, and text information of the element are acquired, if the type of the test instruction is the sliding type, a relative coordinate of pressing and releasing when a mouse is dragged is acquired, and if the type of the test instruction is the text box input type, the unique identifier of the element operated by the test instruction, and the path of the element are acquired; generating a command information file in a json format according to the type of the test command and the obtained one or more information; and sending the instruction information file to the second browser.
FIG. 4 is a flow diagram of comparing report files, according to one embodiment of the present invention.
As shown in fig. 4, the test information of the same node corresponding to the first report file and the second report file is compared according to the node, and if the test information of all the same nodes of the first browser and the second browser are consistent, the test result passes. Specifically, a node C is a node in a first browser, a node D is a node in a certain second browser, and the node C corresponds to the node D; when the comparison result shows that whether the test information of the node C is the same as that of the node D or not, the test information of the node C is obtained in the first report file, and the test information of the node D is obtained in the second report file; judging whether the test information of the node C and the test information of the node D are not null, if not, finishing comparison, determining that the test information of the corresponding nodes of the first browser and the second browser are different, if not, judging whether the test information of the node C and the test information of the node D are the same, if not, finishing comparison, determining that the test information of the corresponding nodes of the first browser and the second browser are different, if so, judging whether the node C and the node D both have a child node, if not, finishing comparison of the pair of nodes, determining that the test information of the node C and the test information of the node D are the same, and continuously comparing the next corresponding node; otherwise, comparing the test information of the child nodes of the node C and the child nodes of the node D, if the test information of the child nodes corresponding to the node C and the node D are consistent, finishing the comparison, and determining that the test information of the node C is the same as the test information of the node D; and if the comparison of the test information of the child nodes of the node C and the node D is inconsistent, determining that the test information of the node C is different from that of the node D, finishing the comparison, and determining that the test information of the corresponding nodes of the first browser and the second browser is different. And comparing the test information of each node of the first browser with the corresponding node of the second browser according to the method until the test information of all the corresponding nodes is compared. If the comparison of the test information of the corresponding nodes is inconsistent, the whole process of the compatibility test of the second browser is ended, namely the incompatible browser is subjected to an end-to-end test, the incompatible browser is highlighted and marked with red, and meanwhile, incompatible places (nodes, sub-nodes and the like with different test information) are subjected to screenshot, so that the incompatible places can be modified conveniently, and other compatible browsers can be tested continuously.
Fig. 5 is a schematic diagram of main blocks of a browser testing apparatus according to an embodiment of the present invention.
As shown in fig. 5, a browser testing apparatus 500 according to an embodiment of the present invention mainly includes: an instruction information file generating module 501, a test instruction executing module 502 and a report file comparing module 503.
The instruction information file generating module 501 is configured to monitor a test instruction executed by the first browser to generate an instruction information file.
And the test instruction executing module 502 is configured to execute a test instruction on the second browser according to the instruction information file.
The report file comparing module 503 is configured to compare a first report file of the first browser with a second report file of the second browser to determine a test result, where the first report file is generated by executing a test instruction on the first browser, and the second report file is generated by executing a test instruction on the second browser.
In one embodiment, the instruction information file generating module is specifically configured to: and monitoring mouse and/or keyboard operation events of the first browser, and analyzing the monitored operation events to generate an instruction information file.
In one embodiment, the instruction information file generating module is specifically configured to: analyzing the monitored operation events to determine the type of the test instruction, acquiring one or more information of unique identification of an element operated by the test instruction, a path of the element, text information of the element and relative coordinates of dragging, and generating an instruction information file according to the type of the test instruction and the acquired one or more information.
In one embodiment, the number of the second browsers is one or more; the test instruction execution module is specifically configured to: sending the instruction information file to a second browser; analyzing the instruction information file in the second browser to obtain the type of the test instruction executed on the second browser and one or more information of unique identification of an element operated by the test instruction, a path of the element, text information of the element and relative coordinates of dragging; and executing the corresponding test instruction to the second browser according to the type of the test instruction and the one or more kinds of information, and generating a second report file.
In one embodiment, the first report file and the second report file may include test information for one or more nodes of the browser; the report file comparison module is specifically configured to: and comparing the test information of the same node corresponding to the first report file and the second report file according to the node, and if the test information of all the same nodes of the first browser and the second browser is consistent, the test result passes.
In one embodiment, the command information file may be a json format file by the listener listening for test commands executed by the first browser.
In addition, the detailed implementation of the browser testing device in the embodiment of the present invention has been described in detail in the above browser testing method, so that repeated descriptions herein are not repeated.
Fig. 6 shows an exemplary system architecture 600 to which the browser testing method or the browser testing apparatus of the embodiments of the present invention may be applied.
As shown in fig. 6, the system architecture 600 may include terminal devices 601, 602, 603, a network 604, and a server 605. The network 604 serves to provide a medium for communication links between the terminal devices 601, 602, 603 and the server 605. Network 604 may include various types of connections, such as wire, wireless communication links, or fiber optic cables, to name a few.
A user may use the terminal devices 601, 602, 603 to interact with the server 605 via the network 604 to receive or send messages or the like. The terminal devices 601, 602, 603 may have installed thereon various communication client applications, such as shopping applications, web browser applications, search applications, instant messaging tools, mailbox clients, social platform software, etc. (by way of example only).
The terminal devices 601, 602, 603 may be various electronic devices having a display screen and supporting web browsing, including but not limited to smart phones, tablet computers, laptop portable computers, desktop computers, and the like.
The server 605 may be a server providing various services, such as a background management server (for example only) providing support for shopping websites browsed by users using the terminal devices 601, 602, 603. The backend management server may analyze and perform other processing on the received data such as the product information query request, and feed back a processing result (for example, target push information, product information — just an example) to the terminal device.
It should be noted that the browser testing method provided by the embodiment of the present invention is generally executed by the server 605, and accordingly, the browser testing apparatus is generally disposed in the server 605.
It should be understood that the number of terminal devices, networks, and servers in fig. 6 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
Referring now to FIG. 7, a block diagram of a computer system 700 suitable for use with a terminal device or server implementing an embodiment of the invention is shown. The terminal device or the server shown in fig. 7 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present invention.
As shown in fig. 7, the computer system 700 includes a Central Processing Unit (CPU)701, which can perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)702 or a program loaded from a storage section 708 into a Random Access Memory (RAM) 703. In the RAM 703, various programs and data necessary for the operation of the system 700 are also stored. The CPU 701, the ROM 702, and the RAM 703 are connected to each other via a bus 704. An input/output (I/O) interface 705 is also connected to bus 704.
The following components are connected to the I/O interface 705: an input portion 706 including a keyboard, a mouse, and the like; an output section 707 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 708 including a hard disk and the like; and a communication section 709 including a network interface card such as a LAN card, a modem, or the like. The communication section 709 performs communication processing via a network such as the internet. A drive 710 is also connected to the I/O interface 705 as needed. A removable medium 711 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 710 as necessary, so that a computer program read out therefrom is mounted into the storage section 708 as necessary.
In particular, according to the embodiments of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program can be downloaded and installed from a network through the communication section 709, and/or installed from the removable medium 711. The computer program performs the above-described functions defined in the system of the present invention when executed by the Central Processing Unit (CPU) 701.
It should be noted that the computer readable medium shown in the present invention can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present invention, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present invention, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present invention. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules described in the embodiments of the present invention may be implemented by software or hardware. The described modules may also be provided in a processor, which may be described as: a processor comprises an instruction information file generation module, a test instruction execution module and a report file comparison module. The names of these modules do not limit the module itself in some cases, for example, the instruction information file generation module may also be described as a "module for listening to a test instruction executed by the first browser to generate an instruction information file".
As another aspect, the present invention also provides a computer-readable medium that may be contained in the apparatus described in the above embodiments; or may be separate and not incorporated into the device. The computer readable medium carries one or more programs which, when executed by a device, cause the device to comprise: monitoring a test instruction executed by a first browser to generate an instruction information file; executing a test instruction on the second browser according to the instruction information file; and comparing a first report file of the first browser with a second report file of the second browser to determine a test result, wherein the first report file is generated by executing the test instruction on the first browser, and the second report file is generated by executing the test instruction on the second browser.
According to the technical scheme of the embodiment of the invention, a test instruction executed by a first browser is monitored to generate an instruction information file; executing a test instruction on the second browser according to the instruction information file; and comparing a first report file of the first browser with a second report file of the second browser to determine a test result, wherein the first report file is generated by executing the test instruction on the first browser, and the second report file is generated by executing the test instruction on the second browser. The method can test a plurality of browsers simultaneously, does not need to compile automatic scripts, reduces repetitive work, reduces time cost and test cost required by the test, improves the test efficiency of the browsers, and can test all functions.
The above-described embodiments should not be construed as limiting the scope of the invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (14)

1. A browser testing method is characterized by comprising the following steps:
monitoring a test instruction executed by a first browser to generate an instruction information file;
executing the test instruction to a second browser according to the instruction information file;
and comparing a first report file of the first browser with a second report file of the second browser to determine a test result, wherein the first report file is generated by executing the test instruction on the first browser, and the second report file is generated by executing the test instruction on the second browser.
2. The method of claim 1, wherein listening for test instructions executed by the first browser to generate an instruction information file comprises:
and monitoring mouse and/or keyboard operation events of the first browser, and analyzing the monitored operation events to generate the instruction information file.
3. The method of claim 2, wherein parsing the monitored operational events to generate the instruction information file comprises:
analyzing the monitored operation events to determine the type of the test instruction, acquiring one or more information of a unique identifier of an element operated by the test instruction, a path of the element, text information of the element and relative coordinates of dragging, and generating the instruction information file according to the type of the test instruction and the acquired one or more information.
4. The method according to claim 3, wherein the number of the second browsers is one or more;
the executing the test instruction to the second browser according to the instruction information file comprises:
sending the instruction information file to the second browser;
analyzing the instruction information file at the second browser to obtain the type of the test instruction executed on the second browser and one or more information of unique identification of an element operated by the test instruction, a path of the element, text information of the element and relative coordinates of dragging;
and executing a corresponding test instruction on the second browser according to the type of the test instruction and the one or more information, and generating the second report file.
5. The method of claim 1, wherein the first report file and the second report file include test information for one or more nodes of a browser;
the comparing the first report file of the first browser and the second report file of the second browser to determine a test result includes:
and comparing the test information of the same node corresponding to the first report file and the second report file according to the node, wherein if the test information of all the same nodes of the first browser and the second browser is consistent, the test result passes.
6. The method according to claim 1, wherein the test instruction executed by the first browser is monitored through a listener, and the instruction information file is a json format file.
7. A browser testing apparatus, comprising:
the instruction information file generating module is used for monitoring a test instruction executed by the first browser so as to generate an instruction information file;
the test instruction execution module is used for executing the test instruction to the second browser according to the instruction information file;
and the report file comparison module is used for comparing a first report file of the first browser with a second report file of the second browser to determine a test result, wherein the first report file is generated by executing the test instruction on the first browser, and the second report file is generated by executing the test instruction on the second browser.
8. The apparatus of claim 7, wherein the instruction information file generating module is further configured to:
and monitoring mouse and/or keyboard operation events of the first browser, and analyzing the monitored operation events to generate the instruction information file.
9. The apparatus of claim 7, wherein the instruction information file generating module is further configured to:
analyzing the monitored operation events to determine the type of the test instruction, acquiring one or more information of a unique identifier of an element operated by the test instruction, a path of the element, text information of the element and relative coordinates of dragging, and generating the instruction information file according to the type of the test instruction and the acquired one or more information.
10. The apparatus according to claim 9, wherein the number of the second browsers is one or more;
the test instruction execution module is further configured to:
sending the instruction information file to the second browser;
analyzing the instruction information file at the second browser to obtain the type of the test instruction executed on the second browser and one or more information of unique identification of an element operated by the test instruction, a path of the element, text information of the element and relative coordinates of dragging;
and executing a corresponding test instruction on the second browser according to the type of the test instruction and the one or more information, and generating the second report file.
11. The apparatus of claim 7, wherein the first report file and the second report file include test information for one or more nodes of a browser;
the report file comparison module is further used for:
and comparing the test information of the same node corresponding to the first report file and the second report file according to the node, wherein if the test information of all the same nodes of the first browser and the second browser is consistent, the test result passes.
12. The apparatus according to claim 7, wherein a listener is used to listen to the test instruction executed by the first browser, and the instruction information file is a json format file.
13. An electronic device, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-6.
14. A computer-readable medium, on which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1-6.
CN202110585100.5A 2021-05-27 2021-05-27 Browser testing method and device Pending CN113326188A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110585100.5A CN113326188A (en) 2021-05-27 2021-05-27 Browser testing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110585100.5A CN113326188A (en) 2021-05-27 2021-05-27 Browser testing method and device

Publications (1)

Publication Number Publication Date
CN113326188A true CN113326188A (en) 2021-08-31

Family

ID=77421671

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110585100.5A Pending CN113326188A (en) 2021-05-27 2021-05-27 Browser testing method and device

Country Status (1)

Country Link
CN (1) CN113326188A (en)

Similar Documents

Publication Publication Date Title
CN110708346B (en) Information processing system and method
CN111190888A (en) Method and device for managing graph database cluster
CN110543297B (en) Method and apparatus for generating source code
CN110780874B (en) Method and device for generating information
CN112631590B (en) Component library generation method, device, electronic equipment and computer readable medium
CN113760729A (en) Code detection method and device
CN109218041B (en) Request processing method and device for server system
CN113297081B (en) Execution method and device of continuous integrated pipeline
CN113282444A (en) Visualization method and device for business process debugging
CN114371888A (en) Method and device for hot updating of log collection plug-in, electronic equipment and readable medium
CN109144864B (en) Method and device for testing window
CN111435326A (en) Method and device for analyzing crash logs
CN115454956A (en) Log generation method and device, electronic equipment and storage medium
CN110554892A (en) Information acquisition method and device
CN113326188A (en) Browser testing method and device
CN113407229B (en) Method and device for generating offline scripts
CN112131095B (en) Pressure testing method and device
CN109756393B (en) Information processing method, system, medium, and computing device
CN112988560A (en) Method and device for testing system robustness
CN112579447A (en) Browser testing method and device
CN113760698A (en) Method and device for converting test case file data
CN113254325A (en) Test case processing method and device
CN113360365A (en) Flow testing method and flow testing system
CN112579428A (en) Interface testing method and device, electronic equipment and storage medium
CN111176982A (en) Test interface generation method and device

Legal Events

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