User interface testing method, device, server and medium

By generating automatic execution scripts and calculating user interface test coverage, the problems of inefficient and unstable user interface automation test development are solved, and an efficient user interface automation test process is achieved.

CN113190453BActive Publication Date: 2025-03-21BEIJING WODONG TIANJUN INFORMATION TECH CO LTD +1
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110506115.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-05-10
Publication Date
2025-03-21
Estimated Expiration
2041-05-10

AI Technical Summary

Technical Problem

In the prior art, the development efficiency of user interface automation testing is low and the execution of test scripts is unstable, resulting in a low input-output ratio and unable to effectively improve the testing efficiency.

Method used

By obtaining manual test operation data of each page to be tested in the system to be tested, analyzing this data to generate an automatic execution script, and reading the program running data during the test, and calculating the user interface test coverage based on the call relationship diagram of the program running data and all codes.

Benefits of technology

It realizes a complete user interface automated testing process from test script generation, automated testing to test result measurement, improves the efficiency and input-output ratio of user interface automation testing, and improves the stability of tests.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113190453B_ABST
    Figure CN113190453B_ABST
Patent Text Reader

Abstract

The embodiment of the present invention discloses a user interface testing method, device, server and medium, wherein the method comprises: obtaining manual test operation data of each page to be tested in the system to be tested, and parsing the operation data to generate an automatic execution script; executing the automatic execution script to test each page to be tested, and reading the program running data of the system to be tested during the test; and calculating the user interface test coverage based on the call relationship diagram of the program running data and all codes of the system to be tested. The technical solution of this embodiment solves the problem that the efficiency of developing test scripts for automatic user interface testing is low and the input-output ratio of the test is low, and realizes a complete user interface automated testing process from test script generation, automated testing to test result measurement, thereby improving the efficiency and input-output ratio of user interface automated testing.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The embodiments of the present invention relate to the field of computer technology, and in particular to a user interface testing method, device, server and medium. Background Art

[0002] User Interface (UI) automated testing is an important branch of automated testing. It can directly reflect end-to-end user operations and tends to be a test of real scenarios. The common method is to test developers to write code to implement the use case of UI interface operations, and use methods such as browser drivers (web drivers) to simulate user operation scenarios. Automated test coverage is a common method for measuring test integrity, and usually indicators such as code coverage are used to measure tests.

[0003] However, in the process of implementing the present invention, it was found that there are at least the following technical problems in the prior art: test developers are inefficient in developing test scripts and the test scripts are unstable in execution, the return on investment of UI automation testing is low, and the test efficiency cannot be improved in actual testing. Summary of the invention

[0004] The embodiments of the present invention provide a user interface testing method, device, server and medium to realize a complete user interface automated testing process from test script generation, automated testing to test result measurement, thereby improving the efficiency and input-output ratio of user interface automated testing.

[0005] In a first aspect, an embodiment of the present invention provides a user interface testing method, the method comprising:

[0006] Obtaining manual test operation data of each page to be tested in the system to be tested, and parsing the operation data to generate an automatic execution script;

[0007] Executing the automatic execution script to test each of the pages to be tested, and reading the program running data of the system to be tested during the test;

[0008] The user interface test coverage is calculated based on the call relationship graph between the program running data and all codes of the system to be tested.

[0009] In a second aspect, an embodiment of the present invention further provides a user interface testing device, the device comprising:

[0010] A test script generation module is used to obtain manual test operation data of each page to be tested in the system to be tested, and parse the operation data to generate an automatic execution script;

[0011] A test module, used to execute the automatic execution script to test each page to be tested, and read the program running data of the system to be tested during the test;

[0012] The test statistics module is used to calculate the user interface test coverage based on the program running data and the call relationship diagram of all codes of the system to be tested.

[0013] In a third aspect, an embodiment of the present invention further provides a server, the server comprising:

[0014] one or more processors;

[0015] A memory for storing one or more programs;

[0016] When the one or more programs are executed by the one or more processors, the one or more processors implement the user interface testing method provided by any embodiment of the present invention.

[0017] In a fourth aspect, an embodiment of the present invention further provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements a user interface testing method as provided in any embodiment of the present invention.

[0018] The embodiments of the above invention have the following advantages or beneficial effects:

