|
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 #ifndef UT_SYMBIANUNITTEST_H |
|
19 #define UT_SYMBIANUNITTEST_H |
|
20 |
|
21 // INCLUDES |
|
22 #include <symbianunittest.h> |
|
23 #include "symbianunittestobserver.h" |
|
24 #include <badesca.h> |
|
25 |
|
26 // FORWARD DECLARATIONS |
|
27 class CSymbianUnitTestResult; |
|
28 |
|
29 // CLASS DECLARATION |
|
30 class UT_CSymbianUnitTest : |
|
31 public CSymbianUnitTest, |
|
32 public MSymbianUnitTestObserver |
|
33 { |
|
34 public: // Constructors and destructor |
|
35 |
|
36 static UT_CSymbianUnitTest* NewL(); |
|
37 static UT_CSymbianUnitTest* NewLC(); |
|
38 ~UT_CSymbianUnitTest(); |
|
39 |
|
40 public: // From MSymbianUnitTestObserver |
|
41 |
|
42 void IncrementExecutedTestsCount(); |
|
43 |
|
44 protected: // Test functions |
|
45 |
|
46 void SetupL(); |
|
47 void Teardown(); |
|
48 void UT_NameL(); |
|
49 void UT_IsMemoryAllocationFailureSimulationUsedL(); |
|
50 void UT_PanicInTestL(); |
|
51 void UT_ErrorInSetupL(); |
|
52 void UT_LeaveInTestL(); |
|
53 void UT_MemoryLeakInTestL(); |
|
54 void UT_FailingAssertsL(); |
|
55 void UT_PassingAssertsL(); |
|
56 void UT_TestCaseNamesL(); |
|
57 void UT_TimeoutL(); |
|
58 |
|
59 protected: // Failing functions to simulate failing tests |
|
60 |
|
61 void SimulatePanicL(); |
|
62 void SimulateLeaveL(); |
|
63 void SimulateMemoryLeakL(); |
|
64 void SimulateFailingAssertL(); |
|
65 void SimulateFailingAssertWithIntsL(); |
|
66 void SimulateFailingAssertWithDesC8sL(); |
|
67 void SimulateFailingAssertWithDesC16sL(); |
|
68 void SimulateFailingAssertLeaveL(); |
|
69 void SimulateFailingAssertLeaveWithSpecificValueL(); |
|
70 void SimulateTimeoutL(); |
|
71 |
|
72 protected: // Dummy function to simulate setup and teardown |
|
73 |
|
74 void Dummy(); |
|
75 |
|
76 private: // Contructors |
|
77 |
|
78 UT_CSymbianUnitTest(); |
|
79 void ConstructL(); |
|
80 |
|
81 private: // Data |
|
82 |
|
83 CSymbianUnitTestResult* iTestResult; |
|
84 UT_CSymbianUnitTest* iUnitTest; |
|
85 TInt iExecutedTestCount; |
|
86 CDesCArray* iTestCaseNames; |
|
87 }; |
|
88 |
|
89 #endif // UT_SYMBIANUNITTEST_H |