symbianunittestfw/sutfw/sutfwcore/sutfwframework/tsrc/inc/ut_symbianunittest.h
branchRCL_3
changeset 3 9397a16b6eb8
parent 1 6edeef394eb7
equal deleted inserted replaced
1:6edeef394eb7 3:9397a16b6eb8
     1 /*
       
     2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description:  
       
    15 *
       
    16 */
       
    17 
       
    18 #ifndef UT_SYMBIANUNITTEST_H
       
    19 #define UT_SYMBIANUNITTEST_H
       
    20 
       
    21 // INCLUDES
       
    22 #include <symbianunittest.h>
       
    23 #include "symbianunittestobserver.h"
       
    24 #include <badesca.h>
       
    25 
       
    26 // FORWARD DECLARATIONS
       
    27 class CSymbianUnitTestResult;
       
    28 
       
    29 // CLASS DECLARATION
       
    30 NONSHARABLE_CLASS(UT_CSymbianUnitTest) : 
       
    31     public CSymbianUnitTest, 
       
    32     public MSymbianUnitTestObserver
       
    33     {
       
    34     public: // Constructors and destructor
       
    35     
       
    36         static UT_CSymbianUnitTest* NewL();
       
    37         static UT_CSymbianUnitTest* NewLC();
       
    38         ~UT_CSymbianUnitTest();
       
    39     
       
    40     public: // From MSymbianUnitTestObserver
       
    41         
       
    42         void TestPass(const TDesC& aTestCaseName);
       
    43         void TestFailed(const TDesC& aTestCaseName, const TDesC8& aErrMsg);
       
    44         
       
    45     protected: // Test functions
       
    46     
       
    47         void SetupL();
       
    48         void Teardown();        
       
    49         void UT_NameL();
       
    50         void UT_IsMemoryAllocationFailureSimulationUsedL();
       
    51         void UT_PanicInTestL();
       
    52         void UT_ErrorInSetupL();
       
    53         void UT_LeaveInTestL();
       
    54         void UT_MemoryLeakInTestL();
       
    55         void UT_EqualsAssertsL();
       
    56         void UT_FailingAssertsL();
       
    57         void UT_PassingAssertsL();
       
    58         void UT_TestCaseNamesL();
       
    59         void UT_TimeoutL();
       
    60         void UT_ResourceLeakInTestL();
       
    61         void UT_RequestLeakInTestL();
       
    62 
       
    63     protected: // Failing functions to simulate failing tests
       
    64         
       
    65         void SimulatePanicL();
       
    66         void SimulateLeaveL();
       
    67         void SimulateMemoryLeakL();
       
    68         void SimulateFailingAssertL();
       
    69         void SimulateFailingAssertWithIntsL();
       
    70         void SimulateFailingAssertWithDesC8sL();
       
    71         void SimulateFailingAssertWithDesC16sL();
       
    72         void SimulateFailingAssertLeaveL();
       
    73         void SimulateFailingAssertLeaveWithSpecificValueL();
       
    74         void SimulateTimeoutL();
       
    75         void SimulateEqualsAssertWithStringL();
       
    76 		void SimulateEqualsAssertWithStringFailL();
       
    77 		void SimulateEqualsAssertWithString8L();
       
    78 		void SimulateEqualsAssertWithString8FailL();
       
    79 		void SimulateEqualsAssertWithIntL();
       
    80 		void SimulateEqualsAssertWithIntFailL();
       
    81         void SimulateResourceLeakL();
       
    82         void SimulateRequestLeakL();
       
    83         
       
    84     protected: // Dummy function to simulate setup and teardown
       
    85         
       
    86         void Dummy();
       
    87         
       
    88     private: // Contructors
       
    89         
       
    90         UT_CSymbianUnitTest();
       
    91         void ConstructL();
       
    92         
       
    93     private: // Data
       
    94         
       
    95         CSymbianUnitTestResult* iTestResult;
       
    96         UT_CSymbianUnitTest* iUnitTest;
       
    97         TInt iExecutedTestCount;
       
    98         CDesCArray* iTestCaseNames;
       
    99     };
       
   100 
       
   101 #endif // UT_SYMBIANUNITTEST_H