Question about unittesting
zander at kde.org
Sun Apr 8 22:12:52 BST 2012
On Sunday 08 April 2012 22.57.05 Thomas Lübking wrote:
> I think he wants a macro to execute a branch only in debug compilation
> ie. he's probably looking for Q_ASSERT(deleteSuccedded(path));
> or in doubt sth. stronger than debug that only acts on testing, ie. a
> global cmake
> option "TEST_MODE", so that he can
> # if TEST_MODE
> if (!deleteSucceeded())
> qFatal("my code is crap");
compiling a different exe for testing that behaves differently sounds bad to me.
What we do often is write code like;
do some extra stuff here to test everything is going Ok.
This code should not change the behavior of the app, other than maybe
asserting. The reason for that is that its really hard to maintain an
application that behaves differently in different compilation modes.
This is why we use QTextLib based unit tests; kevin pointed out great links to
More information about the kde-core-devel