Lumiera  0.pre.03
»edit your freedom«
testrunner.cpp
Go to the documentation of this file.
1 /*
2  Testrunner - execute a suite of test objects, possibly filtered by category
3 
4  Copyright (C) Lumiera.org
5  2008, Christian Thaeter <ct@pipapo.org>
6  Hermann Vosseler <Ichthyostega@web.de>
7 
8  This program is free software; you can redistribute it and/or
9  modify it under the terms of the GNU General Public License as
10  published by the Free Software Foundation; either version 2 of
11  the License, or (at your option) any later version.
12 
13  This program is distributed in the hope that it will be useful,
14  but WITHOUT ANY WARRANTY; without even the implied warranty of
15  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  GNU General Public License for more details.
17 
18  You should have received a copy of the GNU General Public License
19  along with this program; if not, write to the Free Software
20  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
21 
22 * *****************************************************/
23 
31 #include "include/lifecycle.h"
32 #include "lib/test/testoption.hpp"
33 #include "lib/test/suite.hpp"
34 
38 
39 
47 int main (int argc, const char* argv[])
48 {
49  lib::Cmdline args (argc,argv);
50  test::TestOption optparser (args);
51  test::Suite suite (optparser.getTestgroup());
52  LifecycleHook::trigger (ON_GLOBAL_INIT);
53 
54  if (optparser.shouldDescribe())
55  suite.describe();
56  else
57  optparser.handleHelpRequest() || suite.run (args);
58 
59  LifecycleHook::trigger (ON_GLOBAL_SHUTDOWN);
60  return suite.getExitCode();
61 }
Installing and invoking of application lifecycle event callbacks.
Commandline options for our unittest test-suite executable.
int main(int argc, const char *argv[])
run all tests or any single test specified in the first command line argument.
Definition: testrunner.cpp:47
const char * ON_GLOBAL_SHUTDOWN
to be triggered at the end of main()
Building and running a suite of tests, implemented as test classes.
const string getTestgroup()
Definition: testoption.cpp:92
Support for selecting and configuring testcases via commandline arguments.
Definition: testoption.hpp:59
const char * ON_GLOBAL_INIT
to be triggered in main()
define and register a callback for a specific lifecycle event.
Definition: lifecycle.h:76
bool handleHelpRequest()
handles the –help switch by printing a syntax description
Definition: testoption.cpp:122
Enables running a collection of tests.
Definition: suite.hpp:66
Abstraction of the usual int argc, int** argv-Commandline, to be able to treat it as a vector of stri...
Definition: cmdline.hpp:57