|
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 case class, user will create own test case class by |
|
15 * deriving from the class. |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 #ifndef C_CBCTESTCASE_H |
|
21 #define C_CBCTESTCASE_H |
|
22 |
|
23 #include "bctestassert.h" |
|
24 #include "AutotestCommands.h" |
|
25 |
|
26 const TInt KNameLength = 50; |
|
27 |
|
28 /** |
|
29 * Test case class, user will derive own test case from the class |
|
30 */ |
|
31 class CBCTestCase : public CBCTestAssert |
|
32 { |
|
33 public: |
|
34 |
|
35 // declaration |
|
36 |
|
37 /** |
|
38 * Test case type |
|
39 * EEndCase means the case is an instance of CBCTestEndCase |
|
40 */ |
|
41 enum TTestCaseType |
|
42 { |
|
43 ENormalCase, |
|
44 EEndCase |
|
45 }; |
|
46 |
|
47 // constructor |
|
48 |
|
49 /** |
|
50 * C++ default constructor |
|
51 */ |
|
52 IMPORT_C CBCTestCase(); |
|
53 |
|
54 /** |
|
55 * Destructor |
|
56 */ |
|
57 IMPORT_C virtual ~CBCTestCase(); |
|
58 |
|
59 // exported new functions |
|
60 |
|
61 /** |
|
62 * Add script commands to the test case. |
|
63 * @param aCmd, script command |
|
64 */ |
|
65 IMPORT_C void AddTestL( TInt aCmd, ... ); |
|
66 |
|
67 /** |
|
68 * Add a series of commands defined in a TInt array to the test case |
|
69 * @param aCmdArray, an array stored script commands |
|
70 * @param aCmdCount, the count of script commands stored in aCmdArray. |
|
71 */ |
|
72 IMPORT_C void AddTestScriptL( const TInt* aCmdArray, TInt aCmdCount ); |
|
73 |
|
74 // exported virtual functions |
|
75 |
|
76 /** |
|
77 * Do actual test work specified by parameter, here the functions is not |
|
78 * implemented. User have to override it. |
|
79 * @param, a value to a test command. |
|
80 */ |
|
81 IMPORT_C virtual void RunL( TInt ); |
|
82 |
|
83 // new functions |
|
84 |
|
85 /** |
|
86 * Return iTestScripts. |
|
87 */ |
|
88 TInt* TestScripts(); |
|
89 |
|
90 /** |
|
91 * Return the count of script commands stored in the test case. |
|
92 */ |
|
93 TInt ScriptCount(); |
|
94 |
|
95 /** |
|
96 * Set name of test case |
|
97 */ |
|
98 void SetName( const TDesC& aName ); |
|
99 |
|
100 /** |
|
101 * Get name of test case |
|
102 */ |
|
103 TDesC& Name(); |
|
104 |
|
105 /** |
|
106 * Set type of test case. |
|
107 */ |
|
108 void SetType( TInt aType ); |
|
109 |
|
110 /** |
|
111 * Get type of test case. |
|
112 */ |
|
113 TInt Type(); |
|
114 |
|
115 protected: |
|
116 |
|
117 // new functions |
|
118 |
|
119 /** |
|
120 * Add a TInt to iTestScripts, and dynamically expand the array |
|
121 * when necessary. |
|
122 * @param aCmd, a script command. |
|
123 */ |
|
124 void AppendL( TInt aCmd ); |
|
125 |
|
126 private: // data |
|
127 |
|
128 /** |
|
129 * Array to store script commands. Use TInt* for combining several |
|
130 * TInt array together easily. And copying memory is not needed by |
|
131 * the way. |
|
132 * Own. |
|
133 */ |
|
134 TInt* iTestScripts; |
|
135 |
|
136 /** |
|
137 * Record the count of script commands stored in iTestScripts. |
|
138 */ |
|
139 TInt iScriptCount; |
|
140 |
|
141 /** |
|
142 * Record the maximum size of iTestScripts. |
|
143 */ |
|
144 TInt iMaxSize; |
|
145 |
|
146 /** |
|
147 * The name of test case. |
|
148 */ |
|
149 TBuf<KNameLength> iName; |
|
150 |
|
151 /** |
|
152 * The type of test case, using the value ETestCaseType. |
|
153 */ |
|
154 TInt iType; |
|
155 |
|
156 }; |
|
157 |
|
158 #endif // C_CBCTESTCASE_H |