Graphical User Interface Testing Method and Device

By obtaining and generating test cases, using Java control library to identify and simulate operations in the graphical user interface, the problem of inaccuracy and efficiency in graphical user interface testing is solved, and efficient and accurate automated testing is achieved.

CN113127332BActive Publication Date: 2025-07-11ZTE CORP
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN201911419832.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2019-12-31
Publication Date
2025-07-11
Estimated Expiration
2039-12-31

AI Technical Summary

Technical Problem

In the prior art, efficient and accurate testing cannot be achieved during the testing process of graphical user interfaces, especially under the influence of environmental information such as picture pixels, the test accuracy and timeliness are not high, and the natural language description test case conversion process increases operation and maintenance costs.

Method used

By obtaining the first control of the test object as the object control, generating test cases, and identifying and simulating the operation of the second control in the graphical user interface, using the Java control library for automated testing, embed testing tools to achieve efficient and accurate testing.

Benefits of technology

It realizes the simplification of the test process without changing the original graphical user interface operation process, improves the testing efficiency and quality, reduces the testing cost, and visualizes the test results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113127332B_ABST
    Figure CN113127332B_ABST
Patent Text Reader

Abstract

The present invention provides a method and apparatus for testing a graphical user interface. The method includes: obtaining one or more test cases, where the test cases are used to indicate object controls, and the object controls are the first controls used during the execution of the test object; executing the test object and the test cases, and testing a second control included in the graphical user interface of the test object according to the test cases. By means of the present invention, the problem in the related art that an efficient and accurate test cannot be achieved during the graphical user interface test can be solved, so as to achieve the effect of performing an efficient and accurate graphical user interface test.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer software, and in particular, to a graphical user interface testing method and apparatus. Background Art

[0002] Graphical User Interface (GUI) automated testing is a testing method that simulates manual operations on the interface of software to verify system functions. In related technologies, in the process of implementing GUI automated testing, the following methods can be adopted: reading test cases in Excel, converting the test cases into execution steps, and then comparing whether the current result is consistent with the expected result; in the above test process, both the current result and the expected result are compared based on the generated images; during the execution process, affected by environmental information such as picture pixels, the accuracy and timeliness in the test process are not high, which is not conducive to automated testing. Or, generating test cases through a natural description language element library, converting the test cases into test scripts during execution, and sending them to each test node for testing; in the above test method, both the test cases and the test scripts are described in natural language. In the development process, it needs to go through a conversion chain consisting of steps such as language library -> test cases -> test scripts -> test execution. If an error occurs during the conversion process, it will significantly increase the test and operation and maintenance costs.

[0003] Regarding the problem that high-efficiency and accurate testing cannot be achieved during the graphical user interface testing process in the above related technologies, no effective solution has been proposed in related technologies. Summary of the Invention

[0004] Embodiments of the present invention provide a graphical user interface testing method and apparatus to at least solve the problem that high-efficiency and accurate testing cannot be achieved during the graphical user interface testing process in related technologies.

[0005] According to an embodiment of the present invention, a graphical user interface testing method is provided, including:

[0006] Obtaining one or more test cases; wherein, the test cases are used to indicate object controls, and the object controls are the first controls used during the execution of the test object;

[0007] Executing the test object and the test cases, and testing a second control included in the graphical user interface of the test object according to the test cases.

[0008] According to another embodiment of the present invention, a graphical user interface testing apparatus is further provided, including:

[0009] An acquisition module, configured to acquire one or more test cases; wherein, the test cases are used to indicate object controls, and the object controls are the first controls used during the execution of the test object.

[0010] An execution module, configured to execute the test object and the test cases, and test a second control included in the graphical user interface of the test object according to the test cases.

[0011] According to another embodiment of the present invention, there is also provided a computer-readable storage medium, in which a computer program is stored, and wherein the computer program is configured to execute the steps in any one of the above method embodiments when running.

