Subcommander Development Blog

Creating a testrunner..

leave a comment »

I think i finally found the easiest way to run and organize cppunit tests. Subcommander is split up into several libs and two binaries and a testrunner binary:

subcommander  (binary)
submerge      (binary)
sublib        (static lib)
util          (static lib)
svn           (static lib)
testrunner    (binary)

So far the testrunner contained the tests and linked with all the libs. The issue with this layout is that if i wanted to write a test for code in the subcommander binary and not in a library i had to add the source files to the testrunner. This gets combersome, especially with QObject based classes which also needs their moc files.

My new layout works upside down. I moved the test classes into its own libraries, …

subcommander       (binary)
subcommander-test  (static lib)
sublib             (static lib)
sublib-test        (static lib)

.. moved the testrunner code into the subcommander binary and link the binary with the test libraries. Running subcommander  with the -test command line option will run the tests. Without it, it will run the normal production code.

The test code is a lot easier to handle this way. The only drawback is that the production code now also contains all the test code… but maybe that’s not really a drawback? Everyone can run the tests now.

So far this works really good.  :-)


Written by hauner

Saturday, 13 December, 2008 at 12:16

Posted in subcommander

Tagged with ,

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: