testexecfw/symbianunittestfw/sutfw/sutfwcore/sutfwframework/src/symbianunittestresult.cpp
changeset 1 bbd31066657e
parent 0 3e07fef1e154
equal deleted inserted replaced
0:3e07fef1e154 1:bbd31066657e
    17 
    17 
    18 #include "symbianunittestresult.h"
    18 #include "symbianunittestresult.h"
    19 #include "symbianunittestfailure.h"
    19 #include "symbianunittestfailure.h"
    20 #include "sutlogger.h"
    20 #include "sutlogger.h"
    21 
    21 
       
    22 
    22 _LIT8( KSymbianUnitTestLeaveCodeMessageFormat, "Leave code: %d" );
    23 _LIT8( KSymbianUnitTestLeaveCodeMessageFormat, "Leave code: %d" );
    23 _LIT8( KSymbianUnitTestMemoryLeakPhrase, "Leaked %d bytes of memory" );
    24 _LIT8( KSymbianUnitTestMemoryLeakPhrase, "Leaked %d bytes of memory" );
    24 _LIT8( KSymbianUnitTestPanicPhrase, "Panic: " );
    25 _LIT8( KSymbianUnitTestPanicPhrase, "Panic: " );
    25 _LIT8( KSymbianUnitTestPanicReasonFormat, ", reason: %d" );
    26 _LIT8( KSymbianUnitTestPanicReasonFormat, ", reason: %d" );
    26 _LIT8( KSymbianUnitTestAllocFailureRateFormat, ", alloc failure rate: %d" );
    27 _LIT8( KSymbianUnitTestAllocFailureRateFormat, ", alloc failure rate: %d" );
    70 // -----------------------------------------------------------------------------
    71 // -----------------------------------------------------------------------------
    71 //
    72 //
    72 void CSymbianUnitTestResult::ConstructL()
    73 void CSymbianUnitTestResult::ConstructL()
    73     {
    74     {
    74     iCurrentTestName = KNullDesC().AllocL();
    75     iCurrentTestName = KNullDesC().AllocL();
       
    76     iTestCaseNames = new (ELeave)CDesCArrayFlat(10);
    75     }
    77     }
    76 
    78 
    77 // -----------------------------------------------------------------------------
    79 // -----------------------------------------------------------------------------
    78 //
    80 //
    79 // -----------------------------------------------------------------------------
    81 // -----------------------------------------------------------------------------
    80 //
    82 //
    81 CSymbianUnitTestResult::~CSymbianUnitTestResult()
    83 CSymbianUnitTestResult::~CSymbianUnitTestResult()
    82     {
    84     {
    83     delete iCurrentTestName;
    85     delete iCurrentTestName;
       
    86     delete iTestCaseNames;
    84     iFailures.ResetAndDestroy();
    87     iFailures.ResetAndDestroy();
    85     }
    88     }
    86 
    89 
    87 // -----------------------------------------------------------------------------
    90 // -----------------------------------------------------------------------------
    88 //
    91 //
   139     TReal64 ms= microSeconds.Int64();
   142     TReal64 ms= microSeconds.Int64();
   140     //log the test time in milliseconds
   143     //log the test time in milliseconds
   141     SUT_LOG_FORMAT2(_L("EndCase Result[%S] Time[%d]ms"), 
   144     SUT_LOG_FORMAT2(_L("EndCase Result[%S] Time[%d]ms"), 
   142         iCurrentResult?&KSymbianUnitTestPass:&KSymbianUnitTestFail,
   145         iCurrentResult?&KSymbianUnitTestPass:&KSymbianUnitTestFail,
   143 	microSeconds.Int64()/1000);
   146 	microSeconds.Int64()/1000);
   144     //SUT_LOG_FORMAT2(_L("EndCase Result[%S] Time[%d]ms"), &KSymbianUnitTestPass, microSeconds.Int64()/1000);
   147     if (iCurrentResult)
       
   148         {
       
   149         //only add passed case to the testcasenames
       
   150         iTestCaseNames->AppendL(*iCurrentTestName);
       
   151         }
   145     }
   152     }
   146 
   153 
   147 
   154 
   148 
   155 
   149 // -----------------------------------------------------------------------------
   156 // -----------------------------------------------------------------------------
   315     SUT_LOG_FORMAT(KSymbianUnitTestFailed, &aFailureText);
   322     SUT_LOG_FORMAT(KSymbianUnitTestFailed, &aFailureText);
   316     iCurrentResult = EFalse;
   323     iCurrentResult = EFalse;
   317     iFailures.AppendL( failure );
   324     iFailures.AppendL( failure );
   318     CleanupStack::Pop( failure ); 
   325     CleanupStack::Pop( failure ); 
   319     }
   326     }
       
   327 
       
   328 // -----------------------------------------------------------------------------
       
   329 //
       
   330 // -----------------------------------------------------------------------------
       
   331 //
       
   332 const CDesCArray& CSymbianUnitTestResult::TestCaseNames() const
       
   333     {
       
   334     return *iTestCaseNames;
       
   335     }