[0012] According to another embodiment of the present invention, there is also provided an electronic device, including a memory and a processor, wherein a computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0013] Through the present invention, since test cases for indicating object controls that are the first controls used during the execution of the test object can be acquired to execute the test object and the test cases, and the second control included in the graphical user interface of the test object is tested according to the test cases during the execution process. Therefore, the present invention can solve the problem that efficient and accurate testing cannot be achieved during the graphical user interface testing in the related art, so as to achieve the effect of performing efficient and accurate graphical user interface testing. Description of the Drawings

[0014] The drawings described herein are used to provide a further understanding of the present invention, and constitute a part of this application. The schematic embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute an improper limitation to the present invention. In the drawings:

[0015] Figure 1 is a flowchart of a graphical user interface testing method provided according to an embodiment of the present invention;

[0016] Figure 2 is an execution flowchart of a test tool provided according to a specific embodiment of the present invention;

[0017] Figure 3 is an execution flowchart of a test case provided according to a specific embodiment of the present invention;

[0018] Figure 4 is a schematic diagram of a button control in a graphical user interface provided according to a specific embodiment of the present invention;

[0019] Figure 5 is a schematic diagram of a test case provided according to a specific embodiment of the present invention;

[0020] Figure 6 It is a structural block diagram of a graphical user interface testing device provided according to an embodiment of the present invention. Detailed implementation manners

[0021] The present invention will be described in detail below with reference to the accompanying drawings and in conjunction with embodiments. It should be noted that, without conflict, the embodiments in the present application and the features in the embodiments may be combined with each other.

[0022] It should be noted that the terms "first", "second", etc. in the description and claims of the present invention and the above-mentioned drawings are used to distinguish similar objects, and do not have to be used to describe a specific order or sequence.

[0023] Embodiment 1

[0024] This embodiment provides a graphical user interface testing method. Figure 1 It is a flowchart of the graphical user interface testing method provided according to an embodiment of the present invention. As Figure 1 shown, the graphical user interface testing method in this embodiment includes:

[0025] S102, obtaining one or more test cases; wherein, the test case is used to indicate an object control, and the object control is the first control used in the execution of the test object;

[0026] S104, executing the test object and the test case, and testing the second control included in the graphical user interface of the test object according to the test case.

[0027] It should be further noted that in the above embodiment, the test case is used to indicate the object control, that is, the corresponding test case is expressed or generated through the object control. The object control is specifically the first control used in the execution of the test object.

[0028] For the first control, the first control is the control required for the execution of the test object during testing, and the first control can be one or more; correspondingly, the above-mentioned second control is the control included in the graphical user interface of the test object in each process, and the second control can be one or more; the first control can be the same as or different from the second control.

[0029] It should be further noted that the control in this embodiment can be a Java control. Correspondingly, the graphical user interface testing method in this embodiment can also be developed in the Java language to be compatible with multiple operating systems, and then the graphical user interface testing can be deployed on different types of systems.

[0030] Through the graphical user interface testing method in this embodiment, since test cases for an object control that indicates the first control used during the execution of the test object can be obtained to execute the test object and the test cases, and during the execution, the second control included in the graphical user interface of the test object is tested according to the test cases. Therefore, the graphical user interface testing method in this embodiment can solve the problem in the related art that it is impossible to achieve efficient and accurate testing during the graphical user interface testing process, so as to achieve the effect of performing efficient and accurate graphical user interface testing.

[0031] Specifically, during the testing process of the graphical user interface testing method in the above embodiment, the second control included in the graphical user interface of the test object can be tested through test cases. Since the test cases are used to indicate the object control, according to the object control corresponding to the test cases, the second control included in the graphical user interface can be tested in the graphical user interface of the test object. Therefore, the graphical user interface testing method in the above embodiment can embed the main entry of the test object in the test tool for implementing the above graphical user interface testing method without changing the original graphical user interface operation process of the test object to perform automated testing.

[0032] Through the graphical user interface testing method in this embodiment, automatic testing of the test object can be performed based on automatically generated test cases, thereby achieving effects such as simple operation, strong usability, simplified testing process, and visualization of test results, effectively saving the testing cost during the testing process, and improving the testing efficiency and quality of the product.

[0033] In an alternative embodiment, before obtaining one or more test cases in the above step S102, it includes:

[0034] Execute the test object;

