Methods for automated testing (robustness / functionality testing) of applications with a graphical user interface (GUI) using instrumentation of the underlying GUI frameworks / runtime environments
By instrumenting GUI frameworks to automatically generate and manipulate control elements, the challenges of manual test creation and suboptimal code coverage in existing GUI testing software are addressed, resulting in efficient and robust testing with high code coverage.
Patent Information
- Application Number
- DE102023004467
- Authority / Receiving Office
- DE · DE
- Patent Type
- Applications
- Current Assignee / Owner
- Filing Date
- 2023-11-07
- Publication Date
- 2025-05-08
AI Technical Summary
Existing GUI testing software requires manual creation of tests, leading to significant effort and suboptimal code coverage, while approaches that bypass the GUI can result in false error detection and inconsistent application states.
Instrumenting GUI frameworks to automatically generate and manipulate control elements based on their type and properties, enabling robustness and functional testing with optimized code coverage.
Automatically created tests can achieve high code coverage and robustness testing with minimal effort, ensuring that only valid input values are used and maintaining consistent application states.
Abstract
Description
State of the art
[0001] There is currently a wide variety of software for testing applications with graphical user interfaces (GUIs). These offer the option of recording and replaying interactions with the program under test, and they also allow the creation of textual / graphical specifications for how the test interactions should appear. A disadvantage of this approach is that these tests must be created entirely manually, which can be very time-consuming. Furthermore, this manual process usually does not result in optimal code coverage. More recent research approaches technically truncate the GUI and call the underlying functions directly to test their robustness (fuzzing). This also collects information about code coverage (which branches have already been taken in the program and which have not). This is made possible by instrumentation code.This can be implemented either directly by modern compilers or through other methods used in closed-source software. This makes it possible to obtain feedback on the test and, at the same time, achieve greater code coverage through targeted modification of the input data. A disadvantage of directly calling functions located behind the GUI is that, on the one hand, values that would otherwise be filtered by the controls are passed to the functions, which can lead to false positives (erroneously detected errors). On the other hand, the application state can become inconsistent if only individual functions of the application under test are called, bypassing the actual program logic. Structure of the invention
[0002] The invention instruments the underlying GUI frameworks or runtime environments to report the creation of new controls. The type of each created control and its properties (e.g., minimum / maximum of the selectable integer, etc.) can then be determined via the programming interface provided by the GUI framework / runtime environment. This makes it possible to automatically generate tests in which the created controls are manipulated either repeatedly in sequence or in a different order according to their type and properties (e.g., setting a value while maintaining a minimum / maximum, if applicable), or in which actions (mouse clicks, etc.) are triggered. This results in a so-called robustness test, since input data unforeseen by the programmer may lead to a crash.Additionally, conditions can be specified before starting the automated test (e.g., the value of control A equals the sum of control B and control C), resulting in a functional test. Furthermore, if the application under test is instrumented to report when new program paths are reached, the automated robustness / functional test can be optimized by manipulating the controls in a beneficial way, resulting in greater code coverage and thus a better test. Example
[0003] The invention was implemented using the Qt framework. For closed-source applications, a library necessary for further processing was integrated into the application under test using .dll hooking. If the application has source code available, a provided "dummy function" of the library can simply be called anywhere in the code of the application under test and linked to the integrated library. The integrated library receives control and information about the application under test using various types of hooking (function / V-Table hooking) and can directly manipulate and read controls. Once a control is created, it is registered within the constructor using hooking. The thus-memorized control can later be read and manipulated for testing purposes, taking its type and other properties into account.The injected library gains control by starting a timer in the initialization part of the library, which is triggered in the event loop of the program under test. The timer event handler is called within the event loop so that actions can be performed on the controls. If other events need to be processed by the event loop, the timer event handler returns after reactivating the timer, allowing further actions to be performed on the controls later.
[0004] Finally, information about the current code coverage is collected using instrumentation code generated by the translator and, based on this, new inputs for the controls are generated so that code coverage is maximized.
[0005] This example can be generalized so that, for example, Java or other types of applications can also be supported. Advantages of the invention
[0006] The invention enables automated, self-optimizing tests to be created. This is a clear advantage over the current state of the art, as a test can be created and initiated more or less with the press of a button. Furthermore, by specifying additional conditions, a functional test can be performed with little effort, something that would require significantly more effort to create using the current state of the art. Regarding the approach that "truncates" the GUI, one advantage is that only values that "make sense" are used, because properties of the control elements are taken into account (minimum / maximum / ...). Furthermore, the program logic is not undermined, and inconsistent states cannot arise.
Claims
[1] the automated registration of controls (e.g. text fields, buttons, ...) a) either when they are created b) or after their creation [2] the automated manipulation / operation of controls a) either repeated in the order in which they were created b) or in a different order [3] the automated consideration of the properties (including the type) of the registered controls when manipulating / operating them [4] the automated consideration of any existing specification of conditions that must be fulfilled (functional test) [5] the automated inclusion of code coverage during testing during further manipulation / operation of the controls [6] the use of timers of the corresponding GUI framework / runtime environment, which allow the execution of test code within the timer event handler within the event loop of the program under test