[0019] The embodiment of the present invention first records and obtains the manual test operation data of each front-end page to be tested in the system to be tested, and parses the operation data to generate an automatic execution script; then, executes the automatic execution script to test each page to be tested, and reads the program running data of the system to be tested during the test; calculates the user interface test coverage based on the call relationship diagram between the program running data and all the codes of the system to be tested; solves the problems of low efficiency and low input-output ratio of developing test scripts for user interface testing, realizes a complete user interface automated testing process from test script generation, automated testing to test result measurement, improves the efficiency and input-output ratio of user interface automated testing, and improves test stability. BRIEF DESCRIPTION OF THE DRAWINGS

[0020] Figure 1 is a flow chart of a user interface testing method provided by Embodiment 1 of the present invention;

[0021] Figure 2 This is a schematic diagram of the code calling relationship provided by the first embodiment of the present invention;

[0022] Figure 3 is a flow chart of a user interface testing method provided by Embodiment 2 of the present invention;

[0023] Figure 4 is a structural schematic diagram of a user interface testing device provided in Embodiment 3 of the present invention;

[0024] Figure 5 It is a structural diagram of a server provided in Embodiment 4 of the present invention. DETAILED DESCRIPTION

[0025] The present invention will be further described in detail below in conjunction with the accompanying drawings and embodiments. It is to be understood that the specific embodiments described herein are only used to explain the present invention, rather than to limit the present invention. It should also be noted that, for ease of description, only parts related to the present invention, rather than all structures, are shown in the accompanying drawings.

[0026] Embodiment 1

[0027] Figure 1 This is a flowchart of a user interface testing method provided in Embodiment 1 of the present invention. This embodiment can be applied to the case of automatic user interface testing during program development. The method can be executed by a user interface testing device, which can be implemented by software and / or hardware and integrated into an electronic device with application development function.

[0028] like Figure 1 As shown, the user interface testing method includes the following steps:

[0029] S110, obtaining manual test operation data of each page to be tested in the system to be tested, and parsing the operation data to generate an automatic execution script.

[0030] Among them, the manual test operation data of the page to be tested is the data of manual operations on the front-end page of the system to be tested. The program tester or other user first traverses the page elements of the page to be tested, and then converts the operation process into an automatic test script to automatically generate an automatic execution script for the page to be tested.

[0031] Specifically, the manual test operation data of each page to be tested can be obtained through the page operation monitoring agent plug-in. The page operation monitoring agent and the system to be tested are run in the same life cycle, and the data of the manual test operation is recorded and sent to the server for system testing to generate an automatic execution script. In the process of generating the automatic execution script, firstly, the corresponding operation event test script is matched in the preset script library for each operation event in the manual test data, and then the test script is saved according to the preset data structure and format to obtain the final automatic execution script, wherein the automatic execution script includes the page element automatic execution script and the interface test automatic execution script. That is, for the operation of the front-end user interface, it can be recorded into multiple scripts, that is, the automatic execution script of the user interface element, and one operation event corresponds to one or more automatic scripts of the user interface element. For the http or https request (XMLHttpReques) of the front-end user interface element and the back-end engineering interaction, it can be recorded into multiple interface automatic test scripts. One operation event corresponds to one or more http interface test scripts; the interface test script can be used as a supplement when the page element automatic execution script of the user interface element involved in the corresponding http or https request event is unstable.

[0032] Furthermore, the file format definition of the automatic execution script may include the file name and command set, and the command set includes information such as command, target, value and targets. Among them, command represents the operation event such as click, select and input type; target represents the operation element, such as id = bgDiv,"xpath = / / *[@id = \"content\"] / div / div / div / div (exemplary representation of the search path of the operation element); targets represent other positioning methods of the operation element, that is, other search paths.

[0033] S120, executing the automatic execution script to test each of the pages to be tested, and reading the program running data of the system to be tested during the test.

[0034] In the process of user interface testing, based on the page driver (web driver) and the script parser, the automatic execution script is executed to test the page to be tested, including locating the operation element (target) in the automatic execution script, sending the operation instruction (command) of the operation event to the server to enable the system to be tested to perform the corresponding operation. If the operation element positioning times out, the information in the operation element positioning path list (targets) will be further parsed until the parameter value of one of the operation element positioning paths and the positioning method of the operation path corresponding to the operation are input, etc.