[0035] Monitor the first control used during the execution of the test object to use the first control as the object control.

[0036] In an alternative embodiment, obtaining one or more test cases in the above step S102 includes:

[0037] Convert the object control into test cases to obtain one or more test cases.

[0038] It should be further noted that during the testing of the test object, if there are available test cases in the local directory of the test tool, the test will start directly. If there are no test cases in the local directory, the technical solutions described in the above optional embodiments can be used to complete an execution operation in the graphical user interface of the test object manually or through a preset process, and during the execution process, through the control recognition module, monitor each control, input parameters, execution sequence information, etc. used during the execution. The above controls, input parameters, and execution sequence information together constitute the first control.

[0039] Specifically, the above first control may include any control involved in the execution of the test object. For example, the above first control may include: button, radio, checkbox, combobox, ip address, mac address, list, table, text, tree, popmenu, tab, file chooser, close window, mouse click, verifycode, delay, and so on. Saving the above first control can obtain the object control.

[0040] Based on obtaining the object control, the content involved in the object control can be automatically converted into a test case, that is, generating a corresponding test case according to the object control, and the test case can be saved in the local directory in the form of an xml file.

[0041] It should be further noted that in the above optional embodiment, converting the object control into a test case can be based on the original control library, such as the Java original control library, to associate the test case with the first control on the graphical user interface.

[0042] It should be further noted that before the execution of the above optional embodiment, a startup script can be written for the test tool used to execute the graphical user interface test method in this embodiment, and relevant parameters can be configured, such as the main entry method of the test object, input parameters, dependent jar files, test result storage directory, test case storage directory, etc.

[0043] In an optional embodiment, the testing of the second control included in the graphical user interface of the test object according to the test case in step S104 above includes:

[0044] Searching for the second control corresponding to the object control in the second control according to the object control corresponding to the test case;

[0045] In the case where the second control corresponding to the object control is found in the second control, simulate the operation of the second control according to the test case to test the second control.

[0046] It should be further noted that in the above optional embodiments, the process of testing the second control included in the graphical user interface of the test object according to the test case is to search for or identify the second control corresponding to the object control corresponding to the test case in the second control included in the image user interface of the test object, and the process of simulating the operation.

[0047] It should be further noted that to synchronize the test case with the test object, the corresponding test steps can also be generated in advance with reference to the execution flow of the test object according to the test case.

[0048] In an optional embodiment, the above test case includes: control type information and control operation information;

[0049] Among them, the control type information is used to indicate the type of the object control, and the control operation information is used to indicate the operation of the object control.

[0050] In an optional embodiment, the above-mentioned searching for the second control corresponding to the object control in the second control according to the object control corresponding to the test case includes:

[0051] Search for the second control corresponding to the control type information in the second control according to the control type information in the test case.

[0052] In an optional embodiment, in the case where the second control corresponding to the object control is found in the second control, simulating the operation of the second control according to the test case includes:

[0053] In the case where the second control corresponding to the object control is found in the second control, simulate the operation of the second control according to the control operation information in the test case.

[0054] It should be further noted that in the above optional embodiments, in the second control included in the graphical user interface of the test object, according to the control type information in the test case, the second control corresponding to the control type information can be found through the set control recognition module, that is, to find whether there is a control corresponding to the object control indicated by the test case on the current graphical user interface. Specifically, the control type information can be identified by the type field of the control.

[0055] In the case where the second control corresponding to the object control is found, the operations on the second control can be further simulated in the test object according to the control operation information of the test case corresponding to the second control. For example, the confirmation of a button, the input of parameters into an input box, etc. In this way, the test of the second control in the graphical user interface of the test object can be realized.

[0056] In an alternative embodiment, the above-mentioned simulating the operations of the second control according to the test case to test the second control includes:

[0057] Obtain the execution result information of the operations of the test case simulating the second control, and test the second control according to the execution result information.

[0058] In an alternative embodiment, the above-mentioned testing the second control according to the execution result information includes:

[0059] In the case where the execution result information is consistent with the preset execution result of the second control, it is determined that the test of the second control is successful; or,

[0060] In the case where the execution result information is not consistent with the preset execution result of the second control, it is determined that the test of the second control fails.

