[Qt-interest] [slightly OT] Test Driven Development

Ross Bencina rossb-lists at audiomulch.com
Mon Feb 8 05:21:20 CET 2010


Hi Dave

I don't use TDD or even Unit Testing in my Qt GUI. I have taken a TDD
approach with developing some non-GUI components.

One reason for not having a hard-core automated testing approach is that the
project started (with another GUI framework) well before Unit Testing/XP/TDD
became mainstream and I just never got into it. I view functional testing
and regression testing as more important for the GUI. At the moment I do a
lot of beta testing with end users but I'm also considering automating
regression testing with Squish in the future.

That said, I do code pretty defensively and make extensive use of assertions
and sometimes write extra validation/sanity-check code which stops the
program if something unexpected is encountered (usually this catches bugs
during testing).

That said I do have test suites for some non-GUI components of my app and at
times I have developed client code (tests) as a way of working out
interfaces and testing new designs -- that's the TDD approach and I think
its a good one.

Personally I consider unit testing difficult for GUI stuff because:
- a lot of the program inputs are UI event streams and you need to know a
fair bit about what the window system might throw at you to synthesize
reasonable test streams.
- GUI widgets tend to have dependencies on a lot of other code and the
scaffolding required for testing is often non-trivial. unit testing
stand-along classes with few dependencies is much easier than unit testing
highly interdependent higher level aggregate objects I think.

None of this is an argument against TDD or unit testing. I imagine it's
possible to become an expert at GUI related TDD I just havn't invested in
that direction.

Ross.


Dave Smith wrote:
>I have a question for the Qt development community at large, and it's
> regarding a matter of opinion.
>
> Are you using test driven development in your Qt projects? If so, have
> you found that it benefits your project or not?
>
> If you are not using TDD, why not? All details are welcome. I am
> trying to form an opinion of my own.
>
> Have you found that TDD works better for certain areas within your
> projects and not others? For example, the back-end vs. the GUI?
>
> Thanks!
>
> --Dave




More information about the Qt-interest-old mailing list