[0035] At the same time, in this embodiment, the program running data of the system to be tested during the test process is collected through a proxy or aspect method based on the spring framework, wherein the program running data includes the program running log of the system to be tested, and the program running log includes the name of the tested function, the calling method, the input parameters and the output parameters.

[0036] S130: Calculate user interface test coverage based on the program running data and a call relationship graph of all codes of the system to be tested.

[0037] Based on the obtained program running data, the call chain of the entire tested function code can be obtained, that is, a directed call relationship graph. Exemplarily, the directed relationship graph data structure is as follows: Figure 2 As shown in the figure, the function name is used as the node, and the parameter transfer between two functions with a calling relationship is used as the connection between the two nodes. In two connected nodes, the output parameter of the upstream node is the input parameter of the downstream node. Figure 2 In the example, the output parameters of node 1 are passed to node 2 and node 3 respectively as the input parameters of node 2 and node 3, and the output parameters of node 3 are passed to node 4 as the input parameters of node 4.

[0038] Furthermore, the directed relationship graph of the tested function is matched with the directed relationship graph of all the functions to be tested acquired in advance, and the matching rate is used as the test coverage rate. The directed relationship graph of all the functions to be tested can be a grammatical relationship graph determined by static analysis of all the codes to be tested.

[0039] The technical solution of the present embodiment is to first record and obtain the manual test operation data of each front-end page to be tested in the system to be tested, and parse the operation data to generate an automatic execution script; then, execute the automatic execution script to test each page to be tested, and read the program running data of the system to be tested during the test; calculate the user interface test coverage based on the call relationship diagram between the program running data and all the codes of the system to be tested; solve the problems of low efficiency and low input-output ratio of user interface testing in developing test scripts, realize a complete user interface automated testing process from test script generation, automated testing to test result measurement, improve the efficiency and input-output ratio of user interface automated testing, and compared with the possibility of errors in manually developed test codes, the method of the present embodiment has better test stability in user interface testing.

[0040] Embodiment 2

[0041] Figure 3This is a flowchart of a user interface testing method provided in the second embodiment of the present invention. This embodiment can be applied to the process of automatically testing the user interface and obtaining the test coverage during the program development process, and further obtaining the call relationship diagram of all programs to be tested, which belongs to the same inventive concept as the user interface testing method in the above embodiment. The method can be executed by a user interface testing device, which can be implemented by software and / or hardware and integrated in a server device with application development function.

[0042] like Figure 3 As shown, the user interface testing method includes the following steps:

[0043] S210, acquiring and analyzing all codes of the system to be tested, and generating a call relationship graph of all codes.

[0044] In this embodiment, for all the codes to be tested, the call relationship graph of all the codes is obtained by statically analyzing the code relationship. First, the class files in all the codes are lexically analyzed to generate an abstract syntax tree of the entire code, and then the abstract syntax tree is parsed to determine the call relationship between various types of files, and the call relationship graph of the entire code is generated based on the call relationship. For example, the call relationship between code classes is stored in the form of a multi-linked list, and finally the multi-linked list is parsed to obtain a directed graph of code call relationships. Alternatively, the abstract syntax tree can be browsed through the tool AST (Abstract Syntax Tree, AST) View to determine the call relationship graph of the entire code.

[0045] In a preferred embodiment, since code modification is a relatively common occurrence during the code testing phase, the update status of all codes can be checked regularly; if there are updates in all codes, the call relationship graph of all codes is updated accordingly, so that the test coverage can be accurately calculated in the subsequent testing process.

[0046] S220: Obtain manual test operation data of each page to be tested in the system to be tested, and parse the operation data to generate an automatic execution script.

[0047] S230, executing the automatic execution script to test each of the pages to be tested, and reading the program running data of the system to be tested during the test.

[0048] S240: Calculate user interface test coverage based on the program running data and a call relationship graph of all codes of the system to be tested.

