First public contribution.
2 * Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
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".
9 * Initial Contributors:
10 * Nokia Corporation - initial contribution.
21 #include <Stiftestinterface.h>
23 //#include <SettingServerClient.h>
25 // EXTERNAL DATA STRUCTURES
26 //extern ?external_data;
28 // EXTERNAL FUNCTION PROTOTYPES
29 //extern ?external_function( ?arg_type,?arg_type );
32 //const ?type ?constant_var = ?constant;
35 //#define ?macro ?macro_def
37 // LOCAL CONSTANTS AND MACROS
38 //const ?type ?constant_var = ?constant;
39 //#define ?macro_name ?macro_def
41 // MODULE DATA STRUCTURES
43 //typedef ?declaration
45 // LOCAL FUNCTION PROTOTYPES
46 //?type ?function_name( ?arg_type, ?arg_type );
48 // FORWARD DECLARATIONS
49 //class ?FORWARD_CLASSNAME;
51 // ============================= LOCAL FUNCTIONS ===============================
53 // -----------------------------------------------------------------------------
54 // ?function_name ?description.
56 // Returns: ?value_1: ?description
57 // ?value_n: ?description_line1
59 // -----------------------------------------------------------------------------
63 ?arg_type arg, // ?description
64 ?arg_type arg) // ?description
74 // ============================ MEMBER FUNCTIONS ===============================
76 // -----------------------------------------------------------------------------
77 // Ctutility::Ctutility
78 // C++ default constructor can NOT contain any code, that
80 // -----------------------------------------------------------------------------
83 CTestModuleIf& aTestModuleIf ):
84 CScriptBase( aTestModuleIf )
88 // -----------------------------------------------------------------------------
89 // Ctutility::ConstructL
90 // Symbian 2nd phase constructor can leave.
91 // -----------------------------------------------------------------------------
93 void Ctutility::ConstructL()
95 //Read logger settings to check whether test case name is to be
96 //appended to log file name.
97 /* RSettingServer settingServer;
98 TInt ret = settingServer.Connect();
103 // Struct to StifLogger settigs.
104 TLoggerSettings loggerSettings;
105 // Parse StifLogger defaults from STIF initialization file.
106 ret = settingServer.GetLoggerSettings(loggerSettings);
111 // Close Setting server session
112 settingServer.Close();
114 TFileName logFileName;
116 if(loggerSettings.iAddTestCaseTitle)
119 TestModuleIf().GetTestCaseTitleL(title);
120 logFileName.Format(KtutilityLogFileWithTitle, &title);
124 logFileName.Copy(KtutilityLogFile);
127 iLog = CStifLogger::NewL( KtutilityLogPath,
132 SendTestModuleVersion();
135 // -----------------------------------------------------------------------------
137 // Two-phased constructor.
138 // -----------------------------------------------------------------------------
140 Ctutility* Ctutility::NewL(
141 CTestModuleIf& aTestModuleIf )
143 Ctutility* self = new (ELeave) Ctutility( aTestModuleIf );
145 CleanupStack::PushL( self );
154 Ctutility::~Ctutility()
157 // Delete resources allocated from test methods
165 // ========================== OTHER EXPORTED FUNCTIONS =========================
167 // -----------------------------------------------------------------------------
168 // LibEntryL is a polymorphic Dll entry point.
169 // Returns: CScriptBase: New CScriptBase derived object
170 // -----------------------------------------------------------------------------
172 EXPORT_C CScriptBase* LibEntryL(
173 CTestModuleIf& aTestModuleIf ) // Backpointer to STIF Test Framework
176 return ( CScriptBase* ) Ctutility::NewL( aTestModuleIf );
180 //-----------------------------------------------------------------------------
181 // Ctutility::SendTestClassVersion
182 // Method used to send version of test class
183 //-----------------------------------------------------------------------------
185 void Ctutility::SendTestModuleVersion()
187 TVersion moduleVersion;
188 moduleVersion.iMajor = TEST_MODULE_VERSION_MAJOR;
189 moduleVersion.iMinor = TEST_MODULE_VERSION_MINOR;
190 moduleVersion.iBuild = TEST_MODULE_VERSION_BUILD;
192 TFileName moduleName;
193 moduleName = _L("Ctutility.dll");
196 TBool newVersionOfMethod = ETrue;
197 CTestModuleIf &test=TestModuleIf();
198 test.SendTestModuleVersion(moduleVersion, moduleName, newVersionOfMethod);
199 test.SetBehavior(CTestModuleIf::ETestLeaksHandles);