|
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 utility, an interface of BCTest framework. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef C_CBCTESTUTIL_H |
|
20 #define C_CBCTESTUTIL_H |
|
21 |
|
22 #include <e32std.h> |
|
23 #include <e32base.h> |
|
24 #include <f32file.h> |
|
25 |
|
26 class CEikonEnv; |
|
27 class CBCTestKeyFeeder; |
|
28 class CBCTestCase; |
|
29 class CBCTestSuite; |
|
30 class CBCTestLogger; |
|
31 |
|
32 // Struct to be used as parameter passing |
|
33 struct SAutoTest |
|
34 { |
|
35 TInt** scripts; |
|
36 TInt* countArray; |
|
37 RArray<TDesC> nameArray; |
|
38 TInt scriptCount; |
|
39 }; |
|
40 |
|
41 // Panics |
|
42 _LIT( KBCTestUtilPanicText, "BCTestUtilDLL" ); |
|
43 |
|
44 enum TBCTestUtilPanics |
|
45 { |
|
46 EBCTestUtilNoSuchVariant = 1, |
|
47 EBCTestUtilUnbalacedIfOrEndif, |
|
48 EBCTestUtilNestedIf, |
|
49 EBCTestUtilTooManyEndifs |
|
50 }; |
|
51 |
|
52 /** |
|
53 * Test utility class. |
|
54 */ |
|
55 class CBCTestUtil: public CBase |
|
56 { |
|
57 public: |
|
58 |
|
59 // constructor and destructor |
|
60 |
|
61 /** |
|
62 * Symbian 2nd phase constructor. |
|
63 */ |
|
64 IMPORT_C static CBCTestUtil* NewL(); |
|
65 |
|
66 /** |
|
67 * Destructor. |
|
68 */ |
|
69 IMPORT_C virtual ~CBCTestUtil(); |
|
70 |
|
71 // new functions |
|
72 |
|
73 /** |
|
74 * start the runner engine, test scripts will be feed to the |
|
75 * application continuously. |
|
76 */ |
|
77 IMPORT_C void RunL(); |
|
78 |
|
79 /** |
|
80 * run according to the specified UI event, this will invoke a mapping |
|
81 * from UI-event to test cases in test suite |
|
82 * @param aCmd, a test command. |
|
83 */ |
|
84 IMPORT_C void RunL( TInt aCmd ); |
|
85 |
|
86 /** |
|
87 * Add test case to test suite. It will call CTestSuite::AddTestCaseL |
|
88 * directly. A interface for user. |
|
89 * @param aTestCase, pointer to a test case. |
|
90 * @param aName, name of the test case. |
|
91 */ |
|
92 IMPORT_C void AddTestCaseL( CBCTestCase* aTestCase, const TDesC& aName ); |
|
93 |
|
94 private: // constructor |
|
95 |
|
96 /** |
|
97 * C++ default constructor. |
|
98 */ |
|
99 CBCTestUtil(); |
|
100 |
|
101 /** |
|
102 * Symbian 2nd constructor. |
|
103 */ |
|
104 void ConstructL(); |
|
105 |
|
106 private: // data |
|
107 |
|
108 /** |
|
109 * A parameter for automatic test |
|
110 */ |
|
111 SAutoTest iAutoTest; |
|
112 |
|
113 /** |
|
114 * Own |
|
115 */ |
|
116 CBCTestLogger* iLogger; |
|
117 |
|
118 /** |
|
119 * Not own |
|
120 */ |
|
121 CEikonEnv* iEikEnv; |
|
122 |
|
123 /** |
|
124 * Own |
|
125 */ |
|
126 CBCTestSuite* iTestSuite; |
|
127 |
|
128 /** |
|
129 * Own |
|
130 */ |
|
131 CBCTestKeyFeeder* iKeyFeeder; |
|
132 |
|
133 }; |
|
134 |
|
135 #endif // C_CBCTESTUTIL_H |