--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/symbianunittestfw/doc/ReleaseNotes.txt Mon Mar 29 14:46:27 2010 +0800
@@ -0,0 +1,37 @@
+
+SymbianUnitTest Release Notes 1.1
+
+OVERVIEW:
+SymbianUnitTest is a unit test framework, which is a port of xUnit to Symbian C++. Its basic architecture and usage is closely followed the xUnit model.
+SymbianUnitTest makes full use of Symbian C++ language features. It provides helper macros for users to easily define test cases.
+Unit test frameworks are key elements of TDD (or Test Driven Development). For this reason, SymbianUnitTest is not only considered
+as test framework to validate the software, but also the enabler for TDD and continuous integration to improve software quality and speed time to market.
+
+
+TECHNICAL SUPPORT:
+ -You can get latest information from SymbianUnitTest wiki page: http://wikis.in.nokia.com/Personal/SymbianUnitTest
+ -For any question and suggestion, please send email to ITE-Support@Nokia.com
+
+
+MAJOR FEATURES:
+ - Console UI (symbianunittest.exe) to run test cases
+ - Helper macros for eaily define test cases and assertion
+ - Support to run user specified test case(s)
+ - Support OOM testing
+ - Automatic memory leak detection
+ - Multiple output format (plain text, html, or xml)
+ - Configurable test execution time out
+ - Script to convert existing EUnit test cases into SymbianUnitTest
+ - Carbide plug-in to create test case
+ - Support ATS4
+ - User Guide document
+
+FIXED BUGS AND WORKAROUNDS:
+
+
+KNOWN ISSUES:
+ * There is no S60 or QT UI for SymbianUnitTest yet. Pleas use the console UI instead.
+ * SymbianUnitTest doesn't support S60 ui component unit testing
+
+
+
Binary file testexecfw/symbianunittestfw/doc/SymbianUnitTestUserGuide.pdf has changed
--- a/testexecfw/symbianunittestfw/group/bld.inf Mon Mar 08 15:03:44 2010 +0800
+++ b/testexecfw/symbianunittestfw/group/bld.inf Mon Mar 29 14:46:27 2010 +0800
@@ -17,4 +17,3 @@
#include "../symbianunittestfw_pub/group/bld.inf"
#include "../sutfw/group/bld.inf"
-
--- a/testexecfw/symbianunittestfw/sutfw/inc/symbianunittestversion.h Mon Mar 08 15:03:44 2010 +0800
+++ b/testexecfw/symbianunittestfw/sutfw/inc/symbianunittestversion.h Mon Mar 29 14:46:27 2010 +0800
@@ -17,8 +17,8 @@
#ifndef SYMBIANUNITTESTVERSION_H
#define SYMBIANUNITTESTVERSION_H
-#define SUT_MAJOR_VERSION 0
-#define SUT_MINOR_VERSION 9
-#define SUT_BUILD_VERSION 1
+#define SUT_MAJOR_VERSION 1
+#define SUT_MINOR_VERSION 1
+#define SUT_BUILD_VERSION 0
#endif /*SYNBIANUNITTESTVERSION_H*/
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/symbianunittestfw/sutfw/sis/symbianunittest.pkg Mon Mar 29 14:46:27 2010 +0800
@@ -0,0 +1,37 @@
+;
+; Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+; All rights reserved.
+; This component and the accompanying materials are made available
+; under the terms of the License "Symbian Foundation License v1.0"
+; which accompanies this distribution, and is available
+; at the URL "http://www.symbianfoundation.org/legal/sfl-v10.html".
+;
+; Initial Contributors:
+; Nokia Corporation - initial contribution.
+;
+; Contributors:
+;
+; Description:
+;
+; Languages
+&EN
+
+; standard SIS file header
+#{"SymbianUnitTest"},(0x20022E75),1,0,0
+
+;Localised Vendor name
+%{"Nokia"}
+
+;Unique Vendor name
+:"Nokia"
+
+;Supports Series 60 v 3.0
+
+;Files to install
+"\epoc32\release\armv5\urel\symbianunittest.exe" -"!:\sys\bin\symbianunittest.exe"
+"\epoc32\release\armv5\urel\symbianunittestfw.dll" -"!:\sys\bin\symbianunittestfw.dll"
+"\epoc32\release\armv5\urel\ut_racecar.dll" -"!:\sys\bin\ut_racecar.dll"
+"\epoc32\release\armv5\urel\ut_sutfwframework.dll" -"!:\sys\bin\ut_sutfwframework.dll"
+"\epoc32\release\armv5\urel\ut_symbianunittestconsoleui.dll" -"!:\sys\bin\ut_symbianunittestconsoleui.dll"
+
+;required for application to be covered by backup/restore facility
--- a/testexecfw/symbianunittestfw/sutfw/sutfwcore/BWINS/symbianunittestfwU.DEF Mon Mar 08 15:03:44 2010 +0800
+++ b/testexecfw/symbianunittestfw/sutfw/sutfwcore/BWINS/symbianunittestfwU.DEF Mon Mar 29 14:46:27 2010 +0800
@@ -4,28 +4,33 @@
?ConstructL@CSymbianUnitTest@@IAEXABVTDesC8@@@Z @ 3 NONAME ; void CSymbianUnitTest::ConstructL(class TDesC8 const &)
?AddL@CSymbianUnitTestSuite@@QAEXPAVMSymbianUnitTestInterface@@@Z @ 4 NONAME ; void CSymbianUnitTestSuite::AddL(class MSymbianUnitTestInterface *)
??1CSymbianUnitTest@@UAE@XZ @ 5 NONAME ; CSymbianUnitTest::~CSymbianUnitTest(void)
- ?AssertionFailedL@CSymbianUnitTest@@IAEXABVTDesC8@@H0@Z @ 6 NONAME ; void CSymbianUnitTest::AssertionFailedL(class TDesC8 const &, int, class TDesC8 const &)
- ?TestCount@CSymbianUnitTestRunner@@QAEHXZ @ 7 NONAME ; int CSymbianUnitTestRunner::TestCount(void)
- ?ExecuteTestsL@CSymbianUnitTestRunner@@QAEXABVMDesC16Array@@HABVTDesC16@@1ABVCDesC16Array@@H@Z @ 8 NONAME ; void CSymbianUnitTestRunner::ExecuteTestsL(class MDesC16Array const &, int, class TDesC16 const &, class TDesC16 const &, class CDesC16Array const &, int)
- ?AssertEqualsL@CSymbianUnitTest@@IAEXHHHABVTDesC8@@@Z @ 9 NONAME ; void CSymbianUnitTest::AssertEqualsL(int, int, int, class TDesC8 const &)
- ?AssertEqualsL@CSymbianUnitTest@@IAEXABVTDesC16@@0HABVTDesC8@@@Z @ 10 NONAME ; void CSymbianUnitTest::AssertEqualsL(class TDesC16 const &, class TDesC16 const &, int, class TDesC8 const &)
- ?Name@CSymbianUnitTestSuite@@UBEABVTDesC16@@XZ @ 11 NONAME ; class TDesC16 const & CSymbianUnitTestSuite::Name(void) const
- ?AssertLeaveL@CSymbianUnitTest@@IAEXABVTDesC8@@HHH0@Z @ 12 NONAME ; void CSymbianUnitTest::AssertLeaveL(class TDesC8 const &, int, int, int, class TDesC8 const &)
- ?AssertEqualsL@CSymbianUnitTest@@IAEXABVTDesC8@@0H0@Z @ 13 NONAME ; void CSymbianUnitTest::AssertEqualsL(class TDesC8 const &, class TDesC8 const &, int, class TDesC8 const &)
- ?SetupL@CSymbianUnitTest@@MAEXXZ @ 14 NONAME ; void CSymbianUnitTest::SetupL(void)
- ?Name@CSymbianUnitTest@@UBEABVTDesC16@@XZ @ 15 NONAME ; class TDesC16 const & CSymbianUnitTest::Name(void) const
- ?ExecuteL@CSymbianUnitTest@@UAEXAAVMSymbianUnitTestObserver@@AAVCSymbianUnitTestResult@@W4TFailureSimulation@MSymbianUnitTestInterface@@ABVCDesC16Array@@H@Z @ 16 NONAME ; void CSymbianUnitTest::ExecuteL(class MSymbianUnitTestObserver &, class CSymbianUnitTestResult &, enum MSymbianUnitTestInterface::TFailureSimulation, class CDesC16Array const &, int)
- ?NewL@CSymbianUnitTestSuite@@SAPAV1@ABVTDesC16@@@Z @ 17 NONAME ; class CSymbianUnitTestSuite * CSymbianUnitTestSuite::NewL(class TDesC16 const &)
- ??1CSymbianUnitTestSuite@@UAE@XZ @ 18 NONAME ; CSymbianUnitTestSuite::~CSymbianUnitTestSuite(void)
- ?NewLC@CSymbianUnitTestSuite@@SAPAV1@ABVTDesC16@@@Z @ 19 NONAME ; class CSymbianUnitTestSuite * CSymbianUnitTestSuite::NewLC(class TDesC16 const &)
- ?NewLC@CSymbianUnitTestRunner@@SAPAV1@AAVMSymbianUnitTestUiCallBack@@@Z @ 20 NONAME ; class CSymbianUnitTestRunner * CSymbianUnitTestRunner::NewLC(class MSymbianUnitTestUiCallBack &)
- ??1CSymbianUnitTestRunner@@UAE@XZ @ 21 NONAME ; CSymbianUnitTestRunner::~CSymbianUnitTestRunner(void)
- ?ExecuteL@CSymbianUnitTestSuite@@UAEXAAVMSymbianUnitTestObserver@@AAVCSymbianUnitTestResult@@W4TFailureSimulation@MSymbianUnitTestInterface@@ABVCDesC16Array@@H@Z @ 22 NONAME ; void CSymbianUnitTestSuite::ExecuteL(class MSymbianUnitTestObserver &, class CSymbianUnitTestResult &, enum MSymbianUnitTestInterface::TFailureSimulation, class CDesC16Array const &, int)
- ?IsMemoryAllocationFailureSimulationUsed@CSymbianUnitTest@@IBEHXZ @ 23 NONAME ; int CSymbianUnitTest::IsMemoryAllocationFailureSimulationUsed(void) const
- ?FailedTestCount@CSymbianUnitTestRunner@@QAEHXZ @ 24 NONAME ; int CSymbianUnitTestRunner::FailedTestCount(void)
- ?TestCaseCount@CSymbianUnitTestSuite@@UAEHXZ @ 25 NONAME ; int CSymbianUnitTestSuite::TestCaseCount(void)
- ?NewL@CSymbianUnitTestRunner@@SAPAV1@AAVMSymbianUnitTestUiCallBack@@@Z @ 26 NONAME ; class CSymbianUnitTestRunner * CSymbianUnitTestRunner::NewL(class MSymbianUnitTestUiCallBack &)
- ?AddTestCaseL@CSymbianUnitTest@@IAEXABVTDesC16@@P81@AEXXZ11@Z @ 27 NONAME ; void CSymbianUnitTest::AddTestCaseL(class TDesC16 const &, void (*)(void), void (*)(void), void (*)(void))
- ?TestCaseCount@CSymbianUnitTest@@UAEHXZ @ 28 NONAME ; int CSymbianUnitTest::TestCaseCount(void)
- ?Teardown@CSymbianUnitTest@@MAEXXZ @ 29 NONAME ; void CSymbianUnitTest::Teardown(void)
+ ?SetupL@CSymbianUnitTest@@UAEXXZ @ 6 NONAME ; void CSymbianUnitTest::SetupL(void)
+ ?AssertionFailedL@CSymbianUnitTest@@IAEXABVTDesC8@@H0@Z @ 7 NONAME ; void CSymbianUnitTest::AssertionFailedL(class TDesC8 const &, int, class TDesC8 const &)
+ ?TestCount@CSymbianUnitTestRunner@@QAEHXZ @ 8 NONAME ; int CSymbianUnitTestRunner::TestCount(void)
+ ?ExecuteTestsL@CSymbianUnitTestRunner@@QAEXABVMDesC16Array@@HABVTDesC16@@1ABVCDesC16Array@@H@Z @ 9 NONAME ; void CSymbianUnitTestRunner::ExecuteTestsL(class MDesC16Array const &, int, class TDesC16 const &, class TDesC16 const &, class CDesC16Array const &, int)
+ ?AssertEqualsL@CSymbianUnitTest@@IAEXHHHABVTDesC8@@@Z @ 10 NONAME ; void CSymbianUnitTest::AssertEqualsL(int, int, int, class TDesC8 const &)
+ ?AssertEqualsL@CSymbianUnitTest@@IAEXABVTDesC16@@0HABVTDesC8@@@Z @ 11 NONAME ; void CSymbianUnitTest::AssertEqualsL(class TDesC16 const &, class TDesC16 const &, int, class TDesC8 const &)
+ ?Name@CSymbianUnitTestSuite@@UBEABVTDesC16@@XZ @ 12 NONAME ; class TDesC16 const & CSymbianUnitTestSuite::Name(void) const
+ ?Teardown@CSymbianUnitTest@@UAEXXZ @ 13 NONAME ; void CSymbianUnitTest::Teardown(void)
+ ?AssertLeaveL@CSymbianUnitTest@@IAEXABVTDesC8@@HHH0@Z @ 14 NONAME ; void CSymbianUnitTest::AssertLeaveL(class TDesC8 const &, int, int, int, class TDesC8 const &)
+ ?AssertEqualsL@CSymbianUnitTest@@IAEXABVTDesC8@@0H0@Z @ 15 NONAME ; void CSymbianUnitTest::AssertEqualsL(class TDesC8 const &, class TDesC8 const &, int, class TDesC8 const &)
+ ?Name@CSymbianUnitTest@@UBEABVTDesC16@@XZ @ 16 NONAME ; class TDesC16 const & CSymbianUnitTest::Name(void) const
+ ?ExecuteL@CSymbianUnitTest@@UAEXAAVMSymbianUnitTestObserver@@AAVCSymbianUnitTestResult@@W4TFailureSimulation@MSymbianUnitTestInterface@@ABVCDesC16Array@@H@Z @ 17 NONAME ; void CSymbianUnitTest::ExecuteL(class MSymbianUnitTestObserver &, class CSymbianUnitTestResult &, enum MSymbianUnitTestInterface::TFailureSimulation, class CDesC16Array const &, int)
+ ?NewL@CSymbianUnitTestSuite@@SAPAV1@ABVTDesC16@@@Z @ 18 NONAME ; class CSymbianUnitTestSuite * CSymbianUnitTestSuite::NewL(class TDesC16 const &)
+ ??1CSymbianUnitTestSuite@@UAE@XZ @ 19 NONAME ; CSymbianUnitTestSuite::~CSymbianUnitTestSuite(void)
+ ?NewLC@CSymbianUnitTestSuite@@SAPAV1@ABVTDesC16@@@Z @ 20 NONAME ; class CSymbianUnitTestSuite * CSymbianUnitTestSuite::NewLC(class TDesC16 const &)
+ ?NewLC@CSymbianUnitTestRunner@@SAPAV1@AAVMSymbianUnitTestUiCallBack@@@Z @ 21 NONAME ; class CSymbianUnitTestRunner * CSymbianUnitTestRunner::NewLC(class MSymbianUnitTestUiCallBack &)
+ ??1CSymbianUnitTestRunner@@UAE@XZ @ 22 NONAME ; CSymbianUnitTestRunner::~CSymbianUnitTestRunner(void)
+ ?ExecuteL@CSymbianUnitTestSuite@@UAEXAAVMSymbianUnitTestObserver@@AAVCSymbianUnitTestResult@@W4TFailureSimulation@MSymbianUnitTestInterface@@ABVCDesC16Array@@H@Z @ 23 NONAME ; void CSymbianUnitTestSuite::ExecuteL(class MSymbianUnitTestObserver &, class CSymbianUnitTestResult &, enum MSymbianUnitTestInterface::TFailureSimulation, class CDesC16Array const &, int)
+ ?IsMemoryAllocationFailureSimulationUsed@CSymbianUnitTest@@IBEHXZ @ 24 NONAME ; int CSymbianUnitTest::IsMemoryAllocationFailureSimulationUsed(void) const
+ ?FailedTestCount@CSymbianUnitTestRunner@@QAEHXZ @ 25 NONAME ; int CSymbianUnitTestRunner::FailedTestCount(void)
+ ?TestCaseCount@CSymbianUnitTestSuite@@UAEHXZ @ 26 NONAME ; int CSymbianUnitTestSuite::TestCaseCount(void)
+ ?NewL@CSymbianUnitTestRunner@@SAPAV1@AAVMSymbianUnitTestUiCallBack@@@Z @ 27 NONAME ; class CSymbianUnitTestRunner * CSymbianUnitTestRunner::NewL(class MSymbianUnitTestUiCallBack &)
+ ?AddTestCaseL@CSymbianUnitTest@@IAEXABVTDesC16@@P81@AEXXZ11@Z @ 28 NONAME ; void CSymbianUnitTest::AddTestCaseL(class TDesC16 const &, void (*)(void), void (*)(void), void (*)(void))
+ ?TestCaseCount@CSymbianUnitTest@@UAEHXZ @ 29 NONAME ; int CSymbianUnitTest::TestCaseCount(void)
+ ?ConstructL@CSymbianUnitTestSuite@@IAEXABVTDesC16@@@Z @ 30 NONAME ; void CSymbianUnitTestSuite::ConstructL(class TDesC16 const &)
+ ??0CSymbianUnitTestSuite@@IAE@XZ @ 31 NONAME ; CSymbianUnitTestSuite::CSymbianUnitTestSuite(void)
+ ?AssertEqualsL@CSymbianUnitTest@@IAEXABVTDesC8@@0H00@Z @ 32 NONAME ; void CSymbianUnitTest::AssertEqualsL(class TDesC8 const &, class TDesC8 const &, int, class TDesC8 const &, class TDesC8 const &)
+ ?AssertEqualsL@CSymbianUnitTest@@IAEXABVTDesC16@@0HABVTDesC8@@1@Z @ 33 NONAME ; void CSymbianUnitTest::AssertEqualsL(class TDesC16 const &, class TDesC16 const &, int, class TDesC8 const &, class TDesC8 const &)
+ ?AssertEqualsL@CSymbianUnitTest@@IAEXHHHABVTDesC8@@0@Z @ 34 NONAME ; void CSymbianUnitTest::AssertEqualsL(int, int, int, class TDesC8 const &, class TDesC8 const &)
--- a/testexecfw/symbianunittestfw/sutfw/sutfwcore/EABI/symbianunittestfwU.DEF Mon Mar 08 15:03:44 2010 +0800
+++ b/testexecfw/symbianunittestfw/sutfw/sutfwcore/EABI/symbianunittestfwU.DEF Mon Mar 29 14:46:27 2010 +0800
@@ -67,4 +67,10 @@
_ZThn4_N21CSymbianUnitTestSuiteD1Ev @ 66 NONAME
_ZThn4_NK16CSymbianUnitTest4NameEv @ 67 NONAME
_ZThn4_NK21CSymbianUnitTestSuite4NameEv @ 68 NONAME
+ _ZN16CSymbianUnitTest13AssertEqualsLERK6TDesC8S2_iS2_S2_ @ 69 NONAME
+ _ZN16CSymbianUnitTest13AssertEqualsLERK7TDesC16S2_iRK6TDesC8S5_ @ 70 NONAME
+ _ZN16CSymbianUnitTest13AssertEqualsLEiiiRK6TDesC8S2_ @ 71 NONAME
+ _ZN21CSymbianUnitTestSuite10ConstructLERK7TDesC16 @ 72 NONAME
+ _ZN21CSymbianUnitTestSuiteC1Ev @ 73 NONAME
+ _ZN21CSymbianUnitTestSuiteC2Ev @ 74 NONAME
--- a/testexecfw/symbianunittestfw/sutfw/sutfwcore/group/SUTFlags.cfg Mon Mar 08 15:03:44 2010 +0800
+++ b/testexecfw/symbianunittestfw/sutfw/sutfwcore/group/SUTFlags.cfg Mon Mar 29 14:46:27 2010 +0800
@@ -1,19 +1,3 @@
-/*
-* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
-* All rights reserved.
-* This component and the accompanying materials are made available
-* under the terms of "Eclipse Public License v1.0"
-* which accompanies this distribution, and is available
-* at the URL "http://www.eclipse.org/legal/epl-v10.html".
-*
-* Initial Contributors:
-* Nokia Corporation - initial contribution.
-*
-* Contributors:
-*
-* Description:
-*
-*/
// Set this flag to enable logging.
// (create log folder c:\logs\sut manually in the device)
--- a/testexecfw/symbianunittestfw/sutfw/sutfwcore/group/bld.inf Mon Mar 08 15:03:44 2010 +0800
+++ b/testexecfw/symbianunittestfw/sutfw/sutfwcore/group/bld.inf Mon Mar 29 14:46:27 2010 +0800
@@ -15,6 +15,7 @@
*
*/
+#include "../sutfwframework/tsrc/group/bld.inf"
PRJ_EXPORTS
SUTFlags.cfg
--- a/testexecfw/symbianunittestfw/sutfw/sutfwcore/group/symbianunittestfw.mmp Mon Mar 08 15:03:44 2010 +0800
+++ b/testexecfw/symbianunittestfw/sutfw/sutfwcore/group/symbianunittestfw.mmp Mon Mar 29 14:46:27 2010 +0800
@@ -45,7 +45,7 @@
USERINCLUDE ../sutfwoutput/inc
USERINCLUDE ../../inc
-SYSTEMINCLUDE /epoc32/include
+APP_LAYER_SYSTEMINCLUDE_SYMBIAN
SYSTEMINCLUDE /epoc32/include/symbianunittest
LIBRARY euser.lib
--- a/testexecfw/symbianunittestfw/sutfw/sutfwcore/sutfwframework/inc/symbianunittestresult.h Mon Mar 08 15:03:44 2010 +0800
+++ b/testexecfw/symbianunittestfw/sutfw/sutfwcore/sutfwframework/inc/symbianunittestresult.h Mon Mar 29 14:46:27 2010 +0800
@@ -19,6 +19,7 @@
// INCLUDES
#include <e32base.h>
+#include <badesca.h>
#include <symbianunittestmacros.h>
// FORWARD DECLARATIONS
@@ -67,6 +68,8 @@
void AddTimeOutErrorL(
TInt aTimeOut);
+
+ const CDesCArray& TestCaseNames() const;
private: // Constructors
@@ -96,6 +99,7 @@
HBufC* iCurrentTestName;
TTime iTime;
TBool iCurrentResult;
+ CDesCArray * iTestCaseNames;
private: // Test
--- a/testexecfw/symbianunittestfw/sutfw/sutfwcore/sutfwframework/src/symbianunittest.cpp Mon Mar 08 15:03:44 2010 +0800
+++ b/testexecfw/symbianunittestfw/sutfw/sutfwcore/sutfwframework/src/symbianunittest.cpp Mon Mar 29 14:46:27 2010 +0800
@@ -48,7 +48,59 @@
{
classNamePtr.Set( aName.Left( doubleColonPos ) );
}
- iName = CnvUtfConverter::ConvertToUnicodeFromUtf8L( classNamePtr );
+
+ iName = CnvUtfConverter::ConvertToUnicodeFromUtf8L( classNamePtr );
+
+ SUT_LOG_FORMAT(_L("enter CSymbianUnitTest::ConstructL -- aName : [%S]"), iName );
+
+ // unify the same name for armv5 & winscw.
+ // on winscw, the function name is abc,
+ // on armv5, the function name is void abc.
+ // unify to abc.
+ TChar chSpace( ' ' );
+ TChar chTab( '\t' );
+ TChar chAsterisk( '*' );
+ TChar chAnd( '&' );
+ TBuf<100> strTmp( *iName );
+ strTmp.Trim();
+ TInt pos;
+
+ // "char * & abc" => abc
+ pos = strTmp.LocateReverse( chAnd );
+ if( KErrNotFound != pos )
+ {
+ TPtrC ptr = strTmp.Right( strTmp.Length() - pos - 1 );
+ strTmp = ptr;
+ strTmp.Trim();
+ }
+ // "void * abc" => abc
+ pos = strTmp.LocateReverse( chAsterisk );
+ if( KErrNotFound != pos )
+ {
+ TPtrC ptr = strTmp.Right( strTmp.Length() - pos - 1 );
+ strTmp = ptr;
+ strTmp.Trim();
+ }
+ // "void abc"
+ pos = strTmp.LocateReverse( chSpace );
+ if( KErrNotFound != pos )
+ {
+ TPtrC ptr = strTmp.Right( strTmp.Length() - pos - 1 );
+ strTmp = ptr;
+ strTmp.Trim();
+ }
+ // "void abc"
+ pos = strTmp.LocateReverse( chTab );
+ if( KErrNotFound != pos )
+ {
+ TPtrC ptr = strTmp.Right( strTmp.Length() - pos - 1 );
+ strTmp = ptr;
+ strTmp.Trim();
+ }
+
+ *iName = strTmp;
+
+ SUT_LOG_FORMAT(_L("exit CSymbianUnitTest::ConstructL -- aName : [%S]"), iName );
}
// -----------------------------------------------------------------------------
@@ -331,6 +383,61 @@
User::Leave( KErrSymbianUnitTestAssertionFailed );
}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CSymbianUnitTest::AssertEqualsL(
+ TInt aExpectedValue,
+ TInt aActualValue,
+ TInt aLineNumber,
+ const TDesC8& aFileName,
+ const TDesC8& aFailureMessage )
+ {
+ if ( aExpectedValue != aActualValue )
+ {
+ StopAllocFailureSimulation();
+ AssertionFailedL( aFailureMessage, aLineNumber, aFileName );
+ }
+ }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CSymbianUnitTest::AssertEqualsL(
+ const TDesC8& aExpectedValue,
+ const TDesC8& aActualValue,
+ TInt aLineNumber,
+ const TDesC8& aFileName,
+ const TDesC8& aFailureMessage )
+ {
+ if ( aExpectedValue.Compare( aActualValue ) != 0 )
+ {
+ StopAllocFailureSimulation();
+ AssertionFailedL( aFailureMessage, aLineNumber, aFileName );
+ }
+ }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+EXPORT_C void CSymbianUnitTest::AssertEqualsL(
+ const TDesC16& aExpectedValue,
+ const TDesC16& aActualValue,
+ TInt aLineNumber,
+ const TDesC8& aFileName,
+ const TDesC8& aFailureMessage )
+ {
+ if ( aExpectedValue.Compare( aActualValue ) != 0 )
+ {
+ StopAllocFailureSimulation();
+ AssertionFailedL( aFailureMessage, aLineNumber, aFileName );
+ }
+ }
+
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
--- a/testexecfw/symbianunittestfw/sutfw/sutfwcore/sutfwframework/src/symbianunittestresult.cpp Mon Mar 08 15:03:44 2010 +0800
+++ b/testexecfw/symbianunittestfw/sutfw/sutfwcore/sutfwframework/src/symbianunittestresult.cpp Mon Mar 29 14:46:27 2010 +0800
@@ -19,6 +19,7 @@
#include "symbianunittestfailure.h"
#include "sutlogger.h"
+
_LIT8( KSymbianUnitTestLeaveCodeMessageFormat, "Leave code: %d" );
_LIT8( KSymbianUnitTestMemoryLeakPhrase, "Leaked %d bytes of memory" );
_LIT8( KSymbianUnitTestPanicPhrase, "Panic: " );
@@ -72,6 +73,7 @@
void CSymbianUnitTestResult::ConstructL()
{
iCurrentTestName = KNullDesC().AllocL();
+ iTestCaseNames = new (ELeave)CDesCArrayFlat(10);
}
// -----------------------------------------------------------------------------
@@ -81,6 +83,7 @@
CSymbianUnitTestResult::~CSymbianUnitTestResult()
{
delete iCurrentTestName;
+ delete iTestCaseNames;
iFailures.ResetAndDestroy();
}
@@ -141,7 +144,11 @@
SUT_LOG_FORMAT2(_L("EndCase Result[%S] Time[%d]ms"),
iCurrentResult?&KSymbianUnitTestPass:&KSymbianUnitTestFail,
microSeconds.Int64()/1000);
- //SUT_LOG_FORMAT2(_L("EndCase Result[%S] Time[%d]ms"), &KSymbianUnitTestPass, microSeconds.Int64()/1000);
+ if (iCurrentResult)
+ {
+ //only add passed case to the testcasenames
+ iTestCaseNames->AppendL(*iCurrentTestName);
+ }
}
@@ -317,3 +324,12 @@
iFailures.AppendL( failure );
CleanupStack::Pop( failure );
}
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+const CDesCArray& CSymbianUnitTestResult::TestCaseNames() const
+ {
+ return *iTestCaseNames;
+ }
--- a/testexecfw/symbianunittestfw/sutfw/sutfwcore/sutfwframework/src/symbianunittestsuite.cpp Mon Mar 08 15:03:44 2010 +0800
+++ b/testexecfw/symbianunittestfw/sutfw/sutfwcore/sutfwframework/src/symbianunittestsuite.cpp Mon Mar 29 14:46:27 2010 +0800
@@ -48,7 +48,7 @@
//
// -----------------------------------------------------------------------------
//
-void CSymbianUnitTestSuite::ConstructL( const TDesC& aName )
+EXPORT_C void CSymbianUnitTestSuite::ConstructL( const TDesC& aName )
{
iName = aName.AllocL();
}
@@ -57,7 +57,7 @@
//
// -----------------------------------------------------------------------------
//
-CSymbianUnitTestSuite::CSymbianUnitTestSuite()
+EXPORT_C CSymbianUnitTestSuite::CSymbianUnitTestSuite()
{
}
--- a/testexecfw/symbianunittestfw/sutfw/sutfwcore/sutfwframework/tsrc/BWINS/ut_sutfwframeworkU.DEF Mon Mar 08 15:03:44 2010 +0800
+++ b/testexecfw/symbianunittestfw/sutfw/sutfwcore/sutfwframework/tsrc/BWINS/ut_sutfwframeworkU.DEF Mon Mar 29 14:46:27 2010 +0800
@@ -1,3 +1,31 @@
EXPORTS
?CreateTestSuiteL@@YAPAVMSymbianUnitTestInterface@@XZ @ 1 NONAME ; class MSymbianUnitTestInterface * CreateTestSuiteL(void)
+ ?RecordNoLeaveFromStatementL@CSymbianUnitTest@@IAEXABVTDesC8@@H0@Z @ 2 NONAME ; void CSymbianUnitTest::RecordNoLeaveFromStatementL(class TDesC8 const &, int, class TDesC8 const &)
+ ??0CSymbianUnitTest@@IAE@XZ @ 3 NONAME ; CSymbianUnitTest::CSymbianUnitTest(void)
+ ?ConstructL@CSymbianUnitTest@@IAEXABVTDesC8@@@Z @ 4 NONAME ; void CSymbianUnitTest::ConstructL(class TDesC8 const &)
+ ?AddL@CSymbianUnitTestSuite@@QAEXPAVMSymbianUnitTestInterface@@@Z @ 5 NONAME ; void CSymbianUnitTestSuite::AddL(class MSymbianUnitTestInterface *)
+ ??1CSymbianUnitTest@@UAE@XZ @ 6 NONAME ; CSymbianUnitTest::~CSymbianUnitTest(void)
+ ?SetupL@CSymbianUnitTest@@UAEXXZ @ 7 NONAME ; void CSymbianUnitTest::SetupL(void)
+ ?AssertionFailedL@CSymbianUnitTest@@IAEXABVTDesC8@@H0@Z @ 8 NONAME ; void CSymbianUnitTest::AssertionFailedL(class TDesC8 const &, int, class TDesC8 const &)
+ ?ConstructL@CSymbianUnitTestSuite@@IAEXABVTDesC16@@@Z @ 9 NONAME ; void CSymbianUnitTestSuite::ConstructL(class TDesC16 const &)
+ ?AssertEqualsL@CSymbianUnitTest@@IAEXHHHABVTDesC8@@@Z @ 10 NONAME ; void CSymbianUnitTest::AssertEqualsL(int, int, int, class TDesC8 const &)
+ ?AssertEqualsL@CSymbianUnitTest@@IAEXABVTDesC16@@0HABVTDesC8@@@Z @ 11 NONAME ; void CSymbianUnitTest::AssertEqualsL(class TDesC16 const &, class TDesC16 const &, int, class TDesC8 const &)
+ ?Name@CSymbianUnitTestSuite@@UBEABVTDesC16@@XZ @ 12 NONAME ; class TDesC16 const & CSymbianUnitTestSuite::Name(void) const
+ ?Teardown@CSymbianUnitTest@@UAEXXZ @ 13 NONAME ; void CSymbianUnitTest::Teardown(void)
+ ?AssertLeaveL@CSymbianUnitTest@@IAEXABVTDesC8@@HHH0@Z @ 14 NONAME ; void CSymbianUnitTest::AssertLeaveL(class TDesC8 const &, int, int, int, class TDesC8 const &)
+ ?AssertEqualsL@CSymbianUnitTest@@IAEXABVTDesC8@@0H0@Z @ 15 NONAME ; void CSymbianUnitTest::AssertEqualsL(class TDesC8 const &, class TDesC8 const &, int, class TDesC8 const &)
+ ?AssertEqualsL@CSymbianUnitTest@@IAEXABVTDesC8@@0H00@Z @ 16 NONAME ; void CSymbianUnitTest::AssertEqualsL(class TDesC8 const &, class TDesC8 const &, int, class TDesC8 const &, class TDesC8 const &)
+ ??0CSymbianUnitTestSuite@@IAE@XZ @ 17 NONAME ; CSymbianUnitTestSuite::CSymbianUnitTestSuite(void)
+ ?AssertEqualsL@CSymbianUnitTest@@IAEXABVTDesC16@@0HABVTDesC8@@1@Z @ 18 NONAME ; void CSymbianUnitTest::AssertEqualsL(class TDesC16 const &, class TDesC16 const &, int, class TDesC8 const &, class TDesC8 const &)
+ ?Name@CSymbianUnitTest@@UBEABVTDesC16@@XZ @ 19 NONAME ; class TDesC16 const & CSymbianUnitTest::Name(void) const
+ ?ExecuteL@CSymbianUnitTest@@UAEXAAVMSymbianUnitTestObserver@@AAVCSymbianUnitTestResult@@W4TFailureSimulation@MSymbianUnitTestInterface@@ABVCDesC16Array@@H@Z @ 20 NONAME ; void CSymbianUnitTest::ExecuteL(class MSymbianUnitTestObserver &, class CSymbianUnitTestResult &, enum MSymbianUnitTestInterface::TFailureSimulation, class CDesC16Array const &, int)
+ ?NewL@CSymbianUnitTestSuite@@SAPAV1@ABVTDesC16@@@Z @ 21 NONAME ; class CSymbianUnitTestSuite * CSymbianUnitTestSuite::NewL(class TDesC16 const &)
+ ??1CSymbianUnitTestSuite@@UAE@XZ @ 22 NONAME ; CSymbianUnitTestSuite::~CSymbianUnitTestSuite(void)
+ ?NewLC@CSymbianUnitTestSuite@@SAPAV1@ABVTDesC16@@@Z @ 23 NONAME ; class CSymbianUnitTestSuite * CSymbianUnitTestSuite::NewLC(class TDesC16 const &)
+ ?ExecuteL@CSymbianUnitTestSuite@@UAEXAAVMSymbianUnitTestObserver@@AAVCSymbianUnitTestResult@@W4TFailureSimulation@MSymbianUnitTestInterface@@ABVCDesC16Array@@H@Z @ 24 NONAME ; void CSymbianUnitTestSuite::ExecuteL(class MSymbianUnitTestObserver &, class CSymbianUnitTestResult &, enum MSymbianUnitTestInterface::TFailureSimulation, class CDesC16Array const &, int)
+ ?IsMemoryAllocationFailureSimulationUsed@CSymbianUnitTest@@IBEHXZ @ 25 NONAME ; int CSymbianUnitTest::IsMemoryAllocationFailureSimulationUsed(void) const
+ ?TestCaseCount@CSymbianUnitTestSuite@@UAEHXZ @ 26 NONAME ; int CSymbianUnitTestSuite::TestCaseCount(void)
+ ?AddTestCaseL@CSymbianUnitTest@@IAEXABVTDesC16@@P81@AEXXZ11@Z @ 27 NONAME ; void CSymbianUnitTest::AddTestCaseL(class TDesC16 const &, void (*)(void), void (*)(void), void (*)(void))
+ ?TestCaseCount@CSymbianUnitTest@@UAEHXZ @ 28 NONAME ; int CSymbianUnitTest::TestCaseCount(void)
+ ?AssertEqualsL@CSymbianUnitTest@@IAEXHHHABVTDesC8@@0@Z @ 29 NONAME ; void CSymbianUnitTest::AssertEqualsL(int, int, int, class TDesC8 const &, class TDesC8 const &)
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/symbianunittestfw/sutfw/sutfwcore/sutfwframework/tsrc/eabi/ut_sutfwframeworku.def Mon Mar 29 14:46:27 2010 +0800
@@ -0,0 +1,47 @@
+EXPORTS
+ _Z16CreateTestSuiteLv @ 1 NONAME
+ _ZN16CSymbianUnitTest10ConstructLERK6TDesC8 @ 2 NONAME
+ _ZN16CSymbianUnitTest12AddTestCaseLERK7TDesC16MS_FvvES4_S4_ @ 3 NONAME
+ _ZN16CSymbianUnitTest12AssertLeaveLERK6TDesC8iiiS2_ @ 4 NONAME
+ _ZN16CSymbianUnitTest13AssertEqualsLERK6TDesC8S2_iS2_ @ 5 NONAME
+ _ZN16CSymbianUnitTest13AssertEqualsLERK6TDesC8S2_iS2_S2_ @ 6 NONAME
+ _ZN16CSymbianUnitTest13AssertEqualsLERK7TDesC16S2_iRK6TDesC8 @ 7 NONAME
+ _ZN16CSymbianUnitTest13AssertEqualsLERK7TDesC16S2_iRK6TDesC8S5_ @ 8 NONAME
+ _ZN16CSymbianUnitTest13AssertEqualsLEiiiRK6TDesC8 @ 9 NONAME
+ _ZN16CSymbianUnitTest13AssertEqualsLEiiiRK6TDesC8S2_ @ 10 NONAME
+ _ZN16CSymbianUnitTest13TestCaseCountEv @ 11 NONAME
+ _ZN16CSymbianUnitTest16AssertionFailedLERK6TDesC8iS2_ @ 12 NONAME
+ _ZN16CSymbianUnitTest27RecordNoLeaveFromStatementLERK6TDesC8iS2_ @ 13 NONAME
+ _ZN16CSymbianUnitTest6SetupLEv @ 14 NONAME
+ _ZN16CSymbianUnitTest8ExecuteLER24MSymbianUnitTestObserverR22CSymbianUnitTestResultN25MSymbianUnitTestInterface18TFailureSimulationERK12CDesC16Arrayi @ 15 NONAME
+ _ZN16CSymbianUnitTest8TeardownEv @ 16 NONAME
+ _ZN16CSymbianUnitTestC1Ev @ 17 NONAME
+ _ZN16CSymbianUnitTestC2Ev @ 18 NONAME
+ _ZN16CSymbianUnitTestD0Ev @ 19 NONAME
+ _ZN16CSymbianUnitTestD1Ev @ 20 NONAME
+ _ZN16CSymbianUnitTestD2Ev @ 21 NONAME
+ _ZN21CSymbianUnitTestSuite10ConstructLERK7TDesC16 @ 22 NONAME
+ _ZN21CSymbianUnitTestSuite13TestCaseCountEv @ 23 NONAME
+ _ZN21CSymbianUnitTestSuite4AddLEP25MSymbianUnitTestInterface @ 24 NONAME
+ _ZN21CSymbianUnitTestSuite4NewLERK7TDesC16 @ 25 NONAME
+ _ZN21CSymbianUnitTestSuite5NewLCERK7TDesC16 @ 26 NONAME
+ _ZN21CSymbianUnitTestSuite8ExecuteLER24MSymbianUnitTestObserverR22CSymbianUnitTestResultN25MSymbianUnitTestInterface18TFailureSimulationERK12CDesC16Arrayi @ 27 NONAME
+ _ZN21CSymbianUnitTestSuiteC1Ev @ 28 NONAME
+ _ZN21CSymbianUnitTestSuiteC2Ev @ 29 NONAME
+ _ZN21CSymbianUnitTestSuiteD0Ev @ 30 NONAME
+ _ZN21CSymbianUnitTestSuiteD1Ev @ 31 NONAME
+ _ZN21CSymbianUnitTestSuiteD2Ev @ 32 NONAME
+ _ZNK16CSymbianUnitTest39IsMemoryAllocationFailureSimulationUsedEv @ 33 NONAME
+ _ZNK16CSymbianUnitTest4NameEv @ 34 NONAME
+ _ZNK21CSymbianUnitTestSuite4NameEv @ 35 NONAME
+ _ZThn4_N16CSymbianUnitTest13TestCaseCountEv @ 36 NONAME
+ _ZThn4_N16CSymbianUnitTest8ExecuteLER24MSymbianUnitTestObserverR22CSymbianUnitTestResultN25MSymbianUnitTestInterface18TFailureSimulationERK12CDesC16Arrayi @ 37 NONAME
+ _ZThn4_N16CSymbianUnitTestD0Ev @ 38 NONAME
+ _ZThn4_N16CSymbianUnitTestD1Ev @ 39 NONAME
+ _ZThn4_N21CSymbianUnitTestSuite13TestCaseCountEv @ 40 NONAME
+ _ZThn4_N21CSymbianUnitTestSuite8ExecuteLER24MSymbianUnitTestObserverR22CSymbianUnitTestResultN25MSymbianUnitTestInterface18TFailureSimulationERK12CDesC16Arrayi @ 41 NONAME
+ _ZThn4_N21CSymbianUnitTestSuiteD0Ev @ 42 NONAME
+ _ZThn4_N21CSymbianUnitTestSuiteD1Ev @ 43 NONAME
+ _ZThn4_NK16CSymbianUnitTest4NameEv @ 44 NONAME
+ _ZThn4_NK21CSymbianUnitTestSuite4NameEv @ 45 NONAME
+
--- a/testexecfw/symbianunittestfw/sutfw/sutfwcore/sutfwframework/tsrc/group/ut_sutfwframework.mmp Mon Mar 08 15:03:44 2010 +0800
+++ b/testexecfw/symbianunittestfw/sutfw/sutfwcore/sutfwframework/tsrc/group/ut_sutfwframework.mmp Mon Mar 29 14:46:27 2010 +0800
@@ -18,7 +18,7 @@
TARGET ut_sutfwframework.dll
TARGETTYPE dll
UID 0x20022E76 0x20022E76
-
+NOEXPORTLIBRARY
MACRO SYMBIAN_UNIT_TEST
// Sources tested
@@ -35,12 +35,13 @@
SOURCE ut_symbianunittestsuite.cpp
SOURCE ut_symbianunittestfailure.cpp
SOURCE ut_symbianunittestresult.cpp
+SOURCE ut_symbianunittestother.cpp
USERINCLUDE ../inc
USERINCLUDE ../../inc
USERINCLUDE ../../../../inc
-SYSTEMINCLUDE /epoc32/include
+APP_LAYER_SYSTEMINCLUDE_SYMBIAN
SYSTEMINCLUDE /epoc32/include/symbianunittest
LIBRARY euser.lib
@@ -53,4 +54,3 @@
VENDORID 0x101FB657
CAPABILITY ALL -TCB
-
--- a/testexecfw/symbianunittestfw/sutfw/sutfwcore/sutfwframework/tsrc/inc/ut_symbianunittest.h Mon Mar 08 15:03:44 2010 +0800
+++ b/testexecfw/symbianunittestfw/sutfw/sutfwcore/sutfwframework/tsrc/inc/ut_symbianunittest.h Mon Mar 29 14:46:27 2010 +0800
@@ -27,7 +27,7 @@
class CSymbianUnitTestResult;
// CLASS DECLARATION
-class UT_CSymbianUnitTest :
+NONSHARABLE_CLASS(UT_CSymbianUnitTest) :
public CSymbianUnitTest,
public MSymbianUnitTestObserver
{
@@ -51,10 +51,11 @@
void UT_ErrorInSetupL();
void UT_LeaveInTestL();
void UT_MemoryLeakInTestL();
+ void UT_EqualsAssertsL();
void UT_FailingAssertsL();
void UT_PassingAssertsL();
- void UT_TestCaseNamesL();
- void UT_TimeoutL();
+ void UT_TestCaseNamesL();
+ void UT_TimeoutL();
protected: // Failing functions to simulate failing tests
@@ -68,6 +69,12 @@
void SimulateFailingAssertLeaveL();
void SimulateFailingAssertLeaveWithSpecificValueL();
void SimulateTimeoutL();
+ void SimulateEqualsAssertWithStringL();
+ void SimulateEqualsAssertWithStringFailL();
+ void SimulateEqualsAssertWithString8L();
+ void SimulateEqualsAssertWithString8FailL();
+ void SimulateEqualsAssertWithIntL();
+ void SimulateEqualsAssertWithIntFailL();
protected: // Dummy function to simulate setup and teardown
--- a/testexecfw/symbianunittestfw/sutfw/sutfwcore/sutfwframework/tsrc/inc/ut_symbianunittestfailure.h Mon Mar 08 15:03:44 2010 +0800
+++ b/testexecfw/symbianunittestfw/sutfw/sutfwcore/sutfwframework/tsrc/inc/ut_symbianunittestfailure.h Mon Mar 29 14:46:27 2010 +0800
@@ -25,7 +25,7 @@
class CSymbianUnitTestFailure;
// CLASS DECLARATION
-class UT_CSymbianUnitTestFailure : public CSymbianUnitTest
+NONSHARABLE_CLASS( UT_CSymbianUnitTestFailure ) : public CSymbianUnitTest
{
public: // Constructors and destructor
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/symbianunittestfw/sutfw/sutfwcore/sutfwframework/tsrc/inc/ut_symbianunittestother.h Mon Mar 29 14:46:27 2010 +0800
@@ -0,0 +1,52 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#ifndef UT_SYMBIANUNITTESTOTHER_H
+#define UT_SYMBIANUNITTESTOTHER_H
+
+// INCLUDES
+#include <symbianunittest.h>
+
+// FORWARD DECLARATIONS
+class CSymbianUnitTestFailure;
+
+// CLASS DECLARATION
+NONSHARABLE_CLASS( UT_CSymbianUnitTestOther ) : public CSymbianUnitTest
+ {
+ public: // Constructors and destructor
+
+ static UT_CSymbianUnitTestOther* NewL();
+ static UT_CSymbianUnitTestOther* NewLC();
+ ~UT_CSymbianUnitTestOther();
+
+ protected: // Test functions
+
+ /*void SetupL();
+ void Teardown(); */
+ void UT_GettersL();
+
+ private: // Contructors
+
+ UT_CSymbianUnitTestOther();
+ void ConstructL();
+
+ private: // Data
+
+ CSymbianUnitTestFailure* iUnitTestFailure;
+ };
+
+#endif // UT_SYMBIANUNITTESTOTHER_H
--- a/testexecfw/symbianunittestfw/sutfw/sutfwcore/sutfwframework/tsrc/inc/ut_symbianunittestresult.h Mon Mar 08 15:03:44 2010 +0800
+++ b/testexecfw/symbianunittestfw/sutfw/sutfwcore/sutfwframework/tsrc/inc/ut_symbianunittestresult.h Mon Mar 29 14:46:27 2010 +0800
@@ -25,7 +25,7 @@
class CSymbianUnitTestResult;
// CLASS DECLARATION
-class UT_CSymbianUnitTestResult : public CSymbianUnitTest
+NONSHARABLE_CLASS( UT_CSymbianUnitTestResult ) : public CSymbianUnitTest
{
public: // Constructors and destructor
--- a/testexecfw/symbianunittestfw/sutfw/sutfwcore/sutfwframework/tsrc/inc/ut_symbianunittestsuite.h Mon Mar 08 15:03:44 2010 +0800
+++ b/testexecfw/symbianunittestfw/sutfw/sutfwcore/sutfwframework/tsrc/inc/ut_symbianunittestsuite.h Mon Mar 29 14:46:27 2010 +0800
@@ -25,7 +25,7 @@
class CSymbianUnitTestSuite;
// CLASS DECLARATION
-class UT_CSymbianUnitTestSuite : public CSymbianUnitTest
+NONSHARABLE_CLASS( UT_CSymbianUnitTestSuite ) : public CSymbianUnitTest
{
public: // Constructors and destructor
--- a/testexecfw/symbianunittestfw/sutfw/sutfwcore/sutfwframework/tsrc/src/ut_symbianunittest.cpp Mon Mar 08 15:03:44 2010 +0800
+++ b/testexecfw/symbianunittestfw/sutfw/sutfwcore/sutfwframework/tsrc/src/ut_symbianunittest.cpp Mon Mar 29 14:46:27 2010 +0800
@@ -15,6 +15,7 @@
*
*/
+#include "sutlogger.h"
#include "ut_symbianunittest.h"
#include "symbianunittestresult.h"
#include <symbianunittestmacros.h>
@@ -48,6 +49,8 @@
//
UT_CSymbianUnitTest::UT_CSymbianUnitTest()
{
+ SUT_LOG_DEBUG( "Entering UT_CSymbianUnitTest::UT_CSymbianUnitTest()" )
+ SUT_LOG_DEBUG( "Exiting UT_CSymbianUnitTest::UT_CSymbianUnitTest()" )
}
// ---------------------------------------------------------------------------
@@ -57,12 +60,16 @@
void UT_CSymbianUnitTest::ConstructL()
{
BASE_CONSTRUCT
+
+ DEFINE_TEST_CLASS( UT_CSymbianUnitTest )
+
ADD_SUT_WITH_SETUP_AND_TEARDOWN( SetupL, UT_NameL, Teardown )
ADD_SUT( UT_IsMemoryAllocationFailureSimulationUsedL )
ADD_SUT( UT_PanicInTestL )
ADD_SUT( UT_ErrorInSetupL )
ADD_SUT( UT_LeaveInTestL )
- ADD_SUT( UT_MemoryLeakInTestL )
+ ADD_SUT( UT_MemoryLeakInTestL )
+ ADD_SUT( UT_EqualsAssertsL )
ADD_SUT( UT_FailingAssertsL )
ADD_SUT( UT_PassingAssertsL )
ADD_SUT( UT_TestCaseNamesL )
@@ -148,9 +155,9 @@
_LIT( KTestName, "PanicInTest" );
iUnitTest->AddTestCaseL(
KTestName,
- CSymbianUnitTest::FunctionPtr( Dummy ),
- CSymbianUnitTest::FunctionPtr( SimulatePanicL ),
- CSymbianUnitTest::FunctionPtr( Dummy ) );
+ CSymbianUnitTest::FunctionPtr( &UT_CSymbianUnitTest::Dummy ),
+ CSymbianUnitTest::FunctionPtr( &UT_CSymbianUnitTest::SimulatePanicL ),
+ CSymbianUnitTest::FunctionPtr( &UT_CSymbianUnitTest::Dummy ) );
// Without memory allocation failure simulation
iUnitTest->ExecuteL( *this, *iTestResult, ENoFailureSimulation, *iTestCaseNames, 0 );
@@ -175,9 +182,9 @@
_LIT( KTestName, "ErrorInSetup" );
iUnitTest->AddTestCaseL(
KTestName,
- CSymbianUnitTest::FunctionPtr( SimulateLeaveL ),
- CSymbianUnitTest::FunctionPtr( Dummy ),
- CSymbianUnitTest::FunctionPtr( Dummy ) );
+ CSymbianUnitTest::FunctionPtr( &UT_CSymbianUnitTest::SimulateLeaveL ),
+ CSymbianUnitTest::FunctionPtr( &UT_CSymbianUnitTest::Dummy ),
+ CSymbianUnitTest::FunctionPtr( &UT_CSymbianUnitTest::Dummy ) );
// Without memory allocation failure simulation
iUnitTest->ExecuteL( *this, *iTestResult, ENoFailureSimulation, *iTestCaseNames, 0 );
@@ -202,9 +209,9 @@
_LIT( KTestName, "LeaveInTest" );
iUnitTest->AddTestCaseL(
KTestName,
- CSymbianUnitTest::FunctionPtr( Dummy ),
- CSymbianUnitTest::FunctionPtr( SimulateLeaveL ),
- CSymbianUnitTest::FunctionPtr( Dummy ) );
+ CSymbianUnitTest::FunctionPtr( &UT_CSymbianUnitTest::Dummy ),
+ CSymbianUnitTest::FunctionPtr( &UT_CSymbianUnitTest::SimulateLeaveL ),
+ CSymbianUnitTest::FunctionPtr( &UT_CSymbianUnitTest::Dummy ) );
// Without memory allocation failure simulation
iUnitTest->ExecuteL( *this, *iTestResult, ENoFailureSimulation, *iTestCaseNames, 0);
@@ -229,9 +236,9 @@
_LIT( KTestName, "MemoryLeakInTest" );
iUnitTest->AddTestCaseL(
KTestName,
- CSymbianUnitTest::FunctionPtr( Dummy ),
- CSymbianUnitTest::FunctionPtr( SimulateMemoryLeakL ),
- CSymbianUnitTest::FunctionPtr( Dummy ) );
+ CSymbianUnitTest::FunctionPtr( &UT_CSymbianUnitTest::Dummy ),
+ CSymbianUnitTest::FunctionPtr( &UT_CSymbianUnitTest::SimulateMemoryLeakL ),
+ CSymbianUnitTest::FunctionPtr( &UT_CSymbianUnitTest::Dummy ) );
// Without memory allocation failure simulation
iUnitTest->ExecuteL( *this, *iTestResult, ENoFailureSimulation, *iTestCaseNames, 0 );
@@ -248,6 +255,66 @@
//
// ---------------------------------------------------------------------------
//
+void UT_CSymbianUnitTest::UT_EqualsAssertsL()
+ {
+ SUT_ASSERT_EQUALS( 0, iTestResult->Failures().Count() )
+ SUT_ASSERT_EQUALS( 0, iExecutedTestCount )
+
+ _LIT( KTestName, "TestAssertEquals" );
+
+ iUnitTest->AddTestCaseL(
+ KTestName,
+ CSymbianUnitTest::FunctionPtr( &UT_CSymbianUnitTest::Dummy ),
+ CSymbianUnitTest::FunctionPtr( &UT_CSymbianUnitTest::SimulateEqualsAssertWithStringL ),
+ CSymbianUnitTest::FunctionPtr( &UT_CSymbianUnitTest::Dummy ) );
+
+
+ iUnitTest->AddTestCaseL(
+ KTestName,
+ CSymbianUnitTest::FunctionPtr( &UT_CSymbianUnitTest::Dummy ),
+ CSymbianUnitTest::FunctionPtr( &UT_CSymbianUnitTest::SimulateEqualsAssertWithStringFailL ),
+ CSymbianUnitTest::FunctionPtr( &UT_CSymbianUnitTest::Dummy ) );
+
+
+ iUnitTest->AddTestCaseL(
+ KTestName,
+ CSymbianUnitTest::FunctionPtr( &UT_CSymbianUnitTest::Dummy ),
+ CSymbianUnitTest::FunctionPtr( &UT_CSymbianUnitTest::SimulateEqualsAssertWithString8L ),
+ CSymbianUnitTest::FunctionPtr( &UT_CSymbianUnitTest::Dummy ) );
+
+ iUnitTest->AddTestCaseL(
+ KTestName,
+ CSymbianUnitTest::FunctionPtr( &UT_CSymbianUnitTest::Dummy ),
+ CSymbianUnitTest::FunctionPtr( &UT_CSymbianUnitTest::SimulateEqualsAssertWithString8FailL ),
+ CSymbianUnitTest::FunctionPtr( &UT_CSymbianUnitTest::Dummy ) );
+
+ iUnitTest->AddTestCaseL(
+ KTestName,
+ CSymbianUnitTest::FunctionPtr( &UT_CSymbianUnitTest::Dummy ),
+ CSymbianUnitTest::FunctionPtr( &UT_CSymbianUnitTest::SimulateEqualsAssertWithIntL ),
+ CSymbianUnitTest::FunctionPtr( &UT_CSymbianUnitTest::Dummy ) );
+
+ iUnitTest->AddTestCaseL(
+ KTestName,
+ CSymbianUnitTest::FunctionPtr( &UT_CSymbianUnitTest::Dummy ),
+ CSymbianUnitTest::FunctionPtr( &UT_CSymbianUnitTest::SimulateEqualsAssertWithIntFailL ),
+ CSymbianUnitTest::FunctionPtr( &UT_CSymbianUnitTest::Dummy ) );
+
+ // Without memory allocation failure simulation
+ iUnitTest->ExecuteL( *this, *iTestResult, ENoFailureSimulation, *iTestCaseNames, 0 );
+ SUT_ASSERT_EQUALS( 3, iTestResult->Failures().Count() )
+ SUT_ASSERT_EQUALS( 6, iExecutedTestCount )
+
+ // With memory allocation failure simulation
+ iUnitTest->ExecuteL( *this, *iTestResult, EMemAllocFailureSimulation, *iTestCaseNames, 0 );
+ SUT_ASSERT_EQUALS( 6, iTestResult->Failures().Count() )
+ SUT_ASSERT_EQUALS( 12, iExecutedTestCount )
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
void UT_CSymbianUnitTest::UT_FailingAssertsL()
{
SUT_ASSERT_EQUALS( 0, iTestResult->Failures().Count() )
@@ -256,34 +323,34 @@
_LIT( KTestName, "TestAssertFailures" );
iUnitTest->AddTestCaseL(
KTestName,
- CSymbianUnitTest::FunctionPtr( Dummy ),
- CSymbianUnitTest::FunctionPtr( SimulateFailingAssertL ),
- CSymbianUnitTest::FunctionPtr( Dummy ) );
+ CSymbianUnitTest::FunctionPtr( &UT_CSymbianUnitTest::Dummy ),
+ CSymbianUnitTest::FunctionPtr( &UT_CSymbianUnitTest::SimulateFailingAssertL ),
+ CSymbianUnitTest::FunctionPtr( &UT_CSymbianUnitTest::Dummy ) );
iUnitTest->AddTestCaseL(
KTestName,
- CSymbianUnitTest::FunctionPtr( Dummy ),
- CSymbianUnitTest::FunctionPtr( SimulateFailingAssertWithIntsL ),
- CSymbianUnitTest::FunctionPtr( Dummy ) );
+ CSymbianUnitTest::FunctionPtr( &UT_CSymbianUnitTest::Dummy ),
+ CSymbianUnitTest::FunctionPtr( &UT_CSymbianUnitTest::SimulateFailingAssertWithIntsL ),
+ CSymbianUnitTest::FunctionPtr( &UT_CSymbianUnitTest::Dummy ) );
iUnitTest->AddTestCaseL(
KTestName,
- CSymbianUnitTest::FunctionPtr( Dummy ),
- CSymbianUnitTest::FunctionPtr( SimulateFailingAssertWithDesC8sL ),
- CSymbianUnitTest::FunctionPtr( Dummy ) );
+ CSymbianUnitTest::FunctionPtr( &UT_CSymbianUnitTest::Dummy ),
+ CSymbianUnitTest::FunctionPtr( &UT_CSymbianUnitTest::SimulateFailingAssertWithDesC8sL ),
+ CSymbianUnitTest::FunctionPtr( &UT_CSymbianUnitTest::Dummy ) );
iUnitTest->AddTestCaseL(
KTestName,
- CSymbianUnitTest::FunctionPtr( Dummy ),
- CSymbianUnitTest::FunctionPtr( SimulateFailingAssertWithDesC16sL ),
- CSymbianUnitTest::FunctionPtr( Dummy ) );
+ CSymbianUnitTest::FunctionPtr( &UT_CSymbianUnitTest::Dummy ),
+ CSymbianUnitTest::FunctionPtr( &UT_CSymbianUnitTest::SimulateFailingAssertWithDesC16sL ),
+ CSymbianUnitTest::FunctionPtr( &UT_CSymbianUnitTest::Dummy ) );
iUnitTest->AddTestCaseL(
KTestName,
- CSymbianUnitTest::FunctionPtr( Dummy ),
- CSymbianUnitTest::FunctionPtr( SimulateFailingAssertLeaveL ),
- CSymbianUnitTest::FunctionPtr( Dummy ) );
+ CSymbianUnitTest::FunctionPtr( &UT_CSymbianUnitTest::Dummy ),
+ CSymbianUnitTest::FunctionPtr( &UT_CSymbianUnitTest::SimulateFailingAssertLeaveL ),
+ CSymbianUnitTest::FunctionPtr( &UT_CSymbianUnitTest::Dummy ) );
iUnitTest->AddTestCaseL(
KTestName,
- CSymbianUnitTest::FunctionPtr( Dummy ),
- CSymbianUnitTest::FunctionPtr( SimulateFailingAssertLeaveWithSpecificValueL ),
- CSymbianUnitTest::FunctionPtr( Dummy ) );
+ CSymbianUnitTest::FunctionPtr( &UT_CSymbianUnitTest::Dummy ),
+ CSymbianUnitTest::FunctionPtr( &UT_CSymbianUnitTest::SimulateFailingAssertLeaveWithSpecificValueL ),
+ CSymbianUnitTest::FunctionPtr( &UT_CSymbianUnitTest::Dummy ) );
// Without memory allocation failure simulation
iUnitTest->ExecuteL( *this, *iTestResult, ENoFailureSimulation, *iTestCaseNames, 0 );
@@ -303,6 +370,7 @@
void UT_CSymbianUnitTest::UT_PassingAssertsL()
{
SUT_ASSERT( ETrue )
+ SUT_ASSERT_DESC( ETrue, "test assert with desc")
SUT_ASSERT( ETrue == ETrue )
SUT_ASSERT( 1 == 1 )
HBufC* ptr( NULL );
@@ -312,10 +380,10 @@
CleanupStack::PopAndDestroy( ptr );
SUT_ASSERT_EQUALS( 1, 1 )
+ SUT_ASSERT_EQUALS_DESC( 1, 1, "test assert equals with desc" )
SUT_ASSERT_EQUALS( KNullDesC8, KNullDesC8 )
SUT_ASSERT_EQUALS( KNullDesC, KNullDesC )
- SUT_ASSERT_LEAVE( User::Leave( KErrNone ) )
SUT_ASSERT_LEAVE( User::Leave( KErrGeneral ) )
SUT_ASSERT_LEAVE_WITH( User::Leave( KErrGeneral ), KErrGeneral )
@@ -334,23 +402,23 @@
_LIT( KTest1Name, "TestCase1" );
iUnitTest->AddTestCaseL(
KTest1Name,
- CSymbianUnitTest::FunctionPtr( Dummy ),
- CSymbianUnitTest::FunctionPtr( SimulateLeaveL ),
- CSymbianUnitTest::FunctionPtr( Dummy ) );
+ CSymbianUnitTest::FunctionPtr( &UT_CSymbianUnitTest::Dummy ),
+ CSymbianUnitTest::FunctionPtr( &UT_CSymbianUnitTest::SimulateLeaveL ),
+ CSymbianUnitTest::FunctionPtr( &UT_CSymbianUnitTest::Dummy ) );
_LIT( KTest2Name, "TestCase2" );
iUnitTest->AddTestCaseL(
KTest2Name,
- CSymbianUnitTest::FunctionPtr( Dummy ),
- CSymbianUnitTest::FunctionPtr( SimulateLeaveL ),
- CSymbianUnitTest::FunctionPtr( Dummy ) );
+ CSymbianUnitTest::FunctionPtr( &UT_CSymbianUnitTest::Dummy ),
+ CSymbianUnitTest::FunctionPtr( &UT_CSymbianUnitTest::SimulateLeaveL ),
+ CSymbianUnitTest::FunctionPtr( &UT_CSymbianUnitTest::Dummy ) );
_LIT( KTest3Name, "TestCase3" );
iUnitTest->AddTestCaseL(
KTest3Name,
- CSymbianUnitTest::FunctionPtr( Dummy ),
- CSymbianUnitTest::FunctionPtr( SimulateLeaveL ),
- CSymbianUnitTest::FunctionPtr( Dummy ) );
+ CSymbianUnitTest::FunctionPtr( &UT_CSymbianUnitTest::Dummy ),
+ CSymbianUnitTest::FunctionPtr( &UT_CSymbianUnitTest::SimulateLeaveL ),
+ CSymbianUnitTest::FunctionPtr( &UT_CSymbianUnitTest::Dummy ) );
_LIT( LTest1FullName, "UT_CSymbianUnitTest::TestCase1");
iTestCaseNames->AppendL(LTest1FullName);
@@ -370,9 +438,9 @@
_LIT( KTestName, "TimeoutTestCase" );
iUnitTest->AddTestCaseL(
KTestName,
- CSymbianUnitTest::FunctionPtr( Dummy ),
- CSymbianUnitTest::FunctionPtr( SimulateTimeoutL ),
- CSymbianUnitTest::FunctionPtr( Dummy ) );
+ CSymbianUnitTest::FunctionPtr( &UT_CSymbianUnitTest::Dummy ),
+ CSymbianUnitTest::FunctionPtr( &UT_CSymbianUnitTest::SimulateTimeoutL ),
+ CSymbianUnitTest::FunctionPtr( &UT_CSymbianUnitTest::Dummy ) );
//run test case without timeout control
iUnitTest->ExecuteL( *this, *iTestResult, ENoFailureSimulation, *iTestCaseNames, 0 );
SUT_ASSERT_EQUALS( 0, iTestResult->Failures().Count() )
@@ -399,8 +467,8 @@
//
void UT_CSymbianUnitTest::SimulatePanicL()
{
- HBufC* tmp( NULL );
- tmp->Length();
+ _LIT( KPanicString, "kkkkkkkkkkkk");
+ TBufC<3> buf( KPanicString );
}
// ---------------------------------------------------------------------------
@@ -486,3 +554,63 @@
void UT_CSymbianUnitTest::Dummy()
{
}
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void UT_CSymbianUnitTest::SimulateEqualsAssertWithStringL()
+ {
+ _LIT( KSomeText, "some text" );
+ AssertEqualsL( KSomeText, KSomeText, __LINE__, _L8( __FILE__ ) );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void UT_CSymbianUnitTest::SimulateEqualsAssertWithStringFailL()
+ {
+ _LIT( KSomeText, "some text" );
+ AssertEqualsL( KNullDesC, KSomeText, __LINE__, _L8( __FILE__ ) );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void UT_CSymbianUnitTest::SimulateEqualsAssertWithString8L()
+ {
+ _LIT8( KSomeText, "some text" );
+ AssertEqualsL( KSomeText, KSomeText, __LINE__, _L8( __FILE__ ) );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void UT_CSymbianUnitTest::SimulateEqualsAssertWithString8FailL()
+ {
+ _LIT8( KSomeText, "some text" );
+ AssertEqualsL( KNullDesC8, KSomeText, __LINE__, _L8( __FILE__ ) );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void UT_CSymbianUnitTest::SimulateEqualsAssertWithIntL()
+ {
+ const TInt KAssertValue(123);
+ AssertEqualsL( 123, KAssertValue, __LINE__, _L8( __FILE__ ) );
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void UT_CSymbianUnitTest::SimulateEqualsAssertWithIntFailL()
+ {
+ const TInt KAssertValue(123);
+ AssertEqualsL( -1, KAssertValue, __LINE__, _L8( __FILE__ ) );
+ }
--- a/testexecfw/symbianunittestfw/sutfw/sutfwcore/sutfwframework/tsrc/src/ut_symbianunittestfailure.cpp Mon Mar 08 15:03:44 2010 +0800
+++ b/testexecfw/symbianunittestfw/sutfw/sutfwcore/sutfwframework/tsrc/src/ut_symbianunittestfailure.cpp Mon Mar 29 14:46:27 2010 +0800
@@ -64,6 +64,9 @@
void UT_CSymbianUnitTestFailure::ConstructL()
{
BASE_CONSTRUCT
+
+ DEFINE_TEST_CLASS( UT_CSymbianUnitTestFailure )
+
ADD_SUT( UT_GettersL )
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/symbianunittestfw/sutfw/sutfwcore/sutfwframework/tsrc/src/ut_symbianunittestother.cpp Mon Mar 29 14:46:27 2010 +0800
@@ -0,0 +1,81 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+* Contributors:
+*
+* Description:
+*
+*/
+
+#include "ut_symbianunittestother.h"
+#include "symbianunittestfailure.h"
+#include <symbianunittestmacros.h>
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+UT_CSymbianUnitTestOther* UT_CSymbianUnitTestOther::NewL()
+ {
+ UT_CSymbianUnitTestOther* self = UT_CSymbianUnitTestOther::NewLC();
+ CleanupStack::Pop( self );
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+UT_CSymbianUnitTestOther* UT_CSymbianUnitTestOther::NewLC()
+ {
+ UT_CSymbianUnitTestOther* self =
+ new( ELeave )UT_CSymbianUnitTestOther();
+ CleanupStack::PushL( self );
+ self->ConstructL();
+ return self;
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+UT_CSymbianUnitTestOther::UT_CSymbianUnitTestOther()
+ {
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void UT_CSymbianUnitTestOther::ConstructL()
+ {
+ BASE_CONSTRUCT
+
+ DEFINE_TEST_CLASS( UT_CSymbianUnitTestOther )
+
+ ADD_SUT( UT_GettersL )
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+UT_CSymbianUnitTestOther::~UT_CSymbianUnitTestOther()
+ {
+ }
+
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void UT_CSymbianUnitTestOther::UT_GettersL()
+ {
+ }
--- a/testexecfw/symbianunittestfw/sutfw/sutfwcore/sutfwframework/tsrc/src/ut_symbianunittestresult.cpp Mon Mar 08 15:03:44 2010 +0800
+++ b/testexecfw/symbianunittestfw/sutfw/sutfwcore/sutfwframework/tsrc/src/ut_symbianunittestresult.cpp Mon Mar 29 14:46:27 2010 +0800
@@ -60,6 +60,9 @@
void UT_CSymbianUnitTestResult::ConstructL()
{
BASE_CONSTRUCT
+
+ DEFINE_TEST_CLASS( UT_CSymbianUnitTestResult )
+
ADD_SUT( UT_TestCountL )
ADD_SUT( UT_StartTestL )
ADD_SUT( UT_AddFailureL )
--- a/testexecfw/symbianunittestfw/sutfw/sutfwcore/sutfwframework/tsrc/src/ut_symbianunittestsuite.cpp Mon Mar 08 15:03:44 2010 +0800
+++ b/testexecfw/symbianunittestfw/sutfw/sutfwcore/sutfwframework/tsrc/src/ut_symbianunittestsuite.cpp Mon Mar 29 14:46:27 2010 +0800
@@ -60,6 +60,9 @@
void UT_CSymbianUnitTestSuite::ConstructL()
{
BASE_CONSTRUCT
+
+ DEFINE_TEST_CLASS( UT_CSymbianUnitTestSuite )
+
ADD_SUT( UT_NameL )
ADD_SUT( UT_AddL )
}
--- a/testexecfw/symbianunittestfw/sutfw/sutfwcore/sutfwoutput/inc/symbianunittestfileoutputwriter.h Mon Mar 08 15:03:44 2010 +0800
+++ b/testexecfw/symbianunittestfw/sutfw/sutfwcore/sutfwoutput/inc/symbianunittestfileoutputwriter.h Mon Mar 29 14:46:27 2010 +0800
@@ -40,6 +40,7 @@
void WriteDateAndTimeL();
void WriteL( const TDesC8& aValue );
void WriteL( const TDesC8& aFormat, TInt aValue );
+ void WriteL( const TDesC& aValue);
private: // Constructors
--- a/testexecfw/symbianunittestfw/sutfw/sutfwcore/sutfwoutput/src/symbianunittestfileoutputwriter.cpp Mon Mar 08 15:03:44 2010 +0800
+++ b/testexecfw/symbianunittestfw/sutfw/sutfwcore/sutfwoutput/src/symbianunittestfileoutputwriter.cpp Mon Mar 29 14:46:27 2010 +0800
@@ -17,6 +17,7 @@
#include "symbianunittestfileoutputwriter.h"
#include "symbianunittestuicallback.h"
+#include <utf.h>
_LIT( KResultDirectory, "\\sut\\" );
_LIT8( KDateAndTimeFormat, "%02d.%02d.%04d @ %02d:%02d:%02d" );
@@ -113,6 +114,18 @@
//
// -----------------------------------------------------------------------------
//
+void CSymbianUnitTestFileOutputWriter::WriteL( const TDesC& aValue )
+ {
+ HBufC8* value = CnvUtfConverter::ConvertFromUnicodeToUtf8L(aValue);
+ CleanupStack::PushL(value);
+ User::LeaveIfError( iFile.Write( *value ) );
+ CleanupStack::PopAndDestroy( value );
+ }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
void CSymbianUnitTestFileOutputWriter::WriteL(
const TDesC8& aFormat,
TInt aValue )
--- a/testexecfw/symbianunittestfw/sutfw/sutfwcore/sutfwoutput/src/symbianunittestoutputashtml.cpp Mon Mar 08 15:03:44 2010 +0800
+++ b/testexecfw/symbianunittestfw/sutfw/sutfwcore/sutfwoutput/src/symbianunittestoutputashtml.cpp Mon Mar 29 14:46:27 2010 +0800
@@ -19,6 +19,7 @@
#include "symbianunittestfailure.h"
#include "symbianunittestfileoutputwriter.h"
#include "symbianunittestoutputashtml.h"
+#include <utf.h>
// CONSTANTS
_LIT8( KHtmlHeader, "<html><head><title>Unit test results</title></head>\n" );
@@ -108,6 +109,15 @@
CSymbianUnitTestResult& aResult )
{
iOutputWriter->WriteL( KHtmlPassedTests, aResult.PassedTestCount() );
+ iOutputWriter->WriteL( KHtmlTableStartTag );
+ const CDesCArray& testCaseNames = aResult.TestCaseNames();
+ for ( TInt i=0; i < testCaseNames.Count(); i++ )
+ {
+ HBufC8* testName = CnvUtfConverter::ConvertFromUnicodeToUtf8L( testCaseNames[i] );
+ PrintTableRowL( KHtmlTestNameTitle, *testName );
+ delete testName;
+ }
+ iOutputWriter->WriteL( KHtmlTableEndTag );
}
// -----------------------------------------------------------------------------
--- a/testexecfw/symbianunittestfw/sutfw/sutfwcore/sutfwoutput/src/symbianunittestoutputastext.cpp Mon Mar 08 15:03:44 2010 +0800
+++ b/testexecfw/symbianunittestfw/sutfw/sutfwcore/sutfwoutput/src/symbianunittestoutputastext.cpp Mon Mar 29 14:46:27 2010 +0800
@@ -22,6 +22,7 @@
_LIT8( KTxtExecutedTests, "\r\n %d unit tests executed " );
_LIT8( KTxtPassedTests, " Passed tests: %d\r\n\r\n" );
+_LIT8( KTxtPassedTest, " Test: " );
_LIT8( KTxtFailedTests, " Failed tests: %d\r\n\r\n" );
_LIT8( KTxtFailureTest, " Test: " );
_LIT8( KTxtFailureFile, " File: " );
@@ -90,6 +91,13 @@
CSymbianUnitTestResult& aResult )
{
iOutputWriter->WriteL( KTxtPassedTests, aResult.PassedTestCount() );
+ const CDesCArray& testCaseNames = aResult.TestCaseNames();
+ for ( TInt i=0; i < testCaseNames.Count(); i++ )
+ {
+ iOutputWriter->WriteL( KTxtPassedTest);
+ iOutputWriter->WriteL( testCaseNames[i]);
+ iOutputWriter->WriteL( KLineEnd );
+ }
}
// -----------------------------------------------------------------------------
--- a/testexecfw/symbianunittestfw/sutfw/sutfwcore/sutfwoutput/src/symbianunittestoutputasxml.cpp Mon Mar 08 15:03:44 2010 +0800
+++ b/testexecfw/symbianunittestfw/sutfw/sutfwcore/sutfwoutput/src/symbianunittestoutputasxml.cpp Mon Mar 29 14:46:27 2010 +0800
@@ -23,7 +23,8 @@
_LIT8( KXmlResultOpenTag, "<SYMBIANUNITTEST_RESULT testcount=\"%d\">\r\n" );
_LIT8( KXmlResultCloseTag, "</SYMBIANUNITTEST_RESULT>\r\n" );
-_LIT8( KXmlPassedTestsTag, "\t<SYMBIANUNITTEST_PASSED count=\"%d\"/>\r\n" );
+_LIT8( KXmlPassedTestsOpenTag, "\t<SYMBIANUNITTEST_PASSED count=\"%d\">\r\n" );
+_LIT8( KXmlPassedTestsCloseTag, "\t</SYMBIANUNITTEST_PASSED>\r\n" );
_LIT8( KXmlFailedTestsOpenTag, "\t<SYMBIANUNITTEST_FAILED count=\"%d\">\r\n" );
_LIT8( KXmlFailedTestsCloseTag, "\t</SYMBIANUNITTEST_FAILED>\r\n" );
_LIT8( KXmlFailureOpenTag, "\t\t<SYMBIANUNITTEST_FAILURE>\r\n" );
@@ -95,7 +96,15 @@
void CSymbianUnitTestOutputAsXml::PrintPassedTestsL(
CSymbianUnitTestResult& aResult )
{
- iOutputWriter->WriteL( KXmlPassedTestsTag, aResult.PassedTestCount() );
+ iOutputWriter->WriteL( KXmlPassedTestsOpenTag, aResult.PassedTestCount() );
+ const CDesCArray& testCaseNames = aResult.TestCaseNames();
+ for ( TInt i=0; i < testCaseNames.Count(); i++ )
+ {
+ iOutputWriter->WriteL( KXmlTestNameOpenTag );
+ iOutputWriter->WriteL( testCaseNames[i]);
+ iOutputWriter->WriteL( KXmlTestNameCloseTag );
+ }
+ iOutputWriter->WriteL( KXmlPassedTestsCloseTag );
}
// -----------------------------------------------------------------------------
--- a/testexecfw/symbianunittestfw/sutfw/sutfwcore/sutfwtestrunner/src/symbianunittestrunner.cpp Mon Mar 08 15:03:44 2010 +0800
+++ b/testexecfw/symbianunittestfw/sutfw/sutfwcore/sutfwtestrunner/src/symbianunittestrunner.cpp Mon Mar 29 14:46:27 2010 +0800
@@ -136,11 +136,14 @@
{
TPtrC16 testDllName( aTestDllNames.MdcaPoint( i ) );
RLibrary library;
- if ( library.Load( testDllName ) != KErrNone )
+ TInt ret;
+ ret = library.Load( testDllName );
+ if ( ret != KErrNone )
{
iUiCallBack.InfoMsg( KFailedToFindDll, testDllName );
- SUT_LOG_FORMAT(KFailedToFindDll, &testDllName);
- User::Leave( KErrNotFound );
+ SUT_LOG_FORMAT(KFailedToFindDll, &testDllName);
+ //User::Leave( KErrNotFound );
+ User::Leave( ret );
}
CleanupClosePushL( library );
// The second UID of the dll to be used must be compatible
--- a/testexecfw/symbianunittestfw/sutfw/sutfwexamples/sutfwracecarexample/tsrc/src/ut_racecar.cpp Mon Mar 08 15:03:44 2010 +0800
+++ b/testexecfw/symbianunittestfw/sutfw/sutfwexamples/sutfwracecarexample/tsrc/src/ut_racecar.cpp Mon Mar 29 14:46:27 2010 +0800
@@ -62,6 +62,9 @@
void UT_CRaceCar::ConstructL()
{
BASE_CONSTRUCT
+
+ DEFINE_TEST_CLASS( UT_CRaceCar )
+
ADD_SUT( UT_FuelL )
ADD_SUT( UT_SteeringL )
ADD_SUT( UT_SpeedL )
--- a/testexecfw/symbianunittestfw/sutfw/sutfwui/sutfwconsoleui/group/bld.inf Mon Mar 08 15:03:44 2010 +0800
+++ b/testexecfw/symbianunittestfw/sutfw/sutfwui/sutfwconsoleui/group/bld.inf Mon Mar 29 14:46:27 2010 +0800
@@ -17,3 +17,6 @@
PRJ_MMPFILES
symbianunittestconsoleui.mmp
+
+PRJ_TESTMMPFILES
+ #include "../tsrc/group/bld.inf"
--- a/testexecfw/symbianunittestfw/sutfw/sutfwui/sutfwconsoleui/group/symbianunittestconsoleui.mmp Mon Mar 08 15:03:44 2010 +0800
+++ b/testexecfw/symbianunittestfw/sutfw/sutfwui/sutfwconsoleui/group/symbianunittestconsoleui.mmp Mon Mar 29 14:46:27 2010 +0800
@@ -37,4 +37,4 @@
VENDORID 0x101FB657
-CAPABILITY ALL -TCB
+CAPABILITY ALL -TCB -DRM
--- a/testexecfw/symbianunittestfw/sutfw/sutfwui/sutfwconsoleui/inc/symbianunittestcommandlineparser.h Mon Mar 08 15:03:44 2010 +0800
+++ b/testexecfw/symbianunittestfw/sutfw/sutfwui/sutfwconsoleui/inc/symbianunittestcommandlineparser.h Mon Mar 29 14:46:27 2010 +0800
@@ -39,6 +39,7 @@
const MDesCArray& TestDllNames() const;
const CDesCArray& TestCaseNames() const;
TBool MemoryAllocationFailureSimulation() const;
+ TBool Background() const;
const TDesC& OutputFileName() const;
const TDesC& OutputFormat() const;
TInt Timeout() const;
@@ -69,6 +70,7 @@
TBool iAllocFailureSimulation;
HBufC* iOutputFormat;
TBool iNoPrompt;
+ TBool iBackground;
TInt iTimeout;
private: // Test
--- a/testexecfw/symbianunittestfw/sutfw/sutfwui/sutfwconsoleui/inc/symbianunittestconsoleui.h Mon Mar 08 15:03:44 2010 +0800
+++ b/testexecfw/symbianunittestfw/sutfw/sutfwui/sutfwconsoleui/inc/symbianunittestconsoleui.h Mon Mar 29 14:46:27 2010 +0800
@@ -34,11 +34,11 @@
{
public: // Constructors and destructor
- static CSymbianUnitTestConsoleUi* NewLC( CConsoleBase& aConsole );
- static CSymbianUnitTestConsoleUi* NewL( CConsoleBase& aConsole );
+ static CSymbianUnitTestConsoleUi* NewLC();
+ static CSymbianUnitTestConsoleUi* NewL();
~CSymbianUnitTestConsoleUi();
- public: // From CActive
+ protected: // From CActive
void RunL();
void DoCancel();
@@ -51,7 +51,7 @@
private: // Constructors
- CSymbianUnitTestConsoleUi( CConsoleBase& aConsole );
+ CSymbianUnitTestConsoleUi();
void ConstructL();
private: // New functions
@@ -60,7 +60,7 @@
private: // Data
- CConsoleBase& iConsole;
+ CConsoleBase* iConsole;
CSymbianUnitTestCommandLineParser* iCommandLineParser;
CSymbianUnitTestRunner* iTestRunner;
TInt iExecutedTestCount;
--- a/testexecfw/symbianunittestfw/sutfw/sutfwui/sutfwconsoleui/src/symbianunittestcommandlineparser.cpp Mon Mar 08 15:03:44 2010 +0800
+++ b/testexecfw/symbianunittestfw/sutfw/sutfwui/sutfwconsoleui/src/symbianunittestcommandlineparser.cpp Mon Mar 29 14:46:27 2010 +0800
@@ -27,6 +27,8 @@
_LIT( KTestCasesKeyShort, "-c=" );
_LIT( KAllocKey, "-alloc" );
_LIT( KAllocKeyShort, "-a" );
+_LIT( KBackgroundKey, "-background" );
+_LIT( KBackgroundKeyShort, "-b" );
_LIT( KOutputKey, "-output=" );
_LIT( KOutputKeyShort, "-o=" );
_LIT( KNoPromptKey, "-noprompt" );
@@ -67,6 +69,7 @@
// -----------------------------------------------------------------------------
//
CSymbianUnitTestCommandLineParser::CSymbianUnitTestCommandLineParser()
+ : iBackground( EFalse )
{
}
@@ -81,6 +84,7 @@
iShowHelp = FindArgument( KHelpKey, KHelpKeyShort, dummy );
iAllocFailureSimulation = FindArgument( KAllocKey, KAllocKeyShort, dummy );
iNoPrompt = FindArgument( KNoPromptKey, KNoPromptKey, dummy );
+ iBackground = FindArgument( KBackgroundKey, KBackgroundKeyShort, dummy );
SetOutputFormatL();
SetTimeoutL();
SetTestDllNamesL();
@@ -139,6 +143,15 @@
//
// -----------------------------------------------------------------------------
//
+TBool CSymbianUnitTestCommandLineParser::Background() const
+ {
+ return iBackground;
+ }
+
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
const TDesC& CSymbianUnitTestCommandLineParser::OutputFileName() const
{
return KOutputFileName;
@@ -180,7 +193,9 @@
{
HBufC* outputFormat = NULL;
TPtrC outputFormatPtr;
- if ( FindArgument( KOutputKey, KOutputKeyShort, outputFormatPtr ) )
+ TBool found = EFalse;
+ found = FindArgument( KOutputKey, KOutputKeyShort, outputFormatPtr );
+ if ( found )
{
outputFormat = outputFormatPtr.AllocL();
}
@@ -204,12 +219,13 @@
if ( hasTimeout)
{
TLex timeoutLex(timeoutPtr);
- TInt timeout;
+ TInt timeout;
TInt ret = timeoutLex.Val(timeout);
- if (ret == KErrNone && timeout >= 0)
- {
- iTimeout = timeout;
- }
+ hasTimeout = ( ret == KErrNone && timeout >= 0 );
+ if ( hasTimeout )
+ {
+ iTimeout = timeout;
+ }
}
}
@@ -222,14 +238,19 @@
CDesCArray* testDllNames = new( ELeave )CDesCArrayFlat( 1 );
CleanupStack::PushL( testDllNames );
TPtrC testDllNamesPtr;
- if ( FindArgument( KTestsKey, KTestsKeyShort, testDllNamesPtr ) )
+ TBool found = EFalse;
+ found = FindArgument( KTestsKey, KTestsKeyShort, testDllNamesPtr );
+ if ( found )
{
TSymbianUnitTestDllNameParser parser;
parser.Parse( testDllNamesPtr );
TPtrC testDllNamePtr;
- while ( parser.GetNext( testDllNamePtr ) == KErrNone )
+ TBool hasNext = EFalse;
+ hasNext = ( parser.GetNext( testDllNamePtr ) == KErrNone );
+ while ( hasNext )
{
testDllNames->AppendL( testDllNamePtr );
+ hasNext = ( parser.GetNext( testDllNamePtr ) == KErrNone );
}
}
iShowHelp = ( testDllNames->Count() == 0 );
@@ -247,15 +268,20 @@
CDesCArray* testCaseNames = new( ELeave )CDesCArrayFlat( 1 );
CleanupStack::PushL( testCaseNames );
TPtrC testCaseNamesPtr;
- if ( FindArgument( KTestCasesKey, KTestCasesKeyShort, testCaseNamesPtr ) )
+ TBool found = EFalse;
+ found = FindArgument( KTestCasesKey, KTestCasesKeyShort, testCaseNamesPtr );
+ if ( found )
{
//reuse the testdll parser here for case names
TSymbianUnitTestDllNameParser parser;
parser.Parse( testCaseNamesPtr );
TPtrC testCaseNamePtr;
- while ( parser.GetNext( testCaseNamePtr ) == KErrNone )
+ TBool hasNext = EFalse;
+ hasNext = ( parser.GetNext( testCaseNamePtr ) == KErrNone );
+ while ( hasNext )
{
testCaseNames->AppendL( testCaseNamePtr );
+ hasNext = ( parser.GetNext( testCaseNamePtr ) == KErrNone );
}
}
CleanupStack::Pop( testCaseNames );
--- a/testexecfw/symbianunittestfw/sutfw/sutfwui/sutfwconsoleui/src/symbianunittestconsoleui.cpp Mon Mar 08 15:03:44 2010 +0800
+++ b/testexecfw/symbianunittestfw/sutfw/sutfwui/sutfwconsoleui/src/symbianunittestconsoleui.cpp Mon Mar 29 14:46:27 2010 +0800
@@ -15,6 +15,8 @@
*
*/
+#include <e32debug.h>
+
#include "symbianunittestconsoleui.h"
#include "symbianunittestcommandlineparser.h"
#include "symbianunittestrunner.h"
@@ -28,9 +30,10 @@
_LIT( KNoTestsFoundTxt, " No tests found!\n" );
_LIT( KTestsExecutedTxt, " Executed: %d / %d\n" );
_LIT( KPassedTestsTxt, " Passed: %d\n" );
-_LIT( KFailedTestsTxt, " Failed: %d\n" );
+//_LIT( KFailedTestsTxt, " Failed: %d\n" );
+_LIT( KFailedTestsTxt2, " Failed: %S\n" );
+_LIT( KWindowName, "SymbianUnit" );
_LIT( KSymbianUnitTestPanic, "SymbianUnit creation" );
-_LIT( KWindowName, "SymbianUnit" );
_LIT( KPressAnyKeyTxt, "\n==[ press any key ]==\n " );
_LIT( KHelpTxt,
@@ -38,6 +41,7 @@
-tests|t=<dll,dll,...>\n\
-cases|c=<case,case,...>\n\
-alloc|a\n\
+-background|b\n\
-help|h\n\
-output|o=<html|xml|txt>\n\
-timeout|to\n\
@@ -50,11 +54,13 @@
//
GLDEF_C TInt E32Main()
{
+ //__UHEAP_MARK;
CTrapCleanup* cleanup = CTrapCleanup::New();
TRAPD( err, MainL() );
__ASSERT_ALWAYS(
err == KErrNone, User::Panic( KSymbianUnitTestPanic, err ) );
delete cleanup;
+ //__UHEAP_MARKEND;
User::Heap().Reset();
return err;
}
@@ -65,18 +71,15 @@
//
LOCAL_C void MainL()
{
- RThread().SetPriority( EPriorityAbsoluteForeground );
// install an active scheduler
CActiveScheduler* scheduler = new( ELeave )CActiveScheduler;
CActiveScheduler::Install( scheduler );
CleanupStack::PushL( scheduler );
-
- TSize size( KConsFullScreen, KConsFullScreen );
- CConsoleBase* console = Console::NewL( KWindowName, size );
CleanupStack::Pop( scheduler );
CSymbianUnitTestConsoleUi* main = NULL;
- TRAPD( err, main = CSymbianUnitTestConsoleUi::NewL( *console ) );
+
+ TRAPD( err, main = CSymbianUnitTestConsoleUi::NewL() );
if ( err == KErrNone )
{
CActiveScheduler::Start();
@@ -86,17 +89,17 @@
// Do not delete console. It will check for memory leaks.
// This is not what is wanted if running tests without
// memory leak detection.
+ //delete console;
}
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
//
-CSymbianUnitTestConsoleUi* CSymbianUnitTestConsoleUi::NewLC(
- CConsoleBase& aConsole )
+CSymbianUnitTestConsoleUi* CSymbianUnitTestConsoleUi::NewLC()
{
CSymbianUnitTestConsoleUi* self =
- new( ELeave )CSymbianUnitTestConsoleUi( aConsole );
+ new( ELeave )CSymbianUnitTestConsoleUi();
CleanupStack::PushL( self );
self->ConstructL();
return self;
@@ -106,11 +109,10 @@
//
// -----------------------------------------------------------------------------
//
-CSymbianUnitTestConsoleUi* CSymbianUnitTestConsoleUi::NewL(
- CConsoleBase& aConsole )
+CSymbianUnitTestConsoleUi* CSymbianUnitTestConsoleUi::NewL()
{
CSymbianUnitTestConsoleUi* self =
- CSymbianUnitTestConsoleUi::NewLC( aConsole );
+ CSymbianUnitTestConsoleUi::NewLC();
CleanupStack::Pop( self );
return self;
}
@@ -119,9 +121,8 @@
//
// -----------------------------------------------------------------------------
//
-CSymbianUnitTestConsoleUi::CSymbianUnitTestConsoleUi( CConsoleBase& aConsole )
- : CActive( EPriorityStandard ),
- iConsole( aConsole )
+CSymbianUnitTestConsoleUi::CSymbianUnitTestConsoleUi()
+ : CActive( EPriorityStandard )
{
}
@@ -134,6 +135,17 @@
User::SetJustInTime( EFalse ); // Do not stop on test case panics
iCommandLineParser = CSymbianUnitTestCommandLineParser::NewL();
iTestRunner = CSymbianUnitTestRunner::NewL( *this );
+ if( !iCommandLineParser->Background() )
+ {
+ TSize size( KConsFullScreen, KConsFullScreen );
+ iConsole = Console::NewL( KWindowName, size );
+ RThread().SetPriority( EPriorityAbsoluteForeground );
+ }
+ else
+ {
+ RThread().SetPriority( EPriorityAbsoluteBackground );
+ }
+
CActiveScheduler::Add( this );
// Set ready to run immediately
TRequestStatus *status = &iStatus;
@@ -150,6 +162,7 @@
Cancel();
delete iTestRunner;
delete iCommandLineParser;
+ delete iConsole;
}
// -----------------------------------------------------------------------------
@@ -158,39 +171,58 @@
//
void CSymbianUnitTestConsoleUi::RunL()
{
- iConsole.Printf( KTitleTxt, SUT_MAJOR_VERSION, SUT_MINOR_VERSION, SUT_BUILD_VERSION);
- if ( iCommandLineParser->ShowHelp() )
+ if (iCommandLineParser->Background())
{
- iConsole.Printf( KHelpTxt );
- }
- else
- {
- PrintAllocFailureSimulationText();
- iConsole.Printf( KExecutingTestsTxt );
+ //run in background
TRAPD( err,
- iTestRunner->ExecuteTestsL(
- iCommandLineParser->TestDllNames(),
- iCommandLineParser->MemoryAllocationFailureSimulation(),
- iCommandLineParser->OutputFileName(),
- iCommandLineParser->OutputFormat(),
- iCommandLineParser->TestCaseNames(),
- iCommandLineParser->Timeout()) )
- if ( err != KErrNone )
+ iTestRunner->ExecuteTestsL(
+ iCommandLineParser->TestDllNames(),
+ iCommandLineParser->MemoryAllocationFailureSimulation(),
+ iCommandLineParser->OutputFileName(),
+ iCommandLineParser->OutputFormat(),
+ iCommandLineParser->TestCaseNames(),
+ iCommandLineParser->Timeout()) )
+ if ( err != KErrNone)
+ {
+ RDebug::Print( KTestRunnerFailedTxt, err );
+ }
+ }
+ else
+ {
+ iConsole->Printf( KTitleTxt, SUT_MAJOR_VERSION, SUT_MINOR_VERSION, SUT_BUILD_VERSION);
+ if ( iCommandLineParser->ShowHelp() )
{
- iConsole.Printf( KTestRunnerFailedTxt, err );
+ InfoMsg( KHelpTxt );
}
- else
- {
- if ( iExecutedTestCount == 0 )
+ else
+ {
+ PrintAllocFailureSimulationText();
+ InfoMsg( KExecutingTestsTxt );
+ TRAPD( err,
+ iTestRunner->ExecuteTestsL(
+ iCommandLineParser->TestDllNames(),
+ iCommandLineParser->MemoryAllocationFailureSimulation(),
+ iCommandLineParser->OutputFileName(),
+ iCommandLineParser->OutputFormat(),
+ iCommandLineParser->TestCaseNames(),
+ iCommandLineParser->Timeout()) )
+ if ( err != KErrNone )
{
- iConsole.Printf( KNoTestsFoundTxt );
+ iConsole->Printf( KTestRunnerFailedTxt, err );
+ }
+ else
+ {
+ if ( iExecutedTestCount == 0 )
+ {
+ InfoMsg( KNoTestsFoundTxt );
+ }
}
}
- }
- if ( iCommandLineParser->PromptUser() )
- {
- iConsole.Printf( KPressAnyKeyTxt );
- iConsole.Getch(); // get and ignore character
+ if ( iCommandLineParser->PromptUser() )
+ {
+ InfoMsg( KPressAnyKeyTxt );
+ iConsole->Getch(); // get and ignore character
+ }
}
CActiveScheduler::Stop();
}
@@ -209,7 +241,7 @@
//
void CSymbianUnitTestConsoleUi::InfoMsg( const TDesC& aMessage )
{
- iConsole.Printf( aMessage );
+ iConsole->Printf( aMessage );
}
// -----------------------------------------------------------------------------
@@ -220,7 +252,7 @@
const TDesC& aFormat,
const TDesC& aMessage )
{
- iConsole.Printf( aFormat, &aMessage );
+ iConsole->Printf( aFormat, &aMessage );
}
// -----------------------------------------------------------------------------
@@ -229,19 +261,29 @@
//
void CSymbianUnitTestConsoleUi::IncrementExecutedTestsCount()
{
- TPoint pos = iConsole.CursorPos();
+ if (iCommandLineParser->Background())
+ {
+ return;
+ }
+ TPoint pos = iConsole->CursorPos();
pos.iY -= 1;
if ( iExecutedTestCount > 0 )
{
pos.iY -= 2;
}
- iConsole.SetCursorPosAbs( pos );
+ iConsole->SetCursorPosAbs( pos );
+
iExecutedTestCount++;
- iConsole.Printf(
+ iConsole->Printf(
KTestsExecutedTxt, iExecutedTestCount, iTestRunner->TestCount());
+
TInt passedTestCount = iExecutedTestCount - iTestRunner->FailedTestCount();
- iConsole.Printf( KPassedTestsTxt, passedTestCount );
- iConsole.Printf( KFailedTestsTxt, iTestRunner->FailedTestCount() );
+ iConsole->Printf( KPassedTestsTxt, passedTestCount );
+
+ TInt count = iTestRunner->FailedTestCount();
+ TBuf<10> txtCount;
+ txtCount.AppendFormat( _L("%d"), count );
+ InfoMsg( KFailedTestsTxt2, txtCount );
}
// -----------------------------------------------------------------------------
@@ -252,10 +294,10 @@
{
if ( iCommandLineParser->MemoryAllocationFailureSimulation() )
{
- iConsole.Printf( KAllocOnTxt );
+ InfoMsg( KAllocOnTxt );
}
else
{
- iConsole.Printf( KAllocOffTxt );
+ InfoMsg( KAllocOffTxt );
}
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/symbianunittestfw/sutfw/sutfwui/sutfwconsoleui/tsrc/bwins/ut_symbianunittestconsoleuiu.def Mon Mar 29 14:46:27 2010 +0800
@@ -0,0 +1,3 @@
+EXPORTS
+ ?CreateTestL@@YAPAVMSymbianUnitTestInterface@@XZ @ 1 NONAME ; class MSymbianUnitTestInterface * CreateTestL(void)
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/testexecfw/symbianunittestfw/sutfw/sutfwui/sutfwconsoleui/tsrc/eabi/ut_symbianunittestconsoleuiu.def Mon Mar 29 14:46:27 2010 +0800
@@ -0,0 +1,3 @@
+EXPORTS
+ _Z11CreateTestLv @ 1 NONAME
+
--- a/testexecfw/symbianunittestfw/sutfw/sutfwui/sutfwconsoleui/tsrc/group/ut_symbianunittestconsoleui.mmp Mon Mar 08 15:03:44 2010 +0800
+++ b/testexecfw/symbianunittestfw/sutfw/sutfwui/sutfwconsoleui/tsrc/group/ut_symbianunittestconsoleui.mmp Mon Mar 29 14:46:27 2010 +0800
@@ -17,6 +17,7 @@
TARGET ut_symbianunittestconsoleui.dll
TARGETTYPE dll
+NOEXPORTLIBRARY
UID 0x20022E76 0x20022E76
MACRO SYMBIAN_UNIT_TEST
--- a/testexecfw/symbianunittestfw/sutfw/sutfwui/sutfwconsoleui/tsrc/inc/ut_symbianunittestcommandlineparser.h Mon Mar 08 15:03:44 2010 +0800
+++ b/testexecfw/symbianunittestfw/sutfw/sutfwui/sutfwconsoleui/tsrc/inc/ut_symbianunittestcommandlineparser.h Mon Mar 29 14:46:27 2010 +0800
@@ -25,7 +25,7 @@
class CSymbianUnitTestCommandLineParser;
// CLASS DECLARATION
-class UT_CSymbianUnitTestCommandLineParser : public CSymbianUnitTest
+class UT_CSymbianUnitTestCommandLineParser : public CSymbianUnitTest
{
public: // Constructors and destructor
@@ -40,6 +40,12 @@
void UT_SetOutputFormatL();
void UT_SetTestDllNamesL();
void UT_FindArgumentL();
+ void UT_SetTimeoutL();
+ void UT_SetTestCaseNamesL();
+
+ // new added.
+ void UT_TestCommandLineL();
+ void LaunchExample( TInt aType );
private: // Contructors
--- a/testexecfw/symbianunittestfw/sutfw/sutfwui/sutfwconsoleui/tsrc/src/dllentry.cpp Mon Mar 08 15:03:44 2010 +0800
+++ b/testexecfw/symbianunittestfw/sutfw/sutfwui/sutfwconsoleui/tsrc/src/dllentry.cpp Mon Mar 29 14:46:27 2010 +0800
@@ -16,6 +16,7 @@
*/
#include "ut_symbianunittestcommandlineparser.h"
+#include <symbianunittestsuite.h>
// Exactly one exported function returning
@@ -23,7 +24,14 @@
//
EXPORT_C MSymbianUnitTestInterface* CreateTestL()
{
- return UT_CSymbianUnitTestCommandLineParser::NewL();
+ CSymbianUnitTestSuite* testSuite =
+ CSymbianUnitTestSuite::NewLC( _L("ut_consoleui") );
+
+ testSuite->AddL( UT_CSymbianUnitTestCommandLineParser::NewLC() );
+ CleanupStack::Pop();
+
+ // Add more tests to the test suite here when testing multiple classes
+
+ CleanupStack::Pop( testSuite );
+ return testSuite;
}
-
-
--- a/testexecfw/symbianunittestfw/sutfw/sutfwui/sutfwconsoleui/tsrc/src/ut_symbianunittestcommandlineparser.cpp Mon Mar 08 15:03:44 2010 +0800
+++ b/testexecfw/symbianunittestfw/sutfw/sutfwui/sutfwconsoleui/tsrc/src/ut_symbianunittestcommandlineparser.cpp Mon Mar 29 14:46:27 2010 +0800
@@ -60,9 +60,14 @@
{
BASE_CONSTRUCT
+ DEFINE_TEST_CLASS( UT_CSymbianUnitTestCommandLineParser )
+
ADD_SUT( UT_SetOutputFormatL )
ADD_SUT( UT_SetTestDllNamesL )
ADD_SUT( UT_FindArgumentL )
+ ADD_SUT( UT_SetTimeoutL )
+ ADD_SUT( UT_SetTestCaseNamesL )
+ //ADD_SUT( UT_TestCommandLineL )
}
// ---------------------------------------------------------------------------
@@ -116,7 +121,38 @@
iParser->SetOutputFormatL();
SUT_ASSERT_EQUALS( _L( "txt" ), iParser->OutputFormat() )
}
+// -----------------------------------------------------------------------------
+//
+// -----------------------------------------------------------------------------
+//
+void UT_CSymbianUnitTestCommandLineParser::UT_SetTimeoutL()
+ {
+ // Default timeout.
+ iParser->iArguments->Args().Reset();
+ iParser->SetTimeoutL();
+ SUT_ASSERT_EQUALS( iParser->Timeout(), 30 )
+ // Set timeout=50, long form.
+ _LIT( KTimeoutLong, "-timeout=50" );
+ iParser->iArguments->Args().Reset();
+ iParser->iArguments->Args().AppendL( KTimeoutLong );
+ iParser->SetTimeoutL();
+ SUT_ASSERT_EQUALS( iParser->Timeout(), 50 )
+
+ // Set timeout=50, short form.
+ _LIT( KTimeoutShort, "-to=20" );
+ iParser->iArguments->Args().Reset();
+ iParser->iArguments->Args().AppendL( KTimeoutShort );
+ iParser->SetTimeoutL();
+ SUT_ASSERT_EQUALS( iParser->Timeout(), 20 )
+
+ // Set timeout to invalid value, long form.
+ _LIT( KInvalidTimeoutLong, "-timeout=-50" );
+ iParser->iArguments->Args().Reset();
+ iParser->iArguments->Args().AppendL( KInvalidTimeoutLong );
+ iParser->SetTimeoutL();
+ SUT_ASSERT_EQUALS( iParser->Timeout(), 30 )
+ }
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
@@ -162,6 +198,57 @@
SUT_ASSERT( !iParser->ShowHelp() )
}
+// ---------------------------------------------------------------------------
+//
+// ---------------------------------------------------------------------------
+//
+void UT_CSymbianUnitTestCommandLineParser::UT_SetTestCaseNamesL()
+ {
+ // Testcase Names, no name.
+ iParser->SetTestCaseNamesL();
+ SUT_ASSERT( !iParser->TestCaseNames().MdcaCount() )
+
+ // One testcase name, long form.
+ _LIT( KOneTestCaseNameLong, "-cases=case1" );
+ iParser->iArguments->Args().Reset();
+ iParser->iArguments->Args().AppendL( KOneTestCaseNameLong );
+ iParser->SetTestCaseNamesL();
+ SUT_ASSERT_EQUALS( 1, iParser->TestCaseNames().MdcaCount() )
+ SUT_ASSERT_EQUALS(
+ _L( "case1" ), iParser->TestCaseNames().MdcaPoint( 0 ) )
+
+ // One testcase name, short form.
+ _LIT( KOneTestCaseNameShort, "-c=case2" );
+ iParser->iArguments->Args().Reset();
+ iParser->iArguments->Args().AppendL( KOneTestCaseNameShort );
+ iParser->SetTestCaseNamesL();
+ SUT_ASSERT_EQUALS( 1, iParser->TestCaseNames().MdcaCount() )
+ SUT_ASSERT_EQUALS(
+ _L( "case2" ), iParser->TestCaseNames().MdcaPoint( 0 ) )
+
+ // Two testcase names, long form.
+ _LIT( KTwoTestCaseNameLong, "-cases=case3,case4" );
+ iParser->iArguments->Args().Reset();
+ iParser->iArguments->Args().AppendL( KTwoTestCaseNameLong );
+ iParser->SetTestCaseNamesL();
+ SUT_ASSERT_EQUALS( 2, iParser->TestCaseNames().MdcaCount() )
+ SUT_ASSERT_EQUALS(
+ _L( "case3" ), iParser->TestCaseNames().MdcaPoint( 0 ) )
+ SUT_ASSERT_EQUALS(
+ _L( "case4" ), iParser->TestCaseNames().MdcaPoint( 1 ) )
+
+ // Two testcase names, short form.
+ _LIT( KTwoTestCaseNameShort, "-c=case5,case6" );
+ iParser->iArguments->Args().Reset();
+ iParser->iArguments->Args().AppendL( KTwoTestCaseNameShort );
+ iParser->SetTestCaseNamesL();
+ SUT_ASSERT_EQUALS( 2, iParser->TestCaseNames().MdcaCount() )
+ SUT_ASSERT_EQUALS(
+ _L( "case5" ), iParser->TestCaseNames().MdcaPoint( 0 ) )
+ SUT_ASSERT_EQUALS(
+ _L( "case6" ), iParser->TestCaseNames().MdcaPoint( 1 ) )
+ }
+
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
@@ -212,3 +299,54 @@
SUT_ASSERT( iParser->FindArgument( KNullDesC, KShortKey, value ) )
SUT_ASSERT_EQUALS( _L( "value2" ), value )
}
+
+void UT_CSymbianUnitTestCommandLineParser::LaunchExample( TInt aType )
+{
+ _LIT( KSymbianUnitTestFilename, "symbianunittest.exe" );
+ _LIT( KSymbianUnitTestArgs, "-t=ut_racecar.dll -noprompt -output=" );
+
+ const TInt KMaxArgLength( 255 );
+ TBuf<KMaxArgLength> strArgs;
+ strArgs.Copy( KSymbianUnitTestArgs );
+
+ switch( aType )
+ {
+ case 0: // html
+ strArgs.Append( _L("html") );
+ break;
+
+ case 1: // xml
+ strArgs.Append( _L("xml") );
+ break;
+
+ case 2: // txt
+ strArgs.Append( _L("txt") );
+ break;
+
+ default:
+ //strArgs.Append( _L("html") );
+ strArgs = strArgs.Left( 27 );
+ }
+
+ RProcess proc;
+ proc.Create( KSymbianUnitTestFilename, strArgs );
+ TRequestStatus status;
+ proc.Logon( status );
+ proc.Resume();
+
+ User::WaitForRequest( status );
+ proc.Close();
+ if ( KErrNone != status.Int() )
+ {
+ User::LeaveIfError( status.Int() );
+ }
+}
+
+void UT_CSymbianUnitTestCommandLineParser::UT_TestCommandLineL()
+ {
+ // set output = html, xml, txt, default;
+ for(TInt i=0; i<30; ++i)
+ {
+ LaunchExample(i);
+ }
+ }
--- a/testexecfw/symbianunittestfw/symbianunittestfw_pub/symbian_unit_test_api/inc/symbianunittest.h Mon Mar 08 15:03:44 2010 +0800
+++ b/testexecfw/symbianunittestfw/symbianunittestfw_pub/symbian_unit_test_api/inc/symbianunittest.h Mon Mar 29 14:46:27 2010 +0800
@@ -98,7 +98,7 @@
*/
IMPORT_C void ConstructL( const TDesC8& aName );
- protected: // New functions
+ public: // New functions
/**
* This function should be overidden in the actual unit test classes.
@@ -114,6 +114,7 @@
*/
IMPORT_C virtual void Teardown();
+ protected: // New functions
/**
* Checks whteher the test case is being run using memory
* allocation failure simulation.
@@ -259,6 +260,77 @@
const TDesC8& aStatement,
TInt aLineNumber,
const TDesC8& aFileName );
+
+
+
+ /**
+ * Asserts that two TInt values are equal.
+ * Leaves with a Symbian unit test framework specific error code
+ * if the values are not equal.
+ * In case of a failed assertion, the framework records
+ * the failure reason, line number and file name to the test results.
+ * Use macro SYMBIAN_UT_ASSERT_EQUALS in symbianunittestmacros.h
+ * instead to avoid the need to pass the other parameters
+ * than the actual asserted values.
+ *
+ * @param aExpectedValue the expected value
+ * @param aActualValue the actual value
+ * @param aLineNumber the line number of the assertion
+ * @param aFileName the name of the file where the assertion is located
+ * @param aFailureMessage the error message
+ */
+ IMPORT_C void AssertEqualsL(
+ TInt aExpectedValue,
+ TInt aActualValue,
+ TInt aLineNumber,
+ const TDesC8& aFileName,
+ const TDesC8& aFailureMessage );
+
+ /**
+ * Asserts that two TDesC8 values are equal.
+ * Leaves with a Symbian unit test framework specific error code
+ * if the values are not equal.
+ * In case of a failed assertion, the framework records
+ * the failure reason, line number and file name to the test results.
+ * Use macro SYMBIAN_UT_ASSERT_EQUALS in symbianunittestmacros.h
+ * instead to avoid the need to pass the other parameters
+ * than the actual asserted values.
+ *
+ * @param aExpectedValue the expected value
+ * @param aActualValue the actual value
+ * @param aLineNumber the line number of the assertion
+ * @param aFileName the name of the file where the assertion is located
+ * @param aFailureMessage the error message
+ */
+ IMPORT_C void AssertEqualsL(
+ const TDesC8& aExpectedValue,
+ const TDesC8& aActualValue,
+ TInt aLineNumber,
+ const TDesC8& aFileName,
+ const TDesC8& aFailureMessage );
+
+ /**
+ * Asserts that two TDesC16 values are equal.
+ * Leaves with a Symbian unit test framework specific error code
+ * if the values are not equal.
+ * In case of a failed assertion, the framework records
+ * the failure reason, line number and file name to the test results.
+ * Use macro SYMBIAN_UT_ASSERT_EQUALS in symbianunittestmacros.h
+ * instead to avoid the need to pass the other parameters
+ * than the actual asserted values.
+ *
+ * @param aExpectedValue the expected value
+ * @param aActualValue the actual value
+ * @param aLineNumber the line number of the assertion
+ * @param aFileName the name of the file where the assertion is located
+ * @param aFailureMessage the error message
+ */
+ IMPORT_C void AssertEqualsL(
+ const TDesC16& aExpectedValue,
+ const TDesC16& aActualValue,
+ TInt aLineNumber,
+ const TDesC8& aFileName,
+ const TDesC8& aFailureMessage );
private: // Internal class for a unit test function's data
--- a/testexecfw/symbianunittestfw/symbianunittestfw_pub/symbian_unit_test_api/inc/symbianunittestmacros.h Mon Mar 08 15:03:44 2010 +0800
+++ b/testexecfw/symbianunittestfw/symbianunittestfw_pub/symbian_unit_test_api/inc/symbianunittestmacros.h Mon Mar 29 14:46:27 2010 +0800
@@ -24,6 +24,27 @@
// MACROS
#ifdef SYMBIAN_UNIT_TEST
+ inline TInt operator==( TTrue, TInt aInt )
+ {
+ return aInt;
+ }
+
+ inline TInt operator==( TInt aInt, TTrue )
+ {
+ return aInt;
+ }
+
+ inline TInt operator!=( TTrue, TInt aInt )
+ {
+ return !aInt;
+ }
+
+ inline TInt operator!=( TInt aInt, TTrue )
+ {
+ return !aInt;
+ }
+
+
/**
* Calls the base class constructor that sets the name of unit test.
*/
@@ -35,12 +56,23 @@
* The default setup and teardown functions will be used.
* @param aTestPtr a function pointer to the unit test case
*/
- #define ADD_SUT( aTestPtr )\
- AddTestCaseL(\
- _L( #aTestPtr ),\
- CSymbianUnitTest::FunctionPtr( SetupL ),\
- CSymbianUnitTest::FunctionPtr( aTestPtr ),\
- CSymbianUnitTest::FunctionPtr( Teardown ) );
+ #ifndef __GCCE__
+ #define ADD_SUT( aTestPtr )\
+ AddTestCaseL(\
+ _L( #aTestPtr ),\
+ CSymbianUnitTest::FunctionPtr( SetupL ),\
+ CSymbianUnitTest::FunctionPtr(aTestPtr),\
+ CSymbianUnitTest::FunctionPtr( Teardown ) );
+
+ #else
+ #define ADD_SUT( aTestPtr )\
+ AddTestCaseL(\
+ _L( #aTestPtr ),\
+ CSymbianUnitTest::FunctionPtr( &CSymbianUnitTest::SetupL ),\
+ CSymbianUnitTest::FunctionPtr(&TYPE::aTestPtr),\
+ CSymbianUnitTest::FunctionPtr( &CSymbianUnitTest::Teardown ) );
+ #endif
+
/**
* Adds a new unit test case to this unit test.
@@ -51,12 +83,22 @@
* @param aTeardownPtr a function pointer to the teardown function
* that will be executed after the actual unit test case
*/
- #define ADD_SUT_WITH_SETUP_AND_TEARDOWN( aSetupPtr, aTestPtr, aTeardownPtr )\
- AddTestCaseL(\
- _L( #aTestPtr ),\
- CSymbianUnitTest::FunctionPtr( aSetupPtr ),\
- CSymbianUnitTest::FunctionPtr( aTestPtr ),\
- CSymbianUnitTest::FunctionPtr( aTeardownPtr ) );
+ #ifndef __GCCE__
+ #define ADD_SUT_WITH_SETUP_AND_TEARDOWN( aSetupPtr, aTestPtr, aTeardownPtr )\
+ AddTestCaseL(\
+ _L( #aTestPtr ),\
+ CSymbianUnitTest::FunctionPtr( aSetupPtr ),\
+ CSymbianUnitTest::FunctionPtr( aTestPtr ),\
+ CSymbianUnitTest::FunctionPtr( aTeardownPtr ) );
+ #else
+ #define ADD_SUT_WITH_SETUP_AND_TEARDOWN( aSetupPtr, aTestPtr, aTeardownPtr )\
+ AddTestCaseL(\
+ _L( #aTestPtr ),\
+ CSymbianUnitTest::FunctionPtr( &TYPE::aSetupPtr ),\
+ CSymbianUnitTest::FunctionPtr( &TYPE::aTestPtr ),\
+ CSymbianUnitTest::FunctionPtr( &TYPE::aTeardownPtr ) );
+
+ #endif
/**
* Asserts a condition in a unit test case.
@@ -66,12 +108,32 @@
* the failure reason, line number and file name to the test results.
* @param aCondition the asserted condition.
*/
+
+
#define SUT_ASSERT( aCondition )\
- if ( !TBool( aCondition ) )\
+ if ( aCondition ) {} else\
{\
AssertionFailedL( _L8( #aCondition ), __LINE__, _L8( __FILE__ ) );\
}
+ /**
+ * Asserts a condition in a unit test case.
+ * Leaves with a Symbian unit test framework specific error code
+ * if the condition evaluates to EFalse.
+ * In case of a failed assertion, the framework records
+ * the failure reason, line number and file name to the test results.
+ * @param aCondition the asserted condition.
+ * @param aDescription the error description
+ */
+
+
+ #define SUT_ASSERT_DESC( aCondition, aDescription )\
+ if ( aCondition ) {} else\
+ {\
+ AssertionFailedL( _L8( aDescription ), __LINE__, _L8( __FILE__ ) );\
+ }
+
+
/**
* Asserts that two values are equal.
* Leaves with a Symbian unit test framework specific error code
@@ -85,6 +147,19 @@
AssertEqualsL( aExpected, aActual, __LINE__, _L8( __FILE__ ) );
/**
+ * Asserts that two values are equal.
+ * Leaves with a Symbian unit test framework specific error code
+ * if the values are not equal.
+ * In case of a failed assertion, the framework records
+ * the failure reason, line number and file name to the test results.
+ * @param aExpectedValue the expected value
+ * @param aActualValue the actual value
+ * @param aDescription the error description
+ */
+ #define SUT_ASSERT_EQUALS_DESC( aExpected, aActual, aDescription )\
+ AssertEqualsL( aExpected, aActual, __LINE__, _L8( __FILE__ ), _L8(aDescription) );
+
+ /**
* Asserts that a statement leaves an expected value.
* Leaves with a Symbian unit test framework specific error code
* if the leave code is not the expected one.
@@ -117,18 +192,23 @@
#define SUT_ASSERT_LEAVE( aStatement )\
{\
TInt KLine( __LINE__ );\
- TBool leaveOccured( ETrue );\
- TRAPD( err, aStatement; leaveOccured = EFalse; )\
- if ( !leaveOccured )\
+ TRAPD( err, aStatement)\
+ if ( err==KErrNone )\
{\
RecordNoLeaveFromStatementL( _L8( #aStatement ), KLine, _L8( __FILE__ ) );\
}\
}
+
/**
* Can be used to hide the friend declaration for a unit test class.
*/
#define SYMBIAN_UNIT_TEST_CLASS( ClassName ) friend class ClassName;
+
+ #define DEFINE_TEST_CLASS( aClassName )\
+ typedef aClassName TYPE;
+
+
#else
#define SYMBIAN_UNIT_TEST_CLASS( ClassName )
#endif // SYMBIAN_UNIT_TEST
--- a/testexecfw/symbianunittestfw/symbianunittestfw_pub/symbian_unit_test_api/inc/symbianunittestsuite.h Mon Mar 08 15:03:44 2010 +0800
+++ b/testexecfw/symbianunittestfw/symbianunittestfw_pub/symbian_unit_test_api/inc/symbianunittestsuite.h Mon Mar 29 14:46:27 2010 +0800
@@ -93,10 +93,10 @@
*/
IMPORT_C void AddL( MSymbianUnitTestInterface* aTest );
- private: // Constructors
+ protected: // Constructors
- CSymbianUnitTestSuite();
- void ConstructL( const TDesC& aName );
+ IMPORT_C CSymbianUnitTestSuite();
+ IMPORT_C void ConstructL( const TDesC& aName );
private: // Data
--- a/testexecfw/symbianunittestfw/tsrc/eunit_to_symbianunit.pl Mon Mar 08 15:03:44 2010 +0800
+++ b/testexecfw/symbianunittestfw/tsrc/eunit_to_symbianunit.pl Mon Mar 29 14:46:27 2010 +0800
@@ -18,6 +18,9 @@
use strict;
use warnings;
use Getopt::Long;
+#use Cwd 'abs_path';
+use Cwd;
+
# Main
my $root_dir = "";
@@ -25,9 +28,42 @@
if ($root_dir eq "") {
$root_dir = ".";
}
+convert_cpp_in_directory($root_dir);
convert_files_in_directory($root_dir);
print "Conversion completed.\n";
+sub convert_cpp_in_directory {
+ my $dir_name = shift;
+ print "Opening directory: " . $dir_name . "\n";
+ opendir(DIR, $dir_name) || die "Cannot open directory " . $dir_name;
+ chdir($dir_name);
+ my @sourcefiles = readdir(DIR);
+ foreach (@sourcefiles) {
+ if ( $_ =~ /.cpp$/i ) {
+ # make the file writable (0666 is in linux/unix terms rw-)
+ chmod(0666,$_);
+ print "Converting: ";
+ print $_;
+ my $converted_file_content = "";
+ if (/.cpp$/ ) {
+ $converted_file_content = convert_source_file_content($_);
+ }
+ open(my $result_file_handle, ">", $_) or die(". Writing " . $_ . " failed!\n");
+ print $result_file_handle $converted_file_content;
+ close $result_file_handle;
+ print ". Done\n";
+ }
+ elsif ( /\./ ) {
+ # Other types of files
+ }
+ else {
+ # Directories
+ convert_cpp_in_directory($_);
+ chdir(".."); # After recursion change back to the current directory
+ }
+ }
+ closedir DIR;
+}
sub convert_files_in_directory {
my $dir_name = shift;
@@ -36,13 +72,13 @@
chdir($dir_name);
my @sourcefiles = readdir(DIR);
foreach (@sourcefiles) {
- if ( $_ =~ /.cpp$/i || $_ =~ /.h$/i || $_ =~ /.mmp$/i || $_ =~ /.def$/i) {
+ if ( $_ =~ /.h$/i || $_ =~ /.mmp$/i || $_ =~ /.def$/i) {
# make the file writable (0666 is in linux/unix terms rw-)
chmod(0666,$_);
print "Converting: ";
print $_;
my $converted_file_content = "";
- if (/.cpp$/ || /.h$/) {
+ if (/.h$/) {
$converted_file_content = convert_source_file_content($_);
}
elsif (/.mmp$/) {
@@ -51,9 +87,9 @@
else {
$converted_file_content = convert_def_file_content($_);
}
- open(my $result_file_handle, ">", $_) or die(". Writing " . $_ . " failed!\n");
- print $result_file_handle $converted_file_content;
- close $result_file_handle;
+ open(my $result_file_handle, ">", $_) or die(". Writing " . $_ . " failed!\n");
+ print $result_file_handle $converted_file_content;
+ close $result_file_handle;
print ". Done\n";
}
elsif ( /\./ ) {
@@ -73,10 +109,26 @@
my $file_name = shift;
my $file_content = read_file_content_into_string($file_name);
+
+ #check if this source include a separate test table header file
+ #in that case, we need to insert the test table content from header first
+ if ($file_content =~ m/\#include\s*\"(.*)testtable\.h\"/) {
+ my $curpath = cwd;
+ my $table_file_name = $curpath . "/../inc/" . $1 . "testtable.h";
+ print "\n try to merge header file at: " . $table_file_name . "\n";
+ my $tabledef = read_file_content_into_string($table_file_name);
+ #remove copyright and other comments
+ $tabledef =~ s/\/\/.*|\/\*[\s\S]*?\*\///g;
+ $tabledef =~ s/#include\s*\".*\"//g;
+ $file_content =~ s/\#include\s*\".*testtable\.h\"/$tabledef/g;
+
+
+ }
# Convert the EUnit test table to SymbianUnit tests and move it to the constructor
my $symbianunit_constructor_content = "BASE_CONSTRUCT";
my $converted_test_table = convert_eunit_test_table($file_content);
+ #print "converted test table: " . $converted_test_table . "\n";
$symbianunit_constructor_content .= $converted_test_table;
$file_content =~ s/CEUnitTestSuiteClass::ConstructL\(.*\)\;/$symbianunit_constructor_content/g;
@@ -88,6 +140,7 @@
$file_content =~ s/#include <eunitmacros.h>/#include <symbianunittestmacros.h>/gi;
$file_content =~ s/#include <ceunittestsuiteclass.h>/#include <symbianunittest.h>/gi;
$file_content =~ s/#include <ceunittestsuite.h>/#include <symbianunittestsuite.h>/gi;
+ $file_content =~ s/#include <eunitdecorators.h>//gi;
$file_content =~ s/CEUnitTestSuiteClass/CSymbianUnitTest/g;
$file_content =~ s/CEUnitTestSuite/CSymbianUnitTestSuite/g;
$file_content =~ s/MEUnitTest/MSymbianUnitTestInterface/g;
@@ -97,6 +150,9 @@
$file_content =~ s/EUNIT_ASSERT_EQUALS/SUT_ASSERT_EQUALS/g;
$file_content =~ s/EUNIT_ASSERT_NO_LEAVE//g;
$file_content =~ s/EUNIT_ASSERT/SUT_ASSERT/g;
+ $file_content =~ s/EUNIT_ASSERT_DESC/SUT_ASSERT_DESC/g;
+ $file_content =~ s/EUNIT_ASSERT_EQUALS_DESC/SUT_ASSERT_EQUALS_DESC/g;
+ $file_content =~ s/EUNIT_PRINT/\/\/EUNIT_PRINT/g;
return $file_content;
}
@@ -108,7 +164,9 @@
my $file_content = read_file_content_into_string($file_name);
$file_content =~ s/eunit.lib/symbianunittestfw.lib/gi;
+ $file_content =~ s/eunitutil.lib//gi;
$file_content =~ s/\/epoc32\/include\/Digia\/EUnit/\/epoc32\/include\/symbianunittest/gi;
+ $file_content =~ s/\/epoc32\/include\/platform\/Digia\/EUnit/\/epoc32\/include\/symbianunittest/gi;
$file_content =~ s/TARGETPATH(.*)\/DigiaEUnit\/Tests//gi;
$file_content =~ s/UID(.*)0x1000af5a/MACRO SYMBIAN_UNIT_TEST\nUID 0x20022E76/gi;