IPSDK  4_1_0_2
IPSDK : Image Processing Software Development Kit
Public Member Functions | Protected Types | Protected Attributes | Friends | List of all members
ipsdk::unittest::UnitTestLog Class Reference

Custom log formatter for unit tests. More...

#include <UnitTestLog.h>

Inheritance diagram for ipsdk::unittest::UnitTestLog:

Public Member Functions

bool isInit () const
 retrieve object initialization flag
 
void initCpp (const boost::filesystem::path &outputHtmlFilePath, const boost::filesystem::path &outputResultFilePath, const boost::filesystem::path &logResourceDir, const bool bDisplayReport)
 initialization for custom logger for c++ tests More...
 
void initPython (const boost::filesystem::path &outputHtmlFilePath, const boost::filesystem::path &outputResultFilePath, const boost::filesystem::path &logResourceDir, const ipUInt32 pythonMajorVersion, const ipUInt32 pythonMinorVersion, const bool bDisplayReport)
 initialization for custom logger for python tests More...
 
const boost::filesystem::path & getOutputHtmlFilePath () const
 retrieve complete output html file path More...
 
const boost::filesystem::path & getOutputResultFilePath () const
 retrieve complete output result file path More...
 
void notifyTestStart ()
 method allowing to notify of test start More...
 
void notifyTestSuiteStart (const std::string &testSuiteName)
 method allowing to notify of test suite start More...
 
void notifyTestCaseStart (const std::string &testCaseName)
 method allowing to notify of test case start More...
 
void notifyTestSuccess (const std::string &testFilePath, const ipUInt32 testLineIdx, const std::string &testMsg)
 method allowing to notify of success of a given test More...
 
void notifyTestWarning (const std::string &testFilePath, const ipUInt32 testLineIdx, const std::string &testMsg)
 method allowing to notify of warning for a given test More...
 
void notifyTestFailure (const std::string &testFilePath, const ipUInt32 testLineIdx, const std::string &testMsg)
 method allowing to notify of failure of a given test More...
 
void notifyTestCrash (const std::string &testMsg)
 method allowing to notify of crash of a given test More...
 
void notifyTestException (const std::string &lastCheckPointFilePath, const ipUInt32 lastCheckPointLineIdx, const std::string &exceptionFunctionName, const std::string &exceptionFilePath, const ipUInt32 exceptionLineIdx, const std::string &exceptionMsg)
 method allowing to notify of exception during unit test More...
 
void notifyTestCaseEnd ()
 method allowing to notify of test case end More...
 
void notifyTestSuiteEnd ()
 method allowing to notify of test suite end More...
 
void notifyTestEnd ()
 method allowing to notify of test end More...
 
Constructors and destructors
 UnitTestLog ()
 
 ~UnitTestLog ()
 

Protected Types

typedef boost::shared_ptr< UnitTestResultUnitTestResultPtr
 shared pointer to unit test result serializable object
 

Protected Attributes

boost::filesystem::path _outputHtmlFilePath
 complete output file path for html file
 
boost::filesystem::path _outputResultFilePath
 complete output file path for result file
 
boost::filesystem::path _logResourceDir
 path to resource directory
 
std::string _testLanguage
 language associated to tests
 
boost::filesystem::ofstream _ofs
 output stream for html file
 
ipUInt32 _nbTestSuites
 number of test suites
 
ipUInt32 _nbTestCases
 number of test cases
 
ipUInt32 _nbTests
 number of tests
 
ipUInt32 _nbTestsInCurCase
 number of tests in the current test case
 
ipUInt32 _nbErrors
 number of errors
 
ipUInt32 _nbWarnings
 number of warnings
 
std::string _curTestValueStr
 current test output value string
 
std::string _curTestInfoStr
 current test output info string
 
std::string _curTestFileName
 current test file name
 
std::string _curTestSuiteName
 
std::string _curTestCaseName
 
ipUInt32 _curTestLineIdx
 current test line index
 
Chrono _testsChrono
 elapsed time for tests
 
Chrono _testSuiteChrono
 elapsed time for current test suite
 
Chrono _testCaseChrono
 elapsed time for current test case
 
bool _bDisplayReport
 flag indicating whether report should be displayed after tests ending
 
UnitTestResultPtr _pUnitTestResult
 unit test result serializable object
 
bool _bTestCaseClosed
 
bool _bInit
 object initilization flag
 

Friends

class PythonUnitTestManager
 

Detailed Description

Custom log formatter for unit tests.

Author
E. Noirfalise
Date
2013/5/22

This log formatter create a formated html log file on output

Member Function Documentation

◆ initCpp()

void ipsdk::unittest::UnitTestLog::initCpp ( const boost::filesystem::path &  outputHtmlFilePath,
const boost::filesystem::path &  outputResultFilePath,
const boost::filesystem::path &  logResourceDir,
const bool  bDisplayReport 
)

