testdev/ite/test/com.nokia.testfw.launch.test/resource/TestModule/inc/Test.h
changeset 1 96906a986c3b
equal deleted inserted replaced
0:f1112f777ce9 1:96906a986c3b
       
     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: This file contains the header file of the Test 
       
    15 * test module of the Test Framework.
       
    16 *
       
    17 */
       
    18 
       
    19 #ifndef TEST_H
       
    20 #define TEST_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include "StifTestModule.h"
       
    24 
       
    25 // CONSTANTS
       
    26 //const <type constant_var = constant;>
       
    27 //Mark "None" if not any, this goes for other sections as well.
       
    28 
       
    29 
       
    30 static TPtrC8 CaseName( TInt aNumber )
       
    31 {
       
    32     static const char* const casenames[] =
       
    33     {
       
    34 	("Passing case"),
       
    35     ("Failing case"),
       
    36 	("One line print"),
       
    37 	("One line print with parsing"),
       
    38 	("Printing with negative priority"),
       
    39 	("Printing with too long description"),
       
    40 	("Printing with too long text"),
       
    41 	("Printing with too long desc&text"),
       
    42 	("Printing with empty desc"),
       
    43 	("Printing with empty text"),
       
    44 	("Printing with empty desc twice"),
       
    45 	("Print overflows when parsing"),
       
    46 	("Print queue overflow"),
       
    47 	("Print queue overflow with leave"),
       
    48 	("Print queue overflow with kill (does not work in Visual Studio)"),
       
    49     ("Printing"),
       
    50     ("Sleep"),
       
    51     ("Wait state event"),
       
    52     ("Set and unset state event"),
       
    53     ("Wait indication and print"),
       
    54     ("Set indication event 20 times in every 1 sec"),
       
    55 	("Test module crash (does not work in Visual Studio) "),
       
    56 	("Test module kill"),
       
    57 	("Test module exception"),
       
    58 	("Test module leaves"),
       
    59 	("Test module panic"),
       
    60 	("Test module two state event set"),
       
    61 	("Test module two indication event sending"),
       
    62 	("Non existing test case1"),
       
    63 	("A test case with a very long case name which will cause clipping here and there to fit it to buffers in server, engine or in UI"),
       
    64 	("memory leak (fail case)"),
       
    65 	("alloved memory leak"),
       
    66     ("Max size of the result description"),
       
    67     ("Test result setting"),
       
    68     ("Test result setting (fail case)"),
       
    69     ("Test result setting with max desc length"),
       
    70     ("Test result setting with too length desc. Description will cutted"),
       
    71     ("TL Macro testing"),
       
    72     ("T1L,T2L,T3L, T4L, T5L Macro testing with multible expected result"),
       
    73     ("TL Macro(fail case, -6) Macro testing, TL"),
       
    74     ("Verify that test case passes after macro testing"),
       
    75     ("T1L Macro(fail case, -6, result 0) STIF TF's macro testing with multible expected result"),
       
    76     ("Verify that test case passes after macro testing"),
       
    77     ("T2L Macro(fail case, -6, result 0) STIF TF's macro testing with multible expected result"),
       
    78     ("Verify that test case passes after macro testing"),
       
    79     ("T3L Macro(fail case, -6, result 0) STIF TF's macro testing with multible expected result"),
       
    80     ("Verify that test case passes after macro testing"),
       
    81     ("T3L Macro(fail case, -2, result -2) STIF TF's macro testing with multible expected result"),
       
    82     ("Verify that test case passes after macro testing"),
       
    83     ("T4L Macro(fail case, -6, result 0) STIF TF's macro testing with multible expected result"),
       
    84     ("Verify that test case passes after macro testing"),
       
    85     ("T4L Macro(fail case, -2, result -2) STIF TF's macro testing with multible expected result"),
       
    86     ("Verify that test case passes after macro testing"),
       
    87     ("T5L Macro(fail case, -6, result 0) STIF TF's macro testing with multible expected result"),
       
    88     ("Verify that test case passes after macro testing"),
       
    89     ("T5L Macro(fail case, -2, result -2) STIF TF's macro testing with multible expected result"),
       
    90 
       
    91     ("Verify that test case passes after macro testing"),
       
    92     ("Test SetExitReason with killing test thread (passes)"),
       
    93     ("Test module sleeps one minute (passes)"),
       
    94     ("T5L Macro(fail case, -222, result -222)"),
       
    95     ("TAL-TA5L Macros tests with allow results"),
       
    96     ("Test module fails always with -222 (fails)"),
       
    97     
       
    98 	};
       
    99 
       
   100 	const TUint8 **keys = (const TUint8**) casenames;
       
   101     TPtrC8 keyword( keys[ aNumber ] ); 
       
   102     return keyword;
       
   103 
       
   104     };
       
   105 
       
   106 // MACROS
       
   107 //#define <macro macro_def>
       
   108 
       
   109 
       
   110 // DATA TYPES
       
   111 //enum <declaration>
       
   112 //typedef <declaration>
       
   113 //extern <data_type;>
       
   114 
       
   115 
       
   116 // FUNCTION PROTOTYPES
       
   117 //<type function_name(arg_list);>
       
   118 
       
   119 
       
   120 // FORWARD DECLARATIONS
       
   121 //<class FORWARD_CLASSNAME;>
       
   122 
       
   123 
       
   124 // CLASS DECLARATION
       
   125 
       
   126 
       
   127 // DESCRIPTION
       
   128 // <one line short description>
       
   129 // <other description lines>
       
   130 
       
   131 NONSHARABLE_CLASS(CTestModuleTest) 
       
   132         :public CTestModuleBase
       
   133     {
       
   134     public: // Enumerations
       
   135 
       
   136     private: // Enumerations
       
   137         enum TestModuleTestCases
       
   138             {
       
   139 			KTestModuleCasePass,
       
   140 			KTestModuleCaseFail,
       
   141 			KTestModuleOneLinePrint,
       
   142 			KTestModuleSimplePrintParsing,			
       
   143 			KTestModuleNegativePriorityPrint,
       
   144 			KTestModuleTooLongDescription,
       
   145 			KTestModuleTooLongText,
       
   146 			KTestModuleTooLongDescAndText,
       
   147 			KTestModuleEmptyDescription,
       
   148 			KTestmoduleEmptyText,
       
   149 			KTestModuleEmptyDescriptionTwice,
       
   150 			KTestModulePrintParseOverflow,
       
   151 			KPrintQueueOverflow,
       
   152 			KPrintQueueOverflowWithLeave,
       
   153 			KPrintQueueOverflowWithKill,
       
   154             KTestModulePrinting,
       
   155             KTestModuleSleep,
       
   156             KTestModuleStateEventWait,
       
   157             KTestModuleStateEventSetAndUnset,
       
   158             KTestModuleEventWait,
       
   159             KTestModuleEventSet,
       
   160 			KTestModuleCrash,
       
   161 			KTestModuleKill,
       
   162 			KTestModuleException,
       
   163 			KTestModuleLeave,
       
   164 			KTestModulePanic,
       
   165 			KTestModuleTwoStateEventSetAndUnset,
       
   166 			KTestModuleTwoEventSet,
       
   167 			KTestModuleCaseNonExisting,
       
   168 			KCaseWithALongName,
       
   169 			KCaseMemLeak,
       
   170 			KCaseMemLeakAllowed,
       
   171             KCaseTestMaxResultDes,
       
   172             KCaseTestResultSetting,
       
   173             KCaseTestResultSettingFail,
       
   174             KCaseTestResultSettingWithMaxLength,
       
   175             KCaseTestResultSettingWithTooLength,
       
   176             KStifMacroTesting,
       
   177             KStifMacroTesting_INT,
       
   178             KStifMacroTesting_TL_fail_1,
       
   179             KCaseVerifyThatTestCasePassesAfterMacro1,
       
   180             KStifMacroTesting_T1L_fail_1,
       
   181             KCaseVerifyThatTestCasePassesAfterMacro2,
       
   182             KStifMacroTesting_T2L_fail_1,
       
   183             KCaseVerifyThatTestCasePassesAfterMacro3,
       
   184             KStifMacroTesting_T3L_fail_1,
       
   185             KCaseVerifyThatTestCasePassesAfterMacro4,
       
   186             KStifMacroTesting_T3L_fail_2,
       
   187             KCaseVerifyThatTestCasePassesAfterMacro5,
       
   188             KStifMacroTesting_T4L_fail_1,
       
   189             KCaseVerifyThatTestCasePassesAfterMacro6,
       
   190             KStifMacroTesting_T4L_fail_2,
       
   191             KCaseVerifyThatTestCasePassesAfterMacro7,
       
   192             KStifMacroTesting_T5L_fail_1,
       
   193             KCaseVerifyThatTestCasePassesAfterMacro8,
       
   194             KStifMacroTesting_T5L_fail_2,
       
   195             KCaseVerifyThatTestCasePassesAfterMacro9,
       
   196             KTestSetExitReasonWithKillingTestThread,
       
   197             KSleepOneMinute,
       
   198             KStifMacroTesting_General_1,
       
   199             KStifTAL_TA5LMacrosWithAllowresults,
       
   200             KFailAlways,
       
   201 			KLastCase								// This must be last one
       
   202             };
       
   203 
       
   204     public:  // Constructors and destructor
       
   205         
       
   206         /**
       
   207         * Two-phased constructor.
       
   208         */
       
   209         static CTestModuleTest* NewL();
       
   210         
       
   211         /**
       
   212         * Destructor.
       
   213         */
       
   214         ~CTestModuleTest();
       
   215 
       
   216     public: // New functions
       
   217         
       
   218         /**
       
   219         * <member_description.>
       
   220         */
       
   221         //<type member_function( type arg1 );>
       
   222 
       
   223     public: // Functions from base classes
       
   224         
       
   225          /**
       
   226         * Init is used to initialize the Test Module. The Test Modules can use 
       
   227         * the config file to read parameters for Test Module initialization but
       
   228         * they can also have their own config file or some other routine to
       
   229         * initialize themselves.
       
   230         * This method is pure virtual and the Test Module shall implement it.
       
   231         */
       
   232         TInt InitL( TFileName& aIniFile, TBool aFirstTime );
       
   233         /**
       
   234         * Test cases are inquired from the Test Module by calling GetTestCases. 
       
   235         * Test cases are read from the config file specified by aConfigFile. 
       
   236         * If the Test Module does not use config files for test case definition 
       
   237         * it does not use aConfigFile parameter. Test cases are appended 
       
   238         * to CArrayPtrFlat<TTestCaseInfo> that is a list consisting of 
       
   239         * several TTestCaseInfo objects.
       
   240         * TTestCaseInfo class defines individual test cases and, if needed, 
       
   241         * a test set where the test case belongs to. TTestCaseInfo is 
       
   242         * defined in Table 9.
       
   243         * This method is pure virtual and the Test Module shall implement it.
       
   244         */
       
   245         TInt GetTestCasesL( const TFileName& aConfigFile, 
       
   246             RPointerArray<TTestCaseInfo>& aTestCases );
       
   247         /**
       
   248         * RunTestCase is used to run an individual test case specified 
       
   249         * by aTestCase. Test cases that can be run are requested from 
       
   250         * Test Module by GetTestCases method before calling RunTestCase.
       
   251         * This method is pure virtual and the Test Module shall implement it. 
       
   252         */
       
   253         TInt RunTestCaseL( const TInt aCaseNumber, 
       
   254                           const TFileName& aConfig,
       
   255                           TTestResult& aResult );
       
   256         
       
   257     protected:  // New functions
       
   258         
       
   259         /**
       
   260         * <member_description.>
       
   261         */
       
   262         //<type member_function( type arg1 );>
       
   263 
       
   264     protected:  // Functions from base classes
       
   265         
       
   266         /**
       
   267         * From <base_class member_description>
       
   268         */
       
   269         //<type member_function();>
       
   270 
       
   271     private:
       
   272 
       
   273         /**
       
   274         * C++ default constructor.
       
   275         */
       
   276         CTestModuleTest();
       
   277 
       
   278         /**
       
   279         * By default Symbian OS constructor is private.
       
   280         */
       
   281         void ConstructL();
       
   282 
       
   283         // Prohibit copy constructor if not deriving from CBase.
       
   284         // <classname( const classname& );>
       
   285         // Prohibit assigment operator if not deriving from CBase.
       
   286         // <classname& operator= ( const classname& );>
       
   287 
       
   288         /**
       
   289         * Get thread status. 
       
   290         */
       
   291         void ThreadStatus();
       
   292 
       
   293         /**
       
   294         * 
       
   295         */
       
   296         TInt MacroTestInt_1();
       
   297 
       
   298         /**
       
   299         * 
       
   300         */
       
   301         TInt MacroTestInt_2();
       
   302 
       
   303         /**
       
   304         * 
       
   305         */
       
   306         TInt MacroTestInt_General( TInt aReturn );
       
   307 
       
   308         /**
       
   309         * 
       
   310         */
       
   311         TBuf<50> MacroTestString_1();
       
   312 
       
   313         /**
       
   314         * 
       
   315         */
       
   316         TBool MacroTestBool_1();
       
   317 
       
   318         /**
       
   319         * 
       
   320         */
       
   321         TBool MacroTestBool_2();
       
   322 
       
   323         /**
       
   324         * 
       
   325         */
       
   326         TInt TALMacrosWithAllowresults();
       
   327 
       
   328     public:   //Data
       
   329         //<data_declaration;>
       
   330     
       
   331     protected:  // Data
       
   332         //<data_declaration;>
       
   333 
       
   334     private:    // Data
       
   335         //<data_declaration;>
       
   336 
       
   337     public:     // Friend classes
       
   338         //<friend_class_declaration;>
       
   339 
       
   340     protected:  // Friend classes
       
   341         //<friend_class_declaration;>
       
   342 
       
   343     private:    // Friend classes
       
   344         //<friend_class_declaration;>
       
   345 
       
   346     };
       
   347 
       
   348 #endif      // TEST_H
       
   349 
       
   350 // End of File