Re: [TFUI] testing Qt code
Phlip <phlipcpp-/[email protected]>
| Newsgroups | gmane.comp.programming.test-first-user-interfaces |
|---|---|
| Message-ID | <[email protected]> |
dammak rafik wrote:
> My question is about : how I must do to respect the
> test driven
> development in the case of Qt library for GUI.I have
> found two test
> tools(not free) :squish (froglogic.com) and
> Kdexucator(ics.com).I had
> found also Qtunit but it is old version and hadn't
> be update since two
> years.I am a very newbie in everything related
> testing and I am
> searching to respect a good policy testing in the
> same time of
> developing(I am doing a XP process).I will repeat ,I
> am try to respect
> MVC pattern to separate control to view.
> For the previous code sended by david and
> philip(thanks) how I can
> used it to improve my code and testing in this case.
If you have a GUI Toolkit, and if it stores objects in
memory before painting them (like most do) then those
test tools will solve a problem that you don't have.
> P.S spigot????
Faucet.
When you write a debugging trace statement, like this:
sprintf("x is %i today\n", x);
that's like turning on a little hose; the value of X
streams out of it. Programmers turn these traces off
like this:
// sprintf("x is %i today\n", x);
When you use David's reveal() method, you do the same
thing with the entire window.
However, this is not strictly a testing technique;
it's a way to re-verify the tests. The more you use
reveal(), the better your tests get, and the less you
need to use it.
In general, write tests like this:
int main(int argc, char** argv)
{
QApplication qApp(argc, argv);
//create an empty dialog object
QDialog* dialog = new QDialog();
assert(dialog->getTitle() == "dammak's dialog");
// hide the dialog
//reveal(dialog);
int dummy; std::cin >> dummy; // pause
return EXIT_SUCCESS;
}
Treat the GUI objects as just another library - not
anything special. This requires you to learn how to
write code substantially differently from the Qt
tutorial code...
But of course use a test rig like CppUnit - not main()!
=====
Phlip
http://www.xpsd.org/cgi-bin/wiki?TestFirstUserInterfaces
__________________________________
Do you Yahoo!?
Yahoo! Movies - Buy advance tickets for 'Shrek 2'
http://movies.yahoo.com/showtimes/movie?mid=1808405861
------------------------ Yahoo! Groups Sponsor ---------------------~-->
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/nhFolB/TM
---------------------------------------------------------------------~->
To unsubscribe, email:
TestFirstUserInterfaces-unsubscribe-hHKSG33TihhbjbujkaE4pw@public.gmane.org
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/TestFirstUserInterfaces/
<*> To unsubscribe from this group, send an email to:
TestFirstUserInterfaces-unsubscribe-hHKSG33TihhbjbujkaE4pw@public.gmane.org
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/