1

I'm writing my first large GUI application, which has hundreds of features and expected behaviors, and I'm in need to track and test these as I make changes and add functionality.

How is this done, with what tools, and specifically how can it be done for Python and GTK+3? I'm not a software engineer, so I don't even know the terminology. I guess it's about unit testing (which I'm not familiar with), but that's probably only part of the story.

jpcgt
  • 2,138
  • 2
  • 19
  • 34

1 Answers1

2

Testing GUI desktop applications is usually not fun at all.

Better make your code modular, divide it into pieces, draw strict "lines" between the parts of your application. Then, write tests for each part of it, separately. This is where unittest framework from the standard library would help.

If the application is written following some traditional pattern, like MVC - what to test and how would be more clear to you.

Make your tests module by module, function by function measuring coverage and looking at coverage reports at every step - aim to a high-percent coverage. That wouldn't actually mean that you don't have any errors, but, at least, it would mean that high percentage of your code is executed. Mock python module would help with testing different, difficult-to-reproduce situations.

Also see: Writing unit tests in Python: How do I start?

Besides, you would probably want to test how do your parts interact and work together. This is there you would probably need some end-to-end UI tests. As an option, take a look at sikuli project - it's actually framework and UI agnostic since it's based on screensots/images.

Also see:

Hope that helps.

Community
  • 1
  • 1
alecxe
  • 462,703
  • 120
  • 1,088
  • 1,195
  • This certainly helps. This will help me get started with some reading. I'm a little skeptical of following the formal approaches because I don't want to write as much code for testing as for the app itself. Any tips or tricks to add? Thanks! – jpcgt Apr 02 '14 at 22:29
  • @jpcgt well, in serious projects that have a lot of users usually the amount of testing code base is larger than the code for the actual application. But, I'm just too concerned about testing in general, probably too much :) If you don't have tests at all and you don't want to waste a lot of time on it (which is bad), may be a good idea would be to start in a reverse direction - first end-to-end UI tests, measure coverage and add tests for uncovered parts..just thoughts. – alecxe Apr 02 '14 at 22:42