initialization for custom logger for c++ tests

Note
if outputResultFilePath is empty, no file is generated
Exceptions
ipsdk::IPSDKUnitTestToolsExceptionif failed to open output html file

◆ initPython()

void ipsdk::unittest::UnitTestLog::initPython ( const boost::filesystem::path &  outputHtmlFilePath,
const boost::filesystem::path &  outputResultFilePath,
const boost::filesystem::path &  logResourceDir,
const ipUInt32  pythonMajorVersion,
const ipUInt32  pythonMinorVersion,
const bool  bDisplayReport 
)

initialization for custom logger for python tests

Note
if outputResultFilePath is empty, no file is generated
Exceptions
ipsdk::IPSDKUnitTestToolsExceptionif failed to open output html file

◆ getOutputHtmlFilePath()

const boost::filesystem::path& ipsdk::unittest::UnitTestLog::getOutputHtmlFilePath ( ) const

retrieve complete output html file path

Exceptions
ipsdk::IPSDKUnitTestToolsExceptionif isInit() == false

◆ getOutputResultFilePath()

const boost::filesystem::path& ipsdk::unittest::UnitTestLog::getOutputResultFilePath ( ) const

retrieve complete output result file path

Exceptions
ipsdk::IPSDKUnitTestToolsExceptionif isInit() == false

◆ notifyTestStart()

void ipsdk::unittest::UnitTestLog::notifyTestStart ( )

method allowing to notify of test start

Exceptions
ipsdk::IPSDKUnitTestToolsExceptionif isInit() == false

◆ notifyTestSuiteStart()

void ipsdk::unittest::UnitTestLog::notifyTestSuiteStart ( const std::string &  testSuiteName)

method allowing to notify of test suite start

Exceptions
ipsdk::IPSDKUnitTestToolsExceptionif isInit() == false

◆ notifyTestCaseStart()

void ipsdk::unittest::UnitTestLog::notifyTestCaseStart ( const std::string &  testCaseName)

method allowing to notify of test case start

Exceptions
ipsdk::IPSDKUnitTestToolsExceptionif isInit() == false

◆ notifyTestSuccess()

void ipsdk::unittest::UnitTestLog::notifyTestSuccess ( const std::string &  testFilePath,
const ipUInt32  testLineIdx,
const std::string &  testMsg 
)

method allowing to notify of success of a given test

Exceptions
ipsdk::IPSDKUnitTestToolsExceptionif isInit() == false

◆ notifyTestWarning()

void ipsdk::unittest::UnitTestLog::notifyTestWarning ( const std::string &  testFilePath,
const ipUInt32  testLineIdx,
const std::string &  testMsg 
)

method allowing to notify of warning for a given test

Exceptions
ipsdk::IPSDKUnitTestToolsExceptionif isInit() == false

◆ notifyTestFailure()

void ipsdk::unittest::UnitTestLog::notifyTestFailure ( const std::string &  testFilePath,
const ipUInt32  testLineIdx,
const std::string &  testMsg 
)

method allowing to notify of failure of a given test

Exceptions
ipsdk::IPSDKUnitTestToolsExceptionif isInit() == false

◆ notifyTestCrash()

void ipsdk::unittest::UnitTestLog::notifyTestCrash ( const std::string &  testMsg)

method allowing to notify of crash of a given test

Exceptions
ipsdk::IPSDKUnitTestToolsExceptionif isInit() == false

◆ notifyTestException()

void ipsdk::unittest::UnitTestLog::notifyTestException ( const std::string &  lastCheckPointFilePath,
const ipUInt32  lastCheckPointLineIdx,
const std::string &  exceptionFunctionName,
const std::string &  exceptionFilePath,
const ipUInt32  exceptionLineIdx,
const std::string &  exceptionMsg 
)

method allowing to notify of exception during unit test

Exceptions
ipsdk::IPSDKUnitTestToolsExceptionif isInit() == false

◆ notifyTestCaseEnd()

void ipsdk::unittest::UnitTestLog::notifyTestCaseEnd ( )

method allowing to notify of test case end

Exceptions
ipsdk::IPSDKUnitTestToolsExceptionif isInit() == false

◆ notifyTestSuiteEnd()

void ipsdk::unittest::UnitTestLog::notifyTestSuiteEnd ( )

method allowing to notify of test suite end

Exceptions
ipsdk::IPSDKUnitTestToolsExceptionif isInit() == false

◆ notifyTestEnd()

void ipsdk::unittest::UnitTestLog::notifyTestEnd ( )

method allowing to notify of test end

Exceptions
ipsdk::IPSDKUnitTestToolsExceptionif isInit() == false

Member Data Documentation

◆ _bTestCaseClosed

bool ipsdk::unittest::UnitTestLog::_bTestCaseClosed
protected

Flag indicating if the current test case is closed Helps to manage exception that prevent from writing properly the HTML log


The documentation for this class was generated from the following file: