QtTest conventions

Manuel Breugelmans mbr.nxi at gmail.com
Wed Apr 23 11:27:00 UTC 2008


Uniform structured code is almost always a positive thing. Unless I overlooked 
the guidelines for tests are currently not written out. This is what I 
deduced by looking at the existing QtTests in kdev{elop,platform}:

* tests should be located in a subdirectory 'tests' directly beneath the 
module under test
* files are named after the class under test, in all lower-case with 'test' 
appended
* declaration & implementation go in seperate .cpp and .h
* testcases are named after the class under test in camel-case with 'Test' 
appended
* KDEVTEST_MAIN or QTTEST_MAIN macro at the end of .cpp, right before .moc 
* test commands are prefixed with 'test'
* fixture methods {init,cleanup}TestCase declared first
* helper methods and fixture attributes declared private in the testcase
* CMakeLists.txt inside each test module with 
http://techbase.kde.org/index.php?title=Development/Tutorials/Unittests#KDE4_CMake_Recipe_for_QTestLib

Ok to add this list of recommendations to the wiki?


Manuel




More information about the KDevelop-devel mailing list