From: Jan Hudec <bulb@ucw.cz>
To: Marco Costalba <mcostalba@gmail.com>
Cc: git@vger.kernel.org
Subject: Re: [QGIT RFC] Unit tests for QGit
Date: Sun, 17 Aug 2008 16:15:30 +0200 [thread overview]
Message-ID: <20080817141530.GA4542@efreet.light.src> (raw)
In-Reply-To: <e5bfff550808170157m45532428y3956e5d0d92e97d9@mail.gmail.com>
On Sun, Aug 17, 2008 at 09:57:36 +0100, Marco Costalba wrote:
> On Fri, Aug 8, 2008 at 10:13 PM, Jan Hudec <bulb@ucw.cz> wrote:
> sorry to reply so late but I just returned from holiday (no PC there
> due to it was severely forbidden by my boss aka wife :-)
That's all right. I am not progressing that fast.
> > I've been thinking about some refactoring of QGit since some time. And to be
> > sure I don't screw up things too hard in the process, I thought about adding
> > a test suite infrastructure first (and add some test cases for each think
> > just before refactoring it).
> That's interesting. I have NO experience on test suites for GUI
> applications (command line applications like git I would think are
> easier to setup some tests suite for)
Well, there are basically three points at which GUI application can be
tested:
1. The code that provides data does not directly do anything with graphics
and therefore can be tested by normal unittests. In this case such tests
can be written for the Git and related classes.
2. Widget events can be emulated inside the test driver, for which Qt4
contains a (quite basic but usable) QTestlib module. The tests work as
normal unittests.
3. User interaction can be simulated from outside the application, eg. with
LDTP.
I actually plan the first two items. While the third would be less invasive
(no need to link anything anywhere), unittests are much more useful for
debugging, because you can test individual functions independently.
> > The problem is, that implementing unittests means I need to compile
> > 2 separate binaries -- qgit itself and the test -- using most (but not all)
> > of the same sources. I see two ways to do it, so I'd like to ask which you
> > consider cleaner:
> >
> > 1. Reorganize stuff so that a (static) library is created from all the
> > sources except qgit.cpp and than qgit.cpp is linked to this library to
> > create qgit and the tests are linked with it to provide the test runner.
> >
> > Pros:
> > - The .pro files should remain reasonably simple.
> > - The sources are only compiled once.
> > Cons:
> > - Need to split the src directory to two, so bigger moving stuff around.
> >
>
> This is not a cons IMHO if it helps in separating tests from sources.
The tests would be a separate directory in any case. What I will need to
separate is qgit.cpp from all other sources. So there will be *three* folders
in the end -- one for linking the qgit binary, containing only qgit.cpp and
a .pro file, one for the majority of source and one for linking the testsuite
with the test sources.
> As I said I am no expert, but I would try to
>
> - Let the test suite be easily stripped/not compiled for the
> publishing (remember that we have to produce also that little
> qgit_install.exe file used on *that* OS)
The test suite basically must be a separate binary. At least that's the only
method I ever used -- it would be possible to link everything together and
start the test suite using a parameter, but I don't intend to do that.
> - Let the test be compiled only on demand (during developing I just
> want to compile and run as few things as possible: C++ is already
> quite bad in that regard and I don't want the situation get worst. BTW
> I consider C++ slow compile times the biggest and probably only
> drawback of C++ against C for big projects)
Yes, you can just comment out the tests. On the other hand it's during the
development I normally want to run the tests. I usually prefer to write
a test for things I work on over starting the user interface and testing them
manually, because manual testing is much more prone to forgetting some
important corner cases.
> - Try to find some literature/reference before starting coding. As I
> said I am no expert of GUI testing, so I would probably try to find
> some Qt projects that use it and see/ask the developers how they
> managed to do that and what are the problems. Then try to be stick to
> known best practice (read someone that has DONE that in a REAL
> project, not someone that has WRITTEN about that in a paper or a
> vendor marketing/documentation)
Well, KDE people talked about doing it, but I am not sure how much they
actually do. But it's really just normal unit-testing.
> Anyhow I'm really interested in this thing, and hope to see your work
> soon. Please feel free to drop me a line for any help you think I can
> give you.
Bye,
Jan
--
Jan 'Bulb' Hudec <bulb@ucw.cz>
next prev parent reply other threads:[~2008-08-17 14:16 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-08-08 21:13 [QGIT RFC] Unit tests for QGit Jan Hudec
2008-08-08 23:00 ` Benjamin Sergeant
2008-08-10 7:55 ` Jan Hudec
2008-08-17 8:57 ` Marco Costalba
2008-08-17 14:15 ` Jan Hudec [this message]
2008-08-17 15:46 ` Marco Costalba
2008-08-17 19:58 ` Jan Hudec
2008-08-17 20:30 ` Marco Costalba
2008-08-18 18:00 ` Jan Hudec
2008-08-19 14:53 ` Marco Costalba
2008-08-27 20:18 ` Jan Hudec
2008-08-28 11:29 ` Marco Costalba
2008-08-28 15:31 ` Karl Hasselström
2008-08-28 18:54 ` Marco Costalba
2008-08-28 22:01 ` Jan Hudec
2008-08-29 7:01 ` Marco Costalba
2008-08-28 22:18 ` Karl Hasselström
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080817141530.GA4542@efreet.light.src \
--to=bulb@ucw.cz \
--cc=git@vger.kernel.org \
--cc=mcostalba@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).