// ----------------------------------------------------------------------------- // CSenFragmentBCTest::RunTestCaseL // RunTestCaseL is used to run an individual test case specified // by aTestCase. Test cases that can be run may be requested from // Test Module by GetTestCases method before calling RunTestCase. // ----------------------------------------------------------------------------- // TInt CSenFragmentBCTest::RunTestCaseL( const TInt aCaseNumber, const TFileName& /*aConfig*/, TTestResult& aResult ) { SendTestModuleVersion(); // Return value TInt execStatus = KErrNone; // Get the pointer to test case function TCaseInfo tmp = Case ( aCaseNumber ); iLog->Log( _L("-------------------------------------------------------------")); _LIT( KLogStartTC, "Starting testcase [%S]" ); iLog->Log( KLogStartTC, &tmp.iCaseName); // Check that case number was valid if ( tmp.iMethod != NULL ) { // Valid case was found, call it via function pointer iMethod = tmp.iMethod; execStatus = ( this->*iMethod )( aResult ); } else { // Valid case was not found, return error. execStatus = KErrNotFound; } // Return case execution status (not the result of the case execution) return execStatus; }
// ----------------------------------------------------------------------------- // CWSTester::ConstructL // Symbian 2nd phase constructor can leave. // ----------------------------------------------------------------------------- // void CWSTester::ConstructL() { // __UHEAP_MARK; TestModuleIf().SetBehavior(CTestModuleIf::ETestLeaksHandles); iLog = CStifLogger::NewL( KWSTesterLogPath, KWSTesterLogFile, CStifLogger::ETxt, CStifLogger::EFile, EFalse ); User::LeaveIfError(this->iFsSession.Connect()); iXmlReader = CSenXmlReader::NewL(); iErrorsOccured = FALSE; iCasePassed = EFalse; iLog->Log(_L(" /------------\\")); iLog->Log(_L("--------------------- New testcase -------------")); iLog->Log(_L(" \\------------/")); iStringPool.OpenL(); iElement = NULL; iFrg = NULL; iProvider = NULL; iArgc = 0; iRunCase = 0; iSaxTester = NULL; iSenCredential = NULL; iSenServiceConnection = NULL; iSenXmlServiceDescription = NULL; iServiceManager = NULL; iSOAPMessage = NULL; SendTestModuleVersion(); }
// ----------------------------------------------------------------------------- // Ctstl_1::ConstructL // Symbian 2nd phase constructor can leave. // ----------------------------------------------------------------------------- // void Ctstl_1::ConstructL() { iLog = CStifLogger::NewL( Ktstl_1LogPath, Ktstl_1LogFile, CStifLogger::ETxt, CStifLogger::EFile, EFalse ); SendTestModuleVersion(); }
// ----------------------------------------------------------------------------- // CSifUiTest::RunTestCaseL // ----------------------------------------------------------------------------- // TInt CSifUiTest::RunTestCaseL( const TInt aCaseNumber, const TFileName& /*aConfig*/, TTestResult& aResult ) { if( !iVersionLogged ) { SendTestModuleVersion(); iVersionLogged = ETrue; } TInt returnValue = KErrNone; TCaseInfo caseInfo = Case ( aCaseNumber ); if( caseInfo.iMethod != NULL ) { _LIT( KLogStartTC, "Starting testcase [%S]" ); iLog->Log( KLogStartTC, &caseInfo.iCaseName ); // Switch to use test case (TC) logger if necessary if( iAddTestCaseTitleToLogName ) { if( iTCLog ) { delete iTCLog; iTCLog = NULL; } TName title; TestModuleIf().GetTestCaseTitleL( title ); TFileName logFileName; logFileName.Format( KSifUiTestLogFileWithTitle, &title ); iTCLog = CStifLogger::NewL( KSifUiTestLogPath, logFileName ); iLog = iTCLog; } // Run test case iMethod = caseInfo.iMethod; TRAPD( err, returnValue = ( this->*iMethod )( aResult ) ); // Restore standard log and close test case logger if( iAddTestCaseTitleToLogName ) { iLog = iStdLog; delete iTCLog; iTCLog = NULL; } // Leave if the case execution failed User::LeaveIfError( err ); } else { returnValue = KErrNotFound; } // Return case execution status (not the result of the case execution) return returnValue; }
// ----------------------------------------------------------------------------- // Ctutility::ConstructL // Symbian 2nd phase constructor can leave. // ----------------------------------------------------------------------------- // void Ctutility::ConstructL() { //Read logger settings to check whether test case name is to be //appended to log file name. /* RSettingServer settingServer; TInt ret = settingServer.Connect(); if(ret != KErrNone) { User::Leave(ret); } // Struct to StifLogger settigs. TLoggerSettings loggerSettings; // Parse StifLogger defaults from STIF initialization file. ret = settingServer.GetLoggerSettings(loggerSettings); if(ret != KErrNone) { User::Leave(ret); } // Close Setting server session settingServer.Close(); TFileName logFileName; if(loggerSettings.iAddTestCaseTitle) { TName title; TestModuleIf().GetTestCaseTitleL(title); logFileName.Format(KtutilityLogFileWithTitle, &title); } else { logFileName.Copy(KtutilityLogFile); } */ iLog = CStifLogger::NewL( KtutilityLogPath, KtutilityLogFile, CStifLogger::ETxt, CStifLogger::EFile, EFalse ); SendTestModuleVersion(); }