1 /* |
|
2 * Copyright (c) 2005-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 * Example CTestStep derived implementation |
|
16 * |
|
17 */ |
|
18 |
|
19 |
|
20 |
|
21 /** |
|
22 @file SampleStep.cpp |
|
23 */ |
|
24 #include "samplestep.h" |
|
25 #include <test/testexecutelog.h> |
|
26 |
|
27 CSampleStep1::~CSampleStep1() |
|
28 /** |
|
29 * Destructor |
|
30 */ |
|
31 { |
|
32 } |
|
33 |
|
34 CSampleStep1::CSampleStep1() |
|
35 /** |
|
36 * Constructor |
|
37 */ |
|
38 { |
|
39 // Call base class method to set up the human readable name for logging |
|
40 SetTestStepName(KSampleStep1); |
|
41 } |
|
42 |
|
43 TVerdict CSampleStep1::doTestStepPreambleL() |
|
44 /** |
|
45 * @return - TVerdict code |
|
46 * Override of base class virtual |
|
47 */ |
|
48 { |
|
49 SetTestStepResult(EPass); |
|
50 return TestStepResult(); |
|
51 } |
|
52 |
|
53 TVerdict CSampleStep1::doTestStepL() |
|
54 /** |
|
55 * @return - TVerdict code |
|
56 * Override of base class pure virtual |
|
57 * Demonstrates reading configuration parameters fom an ini file section |
|
58 */ |
|
59 { |
|
60 // Use logging macro |
|
61 // Could use Flogger().Write.. directly |
|
62 INFO_PRINTF1(_L("In Test Step")); |
|
63 TInt theInt; |
|
64 TBool theBool; |
|
65 TBuf<40> buf; |
|
66 TPtrC theString; |
|
67 GetIntFromConfig(ConfigSection(),_L("TheInt"),theInt); |
|
68 GetBoolFromConfig(ConfigSection(),_L("TheBool"),theBool); |
|
69 GetStringFromConfig(ConfigSection(),_L("TheString"),theString); |
|
70 buf.Copy(theString); |
|
71 INFO_PRINTF4(_L("TheInt = %d The Bool = %d TheString = %S"),theInt,theBool,&buf); |
|
72 SetTestStepResult(EPass); |
|
73 // Demonstrate panic |
|
74 if(theString == _L("PanicMe")) |
|
75 { |
|
76 const TInt KSampleServerPanic = 1; |
|
77 User::Panic(_L("SampleServer"),KSampleServerPanic); |
|
78 } |
|
79 // Demonstrate fail |
|
80 if(theString != _L("TheString")) |
|
81 { |
|
82 SetTestStepResult(EFail); |
|
83 } |
|
84 User::After(5000000); |
|
85 return TestStepResult(); |
|
86 } |
|
87 |
|
88 TVerdict CSampleStep1::doTestStepPostambleL() |
|
89 /** |
|
90 * @return - TVerdict code |
|
91 * Override of base class virtual |
|
92 */ |
|
93 { |
|
94 INFO_PRINTF1(_L("Test Step Postamble")); |
|
95 return TestStepResult(); |
|
96 } |
|
97 |
|
98 /////// |
|
99 |
|
100 CSampleStep2::~CSampleStep2() |
|
101 /** |
|
102 * Destructor |
|
103 */ |
|
104 { |
|
105 } |
|
106 |
|
107 CSampleStep2::CSampleStep2(CTEFUnitServer& aParent) : iParent(aParent) |
|
108 /** |
|
109 * Constructor |
|
110 */ |
|
111 { |
|
112 // Call base class method to set up the human readable name for logging |
|
113 SetTestStepName(KSampleStep2); |
|
114 } |
|
115 |
|
116 TVerdict CSampleStep2::doTestStepPreambleL() |
|
117 /** |
|
118 * @return - TVerdict code |
|
119 * Override of base class virtual |
|
120 */ |
|
121 { |
|
122 INFO_PRINTF1(_L("Test Step Preamble")); |
|
123 SetTestStepResult(EPass); |
|
124 return TestStepResult(); |
|
125 } |
|
126 |
|
127 TVerdict CSampleStep2::doTestStepL() |
|
128 /** |
|
129 * @return - TVerdict code |
|
130 * Override of base class pure virtual |
|
131 * Demonstrates reading configuration parameters fom an ini file section |
|
132 */ |
|
133 { |
|
134 INFO_PRINTF1(_L("doTestStepL")); |
|
135 User::LeaveIfError(iParent.Fs().Connect()); |
|
136 SetTestStepResult(EPass); |
|
137 User::After(5000000); |
|
138 return TestStepResult(); |
|
139 } |
|
140 |
|
141 TVerdict CSampleStep2::doTestStepPostambleL() |
|
142 /** |
|
143 * @return - TVerdict code |
|
144 * Override of base class virtual |
|
145 */ |
|
146 { |
|
147 INFO_PRINTF1(_L("Test Step Postamble")); |
|
148 SetTestStepResult(EPass); |
|
149 return TestStepResult(); |
|
150 } |
|
151 /////// |
|
152 |
|
153 CSampleStep3::~CSampleStep3() |
|
154 /** |
|
155 * Destructor |
|
156 */ |
|
157 { |
|
158 } |
|
159 |
|
160 CSampleStep3::CSampleStep3(CTEFUnitServer& aParent) : iParent(aParent) |
|
161 /** |
|
162 * Constructor |
|
163 */ |
|
164 { |
|
165 // Call base class method to set up the human readable name for logging |
|
166 SetTestStepName(KSampleStep3); |
|
167 } |
|
168 |
|
169 TVerdict CSampleStep3::doTestStepPreambleL() |
|
170 /** |
|
171 * @return - TVerdict code |
|
172 * Override of base class virtual |
|
173 */ |
|
174 { |
|
175 INFO_PRINTF1(_L("Test Step Preamble")); |
|
176 SetTestStepResult(EPass); |
|
177 return TestStepResult(); |
|
178 } |
|
179 |
|
180 TVerdict CSampleStep3::doTestStepL() |
|
181 /** |
|
182 * @return - TVerdict code |
|
183 * Override of base class pure virtual |
|
184 * Demonstrates reading configuration parameters fom an ini file section |
|
185 */ |
|
186 { |
|
187 INFO_PRINTF1(_L("doTestStepL")); |
|
188 iParent.Fs().Close(); |
|
189 SetTestStepResult(EPass); |
|
190 User::After(5000000); |
|
191 return TestStepResult(); |
|
192 } |
|
193 |
|
194 TVerdict CSampleStep3::doTestStepPostambleL() |
|
195 /** |
|
196 * @return - TVerdict code |
|
197 * Override of base class virtual |
|
198 */ |
|
199 { |
|
200 INFO_PRINTF1(_L("Test Step Postamble")); |
|
201 INFO_PRINTF1( GetServerName() ); |
|
202 SetTestStepResult(EPass); |
|
203 return TestStepResult(); |
|
204 } |
|
205 |
|