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: |
|
15 * |
|
16 */ |
|
17 |
|
18 #include <symbianunittestsuite.h> |
|
19 #include "symbianunittestresult.h" |
|
20 #include "sutlogger.h" |
|
21 #include <e32debug.h> |
|
22 |
|
23 // ----------------------------------------------------------------------------- |
|
24 // |
|
25 // ----------------------------------------------------------------------------- |
|
26 // |
|
27 EXPORT_C CSymbianUnitTestSuite* CSymbianUnitTestSuite::NewLC( |
|
28 const TDesC& aName ) |
|
29 { |
|
30 CSymbianUnitTestSuite* self = new( ELeave )CSymbianUnitTestSuite(); |
|
31 CleanupStack::PushL( self ); |
|
32 self->ConstructL( aName ); |
|
33 return self; |
|
34 } |
|
35 |
|
36 // ----------------------------------------------------------------------------- |
|
37 // |
|
38 // ----------------------------------------------------------------------------- |
|
39 // |
|
40 EXPORT_C CSymbianUnitTestSuite* CSymbianUnitTestSuite::NewL( |
|
41 const TDesC& aName ) |
|
42 { |
|
43 CSymbianUnitTestSuite* self = CSymbianUnitTestSuite::NewLC( aName ); |
|
44 CleanupStack::Pop( self ); |
|
45 return self; |
|
46 } |
|
47 |
|
48 // ----------------------------------------------------------------------------- |
|
49 // |
|
50 // ----------------------------------------------------------------------------- |
|
51 // |
|
52 EXPORT_C void CSymbianUnitTestSuite::ConstructL( const TDesC& aName ) |
|
53 { |
|
54 iName = aName.AllocL(); |
|
55 } |
|
56 |
|
57 // ----------------------------------------------------------------------------- |
|
58 // |
|
59 // ----------------------------------------------------------------------------- |
|
60 // |
|
61 EXPORT_C CSymbianUnitTestSuite::CSymbianUnitTestSuite() |
|
62 { |
|
63 } |
|
64 |
|
65 // ----------------------------------------------------------------------------- |
|
66 // |
|
67 // ----------------------------------------------------------------------------- |
|
68 // |
|
69 EXPORT_C CSymbianUnitTestSuite::~CSymbianUnitTestSuite() |
|
70 { |
|
71 iTests.ResetAndDestroy(); |
|
72 delete iName; |
|
73 } |
|
74 |
|
75 // ----------------------------------------------------------------------------- |
|
76 // |
|
77 // ----------------------------------------------------------------------------- |
|
78 // |
|
79 EXPORT_C void CSymbianUnitTestSuite::AddL( |
|
80 MSymbianUnitTestInterface* aTest ) |
|
81 { |
|
82 iTests.AppendL( aTest ); |
|
83 } |
|
84 |
|
85 // ----------------------------------------------------------------------------- |
|
86 // |
|
87 // ----------------------------------------------------------------------------- |
|
88 // |
|
89 EXPORT_C void CSymbianUnitTestSuite::ExecuteL( |
|
90 MSymbianUnitTestObserver& aObserver, |
|
91 CSymbianUnitTestResult& aResult, |
|
92 MSymbianUnitTestInterface::TFailureSimulation aFailureSimulation, |
|
93 const CDesCArray& aTestCaseNames, |
|
94 TInt aTimeout ) |
|
95 { |
|
96 for ( TInt i=0; i < iTests.Count(); i++ ) |
|
97 { |
|
98 iTests[i]->ExecuteL( aObserver, aResult, aFailureSimulation, aTestCaseNames, aTimeout); |
|
99 } |
|
100 } |
|
101 |
|
102 |
|
103 // ----------------------------------------------------------------------------- |
|
104 // From MSymbianUnitTestInterface |
|
105 // ----------------------------------------------------------------------------- |
|
106 // |
|
107 EXPORT_C void CSymbianUnitTestSuite::TestCaseNamesL(CDesCArray& aTestCaseNames) |
|
108 { |
|
109 for ( TInt i=0; i < iTests.Count(); i++ ) |
|
110 { |
|
111 MSymbianUnitTestInterface* test = iTests[i]; |
|
112 test->TestCaseNamesL(aTestCaseNames); |
|
113 } |
|
114 |
|
115 } |
|
116 |
|
117 |
|
118 // ----------------------------------------------------------------------------- |
|
119 // |
|
120 // ----------------------------------------------------------------------------- |
|
121 // |
|
122 EXPORT_C TInt CSymbianUnitTestSuite::TestCaseCount() |
|
123 { |
|
124 TInt count = 0; |
|
125 for ( TInt i=0; i < iTests.Count(); i++ ) |
|
126 { |
|
127 count += iTests[i]->TestCaseCount(); |
|
128 } |
|
129 return count; |
|
130 } |
|
131 |
|
132 // ----------------------------------------------------------------------------- |
|
133 // |
|
134 // ----------------------------------------------------------------------------- |
|
135 // |
|
136 EXPORT_C const TDesC& CSymbianUnitTestSuite::Name() const |
|
137 { |
|
138 return *iName; |
|
139 } |
|