|
What is GUI Test Coverage? |
Top Previous Next |
|
This chapter explains what the theory about GUI test coverage: what it is and how it can be measured. What Is Test Coverage? When you test your application, you simulate the behavior of the user. You interact with your application under test (AUT) by pressing buttons, selecting menu items, entering texts, etc. You watch the results and compare them with what you expect. If the actual result matches the expected one, the test succeeds, otherwise it fails. When all test has been executed, you create a test report containing, among other thing, the percentage of succeeded tests. This process can be also automated. If 100% of your test succeed, does it mean that your application is bug-free? Unfortunately, the answer can be 'no', because 100% of successful tests doesn't mean 100% of tested functionality.
It can be that you have only tested 60% of the features: you have test coverage of 60%. Unfortunately you cannot tell anything about the rest: maybe it works, maybe not. If some of your test, let's say 30%, have failed, you know for sure that they don't work. But again, if you have tested only 60% of the whole feature set, you cannot tell anything about the rest 40%.
So, you can see that test coverage shows what you have tested and what you have not tested, regardless of the test results. How GuiProf Measures GUI Test Coverage? As we have seen, two things are essential to measure test coverage:
It's almost impossible to define these notions precisely, especially for GUI tests. But it is possible to find some good approximations that are useful in real life. To illustrate the method GuiProf uses to measure test coverage, consider the following example. Suppose, you have to test an OK button in a form. To do it, you obviously have to select this button, press it and make sure that your form closes and it's data is applied. We see that two actions can be done with this button: setting focus and pressing. GuiProf knows that this button exists. It also knows that every button can be selected and pressed. Therefore it knows, what can be tested. When you run your tests, GuiProf records everything you do. So, if you select and press this button, GuiProf will know. So, it also knows what actually has been tested. GuiProf will consider the button fully tested with 100% test coverage if you at least once select and press it. If, for instance, you select it once or even twice, but never press it, GuiProf will show only 50% test coverage. If you neither pressed the button nor selected it, GuiProf displays 0% coverage. The same principle applies to all GUI objects in your program. GuiProf knows which actions can be executed with it, and it also knows what you actually have done. If you want to test a complex GUI object like a form, you have to test the object itself (e.g. open the form) and test all its children. In this case GuiProf takes into account all possible actions for every child and for the form itself. To achieve 100% coverage for the form, you have to fully cover all the children and the form itself. See Also
|