[0061] It should be further noted that the above alternative embodiment is to compare the execution result information simulated according to the test case with the preset execution result of the second control to realize the test of the second control. The above-mentioned execution result information and the preset execution result of the second control can both be presented in the form of the content of the graphical user interface. Comparing the execution result information with the preset execution result of the second control is to compare whether the corresponding graphical user interface contents of the two are consistent.

[0062] Specifically, the comparison and determination can be performed through a preset test result determination module. If the current graphical user interface content meets the expectations, the next test process is continued. If the current graphical user interface content does not meet the expectations, the on-site information is automatically screen-captured and saved, and the failed test cases are recorded, and then the next test process is executed.

[0063] Further, after the test of the second control in the graphical user interface is completed, the test result can be saved; the test result can be saved in a file in html format or xml format.

[0064] In an alternative embodiment, the above-mentioned graphical user interface test method further includes:

[0065] Generate the thread to be tested and the test thread; wherein, the thread to be tested is used to execute the test object, and the test thread is used to execute the test case.

[0066] It should be further noted that in the graphical user interface testing method of this embodiment, the execution of the test object and the execution of the test cases can be synchronized in two different threads; specifically, the tested thread starts with the entry parameters of the test object as the scheduling parameters to execute the test object, and the test thread is used to execute or read the test cases; in this embodiment, the test thread can identify and simulate the second control in the graphical user interface of the test object through interaction with the tested thread, for example, wrapping the entry method of the test object into the test thread, and using inter-thread data synchronization and control recognition technologies, so as to implement the testing of the graphical user interface of the test object.

[0067] In an alternative embodiment, the graphical user interface testing method in the above embodiment further includes:

[0068] Generating an exception protection thread; wherein, the exception protection thread is used to save the test results of the second controls that have been tested in the test object in the case where the tested thread or the test thread exits abnormally.

[0069] It should be further noted that in the above alternative embodiment, through the generation of the exception protection thread, the set test report saving module can be started in time when the tested thread or the test thread exits abnormally to save the test results of the executed graphical user interface, thereby avoiding the test zeroing caused by the thread exit, so as to further improve the test efficiency.

[0070] To further illustrate the graphical user interface testing method in the above embodiment, the implementation of the above graphical user interface testing method will be described below by means of specific embodiments. Specific Embodiment 1

[0072] The test scenario in this specific embodiment is the automated installation process of network management software. During the installation process of network management software, a large number of professional parameters need to be filled in and different scenarios need to be selected. Therefore, the testing methods in the related technologies require a considerable operation cost for testing under the premise of professional support during the testing process.

[0073] This specific embodiment uses a test tool set with the graphical user interface testing method described in the above embodiment for testing, and embeds the test tool into the installation process of the network management software to simulate the artificial automated installation of the software without changing the original installation process, thereby realizing the testing process; Figure 2 is the execution flow chart of the test tool provided according to the specific embodiment of the present invention, Figure 3 is the execution flow chart of the test case provided according to the specific embodiment of the present invention, used to indicate Figure 2 the execution flow of a single test case during the execution of the test tool shown above. The testing process of the above test tool is asFigure 2 as shown in Figure 3 The specific operation steps are as follows:

[0074] S1. Identify the startup parameters, entry, and location of the network management software, write them into the configuration file, and you can choose to configure the test case directory and execution result directory (if not configured, select the default configuration directory).

[0075] S2. When it is found that there are no executable test cases in the test case directory with the default configuration after the test tool is started, prompt whether to automatically generate test cases. If selected, a test operation needs to be performed manually. Figure 4 FIG. is a schematic diagram of a button control in the graphical user interface provided by a specific embodiment of the present invention. In the above test operation, you can click the add button as shown in Figure 4 The test tool will obtain the control information of this operation according to the Java listening event and generate the following test cases:

[0076] <relate text="Add (A)"type="button">.

[0077] S3. Start the automated test software, read the configuration file, identify the object to be tested and test cases, simulate manual operations for the test cases for testing. If a mismatch scenario occurs, take a screenshot and save and record the information of the failed test cases, and then execute the next test case. If successful, execute the next test case until all test cases are executed, and output a test report. Specific Embodiment 2

