Add keyevent test at end of apploader test suite to remove prompt for location/time settings
authorLouis Henry Nayegon <louisn@symbian.org>
Fri, 24 Jul 2009 09:49:57 +0100
changeset 303 140d2eb79802
parent 259 6beec83e40d8
child 304 6a23ed4f83b5
Add keyevent test at end of apploader test suite to remove prompt for location/time settings Remove redundant batch file. Use perl script instead.
common/tools/ats/smoketest/Group/smoketest.bat
common/tools/ats/smoketest/apploader/Group/smoketest_apploader.mmp
common/tools/ats/smoketest/apploader/Inc/TestAppLoaderKeyEvents.h
common/tools/ats/smoketest/apploader/Src/TestAppLoaderKeyEvents.cpp
common/tools/ats/smoketest/apploader/Src/TestAppLoaderServer.cpp
common/tools/ats/smoketest/apploader/scripts/smoketest_apploader.script
common/tools/ats/smoketest/apploader/testdata/smoketest_apploader.ini
--- a/common/tools/ats/smoketest/Group/smoketest.bat	Thu Jul 16 11:22:53 2009 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-del smoketest.zip
-rd /S /Q temp
-md temp
-md temp\smoketest
-md temp\smoketest\general
-md temp\smoketest\winscw_udeb
-md temp\smoketest\sms
-md temp\smoketest\sms\general
-
-copy /Y smoketest.xml temp\test.xml
-copy %EPOCROOT%epoc32\data\z\smoketest									temp\smoketest\general
-copy %EPOCROOT%epoc32\data\z\smoketest\sms								temp\smoketest\sms\general
-copy %EPOCROOT%epoc32\release\winscw\udeb\Smoketest_Agenda_Server.exe	temp\smoketest\winscw_udeb
-copy %EPOCROOT%epoc32\release\winscw\udeb\smoketest_apploader.exe		temp\smoketest\winscw_udeb
-copy %EPOCROOT%epoc32\release\winscw\udeb\Smoketest_Contacts_Server.exe	temp\smoketest\winscw_udeb
-copy %EPOCROOT%epoc32\release\winscw\udeb\Smoketest_Mess_Server.exe		temp\smoketest\winscw_udeb
-copy %EPOCROOT%epoc32\release\winscw\udeb\Smoketest_System.exe			temp\smoketest\winscw_udeb
-copy %EPOCROOT%epoc32\release\winscw\udeb\Smoketest_Timew_Server.exe	temp\smoketest\winscw_udeb
-copy %EPOCROOT%epoc32\release\winscw\udeb\SmokeTest_Utils.dll			temp\smoketest\winscw_udeb
-copy %EPOCROOT%epoc32\release\winscw\udeb\SmokeTestSecureFSclient.dll	temp\smoketest\winscw_udeb
-copy %EPOCROOT%epoc32\release\winscw\udeb\SmokeTestSecureFSserver.exe	temp\smoketest\winscw_udeb
-
-7z a -tzip smoketest.zip .\temp\*
--- a/common/tools/ats/smoketest/apploader/Group/smoketest_apploader.mmp	Thu Jul 16 11:22:53 2009 +0100
+++ b/common/tools/ats/smoketest/apploader/Group/smoketest_apploader.mmp	Fri Jul 24 09:49:57 2009 +0100
@@ -33,6 +33,7 @@
 SOURCE			TestAppLoaderBase.cpp
 SOURCE			TestAppLoaderAppStart.cpp
 SOURCE			TestAppLoaderEndTask.cpp
