CAtsLogger Class Reference

class CAtsLogger : public CBase

Inherits from

Nested Classes and Structures

Public Member Functions
~CAtsLogger()
IMPORT_C voidBeginTestCaseL(const TDesC &, const TDesC &, const TDesC &, const TDesC &)
IMPORT_C voidBeginTestCaseL(const TDesC &, const TInt, const TDesC &, const TDesC &)
IMPORT_C voidBeginTestCaseReportL(const TDesC &, const TDesC &, const TTime &, const TDesC &, const TDesC &)
IMPORT_C voidBeginTestCaseReportL(const TDesC &, const TInt, const TTime &, const TDesC &, const TDesC &)
IMPORT_C voidBeginTestReportL()
IMPORT_C voidBeginTestSetL(const TDesC &, const TDesC &, const TDesC &, const TDesC &)
IMPORT_C voidCloseL()
IMPORT_C voidCommentL(const TDesC &)
IMPORT_C voidCommentL(TRefByValue< const TDesC >, ...)
IMPORT_C voidContinueAfterRebootL()
IMPORT_C voidDebugL(const TDesC &)
IMPORT_C voidDebugL(TRefByValue< const TDesC >, ...)
IMPORT_C voidDebugOutput(const TDesC &)
IMPORT_C voidEndTestCaseL()
IMPORT_C voidEndTestReportL()
IMPORT_C voidEndTestSetL()
IMPORT_C voidErrorL(const TDesC &)
IMPORT_C voidErrorL(TRefByValue< const TDesC >, ...)
IMPORT_C const TPtrCErrorMessage(const TInt &)
IMPORT_C TBoolIsValid()
IMPORT_C CAtsLogger *NewL(const TDesC &, TBool)
IMPORT_C TIntRawLogL(const TDesC &)
IMPORT_C TIntRawLogL(TRefByValue< const TDesC >, ...)
IMPORT_C voidSaveForRebootL()
IMPORT_C voidSetDebugOutput(TBool)
IMPORT_C voidSetFullReporting(TBool)
IMPORT_C voidSetIndentation(TBool)
IMPORT_C voidSetTestCaseResultL(const TInt)
IMPORT_C voidSetTestCaseResultL(const TDesC &)
IMPORT_C voidSetTestCaseResultL(TRefByValue< const TDesC >, ...)
IMPORT_C voidTestCaseFailed()
IMPORT_C voidTestCaseNa()
IMPORT_C voidTestCasePassed()
IMPORT_C voidTestCaseSkipped()
IMPORT_C voidWarningL(const TDesC &)
IMPORT_C voidWarningL(TRefByValue< const TDesC >, ...)
Protected Member Functions
voidCloseTagIndentL(const TDesC &)
voidCloseTagL(const TDesC &)
HBufC *EncodeLC(const TDesC &)
TBool IsTransitionLegal(const TReportStage &)
voidLineFeedL()
voidOpenTagIndentL(const TDesC &)
voidOpenTagIndentL(const TDesC &, const TDesC &, const TDesC &)
voidOpenTagL(const TDesC &)
voidOpenTagL(const TDesC &, const TDesC &, const TDesC &)
voidTagL(const TDesC &, const TDesC &)
voidTagL(const TDesC &, const TDesC &, const TDesC &, const TDesC &)
voidTimeStampedMessageL(const TDesC &, const TDesC &)
voidWriteL(const TDesC &, RFile &)
voidWriteL(const TDesC &)
Private Member Functions
CAtsLogger(const TDesC &)
TInt BufferL(CBufBase *, TInt &, const TDesC &)
TBool CheckDirectoryL(const TDesC &, TChar &)
voidConstructL(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
enumTReportStage {
ENone, EUninitialized, EBeginTestReport, EBeginTestSet, EBeginTestCase, ESetTestCaseVerdict, EEndTestCase, EEndTestSet, EEndTestReport, EFinished
}
Protected Attributes
const TFileNameiName
CAtsLogger::TReportStage iReportStage
CAtsLogger::TTestCase iTestCase
CAtsLogger::TTestSet iTestSet
Private Attributes
TBool iClosed
TBool iDoDebugOutput
TBool iDoIndentation
TBool iFullReportingMode
TBool iInTestCase
intiIndentLevel
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 voidBeginTestCaseL(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 voidBeginTestCaseL(const TDesC &aId,
const TIntaExpected,
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 voidBeginTestCaseReportL(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 voidBeginTestCaseReportL(const TDesC &aId,
const TIntaExpected,
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 voidBeginTestReportL()

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 voidBeginTestSetL(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 voidCloseL()

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

CloseTagIndentL(const TDesC &)

voidCloseTagIndentL(const TDesC &aTag)[protected]

Closes a tag and descreases indent level.

Parameters

const TDesC & aTag

CloseTagL(const TDesC &)

voidCloseTagL(const TDesC &aTag)[protected]

Closes a tag;

Parameters

const TDesC & aTag

CommentL(const TDesC &)

IMPORT_C voidCommentL(const TDesC &aMsg)

Parameters

const TDesC & aMsg

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

IMPORT_C voidCommentL(TRefByValue< const TDesC >aFmt,
...
)

Parameters

TRefByValue< const TDesC > aFmt
...

ConstructL(TBool)

voidConstructL(TBoolaAfterReboot)[private]

By default Symbian OS two-phase constructor is private.

Parameters

TBool aAfterReboot

ContinueAfterRebootL()

IMPORT_C voidContinueAfterRebootL()

ContinueAfterRebootL() must be called to continue after reboot.

DebugL(const TDesC &)

IMPORT_C voidDebugL(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 voidDebugL(TRefByValue< const TDesC >aFmt,
...
)

Parameters

TRefByValue< const TDesC > aFmt
...

DebugOutput(const TDesC &)

IMPORT_C voidDebugOutput(const TDesC &aMsg)

DebugOutput() writes to RDebug

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 voidEndTestCaseL()

EndTestCaseL() is called when an individual testcase ends

EndTestReportL()

IMPORT_C voidEndTestReportL()

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

EndTestSetL()

IMPORT_C voidEndTestSetL()

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

ErrorL(const TDesC &)

IMPORT_C voidErrorL(const TDesC &aMsg)

Parameters

const TDesC & aMsg

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

IMPORT_C voidErrorL(TRefByValue< const TDesC >aFmt,
...
)

Parameters

TRefByValue< const TDesC > aFmt
...

ErrorMessage(const TInt &)

IMPORT_C const TPtrCErrorMessage(const TInt &aError)[static]

Returns error message. Also includes base E32 error codes.

Parameters

const TInt & aError

FormatDateLC(TDateTime)

HBufC *FormatDateLC(TDateTimeaDate)[private]

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

Parameters

TDateTime aDate

FormatTimeLC(TTimeIntervalMicroSeconds)

HBufC *FormatTimeLC(TTimeIntervalMicroSecondsaTime)[private]

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

Parameters

TTimeIntervalMicroSeconds aTime

IsTransitionLegal(const TReportStage &)

TBool IsTransitionLegal(const TReportStage &aNewStage)[protected]

Checks whether report stage transition is legal.

Parameters

const TReportStage & aNewStage

IsValid()

IMPORT_C TBoolIsValid()

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

LineFeedL()

voidLineFeedL()[protected]

Outputs line feed.

NewL(const TDesC &, TBool)

IMPORT_C CAtsLogger *NewL(const TDesC &aName,
TBoolaAfterReboot = 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 &)

voidOpenTagIndentL(const TDesC &aTag)[protected]

Opens a tag and increases indent level.

Parameters

const TDesC & aTag

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

voidOpenTagIndentL(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 &)

voidOpenTagL(const TDesC &aTag)[protected]

Opens a tag.

Parameters

const TDesC & aTag

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

voidOpenTagL(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 TIntRawLogL(const TDesC &aMsg)

RawLogL() writes to a separate log file.

Parameters

const TDesC & aMsg

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

IMPORT_C TIntRawLogL(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 voidSaveForRebootL()

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

SetDebugOutput(TBool)

IMPORT_C voidSetDebugOutput(TBoolaFlag)

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

Parameters

TBool aFlag

SetFullReporting(TBool)

IMPORT_C voidSetFullReporting(TBoolaFlag)

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

Parameters

TBool aFlag

SetIndentation(TBool)

IMPORT_C voidSetIndentation(TBoolaFlag)

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

Parameters

TBool aFlag

SetTestCaseResultL(const TInt)

IMPORT_C voidSetTestCaseResultL(const TIntaResult)

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 voidSetTestCaseResultL(const TDesC &aResult = KAtsLoggerEmpty)

Parameters

const TDesC & aResult = KAtsLoggerEmpty

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

IMPORT_C voidSetTestCaseResultL(TRefByValue< const TDesC >aFmt,
...
)

Parameters

TRefByValue< const TDesC > aFmt
...

TagL(const TDesC &, const TDesC &)

voidTagL(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 &)

voidTagL(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 voidTestCaseFailed()

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

TestCaseNa()

IMPORT_C voidTestCaseNa()

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

TestCasePassed()

IMPORT_C voidTestCasePassed()

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

TestCaseSkipped()

IMPORT_C voidTestCaseSkipped()

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

TimeStampedMessageL(const TDesC &, const TDesC &)

voidTimeStampedMessageL(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 voidWarningL(const TDesC &aMsg)

Parameters

const TDesC & aMsg

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

IMPORT_C voidWarningL(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 &)

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

Writes data to the specified file.

Parameters

const TDesC & aData
RFile & aFile

WriteL(const TDesC &)

voidWriteL(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

intiIndentLevel[private]

TBool iLineFeedDone

TBool iLineFeedDone[private]

const TFileName iName

const TFileNameiName[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]