KUnitTest
modrunner.cpp
Go to the documentation of this file.
00001 00026 #include <kdebug.h> 00027 #include <kglobal.h> 00028 #include <kcomponentdata.h> 00029 #include <kaboutdata.h> 00030 #include <kcmdlineargs.h> 00031 #include <klocale.h> 00032 00033 #include "runner.h" 00034 00035 00036 int main( int argc, char **argv ) 00037 { 00038 KComponentData componentData("modrunner"); 00039 00040 KLocalizedString description = 00041 ki18n("A command-line application that can be used to run KUnitTest modules."); 00042 00043 const char version[] = "0.1"; 00044 00045 KCmdLineOptions options; 00046 options.add("query [regexp]", ki18n("Only run modules whose filenames match the regexp."), "^kunittest_.*\\.la$"); 00047 options.add("folder [folder]", ki18n("Only run tests modules which are found in the folder. Use the query option to select modules."), "."); 00048 options.add("enable-dbgcap", ki18n("Disables debug capturing. You typically use this option when you use the GUI.")); 00049 00050 KAboutData about("KUnitTest Module Runner", 0, ki18n("KUnitTest ModRunner"), version, description, 00051 KAboutData::License_BSD, ki18n("(C) 2005 Jeroen Wijnhout"), KLocalizedString(), 0, 00052 "Jeroen.Wijnhout@kdemail.net"); 00053 00054 KCmdLineArgs::init(argc, argv, &about); 00055 KCmdLineArgs::addCmdLineOptions( options ); 00056 KCmdLineArgs *args = KCmdLineArgs::parsedArgs(); 00057 00058 KUnitTest::Runner::loadModules(args->getOption("folder"), args->getOption("query")); 00059 KUnitTest::Runner::setDebugCapturingEnabled(args->isSet("enable-dbgcap")); 00060 00061 KUnitTest::Runner::self()->runTests(); 00062 00063 return KUnitTest::Runner::self()->numberOfFailedTests() - KUnitTest::Runner::self()->numberOfExpectedFailures(); 00064 }
KDE 4.6 API Reference