CAtsLogger Class Reference

class CAtsLogger : public CBase

Inherits from

Public Member Functions
~CAtsLogger ()
IMPORT_C void BeginTestCaseL (const TDesC &, const TDesC &, const TDesC &, const TDesC &)
IMPORT_C void BeginTestCaseL (const TDesC &, const TInt , const TDesC &, const TDesC &)
IMPORT_C void BeginTestCaseReportL (const TDesC &, const TDesC &, const TTime &, const TDesC &, const TDesC &)
IMPORT_C void BeginTestCaseReportL (const TDesC &, const TInt , const TTime &, const TDesC &, const TDesC &)
IMPORT_C void BeginTestReportL ()
IMPORT_C void BeginTestSetL (const TDesC &, const TDesC &, const TDesC &, const TDesC &)
IMPORT_C void CloseL ()
IMPORT_C void CommentL (const TDesC &)
IMPORT_C void CommentL ( TRefByValue < const TDesC >, ...)
IMPORT_C void ContinueAfterRebootL ()
IMPORT_C void DebugL (const TDesC &)
IMPORT_C void DebugL ( TRefByValue < const TDesC >, ...)
IMPORT_C void DebugOutput (const TDesC &)
IMPORT_C void EndTestCaseL ()
IMPORT_C void EndTestReportL ()
IMPORT_C void EndTestSetL ()
IMPORT_C void ErrorL (const TDesC &)
IMPORT_C void ErrorL ( TRefByValue < const TDesC >, ...)
IMPORT_C const TPtrC ErrorMessage (const TInt &)
IMPORT_C TBool IsValid ()
IMPORT_C CAtsLogger * NewL (const TDesC &, TBool )
IMPORT_C TInt RawLogL (const TDesC &)
IMPORT_C TInt RawLogL ( TRefByValue < const TDesC >, ...)
IMPORT_C void SaveForRebootL ()
IMPORT_C void SetDebugOutput ( TBool )
IMPORT_C void SetFullReporting ( TBool )
IMPORT_C void SetIndentation ( TBool )
IMPORT_C void SetTestCaseResultL (const TInt )
IMPORT_C void SetTestCaseResultL (const TDesC &)
IMPORT_C void SetTestCaseResultL ( TRefByValue < const TDesC >, ...)
IMPORT_C void TestCaseFailed ()
IMPORT_C void TestCaseNa ()
IMPORT_C void TestCasePassed ()
IMPORT_C void TestCaseSkipped ()
IMPORT_C void WarningL (const TDesC &)
IMPORT_C void WarningL ( TRefByValue < const TDesC >, ...)
Protected Member Functions
void CloseTagIndentL (const TDesC &)
void CloseTagL (const TDesC &)
HBufC * EncodeLC (const TDesC &)
TBool IsTransitionLegal (const TReportStage &)
void LineFeedL ()
void OpenTagIndentL (const TDesC &)
void OpenTagIndentL (const TDesC &, const TDesC &, const TDesC &)
void OpenTagL (const TDesC &)
void OpenTagL (const TDesC &, const TDesC &, const TDesC &)
void TagL (const TDesC &, const TDesC &)
void TagL (const TDesC &, const TDesC &, const TDesC &, const TDesC &)
void TimeStampedMessageL (const TDesC &, const TDesC &)
void WriteL (const TDesC &, RFile &)
void WriteL (const TDesC &)
Private Member Functions
CAtsLogger (const TDesC &)
TInt BufferL ( CBufBase *, TInt &, const TDesC &)
TBool CheckDirectoryL (const TDesC &, TChar &)
void ConstructL ( TBool )
HBufC * FormatDateLC ( TDateTime )
HBufC * FormatTimeLC ( TTimeIntervalMicroSeconds )
TInt OpenExistingFileL (const TDesC &)
TInt ReplaceFileL (const TDesC &)
TInt WriteBufferToDebugPortL ( CBufBase *)
TInt WriteBufferToFileL ( CBufBase *, const TDesC &)
Inherited Functions
CBase::CBase()
CBase::Delete(CBase *)
CBase::Extension_(TUint,TAny *&,TAny *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()
Public Member Enumerations
enum TReportStage {
ENone , EUninitialized , EBeginTestReport , EBeginTestSet , EBeginTestCase , ESetTestCaseVerdict , EEndTestCase , EEndTestSet , EEndTestReport , EFinished
}
Protected Attributes
const TFileName iName
CAtsLogger::TReportStage iReportStage
CAtsLogger::TTestCase iTestCase
CAtsLogger::TTestSet iTestSet
Private Attributes
TBool iClosed
TBool iDoDebugOutput
TBool iDoIndentation
TBool iFullReportingMode
TBool iInTestCase
int iIndentLevel
TBool iLineFeedDone
TBool iRawLog
TFileName iRawLogFileName
RFs iRfs
TBool iValid
CBufBase * iXmlBuffer
TInt iXmlBufferLength
TBool iXmlLog
TFileName iXmlLogFileName

Constructor & Destructor Documentation

CAtsLogger(const TDesC &)

CAtsLogger ( const TDesC & aName ) [private]

C++ constructor

Parameters

const TDesC & aName

~CAtsLogger()

IMPORT_C ~CAtsLogger ( )

C++ destructor

Member Functions Documentation

BeginTestCaseL(const TDesC &, const TDesC &, const TDesC &, const TDesC &)

IMPORT_C void BeginTestCaseL ( const TDesC & aId,
const TDesC & aExpected = KAtsLoggerNa,
const TDesC & aInfo = KAtsLoggerEmpty,
const TDesC & aVersion = KAtsLoggerEmpty
)

BeginTestCaseL() is called whenever an individual testcase begins

id = unique id of the testcase expected = expected result of the test (if applicable) info = short descritpion of the expected result (if applicable)

Parameters

const TDesC & aId
const TDesC & aExpected = KAtsLoggerNa
const TDesC & aInfo = KAtsLoggerEmpty
const TDesC & aVersion = KAtsLoggerEmpty

BeginTestCaseL(const TDesC &, const TInt, const TDesC &, const TDesC &)

IMPORT_C void BeginTestCaseL ( const TDesC & aId,
const TInt aExpected,
const TDesC & aInfo = KAtsLoggerEmpty,
const TDesC & aVersion = KAtsLoggerEmpty
)

BeginTestCaseL() is called whenever an individual testcase begins

id = unique id of the testcase expected = expected result code of the test (if applicable) info = short descritpion of the expected result (if applicable)

Parameters

const TDesC & aId
const TInt aExpected
const TDesC & aInfo = KAtsLoggerEmpty
const TDesC & aVersion = KAtsLoggerEmpty

BeginTestCaseReportL(const TDesC &, const TDesC &, const TTime &, const TDesC &, const TDesC &)

IMPORT_C void BeginTestCaseReportL ( const TDesC & aId,
const TDesC & aExpected,
const TTime & aStartTime,
const TDesC & aInfo = KAtsLoggerEmpty,
const TDesC & aVersion = KAtsLoggerEmpty
)

BeginTestCaseReportL() is called whenever an individual testcase report begins

id = unique id of the testcase expected = expected result code of the test (if applicable) startTime= test case starting time info = short descritpion of the expected result (if applicable)

Parameters

const TDesC & aId
const TDesC & aExpected
const TTime & aStartTime
const TDesC & aInfo = KAtsLoggerEmpty
const TDesC & aVersion = KAtsLoggerEmpty

BeginTestCaseReportL(const TDesC &, const TInt, const TTime &, const TDesC &, const TDesC &)

IMPORT_C void BeginTestCaseReportL ( const TDesC & aId,
const TInt aExpected,
const TTime & aStartTime,
const TDesC & aInfo = KAtsLoggerEmpty,
const TDesC & aVersion = KAtsLoggerEmpty
)

BeginTestCaseReportL() is called whenever an individual testcase report begins

id = unique id of the testcase expected = expected result code of the test (if applicable) startTime= test case starting time info = short descritpion of the expected result (if applicable)

Parameters

const TDesC & aId
const TInt aExpected
const TTime & aStartTime
const TDesC & aInfo = KAtsLoggerEmpty
const TDesC & aVersion = KAtsLoggerEmpty

BeginTestReportL()

IMPORT_C void BeginTestReportL ( )

BeginTestReportL() should be called at the beginning of the program, before any testing begins

BeginTestSetL(const TDesC &, const TDesC &, const TDesC &, const TDesC &)

IMPORT_C void BeginTestSetL ( const TDesC & aFactory = KAtsLoggerNa,
const TDesC & aComponent = KAtsLoggerNa,
const TDesC & aVersion = KAtsLoggerNa,
const TDesC & aDescription = KAtsLoggerEmpty
)

BeginTestSetL() must be called when a new test set begins

factory = component factory whose component is being tested component = name of the software component being tested version = version of the software component description = short, optional description of the batch

Parameters

const TDesC & aFactory = KAtsLoggerNa
const TDesC & aComponent = KAtsLoggerNa
const TDesC & aVersion = KAtsLoggerNa
const TDesC & aDescription = KAtsLoggerEmpty

BufferL(CBufBase *, TInt &, const TDesC &)

TInt BufferL ( CBufBase * aBufBase,
TInt & aLength,
const TDesC & aBuf
) [private]

Expands buffer and then writes aBuf into it.

Parameters

CBufBase * aBufBase
TInt & aLength
const TDesC & aBuf

CheckDirectoryL(const TDesC &, TChar &)

TBool CheckDirectoryL ( const TDesC & aDirName,
TChar & aDrive
) [private]

Checks whether directory exist or not

Parameters

const TDesC & aDirName
TChar & aDrive

CloseL()

IMPORT_C void CloseL ( )

Closes opened resources. Desctructor calls this if it is not called before.

CloseTagIndentL(const TDesC &)

void CloseTagIndentL ( const TDesC & aTag ) [protected]

Closes a tag and descreases indent level.

Parameters

const TDesC & aTag

CloseTagL(const TDesC &)

void CloseTagL ( const TDesC & aTag ) [protected]

Closes a tag;

Parameters

const TDesC & aTag

CommentL(const TDesC &)

IMPORT_C void CommentL ( const TDesC & aMsg )

Parameters

const TDesC & aMsg

CommentL(TRefByValue< const TDesC >, ...)

IMPORT_C void CommentL ( TRefByValue < const TDesC > aFmt,
...
)

Parameters

TRefByValue < const TDesC > aFmt
...

ConstructL(TBool)

void ConstructL ( TBool aAfterReboot ) [private]

By default Symbian OS two-phase constructor is private.

Parameters

TBool aAfterReboot

ContinueAfterRebootL()

IMPORT_C void ContinueAfterRebootL ( )

ContinueAfterRebootL() must be called to continue after reboot.

DebugL(const TDesC &)

IMPORT_C void DebugL ( const TDesC & aMsg )

DebugL() , WarningL() , ErrorL() and CommentL() as used to place informational messages of appropriate debug level into the test report. These functions can be called anywhere between BeginReportL() and EndReportL().

Parameters

const TDesC & aMsg

DebugL(TRefByValue< const TDesC >, ...)

IMPORT_C void DebugL ( TRefByValue < const TDesC > aFmt,
...
)

Parameters

TRefByValue < const TDesC > aFmt
...

DebugOutput(const TDesC &)

IMPORT_C void DebugOutput ( const TDesC & aMsg )

Parameters

const TDesC & aMsg

EncodeLC(const TDesC &)

HBufC * EncodeLC ( const TDesC & aMsg ) [protected]

Encodes XML special chararacters from message

Parameters

const TDesC & aMsg

EndTestCaseL()

IMPORT_C void EndTestCaseL ( )

EndTestCaseL() is called when an individual testcase ends

EndTestReportL()

IMPORT_C void EndTestReportL ( )

EndTestReportL() must be called at the end of the program

EndTestSetL()

IMPORT_C void EndTestSetL ( )

EndTestSetL() must be called as soon as a test set ends

ErrorL(const TDesC &)

IMPORT_C void ErrorL ( const TDesC & aMsg )

Parameters

const TDesC & aMsg

ErrorL(TRefByValue< const TDesC >, ...)

IMPORT_C void ErrorL ( TRefByValue < const TDesC > aFmt,
...
)

Parameters

TRefByValue < const TDesC > aFmt
...

ErrorMessage(const TInt &)

IMPORT_C const TPtrC ErrorMessage ( const TInt & aError ) [static]

Returns error message. Also includes base E32 error codes.

Parameters

const TInt & aError

FormatDateLC(TDateTime)

HBufC * FormatDateLC ( TDateTime aDate ) [private]

Formats given date to a format of yyyy-mm-dd hh:mm:ss

Parameters

TDateTime aDate

FormatTimeLC(TTimeIntervalMicroSeconds)

HBufC * FormatTimeLC ( TTimeIntervalMicroSeconds aTime ) [private]

Formats given time to a format of hh:mm:ss

IsTransitionLegal(const TReportStage &)

TBool IsTransitionLegal ( const TReportStage & aNewStage ) [protected]

Checks whether report stage transition is legal.

Parameters

const TReportStage & aNewStage

IsValid()

IMPORT_C TBool IsValid ( )

IsValid() returns ETrue if this logger is valid and able to write log.

LineFeedL()

void LineFeedL ( ) [protected]

Outputs line feed.

NewL(const TDesC &, TBool)

IMPORT_C CAtsLogger * NewL ( const TDesC & aName,
TBool aAfterReboot = EFalse
) [static]

Symbian OS constructor

Parameters

const TDesC & aName
TBool aAfterReboot = EFalse

OpenExistingFileL(const TDesC &)

TInt OpenExistingFileL ( const TDesC & aFileName ) [private]

Open existing file if already exist

Parameters

const TDesC & aFileName

OpenTagIndentL(const TDesC &)

void OpenTagIndentL ( const TDesC & aTag ) [protected]

Opens a tag and increases indent level.

Parameters

const TDesC & aTag

OpenTagIndentL(const TDesC &, const TDesC &, const TDesC &)

void OpenTagIndentL ( const TDesC & aTag,
const TDesC & aAttribute,
const TDesC & aValue
) [protected]

Opens a tag with attribute having value and increases indent level.

Parameters

const TDesC & aTag
const TDesC & aAttribute
const TDesC & aValue

OpenTagL(const TDesC &)

void OpenTagL ( const TDesC & aTag ) [protected]

Opens a tag.

Parameters

const TDesC & aTag

OpenTagL(const TDesC &, const TDesC &, const TDesC &)

void OpenTagL ( const TDesC & aTag,
const TDesC & aAttribute,
const TDesC & aValue
) [protected]

Opens a tag with attribute and value.

Parameters

const TDesC & aTag
const TDesC & aAttribute
const TDesC & aValue

RawLogL(const TDesC &)

IMPORT_C TInt RawLogL ( const TDesC & aMsg )

RawLogL() writes to a separate log file.

Parameters

const TDesC & aMsg

RawLogL(TRefByValue< const TDesC >, ...)

IMPORT_C TInt RawLogL ( TRefByValue < const TDesC > aFmt,
...
)

Parameters

TRefByValue < const TDesC > aFmt
...

ReplaceFileL(const TDesC &)

TInt ReplaceFileL ( const TDesC & aFileName ) [private]

Replaces file if already exist

Parameters

const TDesC & aFileName

SaveForRebootL()

IMPORT_C void SaveForRebootL ( )

SaveForRebootL() should be called before reboot to save data.

SetDebugOutput(TBool)

IMPORT_C void SetDebugOutput ( TBool aFlag )

Set this to ETrue if XML log should be written to the debug port also.

Parameters

TBool aFlag

SetFullReporting(TBool)

IMPORT_C void SetFullReporting ( TBool aFlag )

Set this to ETrue if client should use full set of reporting methods

Parameters

TBool aFlag

SetIndentation(TBool)

IMPORT_C void SetIndentation ( TBool aFlag )

Set this to ETrue if XML log should have indentation. This only adds human readability.

Parameters

TBool aFlag

SetTestCaseResultL(const TInt)

IMPORT_C void SetTestCaseResultL ( const TInt aResult )

SetTestCaseResultL() sets the actual result of the test (if applicable), this should correspond to the expected result (see BeginTestCase) if the test succeeds.

Must be called between calls to BeginTestCaseL() and EndTestCaseL() .

Parameters

const TInt aResult

SetTestCaseResultL(const TDesC &)

IMPORT_C void SetTestCaseResultL ( const TDesC & aResult = KAtsLoggerEmpty )

Parameters

const TDesC & aResult = KAtsLoggerEmpty

SetTestCaseResultL(TRefByValue< const TDesC >, ...)

IMPORT_C void SetTestCaseResultL ( TRefByValue < const TDesC > aFmt,
...
)

Parameters

TRefByValue < const TDesC > aFmt
...

TagL(const TDesC &, const TDesC &)

void TagL ( const TDesC & aTag,
const TDesC & aMsg
) [protected]

Outputs message closed by the tags.

Parameters

const TDesC & aTag
const TDesC & aMsg

TagL(const TDesC &, const TDesC &, const TDesC &, const TDesC &)

void TagL ( const TDesC & aTag,
const TDesC & aMsg,
const TDesC & aAttribute,
const TDesC & aValue
) [protected]

Adds attribute with value to the message and outputs message closed by the tags.

Parameters

const TDesC & aTag
const TDesC & aMsg
const TDesC & aAttribute
const TDesC & aValue

TestCaseFailed()

IMPORT_C void TestCaseFailed ( )

TestCaseFailed() must be called between calls to BeginTestCase() and EndTestCase(). This results test case to be failed.

TestCaseNa()

IMPORT_C void TestCaseNa ( )

TestCaseNa() must be called between calls to BeginTestCase() and EndTestCase(). This results test case to be N/A.

TestCasePassed()

IMPORT_C void TestCasePassed ( )

TestCasePassed() must be called between calls to BeginTestCase() and EndTestCase(). This results test case to be passed.

TestCaseSkipped()

IMPORT_C void TestCaseSkipped ( )

TestCaseSkipped() must be called between calls to BeginTestCase() and EndTestCase(). This results test case to be skipped.

TimeStampedMessageL(const TDesC &, const TDesC &)

void TimeStampedMessageL ( const TDesC & aTag,
const TDesC & aMsg
) [protected]

Outputs message closed by the tags. This is used with DebugL() , WarningL() , ErrorL() and CommentL() . Time stamp is added to the message.

Parameters

const TDesC & aTag
const TDesC & aMsg

WarningL(const TDesC &)

IMPORT_C void WarningL ( const TDesC & aMsg )

Parameters

const TDesC & aMsg

WarningL(TRefByValue< const TDesC >, ...)

IMPORT_C void WarningL ( TRefByValue < const TDesC > aFmt,
...
)

Parameters

TRefByValue < const TDesC > aFmt
...

WriteBufferToDebugPortL(CBufBase *)

TInt WriteBufferToDebugPortL ( CBufBase * aCBufBase ) [private]

Writes whole buffer to the debug port. Does not reset buffer.

Parameters

CBufBase * aCBufBase

WriteBufferToFileL(CBufBase *, const TDesC &)

TInt WriteBufferToFileL ( CBufBase * aCBufBase,
const TDesC & aFileName
) [private]

Writes whole buffer to a file. Does not reset buffer.

Parameters

CBufBase * aCBufBase
const TDesC & aFileName

WriteL(const TDesC &, RFile &)

void WriteL ( const TDesC & aData,
RFile & aFile
) [protected]

Writes data to the specified file.

Parameters

const TDesC & aData
RFile & aFile

WriteL(const TDesC &)

void WriteL ( const TDesC & aData ) [protected]

Writes data to the XML file.

Parameters

const TDesC & aData

Member Enumerations Documentation

Enum TReportStage

Enumerators

ENone
EUninitialized
EBeginTestReport
EBeginTestSet
EBeginTestCase
ESetTestCaseVerdict
EEndTestCase
EEndTestSet
EEndTestReport
EFinished

Member Data Documentation

TBool iClosed

TBool iClosed [private]

TBool iDoDebugOutput

TBool iDoDebugOutput [private]

TBool iDoIndentation

TBool iDoIndentation [private]

TBool iFullReportingMode

TBool iFullReportingMode [private]

TBool iInTestCase

TBool iInTestCase [private]

int iIndentLevel

int iIndentLevel [private]

TBool iLineFeedDone

TBool iLineFeedDone [private]

const TFileName iName

const TFileName iName [protected]

TBool iRawLog

TBool iRawLog [private]

TFileName iRawLogFileName

TFileName iRawLogFileName [private]

CAtsLogger::TReportStage iReportStage

CAtsLogger::TReportStage iReportStage [protected]

RFs iRfs

RFs iRfs [private]

CAtsLogger::TTestCase iTestCase

CAtsLogger::TTestCase iTestCase [protected]

CAtsLogger::TTestSet iTestSet

CAtsLogger::TTestSet iTestSet [protected]

TBool iValid

TBool iValid [private]

CBufBase * iXmlBuffer

CBufBase * iXmlBuffer [private]

TInt iXmlBufferLength

TInt iXmlBufferLength [private]

TBool iXmlLog

TBool iXmlLog [private]

TFileName iXmlLogFileName

TFileName iXmlLogFileName [private]