[0049] When the amount of testable code in a test script is too large, the amount of program running data is large, the directed call graph of the tested code is large, and the test script may miss some operation event tests. The nodes in the directed call graph of the tested code are not completely consistent with the nodes in the directed graph of the entire code. Ultimately, the directed call graph of the tested code may not be matched in the call graph of the entire code, affecting the calculation of test coverage. In this case, the directed call graph of the tested code can be trimmed, and the tested code call graph can be trimmed into multiple tested code call graph subgraphs according to the distribution of nodes and node branches in the tested code call graph, and divided into multiple call graph subgraphs. Multiple tested code call graph subgraphs are matched with the call graph of the entire code of the system to be tested to determine the final user interface test coverage.

[0050] Preferably, when matching the call relationship graph, a test coverage flag can be set for each node in the call relationship graph of the entire code. When the nodes in the two matching relationship graphs are successfully matched once, the test coverage flag bit value is accumulated by 1. Finally, the node coverage flag bit values ​​of the nodes in the call relationship graph of the entire code can be sorted, and the nodes with a test coverage flag bit value of 0 can be filtered out. Thus, the uncovered method nodes can be prompted. Compared with the test coverage calculation method that determines how many lines of code are not executed, the calculation method in this embodiment can more intuitively determine the untested operation events.

[0051] The technical solution of this embodiment is to statically analyze the call relationship graph of all the codes to be tested in advance, then record and obtain the manual test operation data of each front-end page to be tested in the system to be tested, and parse the operation data to generate an automatic execution script; then, execute the automatic execution script to test each page to be tested, and read the program running data of the system to be tested during the test; calculate the user interface test coverage based on the program running data and the call relationship graph of all the codes of the system to be tested; solve the problem of low efficiency and low input-output ratio of developing test scripts for user interface testing, and realize a complete user interface automated testing process from test script generation, automated testing to test result measurement, improve the efficiency and input-output ratio of user interface automated testing, and make the test more stable. It can explicitly determine untested operation events or system functions.

[0052] The following is an embodiment of a user interface testing device provided by an embodiment of the present invention. The device and the user interface testing methods of the above embodiments belong to the same inventive concept and can implement the user interface testing methods of the above embodiments. For details not described in detail in the embodiment of the user interface testing device, reference can be made to the embodiment of the above user interface testing method.

[0053] Embodiment 3

[0054] Figure 4 This is a schematic diagram of the structure of a user interface testing device provided in Embodiment 3 of the present invention. This embodiment can be applied to automatically test the user interface and obtain test coverage during program development.

[0055] like Figure 4 As shown, the user interface testing apparatus includes a test script generating module 310 , a testing module 320 and a test statistics module 330 .

[0056] Among them, the test script generation module 310 is used to obtain the manual test operation data of each page to be tested in the system to be tested, and parse the operation data to generate an automatic execution script; the test module 320 is used to execute the automatic execution script to test each page to be tested, and read the program running data of the system to be tested during the test; the test statistics module 330 is used to calculate the user interface test coverage based on the call relationship diagram of the program running data and all the codes of the system to be tested.

[0057] The technical solution of this embodiment is to first record and obtain the manual test operation data of each front-end page to be tested in the system to be tested, and parse the operation data to generate an automatic execution script; then, execute the automatic execution script to test each page to be tested, and read the program running data of the system to be tested during the test; calculate the user interface test coverage based on the call relationship diagram between the program running data and the entire code of the system to be tested; solve the problems of low efficiency in developing test scripts for user interface testing and low input-output ratio of the test, and realize a complete user interface automated testing process from test script generation, automated testing to test result measurement, thereby improving the efficiency and input-output ratio of user interface automated testing and achieving better test stability.

[0058] Optionally, the test script generating module 310 is specifically used for:

[0059] Obtaining the manual test operation data of each to-be-tested page through a page operation monitoring agent plug-in;

[0060] A corresponding test script is matched for each operation event in the manual test data, and the test script is saved according to a preset data structure and format to obtain the automatic execution script, wherein the automatic execution script includes a page element automatic execution script and an interface test automatic execution script.

[0061] Optionally, the testing module 320 is specifically used for:

[0062] Based on the page driver and the script parser, the automatic execution script is executed to test the page to be tested;

[0063] The program running data of the system to be tested is collected during the test process by means of an agent or a section, wherein the program running data includes the program running log of the system to be tested.

[0064] Optionally, the test statistics module 330 is specifically used for:

[0065] According to the program running log, determine the name of the function called and executed during the test process, and the parameter transfer relationship of the called function;

[0066] Based on the function name and the parameter transfer relationship, generate a tested code call relationship graph;

[0067] The call relationship graph of the tested code is matched with the call relationship graph of all codes of the system to be tested to determine the user interface test coverage.

[0068] Optionally, the test statistics module 330 is further used for:

[0069] The function name is used as a node, and the parameter transfer relationship is used as a connection relationship between two associated nodes to generate a directed tested code call relationship graph.

[0070] Optionally, the user interface testing device further includes a call relationship clipping module:

[0071] Used to cut the tested code call relationship graph into multiple tested code call relationship graph subgraphs according to the distribution of nodes and node branches in the tested code call relationship graph;

[0072] The multiple tested code call relationship graph subgraphs are matched with the call relationship graph of all codes of the system to be tested to determine the user interface test coverage.

[0073] Optionally, the user interface testing device further comprises a complete code call relationship diagram prefabrication module, which is used to obtain and analyze all the codes of the system to be tested and generate a call relationship diagram of the entire code before testing the page to be tested.

[0074] Optionally, the complete code call relationship graph prefabricated module is specifically used for:

[0075] Performing lexical analysis on the class files in the entire code to generate an abstract syntax tree of the entire code;

[0076] Parsing the abstract syntax tree to determine the calling relationship between various files;

[0077] A calling relationship graph of the entire code is generated based on the calling relationship.

[0078] Optionally, the user interface testing device further comprises a relationship diagram updating module, which is used to periodically detect the update status of all the codes;

[0079] When all the codes are updated, the call relationship graph of the all the codes is updated.

[0080] The user interface testing device provided in the embodiment of the present invention can execute the user interface testing method provided in any embodiment of the present invention, and has the corresponding functional modules and beneficial effects of the execution method.

[0081] Embodiment 4

[0082] Figure 5 A schematic diagram of the structure of a server provided in Embodiment 4 of the present invention. Figure 5 A block diagram of an exemplary server 12 suitable for use in implementing embodiments of the present invention is shown. Figure 5 The server 12 shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present invention. The server 12 can be any terminal device with computing capabilities, such as an intelligent controller and server, a mobile phone and other terminal devices.

[0083] like Figure 5 As shown, the server 12 is in the form of a general purpose computing device. The components of the server 12 may include, but are not limited to: one or more processors or processing units 16, a system memory 28, and a bus 18 that connects various system components (including the system memory 28 and the processing unit 16).

[0084] Bus 18 represents one or more of several types of bus structures, including a memory bus or memory controller, a peripheral bus, an accelerated graphics port, a processor or a local bus using any of a variety of bus architectures. By way of example, these architectures include, but are not limited to, an Industry Standard Architecture (ISA) bus, a Micro Channel Architecture (MAC) bus, an Enhanced ISA bus, a Video Electronics Standards Association (VESA) local bus, and a Peripheral Component Interconnect (PCI) bus.

[0085] The server 12 typically includes a variety of computer system readable media. These media can be any available media that can be accessed by the server 12, including volatile and non-volatile media, removable and non-removable media.

[0086] The system memory 28 may include computer system readable media in the form of volatile memory, such as random access memory (RAM) 30 and / or cache memory 32. The server 12 may further include other removable / non-removable, volatile / non-volatile computer system storage media. By way of example only, the storage system 34 may be used to read and write non-removable, non-volatile magnetic media ( Figure 5 not shown, usually called a "hard drive"). Although Figure 5 Not shown in the figure, a disk drive for reading and writing to a removable non-volatile disk (e.g., a "floppy disk"), and an optical disk drive for reading and writing to a removable non-volatile optical disk (e.g., a CD-ROM, a DVD-ROM, or other optical media) may be provided. In these cases, each drive may be connected to the bus 18 via one or more data medium interfaces. The system memory 28 may include at least one program product having a set (e.g., at least one) of program modules that are configured to perform the functions of the various embodiments of the present invention.

[0087] A program / utility 40 having a set (at least one) of program modules 42 may be stored, for example, in system memory 28, such program modules 42 including, but not limited to, an operating system, one or more application programs, other program modules, and program data, each of which or some combination may include an implementation of a network environment. Program modules 42 generally perform the functions and / or methods of the embodiments described herein.

[0088] The server 12 may also communicate with one or more external devices 14 (e.g., keyboards, pointing devices, displays 24, etc.), one or more devices that enable a user to interact with the server 12, and / or any device that enables the server 12 to communicate with one or more other computing devices (e.g., a network card, a modem, etc.). Such communication may be performed via an input / output (I / O) interface 22. Furthermore, the server 12 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 20. As shown, the network adapter 20 communicates with the other modules of the server 12 via the bus 18. It should be understood that although Figure 5 Not shown, other hardware and / or software modules may be used in conjunction with server 12, including but not limited to microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.

[0089] The processing unit 16 executes various functional applications and data processing by running the program stored in the system memory 28, for example, implementing a user interface testing method provided by the embodiment of the present invention, the method comprising:

[0090] Obtaining manual test operation data of each page to be tested in the system to be tested, and parsing the operation data to generate an automatic execution script;

[0091] Executing the automatic execution script to test each of the pages to be tested, and reading the program running data of the system to be tested during the test;

[0092] The user interface test coverage is calculated based on the call relationship graph between the program running data and all codes of the system to be tested.

[0093] Embodiment 5

[0094] The fifth embodiment provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the user interface testing method provided in any embodiment of the present invention is implemented, including:

[0095] Obtaining manual test operation data of each page to be tested in the system to be tested, and parsing the operation data to generate an automatic execution script;

[0096] Executing the automatic execution script to test each of the pages to be tested, and reading the program running data of the system to be tested during the test;

[0097] The user interface test coverage is calculated based on the call relationship graph between the program running data and all codes of the system to be tested.

[0098] The computer storage medium of the embodiment of the present invention can adopt any combination of one or more computer-readable media. The computer-readable medium can be a computer-readable signal medium or a computer-readable storage medium. The computer-readable storage medium can be, for example, but not limited to: an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of computer-readable storage media include: an electrical connection with one or more wires, a portable computer disk, 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 disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In this document, a computer-readable storage medium can be any tangible medium containing or storing a program, which can be used by an instruction execution system, device or device or used in combination with it.

[0099] Computer-readable signal media may include data signals propagated in baseband or as part of a carrier wave, which carry computer-readable program code. Such propagated data signals may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than a computer-readable storage medium, which may send, propagate, or transmit a program for use by or in conjunction with an instruction execution system, apparatus, or device.

[0100] The program code embodied on the computer readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.

[0101] Computer program code for performing the operation of the present invention may be written in one or more programming languages ​​or a combination thereof, including object-oriented programming languages ​​such as Java, Smalltalk, C++, and conventional procedural programming languages ​​such as "C" or similar programming languages. The program code may be executed entirely on the user's computer, partially on the user's computer, as a separate software package, partially on the user's computer and partially on a remote computer, or entirely on a remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computer (e.g., via the Internet using an Internet service provider).

[0102] It should be understood by those skilled in the art that the modules or steps of the present invention described above can be implemented by a general-purpose computing device, they can be concentrated on a single computing device, or distributed on a network composed of multiple computing devices, optionally, they can be implemented by a program code executable by a computer device, so that they can be stored in a storage device and executed by the computing device, or they can be made into individual integrated circuit modules, or multiple modules or steps therein can be made into a single integrated circuit module for implementation. Thus, the present invention is not limited to any specific combination of hardware and software.

[0103] Note that the above are only preferred embodiments of the present invention and the technical principles used. Those skilled in the art will understand that the present invention is not limited to the specific embodiments described herein, and that various obvious changes, readjustments and substitutions can be made by those skilled in the art without departing from the scope of protection of the present invention. Therefore, although the present invention has been described in more detail through the above embodiments, the present invention is not limited to the above embodiments, and may include more other equivalent embodiments without departing from the concept of the present invention, and the scope of the present invention is determined by the scope of the appended claims.

Claims

