Question about unittesting
Dario Freddi
drf54321 at gmail.com
Mon Apr 9 12:43:24 BST 2012
Il 08 aprile 2012 23:12, Thomas Zander <zander at kde.org> ha scritto:
> 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
>> mode,
>> 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");
>> #endif
>
> compiling a different exe for testing that behaves differently sounds bad to me.
I agree, it defeats the whole purpose of testing - after all, we're
not testing the code path the end user would use, I can see such a
thing make it harder to spot problems instead. QTest covers every
possible need, and Q_ASSERT should be enough for having the program
behave differently when compiled in debug mode in a sensible way.
More information about the kde-core-devel
mailing list