sl@0: // Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // This file contains the test steps for Unit Test Suite 12 : TestSuite.cpp sl@0: // sl@0: // sl@0: sl@0: // EPOC includes sl@0: #include sl@0: sl@0: // Test system includes sl@0: #include sl@0: sl@0: // Specific includes for this test suite sl@0: #include "TSU_MmTsthStep12.h" sl@0: #include "TSU_MmTsthSuite12.h" sl@0: sl@0: // Specific includes for these test steps sl@0: #include "TSU_MmTsth12.h" sl@0: sl@0: // -------------------------------------------- sl@0: sl@0: // Unit Test Suite 12 : TestSuite.cpp sl@0: // Depends on : TestStep sl@0: sl@0: // Tests :- sl@0: // 1 ConstructL / InitialiseL sl@0: // 2 AddTestStepL sl@0: // 3 DoTestStep sl@0: // 11 Log - not tested explicitly (if things are logging, it's working!) sl@0: // 12 LogExtra - not tested explicitly sl@0: // 21 GetVersion sl@0: // 22 accessors sl@0: sl@0: // --------------------- sl@0: // RTestMmTsthU1201 sl@0: RTestMmTsthU1201* RTestMmTsthU1201::NewL() sl@0: { sl@0: RTestMmTsthU1201* self = new(ELeave) RTestMmTsthU1201; sl@0: return self; sl@0: } sl@0: sl@0: // Each test step initialises its own name. sl@0: RTestMmTsthU1201::RTestMmTsthU1201() sl@0: { sl@0: iTestStepName = _L("MM-TSTH-U-1201"); sl@0: } sl@0: sl@0: // preamble sl@0: TVerdict RTestMmTsthU1201::OpenL() sl@0: { sl@0: // stub - purpose is that for this test we do not run the parent preamble sl@0: // which initialises iStepStub sl@0: return iTestStepResult = EPass; sl@0: } sl@0: sl@0: // postamble sl@0: void RTestMmTsthU1201::Close() sl@0: { sl@0: } sl@0: sl@0: // do the test step sl@0: TVerdict RTestMmTsthU1201::DoTestStepL() sl@0: { sl@0: INFO_PRINTF1(_L("Unit test for TestSuite - ConstructL / InitialiseL")); sl@0: sl@0: TVerdict currentVerdict = EPass; sl@0: sl@0: CTestSuiteVirtualStub* theSuiteStub = new (ELeave) CTestSuiteVirtualStub; sl@0: CleanupStack::PushL(theSuiteStub); sl@0: TRAPD(err, theSuiteStub->ConstructL()); sl@0: if(err != KErrNone) sl@0: { sl@0: ERR_PRINTF1(_L("CTestSuiteVirtualStub::ConstructL() left")); sl@0: CleanupStack::PopAndDestroy(theSuiteStub); sl@0: return iTestStepResult = EFail; sl@0: } sl@0: iSuiteStub = theSuiteStub; sl@0: sl@0: // NB ensure the suite can log - set its logger to ours sl@0: iSuiteStub->SetLogSystem(iSuite->LogSystem()); sl@0: sl@0: // ConstructL calls InitialiseL. sl@0: // the suite should be called TestSuiteVirtualStub and contain one step, TestStepVirtualStub sl@0: // we can't access this direct but we can run DoTestStep() on it, sl@0: // and any error code other than ETestSuiteError is a pass sl@0: sl@0: TVerdict stepVerdict = iSuiteStub->DoTestStep(_L("TestStepVirtualStub"), KNullDesC, KNullDesC); sl@0: if(stepVerdict == ETestSuiteError) sl@0: { sl@0: ERR_PRINTF1(_L("RTestSuiteVirtualStub::InitialiseL() did not setup test step")); sl@0: CleanupStack::PopAndDestroy(theSuiteStub); sl@0: return iTestStepResult = EFail; sl@0: } sl@0: sl@0: CleanupStack::PopAndDestroy(theSuiteStub); sl@0: iSuiteStub = NULL; sl@0: sl@0: return iTestStepResult = currentVerdict; // should be EPass if we've got here sl@0: } sl@0: sl@0: // ------------------------ sl@0: // RTestMmTsthU1202 sl@0: sl@0: RTestMmTsthU1202* RTestMmTsthU1202::NewL() sl@0: { sl@0: RTestMmTsthU1202* self = new(ELeave) RTestMmTsthU1202; sl@0: return self; sl@0: } sl@0: sl@0: // Each test step initialises its own name. sl@0: RTestMmTsthU1202::RTestMmTsthU1202() sl@0: { sl@0: iTestStepName = _L("MM-TSTH-U-1202"); sl@0: } sl@0: sl@0: // do the test step sl@0: TVerdict RTestMmTsthU1202::DoTestStepL() sl@0: { sl@0: INFO_PRINTF1(_L("Unit test for TestSuite - AddTestStepL")); sl@0: sl@0: TVerdict currentVerdict = EPass; sl@0: sl@0: TRAPD(err, iSuiteStub->AddTestStepL(RTestStepVirtualStub2::NewL())); sl@0: if(err != KErrNone) sl@0: { sl@0: ERR_PRINTF1(_L("RTestSuiteVirtualStub::AddTestStepL() left")); sl@0: return iTestStepResult = EFail; sl@0: } sl@0: sl@0: // find the step we just added sl@0: TVerdict stepVerdict = iSuiteStub->DoTestStep(_L("TestStepVirtualStub2"), KNullDesC, KNullDesC); sl@0: if(stepVerdict == ETestSuiteError) sl@0: { sl@0: ERR_PRINTF1(_L("RTestSuiteVirtualStub::AddTestStepL() failed")); sl@0: return iTestStepResult = EFail; sl@0: } sl@0: sl@0: // no pop / delete - the SUITE owns the step, we don't. sl@0: return iTestStepResult = currentVerdict; // should be EPass if we've got here sl@0: } sl@0: sl@0: // ------------------------ sl@0: // RTestMmTsthU1203 sl@0: sl@0: RTestMmTsthU1203* RTestMmTsthU1203::NewL() sl@0: { sl@0: RTestMmTsthU1203* self = new(ELeave) RTestMmTsthU1203; sl@0: return self; sl@0: } sl@0: sl@0: // Each test step initialises its own name. sl@0: RTestMmTsthU1203::RTestMmTsthU1203() sl@0: { sl@0: iTestStepName = _L("MM-TSTH-U-1203"); sl@0: } sl@0: sl@0: // do the test step sl@0: TVerdict RTestMmTsthU1203::DoTestStepL() sl@0: { sl@0: INFO_PRINTF1(_L("Unit test for TestSuite - DoTestStepL")); sl@0: sl@0: TVerdict currentVerdict = EPass; sl@0: sl@0: // do the step. this time we're testing for PASS only sl@0: TVerdict stepVerdict = iSuiteStub->DoTestStep(_L("TestStepVirtualStub"), KNullDesC, KNullDesC); sl@0: if(stepVerdict != EPass) sl@0: { sl@0: ERR_PRINTF1(_L("RTestSuiteVirtualStub::DoTestStepL() failed")); sl@0: return iTestStepResult = EFail; sl@0: } sl@0: sl@0: return iTestStepResult = currentVerdict; // should be EPass if we've got here sl@0: } sl@0: sl@0: // ------------------------ sl@0: // RTestMmTsthU1221 sl@0: sl@0: RTestMmTsthU1221* RTestMmTsthU1221::NewL() sl@0: { sl@0: RTestMmTsthU1221* self = new(ELeave) RTestMmTsthU1221; sl@0: return self; sl@0: } sl@0: sl@0: // Each test step initialises its own name. sl@0: RTestMmTsthU1221::RTestMmTsthU1221() sl@0: { sl@0: iTestStepName = _L("MM-TSTH-U-1221"); sl@0: } sl@0: sl@0: // do the test step sl@0: TVerdict RTestMmTsthU1221::DoTestStepL() sl@0: { sl@0: INFO_PRINTF1(_L("Unit test for TestSuite - GetVersion")); sl@0: sl@0: TVerdict currentVerdict = EPass; sl@0: sl@0: // get the version, compare it against our known value sl@0: _LIT(KTestVersion,"CTestSuiteVirtualStub Version"); sl@0: TPtrC version = iSuiteStub->GetVersion(); sl@0: if(version != KTestVersion) sl@0: { sl@0: ERR_PRINTF1(_L("RTestSuiteVirtualStub::GetVersion() failed")); sl@0: return iTestStepResult = EFail; sl@0: } sl@0: sl@0: return iTestStepResult = currentVerdict; // should be EPass if we've got here sl@0: } sl@0: sl@0: // ------------------------ sl@0: // RTestMmTsthU1222 sl@0: sl@0: RTestMmTsthU1222* RTestMmTsthU1222::NewL() sl@0: { sl@0: RTestMmTsthU1222* self = new(ELeave) RTestMmTsthU1222; sl@0: return self; sl@0: } sl@0: sl@0: // Each test step initialises its own name. sl@0: RTestMmTsthU1222::RTestMmTsthU1222() sl@0: { sl@0: iTestStepName = _L("MM-TSTH-U-1222"); sl@0: } sl@0: sl@0: // do the test step. sl@0: TVerdict RTestMmTsthU1222::DoTestStepL() sl@0: { sl@0: INFO_PRINTF1(_L("Unit test for TestSuite - accessors")); sl@0: sl@0: TVerdict currentVerdict = EPass; sl@0: sl@0: iSuiteStub->SetSeverity(ESevrInfo); sl@0: TInt theSev = iSuiteStub->Severity(); sl@0: if(theSev != ESevrInfo) sl@0: { sl@0: ERR_PRINTF1(_L("CTestSuite::SetSeverity() failed")); sl@0: return iTestStepResult = EFail; sl@0: } sl@0: sl@0: iSuiteStub->SetStepStatus(EStepStatusFinished); sl@0: TTestStepStatus theStepStatus = iSuiteStub->StepStatus(); sl@0: if(theStepStatus != EStepStatusFinished) sl@0: { sl@0: ERR_PRINTF1(_L("CTestSuite::SetStepStatus() failed")); sl@0: return iTestStepResult = EFail; sl@0: } sl@0: sl@0: CLog* theLog = CLog::NewL(); sl@0: iSuiteStub->SetLogSystem(theLog); sl@0: CLog* theLogSystem = iSuiteStub->LogSystem(); sl@0: if(theLog != theLogSystem) sl@0: { sl@0: ERR_PRINTF1(_L("CTestSuite::SetLogSystem() failed")); sl@0: delete theLog; sl@0: return iTestStepResult = EFail; sl@0: } sl@0: sl@0: delete theLog; sl@0: return iTestStepResult = currentVerdict; // should be EPass if we've got here sl@0: }