Boost External Test Runner
Namespaces | Macros | Typedefs | Functions | Variables
console_test_runner.cpp File Reference
#include <boost/test/unit_test.hpp>
#include <boost/test/utils/runtime/cla/named_parameter.hpp>
#include <boost/test/utils/runtime/cla/parser.hpp>
#include <iostream>
#include <boost/cstdlib.hpp>
#include <fstream>
#include "CBoostTestTreeLister.h"
#include "CBoostTestTreeDebugLister.h"

Go to the source code of this file.

Namespaces

 dyn_lib
 

Macros

#define BOOST_TEST_DYN_LINK
 

Typedefs

typedef bool(* init_func_ptr) ()
 
typedef std::unique_ptr<::etas::boost::unit_test::CBoostTestTreeListerTBoostTestTreeListerPtr
 

Functions

static std::string init_func_name ("init_unit_test")
 
bool load_test_lib ()
 Load the Boost UTF dll containing the tests, locate the initialization method (either the default "init_unit_test" or the one supplied via parameter –init) and in case the initialization method is found, call it. More...
 
std::unique_ptr< std::ofstream > GetListOutputStream (const cla::parser &P, const std::string &arg)
 Generates an object of type ofstream so as to write to file. More...
 
TBoostTestTreeListerPtr GetTestTreeLister (const std::string &arg, const std::string dll, std::ostream *out=nullptr)
 
std::ostream & WriteError (std::ostream &out, const std::string &dll, const std::string &error=std::string())
 Method utilized to format and write any exceptions to the output stream. More...
 
int ListTests (const cla::parser &P)
 Method handling the enumeration of the tests. More...
 
int main (int argc, char *argv[])
 Entry point of the program. More...
 

Variables

static std::string test_lib_name
 
dyn_lib::handle test_lib_handle
 

Macro Definition Documentation

#define BOOST_TEST_DYN_LINK

Definition at line 10 of file console_test_runner.cpp.

Typedef Documentation

typedef bool(* init_func_ptr) ()

Definition at line 184 of file console_test_runner.cpp.

Definition at line 245 of file console_test_runner.cpp.

Function Documentation

std::unique_ptr<std::ofstream> GetListOutputStream ( const cla::parser &  P,
const std::string &  arg 
)

Generates an object of type ofstream so as to write to file.

Parameters
[in]PReference to the object handling the command line parsing
[in]argFull filepath where to write the XML file to

Definition at line 230 of file console_test_runner.cpp.

TBoostTestTreeListerPtr GetTestTreeLister ( const std::string &  arg,
const std::string  dll,
std::ostream *  out = nullptr 
)

Definition at line 255 of file console_test_runner.cpp.

static std::string init_func_name ( "init_unit_test"  )
static
int ListTests ( const cla::parser &  P)

Method handling the enumeration of the tests.

Parameters
[in]PReference to the object handling the command line parsing
Returns
Returns either boost::exit_success or boost::exit_failure

Load library before enumerating test suite to ensure correct registration. Execute initialization function since it may be the case that client code registers custom tests

Definition at line 299 of file console_test_runner.cpp.

bool load_test_lib ( )

Load the Boost UTF dll containing the tests, locate the initialization method (either the default "init_unit_test" or the one supplied via parameter –init) and in case the initialization method is found, call it.

Returns
returns true in case the initialization method has not been located (so that the enumeration can proceed anyway) In case the initialization method has been found, the method is called and whatever status that method return returns is returned by load_test_lib
Note
It has been decided to suppress that the raise of an exception in case the initialization method is not method. At any rate the user will know that his manually registered tests has not been listed because they will not appear in the XML file.

Definition at line 196 of file console_test_runner.cpp.

int main ( int  argc,
char *  argv[] 
)

Entry point of the program.

Parameters
[in]argcargument count
[in]argvargument vector
Returns
Indicates execution failure or success

Definition at line 471 of file console_test_runner.cpp.

std::ostream& WriteError ( std::ostream &  out,
const std::string &  dll,
const std::string &  error = std::string() 
)

Method utilized to format and write any exceptions to the output stream.

Parameters
[in]outreference to the output stream where to write the exception to
[in]dlllibrary path containing the Boost UTF tests
[in]errorexception detail

Definition at line 278 of file console_test_runner.cpp.

Variable Documentation

dyn_lib::handle test_lib_handle

Definition at line 182 of file console_test_runner.cpp.

std::string test_lib_name
static

Definition at line 179 of file console_test_runner.cpp.