[0079] The test scenario in this specific embodiment is the automated upgrade process of the network management software. During the upgrade process of the network management software, a large number of professional parameters need to be filled in and different scenarios need to be selected. Therefore, the test methods in the related technologies require a considerable operation cost for testing on the premise of professional support during the test process.

[0080] This specific embodiment uses a test tool set with the graphical user interface test method described in the above embodiment for testing, and embeds the test tool into the upgrade process of the network management software to simulate manual automated software installation without changing the original upgrade process, thereby realizing the test process; the test process of the above test tool is still as shown in Figure 2 as shown in Figure 3 The specific operation steps are as follows:

[0081] S1. Identify the startup parameters, entry, and location of the network management software upgrade, write them into the configuration file, and you can choose to configure the test case directory and execution result directory (if not configured, select the default configuration directory).

[0082] S2. Start the automated test software, read the configuration file, and identify the test objects and test cases to be tested; simulate manual operations through the test cases for testing. If a mismatch scenario occurs, take a screenshot and save it and record the information of the failed test case, then execute the next test case. If it is successful, execute the next test case until all test cases are executed, and output the test report.

[0083] For example, the above S2 Figure 5 is a schematic diagram of the test case provided according to the specific embodiment of the present invention. The execution process of the test case shown as Figure 5 is as follows:

[0084] 1) Execution of the delay control: When the control recognition module and the Java control library recognize that this operation is a delay control during the upgrade of the network management software, simulate the operation according to the test case and delay the operation for 1000 milliseconds. This test case is to prevent the GUI interface from loading with a delay, and each time it is executed, it delays for 1 second first.

[0085] 2) After the execution of the delay control is completed, read the second test case, identify that the control type is a combobox control, the index position is 0, and the selected item is 1; transfer the control information to the thread under test. The thread under test searches for the control in the current GUI interface according to the control index and control type. If it exists, perform the dropdown selection operation. If it does not exist, transfer the information that the control cannot be found to the exception protection thread, and the exception protection thread intercepts the current GUI interface information and records the test case information.

[0086] 3) After the execution of the combobox control is completed, read the next test case, identify that the control type is a button and the text is "Next Step"; the thread under test searches for the above button in the current GUI interface. If it does not exist, transfer the exception information to the exception protection thread and set the execution result of the previous test case to failed, and record the test case context information. If it exists, click the button, set the execution result of the previous test case to successful, and then click to loop whether the enable information of the button is unavailable (unavailable indicates that the execution has ended, and available indicates that it is still in execution) until the button is available or the GUI interface changes (some button executions will cause the GUI to change).

[0087] 4) After the button execution is completed, read the next test case, identify that the control type is checkbox and the text is "I accept the terms in the License Agreement", the selected option is true, and the tested thread searches for the above checkbox in the current GUI interface. If it does not exist, the exception information will be passed to the exception protection thread and the execution result of the previous test case will be set to fail, and the test case context information will be recorded. If it exists, the control selection value will be changed to true, and the execution result of the previous test case will be set to success.

[0088] Through the description of the above embodiments, those skilled in the art can clearly understand that the method according to the above embodiments can be implemented by means of software plus a necessary general hardware platform. Of course, it can also be implemented by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, can be embodied in the form of a software product. The computer software product is stored in a storage medium (such as ROM / RAM, magnetic disk, optical disk), and includes several instructions for causing a terminal device (which can be a mobile phone, computer, server, or network device, etc.) to execute the methods described in various embodiments of the present invention.

[0089] Embodiment 2

[0090] This embodiment provides a graphical user interface testing device, which is used to implement the above embodiments and preferred implementation manners, and those that have been described will not be repeated. As used below, the term "module" can be a combination of software and / or hardware that realizes a predetermined function. Although the device described in the following embodiments is preferably implemented in software, implementation in hardware, or a combination of software and hardware is also possible and contemplated.

[0091] Figure 6 is a structural block diagram of the graphical user interface testing device provided according to an embodiment of the present invention. As Figure 6 shown, the graphical user interface testing device in this embodiment includes:

[0092] An acquisition module 202, configured to acquire one or more test cases; wherein, the test case is used to indicate an object control, and the object control is the first control used in the execution of the test object;

[0093] A test module 204, configured to execute the test object and the test case, and test the second control included in the graphical user interface of the test object according to the test case.

[0094] It should be further noted that the remaining optional embodiments of the graphical user interface testing device recorded in this embodiment, that is, the device, correspond to the graphical user interface testing method recorded in Embodiment 1, so they will not be repeated here.

[0095] In an alternative embodiment, before obtaining one or more test cases, it includes:

[0096] Execute the test object;

[0097] Monitor the first control used during the execution of the test object to use the first control as the object control.

[0098] In an alternative embodiment, obtaining one or more test cases includes:

[0099] Convert the object control into test cases to obtain one or more test cases.

[0100] In an alternative embodiment, testing the second control included in the graphical user interface of the test object according to the test cases includes:

[0101] According to the object control corresponding to the test case, find the second control corresponding to the object control in the second control;

[0102] When the second control corresponding to the object control is found in the second control, simulate the operation of the second control according to the test case to test the second control.

[0103] In an alternative embodiment, the test case includes: control type information and control operation information;

[0104] Among them, the control type information is used to indicate the type of the object control, and the control operation information is used to indicate the operation of the object control.

[0105] In an alternative embodiment, according to the object control corresponding to the test case, to find the second control corresponding to the object control in the second control, it includes:

[0106] According to the control type information in the test case, find the second control corresponding to the control type information in the second control.

[0107] In an alternative embodiment, when the second control corresponding to the object control is found in the second control, simulating the operation of the second control according to the test case includes:

[0108] When the second control corresponding to the object control is found in the second control, simulate the operation of the second control according to the control operation information in the test case.

[0109] In an alternative embodiment, simulating the operation of the second control according to the test case to test the second control includes:

[0110] Obtain the execution result information of the operation of simulating the second control by the test case, and test the second control according to the execution result information.

[0111] In an alternative embodiment, testing the second control according to the execution result information includes:

[0112] Determining that the test of the second control is successful when the execution result information matches the preset execution result of the second control; or,

[0113] Determining that the test of the second control fails when the execution result information does not match the preset execution result of the second control.

[0114] In an alternative embodiment, the graphical user interface testing apparatus in the above embodiment is further configured to:

[0115] Generate a thread under test and a test thread; wherein, the thread under test is used to execute the test object, and the test thread is used to execute the test case.

[0116] In an alternative embodiment, the graphical user interface testing apparatus in the above embodiment is further configured to:

[0117] Generate an exception protection thread; wherein, the exception protection thread is used to save the test results of the second controls that have completed the test in the test object when the thread under test or the test thread exits abnormally.

[0118] It should be noted that the above-mentioned modules can be implemented by software or hardware. For the latter, it can be implemented in the following ways, but not limited thereto: the above-mentioned modules are all located in the same processor; or, the above-mentioned modules are separately located in different processors in any combination form.

[0119] Embodiment 3

[0120] An embodiment of the present invention further provides a computer-readable storage medium, in which a computer program is stored, and wherein the computer program is configured to execute the steps in any one of the above method embodiments when running.

[0121] Optionally, in this embodiment, the above computer-readable storage medium may be configured to store a computer program for executing the method steps described in the above embodiment:

[0122] Optionally, in this embodiment, the above computer-readable storage medium may include, but is not limited to: USB flash drive, read-only memory (ROM for short), random access memory (RAM for short), mobile hard disk, magnetic disk, or optical disc, etc., various media that can store computer programs.

[0123] Embodiment 4

[0124] An embodiment of the present invention further provides an electronic device, including a memory and a processor. A computer program is stored in the memory, and the processor is configured to run the computer program to execute the steps in any one of the above method embodiments.

[0125] Optionally, the above electronic device may further include a transmission device and an input / output device. Among them, the transmission device is connected to the above processor, and the input / output device is connected to the above processor.

[0126] Optionally, in this embodiment, the above processor may be configured to execute the method steps described in the above embodiment through a computer program.