+SOURCE			TestAppLoaderKeyEvents.cpp
 SOURCE			TestAppLoaderKillProcess.cpp
 SOURCE			TestAppLoaderTaskRunning.cpp
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/apploader/Inc/TestAppLoaderKeyEvents.h	Fri Jul 24 09:49:57 2009 +0100
@@ -0,0 +1,35 @@
+// Copyright (c) 2004-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:
+// TestAppLoaderKeyEvents.h
+// This contains CTestAppLoaderKeyEvents
+// 
+//
+
+#ifndef TEST_APP_LOADER_KEY_EVENTS_H
+#define TEST_APP_LOADER_KEY_EVENTS_H
+
+// User includes
+#include "TestAppLoaderBase.h"
+
+class CTestAppLoaderKeyEvents : public CTestAppLoaderBase
+	{
+public:
+	CTestAppLoaderKeyEvents();
+	
+	TBool GetKeyCodeFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TKeyCode& aResult, TStdScanCode& aScanCode);
+
+	virtual enum TVerdict doTestStepL( void );
+	};
+
+#endif /* TEST_APP_LOADER_KEY_EVENTS_H */
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/common/tools/ats/smoketest/apploader/Src/TestAppLoaderKeyEvents.cpp	Fri Jul 24 09:49:57 2009 +0100
@@ -0,0 +1,110 @@
+// Copyright (c) 2006-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:
+// This contains CTestAppLoaderKeyEvents
+// 
+//
+
+// USER includes
+#include "TestAppLoaderKeyEvents.h"
+
+// EPOC includes
+#include <w32std.h>
+
+/*@{*/
+const TInt KDelayMultiplier		= 1000;
+
+/// Parameters
+_LIT(KKey,						"key%d");
+_LIT(KDelay,					"delay%d");
+
+/// Key codes
+_LIT(KKeyNull,					"EKeyNull");
+_LIT(KKeyDevice0,				"EKeyDevice0");
+_LIT(KKeyDevice1,				"EKeyDevice1");
+/*@}*/
+
+// constructor
+CTestAppLoaderKeyEvents::CTestAppLoaderKeyEvents()
+:	CTestAppLoaderBase()
+	{
+	SetTestStepName(_L("KeyEvents"));
+	}
+
+TBool CTestAppLoaderKeyEvents::GetKeyCodeFromConfig(const TDesC& aSectName, const TDesC& aKeyName, TKeyCode& aResult, TStdScanCode& aScanCode)
+	{
+	TPtrC	str;
+	TBool	ret=GetStringFromConfig(aSectName, aKeyName, str);
+
+	if ( ret )
+		{
+		if ( str==KKeyNull )
+			{
+			aResult=EKeyNull;
+			aScanCode=EStdKeyNull;
+			}
+		else if ( str==KKeyDevice0 )
+			{
+			aResult=EKeyDevice0;
+			aScanCode=EStdKeyDevice0;
+			}
+		else if ( str==KKeyDevice1 )
+			{
+			aResult=EKeyDevice1;
+			aScanCode=EStdKeyDevice1;
+			}
+		}
+
+	return ret;
+	}
+
+// Each test step must supply a implementation for doTestStepL
+enum TVerdict CTestAppLoaderKeyEvents::doTestStepL( void )
+	{
+	// Printing to the console and log file
+	INFO_PRINTF1(_L("TEST-> KEY EVENTS"));
+
+	RWsSession							ws;
+	User::LeaveIfError(ws.Connect());
+	CleanupClosePushL(ws);
+	TBuf<KMaxTestExecuteCommandLength>	tempStore;
+	TInt								index=0;
+	TBool								moreData=ETrue;
+	TKeyCode							keyCode;
+	TStdScanCode						scanCode;
+	TInt								delay;
+	while ( moreData )
+		{
+		tempStore.Format(KKey(), ++index);
+		if ( GetKeyCodeFromConfig(ConfigSection(), tempStore, keyCode, scanCode) )
+			{
+			TKeyEvent	event = {keyCode, scanCode, 0, 0};
+			ws.SimulateKeyEvent(event);
+			ws.Flush();
+
+			tempStore.Format(KDelay(), index);
+			if ( GetIntFromConfig(ConfigSection(), tempStore, delay) )
+				{
+				User::After(delay*KDelayMultiplier);
+				}
+			}
+		else
+			{
+			moreData=EFalse;
+			}
+		}
+	CleanupStack::PopAndDestroy(&ws);
+
+	// test steps return a result
+	return TestStepResult();
+	}
--- a/common/tools/ats/smoketest/apploader/Src/TestAppLoaderServer.cpp	Thu Jul 16 11:22:53 2009 +0100
+++ b/common/tools/ats/smoketest/apploader/Src/TestAppLoaderServer.cpp	Fri Jul 24 09:49:57 2009 +0100
@@ -18,6 +18,7 @@
 // USER includes
 #include "TestAppLoaderServer.h"
 #include "TestAppLoaderAppStart.h"
+#include "TestAppLoaderKeyEvents.h"
 #include "TestAppLoaderKillProcess.h"
 #include "TestAppLoaderEndTask.h"
 #include "TestAppLoaderTaskRunning.h"
@@ -116,6 +117,10 @@
 		{
 		testStep = new CTestAppLoaderAppStart();
 		}
+	else if(aStepName == _L("KeyEvents"))
+		{
+		testStep = new CTestAppLoaderKeyEvents();
+		}
 	else if(aStepName == _L("KillProcess"))
 		{
 		testStep = new CTestAppLoaderKillProcess();
--- a/common/tools/ats/smoketest/apploader/scripts/smoketest_apploader.script	Thu Jul 16 11:22:53 2009 +0100
+++ b/common/tools/ats/smoketest/apploader/scripts/smoketest_apploader.script	Fri Jul 24 09:49:57 2009 +0100
@@ -62,3 +62,9 @@
 //! @SYMTestCaseDesc	Verify the "Contacts" task is running
 	RUN_TEST_STEP		1000	smoketest_apploader	TaskRunning	c:\smoketest\smoketest_apploader.ini	SMOKE_APP_RUNNING_0007
 END_TESTCASE 	SMOKE_APP_LAUNCH_0007
+
+START_TESTCASE			SMOKE_APP_LAUNCH_0008
+//! @SYMTestCaseID		SMOKE_APP_LAUNCH_0008
+//! @SYMTestCaseDesc	Send key events to close UI setup dialogs
+	RUN_TEST_STEP		1000	smoketest_apploader	KeyEvents	c:\smoketest\smoketest_apploader.ini	SMOKE_APP_KEYEVENTS_0008
+END_TESTCASE 			SMOKE_APP_LAUNCH_0008
--- a/common/tools/ats/smoketest/apploader/testdata/smoketest_apploader.ini	Thu Jul 16 11:22:53 2009 +0100
+++ b/common/tools/ats/smoketest/apploader/testdata/smoketest_apploader.ini	Fri Jul 24 09:49:57 2009 +0100
@@ -24,3 +24,15 @@
 
 [SMOKE_APP_RUNNING_0007]
 program	=Contacts
+
+[SMOKE_APP_KEYEVENTS_0008]
+key1	=EKeyDevice0
+delay1	=5000
+key2	=EKeyDevice0
+delay2	=5000
+key3	=EKeyDevice0
+delay3	=5000
+key4	=EKeyDevice1
+delay4	=5000
+key5	=EKeyDevice1
+delay5	=5000