uifw/AvKon/tsrc/bc/bctestutil/inc/bctestsuite.h
changeset 0 2f259fa3e83a
equal deleted inserted replaced
-1:000000000000 0:2f259fa3e83a
       
     1 /*
       
     2 * Copyright (c) 2006-2007 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:  Test suite.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef C_CBCTESTSUITE_H
       
    20 #define C_CBCTESTSUITE_H
       
    21 
       
    22 #include <e32base.h>
       
    23 #include "bctestutil.h"
       
    24 
       
    25 class CEikonEnv;
       
    26 class CBCTestCase;
       
    27 class CBCTestLogger;
       
    28 //class TApaAppCaption
       
    29 
       
    30 enum TBCTestEvent
       
    31     {
       
    32     ETestCaseStart,
       
    33     ETestCaseEnd,
       
    34     ETestCaseNoScript,
       
    35     ETestCaseUnbalancedIf   
       
    36     };
       
    37 
       
    38 /**
       
    39 * Test suite class.
       
    40 */
       
    41 class CBCTestSuite : public CBase
       
    42     {
       
    43 public: 
       
    44 
       
    45 // constructor
       
    46     /**
       
    47      * C++ default constructor.
       
    48      * @param aLogger, pointer to log project
       
    49      */
       
    50     CBCTestSuite( CBCTestLogger* aLogger );
       
    51     
       
    52     /**
       
    53      * Destructor.
       
    54      */
       
    55 	virtual ~CBCTestSuite();
       
    56 
       
    57 // new functions
       
    58     
       
    59     /**
       
    60      * Execute a test work specified by aCmd
       
    61      * @param aCmd, a value to test command.
       
    62      */    
       
    63     void RunL(int aCmd);
       
    64     
       
    65     /**
       
    66      * Add a test case and the name of it.
       
    67      * @param aTestCase, pointer to a test case, test suite will own it.
       
    68      * @param aName, name of the test case.
       
    69      */
       
    70     void AddTestCaseL(CBCTestCase* aTestCase, const TDesC& aName );
       
    71     
       
    72     /**
       
    73      * Build a parameter for automatic test process.
       
    74      * @param aAutoTest, structure storing automatic test information, out.
       
    75      */
       
    76     void BuildScriptsL(SAutoTest* aAutoTest);
       
    77     
       
    78     /**
       
    79      * Handke test event, such as case start, case end, ...
       
    80      * @param aEvent, enum for event type
       
    81      * @param aPrarm, index to relative test case.
       
    82      */
       
    83     void HandleTestEventL( TBCTestEvent aEvent, TInt aParam );
       
    84     
       
    85 protected: 
       
    86 
       
    87 // new functions
       
    88     
       
    89     /**
       
    90      * Creates test case start and end separators to log file
       
    91      * @param aScriptIndex, script index
       
    92      * @param aStart, whether start a test case.
       
    93      */
       
    94     void WriteTestCaseLogL( TInt aScriptIndex, TBool aStart );
       
    95     
       
    96     /**
       
    97      * When start auto test, write some general information
       
    98      */
       
    99     void WriteStartLogL();
       
   100     
       
   101     /**
       
   102      * When all test completed, write summary information.
       
   103      */
       
   104     void WriteSummaryLogL();
       
   105 
       
   106 private: // data
       
   107     
       
   108     /**
       
   109      * An array storing pointer to test case.
       
   110      */
       
   111     RArray<CBCTestCase*> iTestCases;
       
   112     
       
   113     /**
       
   114      * write log
       
   115      * Not own
       
   116      */
       
   117     CBCTestLogger* iLogger;
       
   118     
       
   119     };
       
   120 
       
   121 #endif // C_CBCTESTSUITE_H