How to write UI tests (for sublime/ and shell/)

Manuel Breugelmans mbr.nxi at
Fri May 2 22:56:29 UTC 2008

On Friday 02 May 2008 23:55:02 Alexander Dymo wrote:
> As I've promised before, I sat down today and wrote a small howto on UI
> testing. This basically summarizes my experience writing tests for sublime/
> and shell. Hope you'll find this useful. If something is missing, please
> ping me ;)
> Same howto is on our wiki, if you have changes or fixes, feel free to
> modify:

Interesting read! 

I'm missing some reference to QVERIFY2 though. This is an undocumented assert 
which allows you to specify failure messages. Especially useful when there's 
loads of VERYIFY/COMPARE in a single command, when one fails you'll know 
immediatly why. Using good failure messages here and there will make the test 
code more readable as well.

I use these macro's in my tests:

#define KVERIFY_MSG(condition,message) QVERIFY2(condition, 
#define KVERIFY(condition) QVERIFY(condition)
#define KOMPARE_MSG(expected,actual,message) QVERIFY2(expected == actual, 
#define KOMPARE(expected,actual) QVERIFY(expected == actual)

Maybe it's good to mention 'ctest' as well. This is basicly the command 
behind 'make test', but less keystrokes :) You can pass a --verbose parameter 
which elaborates on failures. Which very stupidly doesnt happen with a 
basic 'make test'.


More information about the KDevelop-devel mailing list