modrunner.cpp00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include <kdebug.h>
00027 #include <kglobal.h>
00028 #include <kinstance.h>
00029 #include <kaboutdata.h>
00030 #include <kcmdlineargs.h>
00031 #include <klocale.h>
00032
00033 #include "runner.h"
00034
00035 static const char description[] =
00036 I18N_NOOP("A command-line application that can be used to run KUnitTest modules.");
00037
00038 static const char version[] = "0.1";
00039
00040 static KCmdLineOptions options[] =
00041 {
00042 {"query [regexp]", I18N_NOOP("Only run modules whose filenames match the regexp."), "^kunittest_.*\\.la$"},
00043 {"folder [folder]", I18N_NOOP("Only run tests modules which are found in the folder. Use the query option to select modules."), "."},
00044 { "enable-dbgcap", I18N_NOOP("Disables debug capturing. You typically use this option when you use the GUI."), 0},
00045 KCmdLineLastOption
00046 };
00047
00048
00049 int main( int argc, char **argv )
00050 {
00051 KInstance instance("modrunner");
00052
00053 KAboutData about("KUnitTest Module Runner", I18N_NOOP("KUnitTest ModRunner"), version, description,
00054 KAboutData::License_BSD, "(C) 2005 Jeroen Wijnhout", 0, 0,
00055 "Jeroen.Wijnhout@kdemail.net");
00056
00057 KCmdLineArgs::init(argc, argv, &about);
00058 KCmdLineArgs::addCmdLineOptions( options );
00059 KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
00060
00061 KUnitTest::Runner::loadModules(args->getOption("folder"), args->getOption("query"));
00062 KUnitTest::Runner::setDebugCapturingEnabled(args->isSet("enable-dbgcap"));
00063
00064 KUnitTest::Runner::self()->runTests();
00065
00066 return KUnitTest::Runner::self()->numberOfFailedTests() - KUnitTest::Runner::self()->numberOfExpectedFailures();
00067 }
|