15 #ifndef __IPSDKUNITTESTTOOLS_UNITTESTLOG_H__ 16 #define __IPSDKUNITTESTTOOLS_UNITTESTLOG_H__ 21 #pragma warning (push) 22 #pragma warning (disable : 4275 4251) 27 #include <IPSDKUtil/Tools/Chrono.h> 28 #include <boost/test/unit_test_log_formatter.hpp> 29 #include <boost/noncopyable.hpp> 30 #include <boost/filesystem/path.hpp> 31 #include <boost/filesystem/fstream.hpp> 32 #include <boost/shared_ptr.hpp> 38 class PythonUnitTestManager;
44 public boost::noncopyable
47 friend class PythonUnitTestManager;
64 void initCpp(
const boost::filesystem::path& outputHtmlFilePath,
65 const boost::filesystem::path& outputResultFilePath,
66 const boost::filesystem::path& logResourceDir,
67 const bool bDisplayReport);
72 void initPython(
const boost::filesystem::path& outputHtmlFilePath,
73 const boost::filesystem::path& outputResultFilePath,
74 const boost::filesystem::path& logResourceDir,
77 const bool bDisplayReport);
81 const boost::filesystem::path& getOutputHtmlFilePath()
const;
85 const boost::filesystem::path& getOutputResultFilePath()
const;
89 void notifyTestStart();
103 const std::string& testMsg);
109 const std::string& testMsg);
115 const std::string& testMsg);
119 void notifyTestCrash(
const std::string& testMsg);
124 const ipUInt32 lastCheckPointLineIdx,
125 const std::string& exceptionFunctionName,
126 const std::string& exceptionFilePath,
128 const std::string& exceptionMsg);
145 void notifyTestEntry(
const std::string& testInfoStr,
146 const std::string& testFilePath,
148 const std::string& testMsg);
152 void log_start(std::ostream& os,
153 boost::unit_test::counter_t);
157 void log_finish(std::ostream& os);
161 void log_build_info(std::ostream& os,
bool b);
165 void test_unit_start(std::ostream& os,
166 const boost::unit_test::test_unit& unitTest);
170 void test_unit_finish(std::ostream& os,
171 const boost::unit_test::test_unit& unitTest,
172 unsigned long elapsed);
176 void test_unit_skipped(std::ostream& os,
177 const boost::unit_test::test_unit& unitTest);
181 void log_entry_start(std::ostream& os,
182 const boost::unit_test::log_entry_data& data,
183 log_entry_types let);
187 void log_entry_value(std::ostream& os,
188 boost::unit_test::const_string value);
192 void log_entry_finish(std::ostream& os);
199 void log_exception_start(std::ostream& os,
200 const boost::unit_test::log_checkpoint_data& data,
201 const boost::execution_exception& e);
205 void log_exception_finish(std::ostream& os) {}
210 void entry_context_start(std::ostream& os, boost::unit_test::log_level l) {}
216 void log_entry_context(std::ostream& os, boost::unit_test::log_level l, boost::unit_test::const_string value) {}
219 void entry_context_finish(std::ostream& os, boost::unit_test::log_level l) {}
236 boost::filesystem::ofstream
_ofs;
266 std::string _curTestSuiteName;
269 std::string _curTestCaseName;
316 #pragma warning (pop) 318 #endif // __IPSDKUNITTESTTOOLS_UNITTESTLOG_H__ Main namespace for IPSDK library.
Definition: AlgorithmFunctionEfficiency.h:22
IPSDKUNITTESTTOOLS_API void notifyTestSuiteStart(const std::string &testSuiteName)
function allowing to notify of test suite start
boost::shared_ptr< UnitTestResult > UnitTestResultPtr
shared pointer to unit test result serializable object
Definition: UnitTestLog.h:287
boost::filesystem::path _outputHtmlFilePath
complete output file path for html file
Definition: UnitTestLog.h:224
IPSDKUNITTESTTOOLS_API void notifyTestWarning(const std::string &testFilePath, const ipUInt32 testLineIdx, const std::string &testMsg)
function allowing to notify of warning for a given test
IPSDKUNITTESTTOOLS_API void notifyTestFailure(const std::string &testFilePath, const ipUInt32 testLineIdx, const std::string &testMsg)
function allowing to notify of failure of a given test
bool _bDisplayReport
flag indicating whether report should be displayed after tests ending
Definition: UnitTestLog.h:284
IPSDKUNITTESTTOOLS_API void notifyTestEnd()
function allowing to notify of test end
Predefined types for unit tests management.
bool _bTestCaseClosed
Definition: UnitTestLog.h:294
boost::filesystem::path _logResourceDir
path to resource directory
Definition: UnitTestLog.h:230
ipUInt32 _nbTestsInCurCase
number of tests in the current test case
Definition: UnitTestLog.h:248
ipUInt32 _nbErrors
number of errors
Definition: UnitTestLog.h:251
boost::filesystem::path _outputResultFilePath
complete output file path for result file
Definition: UnitTestLog.h:227
bool _bInit
object initilization flag
Definition: UnitTestLog.h:297
Chrono _testCaseChrono
elapsed time for current test case
Definition: UnitTestLog.h:281
std::string _curTestInfoStr
current test output info string
Definition: UnitTestLog.h:260
Base types for multiplatform compatibility.
#define IPSDKUNITTESTTOOLS_API
Import/Export macro for library IPSDKUnitTestTools.
Definition: IPSDKUnitTestToolsExports.h:27
IPSDKUNITTESTTOOLS_API void notifyTestCaseStart(const std::string &testCaseName)
function allowing to notify of test case start
Definition of import/export macro for library.
Custom log formatter for unit tests.
Definition: UnitTestLog.h:43
Chronometer class for library processing time evaluation.
Definition: Chrono.h:33
UnitTestResultPtr _pUnitTestResult
unit test result serializable object
Definition: UnitTestLog.h:290
ipUInt32 _nbWarnings
number of warnings
Definition: UnitTestLog.h:254
std::string _curTestFileName
current test file name
Definition: UnitTestLog.h:263
ipUInt32 _curTestLineIdx
current test line index
Definition: UnitTestLog.h:272
ipUInt32 _nbTestCases
number of test cases
Definition: UnitTestLog.h:242
ipUInt32 _nbTests
number of tests
Definition: UnitTestLog.h:245
Chrono _testSuiteChrono
elapsed time for current test suite
Definition: UnitTestLog.h:278
IPSDKUNITTESTTOOLS_API void notifyTestSuiteEnd()
function allowing to notify of test suite end
IPSDKUNITTESTTOOLS_API void notifyTestCaseEnd()
function allowing to notify of test case end
std::string _curTestValueStr
current test output value string
Definition: UnitTestLog.h:257
ipUInt32 _nbTestSuites
number of test suites
Definition: UnitTestLog.h:239
std::string _testLanguage
language associated to tests
Definition: UnitTestLog.h:233
Chrono _testsChrono
elapsed time for tests
Definition: UnitTestLog.h:275
IPSDKUNITTESTTOOLS_API void notifyTestException(const std::string &lastCheckPointFilePath, const ipUInt32 lastCheckPointLineIdx, const std::string &exceptionFunctionName, const std::string &exceptionFilePath, const ipUInt32 exceptionLineIdx, const std::string &exceptionMsg)
function allowing to notify of exception during unit test
bool isInit() const
retrieve object initialization flag
Definition: UnitTestLog.h:305
boost::filesystem::ofstream _ofs
output stream for html file
Definition: UnitTestLog.h:236
IPSDKUNITTESTTOOLS_API void notifyTestSuccess(const std::string &testFilePath, const ipUInt32 testLineIdx, const std::string &testMsg)
function allowing to notify of success of a given test
uint32_t ipUInt32
Base types definition.
Definition: BaseTypes.h:53