1. A user interface testing method, characterized in that: include: Obtaining manual test operation data of each page to be tested in the system to be tested, and parsing the operation data to generate an automatic execution script; Executing the automatic execution script to test each of the pages to be tested, and reading the program running data of the system to be tested during the test; Based on the program running data, the call chain of the entire tested function code is obtained to obtain a directed call relationship graph, and the directed call relationship graph of the tested function code is matched with the directed relationship graphs of all the functions to be tested to obtain a matching rate, and the matching rate is used as the user interface test coverage rate; Among them, in the process of matching the directed call relationship graph of the function code to be tested with the directed relationship graphs of all functions to be tested to obtain the matching rate, according to the distribution of nodes and node branches in the directed call relationship graph of the function code to be tested, the directed call relationship graph of the function code to be tested is trimmed into multiple call relationship graph sub-graphs, and the multiple call relationship graph sub-graphs are matched with the directed relationship graphs of all functions to be tested to obtain the matching rate.

2. The method according to claim 1, characterized in that The step of obtaining manual test operation data of each page to be tested in the system to be tested, and parsing the operation data to generate an automatic execution script includes: Obtaining the manual test operation data of each to-be-tested page through a page operation monitoring agent plug-in; A corresponding test script is matched for each operation event in the manual test operation data, and the test script is saved according to a preset data structure and format to obtain the automatic execution script, wherein the automatic execution script includes a page element automatic execution script and an interface test automatic execution script.

3. The method according to claim 1, characterized in that The executing the automatic execution script to test each of the pages to be tested, and reading the program running data of the system to be tested during the test, includes: Based on the page driver and the script parser, the automatic execution script is executed to test the page to be tested; The program running data of the system to be tested is collected during the test process by means of an agent or a section, wherein the program running data includes the program running log of the system to be tested.

4. The method according to claim 3, characterized in that The calculating the user interface test coverage based on the calling relationship graph of the program running data and all codes of the system to be tested includes: According to the program running log, determine the function name that is called and executed during the test process, and the parameter transfer relationship of the called function; Based on the function name and the parameter transfer relationship, generate a tested code call relationship graph; The call relationship graph of the tested code is matched with the call relationship graph of all codes of the system to be tested to determine the user interface test coverage.

5. The method according to claim 4, characterized in that The generating a tested code call relationship graph based on the function name and the parameter transfer relationship includes: The function name is used as a node, and the parameter transfer relationship is used as a connection relationship between two associated nodes to generate a directed tested code call relationship graph.

6. The method according to any one of claims 1 to 5, characterized in that: Before testing the page to be tested, the method further includes: Acquire and analyze all codes of the system to be tested, and generate a call relationship graph of all codes.

7. The method according to claim 1, characterized in that Acquire and analyze all codes of the system to be tested, and generate a call relationship graph of all codes, including: Performing lexical analysis on the class files in the entire code to generate an abstract syntax tree of the entire code; Parsing the abstract syntax tree to determine the calling relationship between various files; A calling relationship graph of the entire code is generated based on the calling relationship.

8. The method according to claim 1, characterized in that The method further comprises: Regularly check the update status of all codes; When all the codes are updated, the call relationship graph of the all the codes is updated.

9. A user interface testing device, characterized in that: include: A test script generation module is used to obtain manual test operation data of each page to be tested in the system to be tested, and parse the operation data to generate an automatic execution script; A test module, used to execute the automatic execution script to test each page to be tested, and read the program running data of the system to be tested during the test; A test statistics module is used to obtain the call chain of the entire tested function code based on the program running data, obtain a directed call relationship graph, and match the directed call relationship graph of the tested function code with the directed relationship graphs of all functions to be tested to obtain a matching rate, and use the matching rate as the user interface test coverage; wherein, in the process of matching the directed call relationship graph of the tested function code with the directed relationship graphs of all functions to be tested to obtain the matching rate, according to the distribution of nodes and node branches in the directed call relationship graph of the tested function code, the directed call relationship graph of the tested function code is cut into multiple call relationship graph sub-graphs, and the multiple call relationship graph sub-graphs are matched with the directed relationship graphs of all functions to be tested to obtain the matching rate.

10. A server, characterized in that: The server comprises: one or more processors; A memory for storing one or more programs; When the one or more programs are executed by the one or more processors, the one or more processors implement the user interface testing method as described in any one of claims 1-8.

11. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the user interface testing method as described in any one of claims 1 to 8 is implemented.

Citation Information

Patent Citations

  • Automatic test case development system and method based on web

    CN106547689A

  • Code coverage rate testing method and device, electronic equipment and storage medium

    CN111104319A