[TIP] Functional Testing of Desktop Applications

Michael Foord fuzzyman at voidspace.org.uk
Sun Mar 4 15:47:48 PST 2007


Grig Gheorghiu wrote:
> --- Vladimir Ignatov <kmisoft at gmail.com> wrote:
>
>   
>> BTW I am still unsure what unittesting GUI part is a good idea.
>>
>>     
>
> I think this is an excellent point. In my experience, testing at the
> GUI level is very prone to breakages, especially if you have a lot of
> assumptions that might prove to be invalid once your GUI layout
> changes. 
Hmmm...it's not been more subject to breakage that other API changes in 
my experience.

With Windows Forms perhaps it is a bit easier: you can give GUI 
components (controls) 'names' (a Name attribute that serves no purpose 
other than to identify the control). You can then recursively iterate 
through controls (child controls are stored in the 'Controls' collection 
of container controls) looking for them by name. This reduces breakages 
due to minor layout changes - we have a 'getControlByName' method on our 
test framework.

We do still have to change the parent control we start the search from 
occasionally when our layout changes.

It has been a lot of work to get the functional test framework reliable, 
bit it has been worth the effort in my opinion.

> It's OK though if you test elements of your GUI screens that
> are not likely to change; but once you try to get fancier, it's almost
> guaranteed that your tests will break after a while.
>
> The strategy I recommend is to have a shallow set of GUI testing, just
> for smoke testing purposes, and put most of the functional testing at
> the application logic level, below the GUI. This will also force a
> cleaner design of the application (MVC etc.)
>
>   
In my opinion, functional tests that operate below the GUI level aren't 
proper functional tests. Functional tests (as much as possible) interact 
with your application in the same way as the user. This is *not* an 
impossible goal - and will test things that can't be tested in other ways.

Mind you, we have a lot of tests that live in our 'unit tests' 
directories, but which are actually some kind of hybrid unit / 
functional test.

Having a clear presentation layer (using MVC structure) certainly makes 
testing easier.

Fuzzyman
http://www.voidspace.org.uk/python/articles.shtml

> Grig
>
> _______________________________________________
> testing-in-python mailing list
> testing-in-python at lists.idyll.org
> http://lists.idyll.org/listinfo/testing-in-python
>
>   




More information about the testing-in-python mailing list