symbianunittestfw/symbianunittestfw_pub/symbian_unit_test_api/inc/symbianunittestsuite.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 SYMBIANUNITTESTSUITE_H
       
    19 #define SYMBIANUNITTESTSUITE_H
       
    20 
       
    21 // INCLUDES
       
    22 #include <symbianunittestinterface.h>
       
    23 #include <e32base.h>
       
    24 
       
    25 // CLASS DECLARATION
       
    26 /**
       
    27 * A class to collect a number of unit tests to be executed 
       
    28 * during a particular test run.
       
    29 *
       
    30 * @lib symbianunittestfw.lib
       
    31 */
       
    32 class CSymbianUnitTestSuite : public CBase, public MSymbianUnitTestInterface
       
    33     {
       
    34     public: // Constructors and destructor
       
    35 
       
    36         /**
       
    37         * Creates an empty unit test suite.
       
    38         * @param aName the name of the unit test suite
       
    39         * @return a new instance of CSymbianUnitTestSuite, 
       
    40         *         the ownership is transferred
       
    41         */        
       
    42         IMPORT_C static CSymbianUnitTestSuite* NewL( const TDesC& aName );
       
    43         
       
    44         /**
       
    45         * Creates an empty unit test suite and pushes it to the CleanupStack.
       
    46         * @param aName the name of the unit test suite
       
    47         * @return a new instance of CSymbianUnitTestSuite, 
       
    48         *         the ownership is transferred
       
    49         */        
       
    50         IMPORT_C static CSymbianUnitTestSuite* NewLC( const TDesC& aName );
       
    51         
       
    52         /**
       
    53         * Destructor
       
    54         */        
       
    55         IMPORT_C ~CSymbianUnitTestSuite();
       
    56     
       
    57     public: // From MSymbianUnitTestInterface
       
    58 
       
    59         /**
       
    60         * Function called by the framework to execute 
       
    61         * the unit tests contained in this test suite.
       
    62         * There is no need to call this function directly from the unit tests.
       
    63         * 
       
    64         * @param aObserver an observer for the test progress 
       
    65         * @param aResult the test result
       
    66         * @param aFailureSimulation the type of failure simulation to be used
       
    67 	* @param aTestCaseNames the test cases to run
       
    68 	* @param aTimeout the time out value for test execution
       
    69         */        
       
    70         IMPORT_C void ExecuteL( 
       
    71             MSymbianUnitTestObserver& aObserver,
       
    72             CSymbianUnitTestResult& aResult,
       
    73             MSymbianUnitTestInterface::TFailureSimulation aFailureSimulation,
       
    74 	    const CDesCArray& aTestCaseNames,
       
    75 	    TInt aTimeout );
       
    76 
       
    77         /**
       
    78         * Returns the number of unit tests contained in this unit test suite
       
    79         * @return The number of unit tests in this unit test suite
       
    80         */        
       
    81         IMPORT_C TInt TestCaseCount();
       
    82  
       
    83         /**
       
    84         * @return The name of this unit test suite
       
    85         */        
       
    86         IMPORT_C const TDesC& Name() const;
       
    87         
       
    88         /**
       
    89         * @return the array of test case names
       
    90         */
       
    91         IMPORT_C void TestCaseNamesL(CDesCArray& aTestCaseNames);
       
    92   
       
    93     public: // New functions
       
    94 
       
    95         /**
       
    96         * Adds a new unit test to this unit test suite.
       
    97         * @param aTest the test to be added, the ownership is transferred. 
       
    98         */        
       
    99         IMPORT_C void AddL( MSymbianUnitTestInterface* aTest );        
       
   100         
       
   101     protected: // Constructors
       
   102     
       
   103         IMPORT_C CSymbianUnitTestSuite();
       
   104         IMPORT_C void ConstructL( const TDesC& aName );
       
   105     
       
   106     private: // Data
       
   107         
       
   108         RPointerArray< MSymbianUnitTestInterface > iTests;
       
   109         HBufC* iName;
       
   110     };
       
   111 
       
   112 #endif // SYMBIANUNITTESTSUITE_H