[0127] Optionally, specific examples in this embodiment may refer to the examples described in the above embodiment and optional implementation manners, and will not be elaborated herein.

[0128] Obviously, those skilled in the art should understand that the above modules or steps of the present invention can be implemented by a general 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 program codes executable by the computing device, so that they can be stored in a storage device and executed by the computing device. And in some cases, the steps shown or described can be executed in a different order than here, or they can be separately fabricated into individual integrated circuit modules, or multiple modules or steps among them can be fabricated into a single integrated circuit module to implement. Thus, the present invention is not limited to any specific combination of hardware and software.

[0129] The above is only the preferred embodiment of the present invention and is not used to limit the present invention. For those skilled in the art, the present invention can have various changes and modifications. Any modification, equivalent replacement, improvement, etc. made within the principle of the present invention shall be included in the protection scope of the present invention.

Claims

1. A method for testing a graphical user interface, characterized in that Including: Execute the test object; Monitor the first control used during the execution of the test object, and use the first control as the object control; Convert the object control into test cases to obtain one or more test cases; wherein, the test cases are used to indicate the object control, and the object control is the first control used during the execution of the test object; Execute the test object and the test cases, and test the second control corresponding to the control type information in the graphical user interface of the test object according to the control type information in the test cases; wherein, the control type information is used to indicate the type of the object control.

2. The method according to claim 1, wherein The testing of the second control corresponding to the control type information in the graphical user interface of the test object according to the control type information in the test cases includes: Search for the second control corresponding to the object control in the second control according to the object control corresponding to the test case; When the second control corresponding to the object control is found in the second control, simulate the operation of the second control according to the test case to test the second control.

3. The method according to claim 2, wherein The test case further includes: control operation information; Wherein, the control operation information is used to indicate the operation of the object control.

4. The method according to claim 3, characterized in that, The searching for the second control corresponding to the object control in the second control according to the object control corresponding to the test case includes: Search for the second control corresponding to the control type information in the second control according to the control type information in the test case.

5. The method according to claim 3, wherein When the second control corresponding to the object control is found in the second control, the simulating the operation of the second control according to the test case includes: When the second control corresponding to the object control is found in the second control, simulate the operation of the second control according to the control operation information in the test case.

6. The method according to claim 2, wherein The simulating the operation of the second control according to the test case to test the second control includes: Obtain the execution result information of the operation of simulating the second control by the test case, and test the second control according to the execution result information.

7. The method according to claim 6, characterized in that The testing of the second control according to the execution result information includes: When the execution result information is consistent with the preset execution result of the second control, determine that the test of the second control is successful; or, When the execution result information is not consistent with the preset execution result of the second control, determine that the test of the second control fails.

8. The method according to any one of claims 1 to 7, characterized in that, The method further includes: Generate a thread to be tested and a test thread; wherein, the thread to be tested is used to execute the test object, and the test thread is used to execute the test cases.

9. The method according to claim 8, characterized in that, The method further includes: Generate an exception protection thread; wherein, the exception protection thread is used to save the test results of the second control that has been tested in the test object when the thread to be tested or the test thread exits abnormally.

10. A graphical user interface testing device, characterized in that, Including: An acquisition module, configured to execute a test object; Monitoring a first control used during the execution of the test object to use the first control as an object control; converting the object control into test cases to obtain one or more test cases; wherein the test cases are used to indicate the object control, and the object control is the first control used during the execution of the test object; A test module, configured to execute the test object and the test cases, and test a second control corresponding to the control type information in the second controls included in the graphical user interface of the test object according to the control type information in the test cases; wherein the control type information is used to indicate the type of the object control.

11. A computer-readable storage medium, characterized in that, A computer program is stored in the computer-readable storage medium, wherein the computer program is configured to execute the method described in any one of claims 1 to 9 when running.

12. An electronic device, comprising a memory and a processor, characterized in that, A computer program is stored in the memory, and the processor is configured to run the computer program to execute the method described in any one of claims 1 to 9.

Citation Information

Patent Citations

  • Memory bug application of application program

    CN102308285A

  • Application program test method, device and system

    CN104794050A