Question about unittesting

Kevin Krammer krammer at kde.org
Sun Apr 8 21:39:55 BST 2012


Hi Giorgos,

On Sunday, 2012-04-08, Giorgos Tsiapaliwkas wrote:
> Hello,
> 
> Why we don't have in KDE a macro like,
> 
> if (application_is_in_debug_mode) {
> //do some testing
> }

How would a macro make things different?
Something like
IF_DEBUG_MODE {
  // do some testing
}

so the developer does not have to remember how to check a command line 
argument's value?

> Why we need a macro like that?
> 
> a. Giorgos added a feature which deletes a folder from dolphin. Without
> this  macro in order Giorgos to
> test it he needs,
> -to create a dir
> -remove the dir
> -check if the remove was successful(this is the actual test)
> 
> but if we had this macro Giorgos would need to implement the last step.

I am probably misunderstanding your use case, but how would only the last step 
necessary? I.e. how would a generic macro know that it has to create and 
remove a directory?

At KDE we usually use the QTest framework [1] for unittesting and we have 
cmake macros that make it easy to add them to a project's CMakeLists.txt (e.f. 
see [2]) and some C/C++ helper macros that make writing them easier [3].

Cheers,
Kevin

[1] http://qt-project.org/doc/qt-4.8/qtest.html
[2] http://ktutorial.wordpress.com/2009/03/18/unit-testing-a-kde-4-library/
[3] http://lxr.kde.org/ident?i=QTEST_KDEMAIN
-- 
Kevin Krammer, KDE developer, xdg-utils developer
KDE user support, developer mentoring
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 190 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20120408/9f2d8dde/attachment.sig>


More information about the kde-core-devel mailing list