# HG changeset patch # User Dremov Kirill (Nokia-D-MSW/Tampere) # Date 1268649973 -7200 # Node ID 8a14024f954ad6728e73e08d3995b7c3119a9a11 # Parent ecff51f1e7fbf842c0bb8e46137f9522f22a3475 Revision: 201009 Kit: 201010 diff -r ecff51f1e7fb -r 8a14024f954a hti/HtiFramework/group/hti.cfg --- a/hti/HtiFramework/group/hti.cfg Fri Mar 12 15:50:45 2010 +0200 +++ b/hti/HtiFramework/group/hti.cfg Mon Mar 15 12:46:13 2010 +0200 @@ -90,3 +90,8 @@ #ShowErrorDialogs=0 #ShowErrorDialogs=1 + +# The value in seconds that HTI will delay before reconnecting when connection lost, +# If the value is 0, reconnect would not happen. +# Default value: 0 +#ReconnectDelay=0 diff -r ecff51f1e7fb -r 8a14024f954a hti/HtiFramework/inc/HtiDispatcher.h --- a/hti/HtiFramework/inc/HtiDispatcher.h Fri Mar 12 15:50:45 2010 +0200 +++ b/hti/HtiFramework/inc/HtiDispatcher.h Mon Mar 15 12:46:13 2010 +0200 @@ -94,6 +94,8 @@ * @param aMaxMsgSize maximum size for an incoming message * @param aMaxQueueMemorySize maximum size of all messages in the * incoming queue + * @param aReconnectDelay seconds of delay for reconnecting when connection + * lost. Value 0 means that reconnect would not happen. * @param aShowConsole whether to open a console window for HTI * @param aShowErrorDialogs whether to show a dialog in case of critical * error or just silently exit @@ -102,6 +104,7 @@ static CHtiDispatcher* NewL( const TDesC8& aCommPlugin, TInt aMaxMsgSize, TInt aMaxQueueMemorySize, + TInt aReconnectDelay, TBool aShowConsole, TBool aShowErrorDialogs ); @@ -113,6 +116,8 @@ * @param aMaxMsgSize maximum size for an incoming message * @param aMaxQueueMemorySize maximum size of all messages in the * incoming queue + * @param aReconnectDelay seconds of delay for reconnecting when connection + * lost. Value 0 means that reconnect would not happen. * @param aShowConsole whether to open a console window for HTI * @param aShowErrorDialogs whether to show a dialog in case of critical * error or just silently exit @@ -121,6 +126,7 @@ static CHtiDispatcher* NewLC( const TDesC8& aCommPlugin, TInt aMaxMsgSize, TInt aMaxQueueMemorySize, + TInt aReconnectDelay, TBool aShowConsole, TBool aShowErrorDialogs ); @@ -207,12 +213,20 @@ */ TBool GetShowErrorDialogs(); + + /* + * Delay a period and reconnect when connection lost. + * If the period is 0, reconnect would not happen. + * @return whether reconnect + */ + TBool CommReconnect(); + protected: /** * Constructors * */ - CHtiDispatcher( TInt aMaxQueueMemorySize, TBool aShowErrorDialogs ); + CHtiDispatcher( TInt aMaxQueueMemorySize, TInt aReconnectDelay, TBool aShowErrorDialogs ); void ConstructL( const TDesC8& aCommPlugin, TInt aMaxMsgSize, @@ -460,6 +474,12 @@ * errors or just silently exit. */ TBool iShowErrorDialogs; + + /** + * Delay a period and reconnect when connection lost. + * If the period is 0, reconnect would not happen. + */ + TInt iReconnectDelay; }; diff -r ecff51f1e7fb -r 8a14024f954a hti/HtiFramework/src/HtiCommAdapter.cpp --- a/hti/HtiFramework/src/HtiCommAdapter.cpp Fri Mar 12 15:50:45 2010 +0200 +++ b/hti/HtiFramework/src/HtiCommAdapter.cpp Mon Mar 15 12:46:13 2010 +0200 @@ -213,6 +213,11 @@ // USB errors from d32usbc.h else if ( -6700 > iStatus.Int() && iStatus.Int() > -6712 ) { + if(iDispatcher->CommReconnect()) + { + return; + } + if ( iDispatcher->GetShowErrorDialogs() ) { TBuf<48> errorText; @@ -226,6 +231,11 @@ else if ( iStatus == KErrDisconnected ) { // This happens if Bluetooth connection is lost. + if(iDispatcher->CommReconnect()) + { + return; + } + if ( iDispatcher->GetShowErrorDialogs() ) { CHtiNotifier::ShowErrorL( @@ -259,6 +269,7 @@ { HTI_LOG_FORMAT( "Error %d, reissue request", iStatus.Int() ); iDispatcher->Notify( iStatus.Int() ); + User::After(2000000); ReceiveMessage(); } break; @@ -289,7 +300,7 @@ iMsgToReceive = NULL; iDispatcher->Notify( iStatus.Int() ); - + User::After(2000000); ReceiveMessage(); } break; diff -r ecff51f1e7fb -r 8a14024f954a hti/HtiFramework/src/HtiDispatcher.cpp --- a/hti/HtiFramework/src/HtiDispatcher.cpp Fri Mar 12 15:50:45 2010 +0200 +++ b/hti/HtiFramework/src/HtiDispatcher.cpp Mon Mar 15 12:46:13 2010 +0200 @@ -113,7 +113,7 @@ * **************************************************************************/ CHtiDispatcher::CHtiDispatcher( TInt aMaxQueueMemorySize, - TBool aShowErrorDialogs ): + TInt aReconnectDelay, TBool aShowErrorDialogs ): iIdleActive( EFalse ), iMaxQueueMemorySize( aMaxQueueMemorySize > 0 ? aMaxQueueMemorySize : KDefaultMaxQueueSize ), @@ -122,7 +122,8 @@ iConsole( NULL ), iIdleOverCommAdapter( EFalse ), iHtiInstanceId( 0 ), - iShowErrorDialogs( aShowErrorDialogs ) + iShowErrorDialogs( aShowErrorDialogs ), + iReconnectDelay (aReconnectDelay) { HTI_LOG_FORMAT( "MaxQueueMemorySize %d", iMaxQueueMemorySize ); iQueueSizeLowThresold = ( iMaxQueueMemorySize / 2 ) / 2; @@ -256,11 +257,12 @@ CHtiDispatcher* CHtiDispatcher::NewLC( const TDesC8& aCommPlugin, TInt aMaxMsgSize, TInt aMaxQueueMemory, + TInt aReconnectDelay, TBool aShowConsole, TBool aShowErrorDialogs ) { CHtiDispatcher* obj = new (ELeave) CHtiDispatcher( - aMaxQueueMemory, aShowErrorDialogs ); + aMaxQueueMemory, aReconnectDelay,aShowErrorDialogs ); CleanupStack::PushL( obj ); obj->ConstructL( aCommPlugin, aMaxMsgSize, aShowConsole ); return obj; @@ -269,11 +271,12 @@ CHtiDispatcher* CHtiDispatcher::NewL( const TDesC8& aCommPlugin, TInt aMaxMsgSize, TInt aMaxQueueMemory, + TInt aReconnectDelay, TBool aShowConsole, TBool aShowErrorDialogs ) { CHtiDispatcher* obj = NewLC( aCommPlugin, aMaxMsgSize, aMaxQueueMemory, - aShowConsole, aShowErrorDialogs ); + aReconnectDelay,aShowConsole, aShowErrorDialogs ); CleanupStack::Pop(); return obj; } @@ -1240,3 +1243,25 @@ } return mappedUid; } + +TBool CHtiDispatcher::CommReconnect() + { + if(iReconnectDelay == 0) + { + return EFalse; + } + + //Delay + HTI_LOG_FORMAT( "Reconnect deley : %d seconds", iReconnectDelay); + User::After(iReconnectDelay * 1000 * 1000); + + //Reconnect + iIncomingQueue->RemoveAll(); + iOutgoingQueue->RemoveAll(); + + iListener->Reset(); + iSender->Reset(); + iListener->ReceiveMessage(); + + return ETrue; + } diff -r ecff51f1e7fb -r 8a14024f954a hti/HtiFramework/src/HtiFramework.cpp --- a/hti/HtiFramework/src/HtiFramework.cpp Fri Mar 12 15:50:45 2010 +0200 +++ b/hti/HtiFramework/src/HtiFramework.cpp Mon Mar 15 12:46:13 2010 +0200 @@ -49,6 +49,7 @@ _LIT8( KEnableHtiWatchDog, "EnableHtiWatchDog" ); _LIT8( KEnableHtiAutoStart, "EnableHtiAutoStart" ); _LIT8( KShowErrorDialogs, "ShowErrorDialogs" ); +_LIT8( KReconnectDelay, "ReconnectDelay"); const static TInt KDefaultMaxWaitTime = 90; // seconds const static TInt KDefaultStartUpDelay = 5; // seconds @@ -57,6 +58,7 @@ const static TInt KHtiConsoleEnabledDefault = 0; const static TInt KHtiAutoStartEnabledDefault = 0; const static TInt KHtiShowErrorDialogsDefault = 1; +const static TInt KHtiReconnectDelay = 0; // MACROS @@ -101,6 +103,7 @@ TInt showConsole = KHtiConsoleEnabledDefault; TInt enableHtiAutoStart = KHtiAutoStartEnabledDefault; TInt showErrorDialogs = KHtiShowErrorDialogsDefault; + TInt reconnectDelay = KHtiReconnectDelay; TRAPD( err, iCfg = CHtiCfg::NewL() ); if ( err == KErrNone ) @@ -212,7 +215,14 @@ HTI_LOG_TEXT( "The following parameter not defined in cfg, using default value:" ); HTI_LOG_DES( KShowErrorDialogs ); } - + + TRAP( paramErr, reconnectDelay = iCfg->GetParameterIntL( KReconnectDelay ) ); + if ( paramErr != KErrNone ) + { + HTI_LOG_TEXT( "The following parameter not defined in cfg, using default value:" ); + HTI_LOG_DES( KReconnectDelay ); + } + if ( !IsStartAcceptedL( enableHtiAutoStart ) ) { User::Leave( KErrAbort ); @@ -220,7 +230,7 @@ WaitNormalState( maxWaitTime, startUpDelay ); iDispatcher = CHtiDispatcher::NewL( commPlugin, maxMsgSize, - maxQueueSize, showConsole != 0, showErrorDialogs != 0 ); + maxQueueSize, reconnectDelay, showConsole != 0, showErrorDialogs != 0 ); } } @@ -239,7 +249,7 @@ //create with default values iDispatcher = CHtiDispatcher::NewL( - KNullDesC8, 0, 0, showConsole != 0, showErrorDialogs != 0 ); + KNullDesC8, 0, 0, 0, showConsole != 0, showErrorDialogs != 0 ); } HTI_LOG_FORMAT( "Priority setting = %d", priority ); diff -r ecff51f1e7fb -r 8a14024f954a hti/hti_plat/hti_api/inc/HtiVersion.h --- a/hti/hti_plat/hti_api/inc/HtiVersion.h Fri Mar 12 15:50:45 2010 +0200 +++ b/hti/hti_plat/hti_api/inc/HtiVersion.h Mon Mar 15 12:46:13 2010 +0200 @@ -25,13 +25,13 @@ // CONSTANTS const TUint8 KHtiVersionMajor = 2; -const TUint8 KHtiVersionMinor = 16; +const TUint8 KHtiVersionMinor = 17; const TUint8 KHtiVersionBuild = 0; const TUint16 KHtiVersionYear = 2010; -const TUint8 KHtiVersionMonth = 1; -const TUint8 KHtiVersionWeek = 3; -const TUint8 KHtiVersionDay = 22; +const TUint8 KHtiVersionMonth = 2; +const TUint8 KHtiVersionWeek = 5; +const TUint8 KHtiVersionDay = 5; // MACROS diff -r ecff51f1e7fb -r 8a14024f954a stif/Logger/src/FileOutput.cpp --- a/stif/Logger/src/FileOutput.cpp Fri Mar 12 15:50:45 2010 +0200 +++ b/stif/Logger/src/FileOutput.cpp Mon Mar 15 12:46:13 2010 +0200 @@ -476,7 +476,7 @@ iFileAndDirName.Insert( iFileAndDirName.Length(), txtPrt ); } - TBool isOpen( EFalse ); +// TBool isOpen( EFalse ); TInt ret( KErrNone ); diff -r ecff51f1e7fb -r 8a14024f954a stif/QtUI/StifQtUI/STIFQtUI.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/stif/QtUI/StifQtUI/STIFQtUI.pro Mon Mar 15 12:46:13 2010 +0200 @@ -0,0 +1,48 @@ +HEADERS += version.h \ + frmmain.h \ + istfqtuicontroller.h \ + stfqtuicontroller.h \ + cstfcase.h \ + cstfmodule.h \ + istfqtuimodel.h \ + stfqtuimodel.h \ + dlgoutput.h \ + uisetting.h \ + dlgsetting.h +SOURCES += frmmain.cpp \ + main.cpp \ + stfqtuimodel.cpp \ + stfqtuicontroller.cpp \ + dlgoutput.cpp \ + uisetting.cpp \ + dlgsetting.cpp +RESOURCES += +symbian { + TARGET.UID3 = 0x2002BCA0 + TARGET.EPOCALLOWDLLDATA = 1 + HEADERS += ../../../inc/. + INCLUDEPATH += /epoc32/include/mw + INCLUDEPATH += /epoc32/include/platform + INCLUDEPATH += /epoc32/include/platform/stifinternal + INCLUDEPATH += /epoc32/include/domain/osextensions + INCLUDEPATH += /epoc32/include/domain/osextensions/stif + HEADERS += stifexecutor.h + SOURCES += stifexecutor.cpp + LIBS += -leuser \ + -lefsrv \ + -lstiftestinterface \ + -lstiftfwif \ + -lstiftestengine \ + -lecons \ + -lhal \ + -lflogger + TARGET.CAPABILITY = AllFiles \ + CommDD + + # Export headers to SDK Epoc32/include directory + deploy.path = $$EPOCROOT + exportheaders.sources = $$PUBLIC_HEADERS + exportheaders.path = epoc32/include + for(header, exportheaders.sources) + :BLD_INF_RULES.prj_exports += "$$header $$deploy.path$$exportheaders.path/$$basename(header)" +} diff -r ecff51f1e7fb -r 8a14024f954a stif/QtUI/StifQtUI/StifQtUI.pkg --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/stif/QtUI/StifQtUI/StifQtUI.pkg Mon Mar 15 12:46:13 2010 +0200 @@ -0,0 +1,32 @@ +; StfQtUI_template.pkg generated by qmake at 2010-02-08T13:37:27 +; This file is generated by qmake and should not be modified by the user +; + +; Language +&EN + +; SIS header: name, uid, version +#{"StifQtUI"},(0x2002BCA0),1,0,0 + +; Localised Vendor name +%{"Vendor"} + +; Unique Vendor name +:"Vendor" + +; Manual PKG pre-rules from PRO files +; Default HW/platform dependencies +[0x101F7961],0,0,0,{"S60ProductID"} +[0x102032BE],0,0,0,{"S60ProductID"} +[0x102752AE],0,0,0,{"S60ProductID"} +[0x1028315F],0,0,0,{"S60ProductID"} + +; Default dependency to Qt libraries +(0x2001E61C), 4, 6, 1, {"Qt"} + +; Executable and default resource files +"/epoc32/release/armv5/urel/StifQtUI.exe" - "!:\sys\bin\StifQtUI.exe" +"/epoc32/data/z/resource/apps/StfQtUI.rsc" - "!:\resource\apps\StfQtUI.rsc" +"/epoc32/data/z/private/10003a3f/import/apps/StfQtUI_reg.rsc" - "!:\private\10003a3f\import\apps\StfQtUI_reg.rsc" + +; Manual PKG post-rules from PRO files diff -r ecff51f1e7fb -r 8a14024f954a stif/QtUI/StifQtUI/cstfcase.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/stif/QtUI/StifQtUI/cstfcase.h Mon Mar 15 12:46:13 2010 +0200 @@ -0,0 +1,63 @@ +/* +* 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: QT C++ based Class. +* CSTFCase used to describe a test case. +* +*/ +#ifndef CSTFCASE_H +#define CSTFCASE_H +#include "QString" + +enum TSTFCaseRunningType + { + Sequentially = 0, + Parallel + }; + +enum TSTFCaseStatusType + { + EStatusRunning = 0x00000001, + EStatusExecuted = 0x00000002, + EStatusPassed = 0x00000004, + EStatusFailed = 0x00000008, + EStatusAborted = 0x00000010, + EStatusCrashed = 0x00000020, + EStatusAll = 0x000000ff, + }; + +class CSTFCase +{ +public: + CSTFCase() {isActive = true; caseIndex=-1;} + CSTFCase(QString name, int index) {caseName = name; caseIndex = index; isActive = true;} + +public: + QString& Name(){return caseName;} + int Index(){return caseIndex;} + bool IsActive(){return isActive;} + QString& ModuleName() {return moduleName;} + +public: + void SetName(const QString name){caseName = name; } + void SetIndex(const int index){caseIndex = index;} + void SetActive(const bool active) {isActive = active;} + void SetModuleName(const QString name){moduleName = name;} + +private: + QString caseName; + int caseIndex; + bool isActive; + QString moduleName; +}; +#endif // CSTFCASE_H diff -r ecff51f1e7fb -r 8a14024f954a stif/QtUI/StifQtUI/cstfmodule.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/stif/QtUI/StifQtUI/cstfmodule.h Mon Mar 15 12:46:13 2010 +0200 @@ -0,0 +1,50 @@ +/* +* 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: QT C++ based Class. +* CSTFModule used to describe a test module. +* +*/ +#ifndef CSTFMODULE_H +#define CSTFMODULE_H +#include "QString" + +class CSTFModule +{ +public: + CSTFModule(){isActive = true;} + CSTFModule(QString name, QString inifile, QString cfgfile) + {moduleName = name; iniFile = inifile; configFile = cfgfile; isActive = true;} + +public: + QString& Name(){return moduleName;} + QString& IniFile(){return iniFile;} + QString& ConfigFile(){return configFile;} + bool IsActive(){return isActive;} + + +public: + void SetName(const QString& name){moduleName = name; } + void SetIniFile(const QString& inifile){iniFile = inifile;} + void SetConfigFile(const QString& cfgfile){configFile = cfgfile;} + void SetActive(const bool active) {isActive = active;} + +private: + QString moduleName; + QString iniFile; + QString configFile; + bool isActive; + + +}; +#endif // CSTFMODULE_H diff -r ecff51f1e7fb -r 8a14024f954a stif/QtUI/StifQtUI/dlgoutput.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/stif/QtUI/StifQtUI/dlgoutput.cpp Mon Mar 15 12:46:13 2010 +0200 @@ -0,0 +1,122 @@ +/* + * 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: QT C++ based Class. + * + */ +#include "dlgoutput.h" +#include + +DlgOutput::DlgOutput(IStfQtUIController* ctl, QWidget *parent) : + QDialog(parent), controller(ctl) + { + QSize btnSize(100,30); + QGridLayout *mainLayout = new QGridLayout(this); + this->setLayout(mainLayout); + this->setContextMenuPolicy(Qt::NoContextMenu); + + tabMain = new QTabWidget(); + tabMain->setContextMenuPolicy(Qt::NoContextMenu); + + QWidget *toolWidget = new QWidget(this); + toolWidget->setContextMenuPolicy(Qt::NoContextMenu); + QGridLayout *toolLayout = new QGridLayout(); + toolWidget->setLayout(toolLayout); + btnPause = new QPushButton(tr("Pause"), toolWidget); + btnPause->setContextMenuPolicy(Qt::NoContextMenu); + btnPause->setFixedSize(btnSize); + QObject::connect(btnPause, SIGNAL(clicked()), this, + SLOT(on_btnPause_clicked())); + btnAbort = new QPushButton(tr("Abort"), toolWidget); + btnAbort->setContextMenuPolicy(Qt::NoContextMenu); + btnAbort->setFixedSize(btnSize); + QObject::connect(btnAbort, SIGNAL(clicked()), this, + SLOT(on_btnAbort_clicked())); + toolLayout->addWidget(btnPause, 0, 0); + toolLayout->addWidget(btnAbort, 0, 1); + + mainLayout->addWidget(toolWidget, 0, 0); + mainLayout->addWidget(tabMain, 1, 0); + controller->AddStfEventListener(this); + } + +DlgOutput::~DlgOutput() + { + controller->RemoveStfEventListener(this); + } + +void DlgOutput::CreateItem(QString index, QString item) + { + QPlainTextEdit* edit = new QPlainTextEdit(this); + edit->setContextMenuPolicy(Qt::NoContextMenu); + tabMain->addTab(edit, item); + tabList.insert(index, edit); + } + +void DlgOutput::CloseItem(QString index) + { + int u = tabList.keys().indexOf(index); + tabList.remove(index); + tabMain->removeTab(u); + if (tabMain->count() == 0) + { + this->close(); + } + } + +void DlgOutput::ShowMessage(QString index, QString msg) + { + if(tabList.contains(index)) + { + tabList.value(index)->setPlainText(msg); + } + } + +void DlgOutput::on_btnPause_clicked() + { + if (btnPause->text() == "Pause") + { + controller->PauseCase(); + btnPause->setText(tr("Resume")); + } + else + { + controller->ResumeCase(); + btnPause->setText(tr("Pause")); + } + } + +void DlgOutput::on_btnAbort_clicked() + { + controller->AbortCase(); + } + +void DlgOutput::OnCaseOutputChanged(const IStfEventListener::CaseOutputCommand& cmd, + const QString& index, const QString& msg) + { + this->showMaximized(); + switch (cmd) + { + case IStfEventListener::ECreate: + CreateItem(index, msg); + break; + case IStfEventListener::EClose: + CloseItem(index); + break; + default: + ShowMessage(index, msg); + break; + } + + } + diff -r ecff51f1e7fb -r 8a14024f954a stif/QtUI/StifQtUI/dlgoutput.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/stif/QtUI/StifQtUI/dlgoutput.h Mon Mar 15 12:46:13 2010 +0200 @@ -0,0 +1,70 @@ +/* +* 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: QT C++ based Class. +* DlgOutput is a QT based dialog. +* Used to display case execution output and control the test case (pause/resume/abort). +* +*/ +#ifndef DLGOUTPUT_H_ +#define DLGOUTPUT_H_ + +#include +#include +#include "istfqtuicontroller.h" + + +QT_BEGIN_NAMESPACE +class QTabWidget; +class QGridLayout; +class QPlainTextEdit; +class QPushButton; +QT_END_NAMESPACE + +class DlgOutput : public QDialog, public IStfEventListener { + Q_OBJECT + +public: + DlgOutput(IStfQtUIController* ctl, QWidget *parent = 0); + ~DlgOutput(); + +private: + void CreateItem(QString index, QString item); + void CloseItem(QString index); + void ShowMessage(QString index, QString msg); + +private://implement IStfEventListener + void OnGetMessage(const QString& ){}; + void OnSetListChanged(){}; + void OnCaseOutputChanged(const IStfEventListener::CaseOutputCommand& cmd, const QString& index, const QString& msg); + +private slots: + void on_btnPause_clicked(); + void on_btnAbort_clicked(); + + +private: + IStfQtUIController* controller; + QTabWidget* tabMain; + QPushButton* btnPause; + QPushButton* btnAbort; + QHash tabList; + +private: + void on_btnClose_clicked(); + + +}; + + +#endif /* DLGOUTPUT_H_ */ diff -r ecff51f1e7fb -r 8a14024f954a stif/QtUI/StifQtUI/dlgsetting.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/stif/QtUI/StifQtUI/dlgsetting.cpp Mon Mar 15 12:46:13 2010 +0200 @@ -0,0 +1,62 @@ +/* + * dlgsetting.cpp + * + * Created on: 2010-2-8 + * Author: y183zhan + */ + +#include "dlgsetting.h" +#include + +DlgSetting::DlgSetting(UiSetting* settingObj, QWidget *parent) + : QDialog(parent), setting(settingObj) + { + SetupUI(); + } + +void DlgSetting::SetupUI() + { + this->setContextMenuPolicy(Qt::NoContextMenu); + QGridLayout *mainLayout = new QGridLayout(this); + this->setLayout(mainLayout); + + chkShowoutput = new QCheckBox(this); + chkShowoutput->setText(tr("Show output in execution.")); + chkShowoutput->setChecked(setting->ReadSetting("showoutput") == "true"); + + QWidget *toolWidget = new QWidget(this); + QGridLayout *toolLayout = new QGridLayout(); + + toolWidget->setLayout(toolLayout); + btnOk = new QPushButton(tr("Ok"), toolWidget); + btnOk->setFixedSize(100, 30); + QObject::connect(btnOk, SIGNAL(clicked()), this, + SLOT(on_btnOk_clicked())); + btnCancel = new QPushButton(tr("Cancel"), toolWidget); + btnCancel->setFixedSize(100, 30); + QObject::connect(btnCancel, SIGNAL(clicked()), this, + SLOT(on_btnCancel_clicked())); + toolLayout->addWidget(btnOk, 0, 0); + toolLayout->addWidget(btnCancel, 0, 1); + + mainLayout->addWidget(chkShowoutput, 0, 0); + mainLayout->addWidget(toolWidget, 2, 0); + } + +void DlgSetting::on_btnOk_clicked() + { + if(chkShowoutput->checkState() == Qt::Checked) + { + setting->SetSetting("showoutput", "true"); + } + else + { + setting->SetSetting("showoutput", "false"); + } + this->accept(); + } + +void DlgSetting::on_btnCancel_clicked() + { + this->reject(); + } diff -r ecff51f1e7fb -r 8a14024f954a stif/QtUI/StifQtUI/dlgsetting.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/stif/QtUI/StifQtUI/dlgsetting.h Mon Mar 15 12:46:13 2010 +0200 @@ -0,0 +1,44 @@ +/* + * dlgsetting.h + * + * Created on: 2010-2-8 + * Author: y183zhan + */ + +#ifndef DLGSETTING_H_ +#define DLGSETTING_H_ +#include +#include "uisetting.h" + + +QT_BEGIN_NAMESPACE +class QTabWidget; +class QGridLayout; +class QCheckBox; +class QPushButton; +QT_END_NAMESPACE + +class DlgSetting : public QDialog { + Q_OBJECT + +public: + DlgSetting(UiSetting* settingObj, QWidget *parent = 0); + +private: + void SetupUI(); + +private: + QPushButton* btnOk; + QPushButton* btnCancel; + QCheckBox* chkShowoutput; + +private slots: + void on_btnOk_clicked(); + void on_btnCancel_clicked(); + +private: + UiSetting* setting; + + }; + +#endif /* DLGSETTING_H_ */ diff -r ecff51f1e7fb -r 8a14024f954a stif/QtUI/StifQtUI/frmmain.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/stif/QtUI/StifQtUI/frmmain.cpp Mon Mar 15 12:46:13 2010 +0200 @@ -0,0 +1,809 @@ +/* + * 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: QT C++ based Class. + * + */ +#include +#include "frmmain.h" +#include "stfqtuicontroller.h" +#include "stfqtuimodel.h" +#include +#include "version.h" +#include + +const QString SELECTITEMHEADER = " * "; +const QString UNSELECTITEMHEADER = " "; + +frmMain::frmMain() + { + uiSetting = new UiSetting(); + createMenus(); + load(); + LoadSubMenu(); + model = new StfQtUIModel(); + model->AddStifModelEventListener(this); + controller = new StfQtUIController(model); + controller->AddStfEventListener(this); + loadContent(); + dlgOutput = new DlgOutput(controller); + setSetting(); + } + +frmMain::~frmMain() + { + model->AbortCase(); + controller->RemoveStfEventListener(this); + model->RemoveStifModelEventListener(this); + + delete uiSetting; + delete dlgOutput; + delete controller; + delete model; + } + +void frmMain::setSetting() + { + controller->SetShowOutput(uiSetting->ReadSetting("showoutput") == "true"); + } + +void frmMain::OnGetMessage(const QString& aMessage) + { + txtOutput->appendPlainText(aMessage); + } + +void frmMain::OnRunningCaseChanged() + { + QList caseList = controller->GetCasesByStatus(EStatusRunning); + lstStartedCases->clear(); + foreach(CSTFCase aCase, caseList) + { + lstStartedCases->addItem(aCase.Name()); + } + if (caseList.size() != 0) + { + btnPauseCase->setEnabled(true); + btnAbortCase->setEnabled(true); + actPause->setEnabled(true); + actAbort->setEnabled(true); + } + else + { + btnPauseCase->setEnabled(false); + btnAbortCase->setEnabled(false); + actPause->setEnabled(false); + actAbort->setEnabled(false); + } + } + +void frmMain::OnCaseOutputChanged(const IStfEventListener::CaseOutputCommand& /*cmd*/, const QString& /*index*/, const QString& /*msg*/) + { + //nothing to do. + } + +void frmMain::OnSetListChanged() + { + loadSetList(); + } + +void frmMain::OnCaseStatisticChanged() + { + loadStatistic(); + } + +void frmMain::createMenus() + { + //operateMenu = menuBar()->addMenu(tr("&Operation")); + actAbout = new QAction(tr("&About"), this); + connect(actAbout, SIGNAL(triggered()), this, + SLOT(on_actAbout_triggered())); + + actExit = new QAction(tr("&Exit"), this); + connect(actExit, SIGNAL(triggered()), this, SLOT(close())); + + actOpenFile = new QAction(tr("&Open Ini File"), this); + connect(actOpenFile, SIGNAL(triggered()), this, + SLOT(on_actOpenFile_triggered())); + + actRunCaseSeq = new QAction(tr("Run Case Sequentially"), this); + connect(actRunCaseSeq, SIGNAL(triggered()), this, + SLOT(on_actRunCaseSeq_triggered())); + + actRunCasePar = new QAction(tr("Run Case Parallel"), this); + connect(actRunCasePar, SIGNAL(triggered()), this, + SLOT(on_actRunCasePar_triggered())); + + actAddtoSet = new QAction(tr("Add cases to Set"), this); + connect(actAddtoSet, SIGNAL(triggered()), this, + SLOT(on_actAddtoSet_triggered())); + + actSelectAll = new QAction(tr("Select All"), this); + connect(actSelectAll, SIGNAL(triggered()), this, + SLOT(on_actSelectAll_triggered())); + + actExpandAll = new QAction(tr("Expand All"), this); + connect(actExpandAll, SIGNAL(triggered()), this, + SLOT(on_actExpandAll_triggered())); + + actCollapseAll = new QAction(tr("Collapse All"), this); + connect(actCollapseAll, SIGNAL(triggered()), this, + SLOT(on_actCollapseAll_triggered())); + + actSetting = new QAction(tr("Setting"), this); + connect(actSetting, SIGNAL(triggered()), this, + SLOT(on_actSetting_triggered())); + + actRunSetSeq = new QAction(tr("Run Set Sequentially"), this); + connect(actRunSetSeq, SIGNAL(triggered()), this, + SLOT(on_actRunSetSeq_triggered())); + + actRunSetPar = new QAction(tr("Run Set Parallel"), this); + connect(actRunSetPar, SIGNAL(triggered()), this, + SLOT(on_actRunSetPar_triggered())); + + actNewSet = new QAction(tr("Create New Set"), this); + connect(actNewSet, SIGNAL(triggered()), this, + SLOT(on_actNewSet_triggered())); + + actDelSet = new QAction(tr("Delete Set"), this); + connect(actDelSet, SIGNAL(triggered()), this, + SLOT(on_actDelSet_triggered())); + + actPause = new QAction(tr("Pause"), this); + actPause->setEnabled(false); + connect(actPause, SIGNAL(triggered()), this, + SLOT(on_actPause_triggered())); + + actAbort = new QAction(tr("Abort"), this); + actAbort->setEnabled(false); + connect(actAbort, SIGNAL(triggered()), this, + SLOT(on_actAbort_triggered())); + + actClearStatistics = new QAction(tr("Clear Statistics"), this); + connect(actClearStatistics, SIGNAL(triggered()), this, + SLOT(on_actClearStatistics_triggered())); + + } + +void frmMain::load() + { + this->setContextMenuPolicy(Qt::NoContextMenu); + QSize btnSize(100,35); + QGridLayout *mainLayout = new QGridLayout(this); + mainLayout->setVerticalSpacing(2); + mainLayout->setHorizontalSpacing(2); + mainLayout->setSpacing(2); + mainLayout->setMargin(2); + + MainWidget = new QWidget(this); + MainWidget->setContextMenuPolicy(Qt::NoContextMenu); + + //tab control + tabWidget = new QTabWidget(this); + tabWidget->setContextMenuPolicy(Qt::NoContextMenu); + tabCase = new QWidget(tabWidget); + tabCase->setContextMenuPolicy(Qt::NoContextMenu); + tabWidget->addTab(tabCase, tr("Cases")); + tabSet = new QWidget(tabWidget); + tabSet->setContextMenuPolicy(Qt::NoContextMenu); + tabWidget->addTab(tabSet, tr(" Set ")); + tabStarted = new QWidget(tabWidget); + tabStarted->setContextMenuPolicy(Qt::NoContextMenu); + tabWidget->addTab(tabStarted, tr("Running")); + tabStatistic = new QWidget(tabWidget); + tabStatistic->setContextMenuPolicy(Qt::NoContextMenu); + tabWidget->addTab(tabStatistic, tr("Statistics")); + connect(tabWidget, SIGNAL(currentChanged(int)), this, + SLOT(onTabWidgetSelectIndexChanged())); + + //output panel + QGroupBox *groupBox = new QGroupBox(this); + groupBox->setFixedHeight(150); + groupBox->setContextMenuPolicy(Qt::NoContextMenu); + groupBox->setTitle(tr("Information")); + QFont serifFont("Times", 5, QFont::Normal); + txtOutput = new QPlainTextEdit(groupBox); + txtOutput->setFont(serifFont); + txtOutput->setContextMenuPolicy(Qt::NoContextMenu); + txtOutput->setReadOnly(true); + txtOutput->setFocusPolicy(Qt::NoFocus); + //txtOutput->setEditFocus(false); + QGridLayout *groupBoxLayout = new QGridLayout(this); + groupBoxLayout->setVerticalSpacing(2); + groupBoxLayout->setHorizontalSpacing(2); + groupBoxLayout->setSpacing(2); + groupBoxLayout->setMargin(2); + groupBoxLayout->addWidget(txtOutput, 0, 0); + groupBox->setLayout(groupBoxLayout); + + //Create MainLayout and MainWidget + mainLayout->addWidget(tabWidget, 0, 0); + mainLayout->addWidget(groupBox, 1, 0, Qt::AlignBottom); + MainWidget->setLayout(mainLayout); + + + //Tab page: Case + QGridLayout *tabCaseLayout = new QGridLayout(this); + tabCaseLayout->setVerticalSpacing(2); + tabCaseLayout->setHorizontalSpacing(2); + tabCaseLayout->setSpacing(2); + tabCaseLayout->setMargin(2); + treeModuleList = new QTreeWidget(tabCase); + treeModuleList->setContextMenuPolicy(Qt::NoContextMenu); + treeModuleList->headerItem()->setText(0, tr("Module List")); + treeModuleList->setSelectionBehavior(QAbstractItemView::SelectRows); + treeModuleList->setEditFocus(false); + connect(treeModuleList, SIGNAL(itemClicked(QTreeWidgetItem* , int)), this, + SLOT(on_treeModuleList_itemClicked(QTreeWidgetItem* , int))); + + + QWidget *caseToolWidget = new QWidget(tabCase); + caseToolWidget->setContextMenuPolicy(Qt::NoContextMenu); + QGridLayout *caseToolWidgetLayout = new QGridLayout; + QPushButton *btnRunCase = new QPushButton(tr("Run"), caseToolWidget); + btnRunCase->setContextMenuPolicy(Qt::NoContextMenu); + btnRunCase->setFixedSize(btnSize); + connect(btnRunCase, SIGNAL(clicked()), this, + SLOT(on_actRunCaseSeq_triggered())); + QPushButton *btnExpandAll = new QPushButton(tr("Expand"), caseToolWidget); + btnExpandAll->setContextMenuPolicy(Qt::NoContextMenu); + btnExpandAll->setFixedSize(btnSize); + connect(btnExpandAll, SIGNAL(clicked()), this, + SLOT(on_actExpandAll_triggered())); + QPushButton *btnCollapseAll = new QPushButton(tr("Collapse"), + caseToolWidget); + btnCollapseAll->setContextMenuPolicy(Qt::NoContextMenu); + btnCollapseAll->setFixedSize(btnSize); + connect(btnCollapseAll, SIGNAL(clicked()), this, + SLOT(on_actCollapseAll_triggered())); + + caseToolWidgetLayout->addWidget(btnRunCase, 0, 0); + caseToolWidgetLayout->addWidget(btnExpandAll, 0, 1); + caseToolWidgetLayout->addWidget(btnCollapseAll, 0, 2); + caseToolWidget->setLayout(caseToolWidgetLayout); + + tabCaseLayout->addWidget(caseToolWidget, 1, 0); + tabCaseLayout->addWidget(treeModuleList, 0, 0); + tabCase->setLayout(tabCaseLayout); + + //Tab page: Set + + QGridLayout *tabSetLayout = new QGridLayout(this); + tabSetLayout->setVerticalSpacing(2); + tabSetLayout->setHorizontalSpacing(2); + tabSetLayout->setSpacing(2); + tabSetLayout->setMargin(2); + + QGridLayout *tabSetMainLayout = new QGridLayout(this); + tabSetMainLayout->setVerticalSpacing(2); + tabSetMainLayout->setHorizontalSpacing(2); + tabSetMainLayout->setSpacing(2); + tabSetMainLayout->setMargin(2); + QWidget *tabSetMainWidget = new QWidget(tabSet); + tabSetMainWidget->setContextMenuPolicy(Qt::NoContextMenu); + QLabel *lblSet = new QLabel(tr("Test Set:"), tabSetMainWidget); + lblSet->setContextMenuPolicy(Qt::NoContextMenu); + QLabel *lblCase = new QLabel(tr("Cases:"), tabSetMainWidget); + lblCase->setContextMenuPolicy(Qt::NoContextMenu); + cboSetList = new QComboBox(tabSetMainWidget); + cboSetList->setContextMenuPolicy(Qt::NoContextMenu); + cboSetList->setEditable(false); + connect(cboSetList, SIGNAL(currentIndexChanged(QString)), this, + SLOT(on_cboSetList_currentIndexChanged(QString))); + lstSetCases = new QListWidget(tabSetMainWidget); + lstSetCases->setContextMenuPolicy(Qt::NoContextMenu); + tabSetMainLayout->addWidget(lblSet, 0, 0); + tabSetMainLayout->addWidget(cboSetList, 0, 1); + tabSetMainLayout->addWidget(lblCase, 1, 0, + (Qt::AlignTop | Qt::AlignRight)); + tabSetMainLayout->addWidget(lstSetCases, 1, 1); + tabSetMainWidget->setLayout(tabSetMainLayout); + + QWidget *setToolWidget = new QWidget(tabSet); + setToolWidget->setContextMenuPolicy(Qt::NoContextMenu); + QGridLayout *setToolWidgetLayout = new QGridLayout(this); + setToolWidgetLayout->setVerticalSpacing(2); + setToolWidgetLayout->setHorizontalSpacing(2); + setToolWidgetLayout->setSpacing(2); + setToolWidgetLayout->setMargin(2); + QPushButton *btnRunSetCase = new QPushButton(tr("Run"), setToolWidget); + btnRunSetCase->setContextMenuPolicy(Qt::NoContextMenu); + btnRunSetCase->setFixedSize(btnSize); + connect(btnRunSetCase, SIGNAL(clicked()), this, + SLOT(on_actRunSetSeq_triggered())); + QPushButton *btnNewSet = new QPushButton(tr("New Set"), setToolWidget); + btnNewSet->setContextMenuPolicy(Qt::NoContextMenu); + btnNewSet->setFixedSize(btnSize); + connect(btnNewSet, SIGNAL(clicked()), this, + SLOT(on_actNewSet_triggered())); + QPushButton *btnDelSet = new QPushButton(tr("Delete Set"), setToolWidget); + btnDelSet->setContextMenuPolicy(Qt::NoContextMenu); + btnDelSet->setFixedSize(btnSize); + connect(btnDelSet, SIGNAL(clicked()), this, + SLOT(on_actDelSet_triggered())); + + setToolWidgetLayout->addWidget(btnRunSetCase, 0, 0); + setToolWidgetLayout->addWidget(btnNewSet, 0, 1); + setToolWidgetLayout->addWidget(btnDelSet, 0, 2); + setToolWidget->setLayout(setToolWidgetLayout); + + tabSetLayout->addWidget(tabSetMainWidget, 0, 0); + tabSetLayout->addWidget(setToolWidget, 1, 0); + tabSet->setLayout(tabSetLayout); + + //Tab Started + QGridLayout *tabStartedLayout = new QGridLayout(this); + tabStartedLayout->setVerticalSpacing(2); + tabStartedLayout->setHorizontalSpacing(2); + tabStartedLayout->setSpacing(2); + tabStartedLayout->setMargin(2); + lstStartedCases = new QListWidget(tabStarted); + lstStartedCases->setContextMenuPolicy(Qt::NoContextMenu); + QWidget *startedToolWidget = new QWidget(tabStarted); + startedToolWidget->setContextMenuPolicy(Qt::NoContextMenu); + QGridLayout *startedToolWidgetLayout = new QGridLayout(this); + startedToolWidgetLayout->setVerticalSpacing(2); + startedToolWidgetLayout->setHorizontalSpacing(2); + startedToolWidgetLayout->setSpacing(2); + startedToolWidgetLayout->setMargin(2); + btnPauseCase = new QPushButton(tr("Pause"), startedToolWidget); + btnPauseCase->setContextMenuPolicy(Qt::NoContextMenu); + btnPauseCase->setFixedSize(btnSize); + connect(btnPauseCase, SIGNAL(clicked()), this, + SLOT(on_actPause_triggered())); + btnPauseCase->setEnabled(false); + + btnAbortCase = new QPushButton(tr("Abort"), startedToolWidget); + btnAbortCase->setContextMenuPolicy(Qt::NoContextMenu); + btnAbortCase->setFixedSize(btnSize); + connect(btnAbortCase, SIGNAL(clicked()), this, + SLOT(on_actAbort_triggered())); + btnAbortCase->setEnabled(false); + // + // QPushButton *btnShowOutput = new QPushButton(tr("Output"), startedToolWidget); + // connect(btnShowOutput, SIGNAL(clicked()), this, + // SLOT(on_btnShowOutput_clicked())); + + + startedToolWidgetLayout->addWidget(btnPauseCase, 0, 0); + startedToolWidgetLayout->addWidget(btnAbortCase, 0, 1); + //startedToolWidgetLayout->addWidget(btnShowOutput, 0, 2); + startedToolWidget->setLayout(startedToolWidgetLayout); + + tabStartedLayout->addWidget(lstStartedCases, 0, 0); + tabStartedLayout->addWidget(startedToolWidget, 1, 0); + tabStarted->setLayout(tabStartedLayout); + + //Tab Statistic + QGridLayout *tabStatisticLayout = new QGridLayout(this); + tabStatisticLayout->setVerticalSpacing(2); + tabStatisticLayout->setHorizontalSpacing(2); + tabStatisticLayout->setSpacing(2); + tabStatisticLayout->setMargin(2); + + treeStatistic = new QTreeWidget(tabStatistic); + treeStatistic->setContextMenuPolicy(Qt::NoContextMenu); + treeStatistic->headerItem()->setText(0, tr("Statistics")); + tabStatisticLayout->addWidget(treeStatistic, 0, 0); + tabStatistic->setLayout(tabStatisticLayout); + + executedItems = new QTreeWidgetItem(treeStatistic); + executedItems->setText(0, tr("Executed Cases(0)")); + passedItems = new QTreeWidgetItem(treeStatistic); + passedItems->setText(0, tr("Passed Cases(0)")); + failedItems = new QTreeWidgetItem(treeStatistic); + failedItems->setText(0, tr("Failed Cases(0)")); + crashedItems = new QTreeWidgetItem(treeStatistic); + crashedItems->setText(0, tr("Crashed Cases(0)")); + abortedItems = new QTreeWidgetItem(treeStatistic); + abortedItems->setText(0, tr("Aborted Cases(0)")); + + + setCentralWidget(MainWidget); + + } + +void frmMain::LoadSubMenu() + { + menuBar()->clear(); + menuBar()->setContextMenuPolicy(Qt::NoContextMenu); + if (tabWidget->currentIndex() == 0) + { + //Cases Tab + menuBar()->addAction(actOpenFile); + menuBar()->addAction(actRunCaseSeq); + menuBar()->addAction(actRunCasePar); + menuBar()->addSeparator(); + menuBar()->addAction(actAddtoSet); + menuBar()->addSeparator(); + menuBar()->addAction(actSelectAll); + menuBar()->addAction(actExpandAll); + menuBar()->addAction(actCollapseAll); + } + else if (tabWidget->currentIndex() == 1) + { + //Set Tab + menuBar()->addAction(actRunSetSeq); + menuBar()->addAction(actRunSetPar); + menuBar()->addSeparator(); + menuBar()->addAction(actNewSet); + menuBar()->addAction(actDelSet); + } + else if (tabWidget->currentIndex() == 2) + { + //Started Tab + menuBar()->addAction(actPause); + menuBar()->addAction(actAbort); + + } + else + { + //Staticstic tab + menuBar()->addAction(actClearStatistics); + } + menuBar()->addSeparator(); + menuBar()->addAction(actSetting); + menuBar()->addAction(actAbout); + menuBar()->addAction(actExit); + + } + +void frmMain::onTabWidgetSelectIndexChanged() + { + LoadSubMenu(); + } + +void frmMain::loadContent() + { + //Load ModuleList + loadModuleList(); + //Load SetList + loadSetList(); + //Load Statistic List + loadStatistic(); + } + +void frmMain::loadModuleList() + { + treeModuleList->clear(); + + QList moduleList = controller->GetModuleList(); + foreach(QString moduleName, moduleList) + { + QTreeWidgetItem* item = new QTreeWidgetItem(treeModuleList); + item->setText(0, UNSELECTITEMHEADER + moduleName); + + QList caseList = controller->GetCaseListByModule( + moduleName); + + foreach(QString caseName, caseList) + { + QTreeWidgetItem* caseItem = new QTreeWidgetItem(item); + caseItem->setText(0, UNSELECTITEMHEADER + caseName); + } + } + if (moduleList.size() > 0) + { + treeModuleList->setCurrentItem(treeModuleList->topLevelItem(0)); + } + } + +void frmMain::reloadStatisticItem(QString name, QTreeWidgetItem* item, + TSTFCaseStatusType type) + { + QList caseList = controller->GetCasesByStatus(type); + while (item->childCount() != 0) + { + item->removeChild(item->child(0)); + } + item->setText(0, name + "(" + QString::number(caseList.size(), 10) + ")"); + foreach(CSTFCase aCase, caseList) + { + QTreeWidgetItem* child = new QTreeWidgetItem(item); + child->setText(0, aCase.Name()); + } + } + +void frmMain::loadStatistic() + { + //executedItems; + reloadStatisticItem("Executed Cases", executedItems, EStatusExecuted); + + //passedItems; + reloadStatisticItem("Passed Cases", passedItems, EStatusPassed); + + //failedItems; + reloadStatisticItem("Failed Cases", failedItems, EStatusFailed); + + //crashedItems; + reloadStatisticItem("Crashed Cases", crashedItems, EStatusCrashed); + + //abortedItems; + reloadStatisticItem("Aborted Cases", abortedItems, EStatusAborted); + + } + +void frmMain::loadSetList() + { + cboSetList->clear(); + + QList setList = controller->GetSetList(); + foreach(QString setName, setList) + { + cboSetList->addItem(setName); + } +// if (setList.size() > 0) +// { +// //cboSetList->setCurrentIndex(0); +// on_cboSetList_currentIndexChanged(setList.at(0)); +// } + } + +QList frmMain::getSelectedCases() + { + int index = 0; + QTreeWidgetItem* item = treeModuleList->topLevelItem(index); + QList caseList; + while (item != 0) + { + for (int i = 0; i < item->childCount(); i++) + { + QTreeWidgetItem* child = item->child(i); + if (child->text(0).startsWith(SELECTITEMHEADER)) + { + CSTFCase aCase(child->text(0).remove(0,3), i); + aCase.SetIndex(i); + //aCase.SetModuleName(moduleBox->text()); + aCase.SetModuleName(item->text(0).remove(0,3)); + caseList.append(aCase); + } + } + index++; + item = treeModuleList->topLevelItem(index); + } + return caseList; + } + +void frmMain::on_cboSetList_currentIndexChanged(QString item) + { + lstSetCases->clear(); + QList list = controller->GetCaseListBySet(item); + foreach(QString caseName, list) + { + lstSetCases->addItem(caseName); + } + } + +void frmMain::on_actRunCaseSeq_triggered() + { + //run case seq + controller->RunCases(getSelectedCases(), Sequentially); + } + +void frmMain::on_actRunCasePar_triggered() + { + controller->RunCases(getSelectedCases(), Parallel); + } + +void frmMain::on_actAddtoSet_triggered() + { + + QList list = getSelectedCases(); + if (list.size() == 0) + { + QErrorMessage *errorMessageDialog = new QErrorMessage(this); + errorMessageDialog->showMessage(tr( + "Please select cases you want to added to set.")); + return; + } + + QList setList = controller->GetSetList(); + + /* + bool ok; + QString setName = QInputDialog::getItem(this, tr( + "Add select cases to Set"), tr("Sets:"), setList, 0, false, &ok); + if (ok && !setName.isEmpty()) + { + controller->AddCaseToSet(list, setName); + } + */ + + //temp code, because UIStore()->AddCaseToSet() is not support to define a set name. + controller->AddCaseToSet(list, ""); + tabWidget->setCurrentIndex(1); + + } + +void frmMain::on_actSelectAll_triggered() + { + QString header = UNSELECTITEMHEADER; + if(actSelectAll->text() == "Select All") + { + actSelectAll->setText("UnSelect All"); + header = SELECTITEMHEADER; + } + else + { + actSelectAll->setText("Select All"); + } + + int index = 0; + QTreeWidgetItem* item = treeModuleList->topLevelItem(index); + while (item != 0) + { + item->setText(0, item->text(0).replace(0,3, header)); + for (int i = 0; i < item->childCount(); i++) + { + QTreeWidgetItem* child = item->child(i); + child->setText(0,child->text(0).replace(0,3,header)); + } + index++; + item = treeModuleList->topLevelItem(index); + } + } + +void frmMain::on_actExpandAll_triggered() + { + treeModuleList->expandAll(); + } + +void frmMain::on_actCollapseAll_triggered() + { + treeModuleList->collapseAll(); + } + +void frmMain::on_actSetting_triggered() + { + DlgSetting dlgSet(uiSetting); + int result = dlgSet.exec(); + if(result == QDialog::Accepted) + { + setSetting(); + } + } + +void frmMain::on_actRunSetSeq_triggered() + { + QString setName = cboSetList->currentText(); + controller->RunSets(setName, Sequentially); + } + +void frmMain::on_actRunSetPar_triggered() + { + QString setName = cboSetList->currentText(); + controller->RunSets(setName, Parallel); + } + +void frmMain::on_actNewSet_triggered() + { + //not supported. + QErrorMessage *errorMessageDialog = new QErrorMessage(this); + errorMessageDialog->showMessage( + tr( + "The feature is not supported in this version.\r\n \ + If you want to Add test set.\r\n \ + Please switch to \"Case\" tab, Select case(s) and perform \"Add case to set\".")); + return; + /* + * These function is not supported in this version. + * Unless this function has been impelemented: + * UIStore()->AddSet(setName); + * + bool ok; + QString text = QInputDialog::getText(this, tr("Create a new Set"), tr( + "Input a set name:"), QLineEdit::Normal, QDir::home().dirName(), + &ok); + if (ok && !text.isEmpty()) + { + controller->CreateSet(text); + } + */ + } + +void frmMain::on_actDelSet_triggered() + { + //not supported. + QErrorMessage *errorMessageDialog = new QErrorMessage(this); + errorMessageDialog->showMessage( + tr( + "The feature is not supported in this version.\r\n \ + If you want to remove test set.\r\n \ + Please delete them under {epoc root}\\winscw\\c\\TestFramework \ + And restart Application")); + return; + /* + * These function is not supported in this version. + * Unless this function has been impelemented: + * UIStore()->RemoveSet(setName); + * + QString setName = cboSetList->currentText(); + QMessageBox msgBox(QMessageBox::Warning, tr("Delete a Set"), tr( + "Do you really want to delete the set?"), 0, this); + msgBox.addButton(tr("&Delete"), QMessageBox::AcceptRole); + msgBox.addButton(tr("&Cancel"), QMessageBox::RejectRole); + if (msgBox.exec() == QMessageBox::AcceptRole) + { + controller->DeleteSet(setName); + } + + + */ + } + +void frmMain::on_actPause_triggered() + { + if (btnPauseCase->text() == "Pause") + { + controller->PauseCase(); + btnPauseCase->setText(tr("Resume")); + actPause->setText(tr("Resume")); + } + else + { + controller->ResumeCase(); + btnPauseCase->setText(tr("Pause")); + actPause->setText(tr("Pause")); + } + } + +void frmMain::on_actAbort_triggered() + { + controller->AbortCase(); + } + +void frmMain::on_treeModuleList_itemClicked(QTreeWidgetItem* item, int /*column*/) + { + QString header = UNSELECTITEMHEADER; + if(item->text(0).startsWith(UNSELECTITEMHEADER)) + { + header = SELECTITEMHEADER; + } + item->setText(0 , item->text(0).replace(0, 3, header)); + for(int i=0;ichildCount();i++) + { + item->child(i)->setText(0, item->child(i)->text(0).replace(0, 3, header)); + } + } + +void frmMain::on_actAbout_triggered() + { + QString str = QtUIVersion; + str.append("\r\n").append("STF version:"); + + str.append(QString::number(STIF_MAJOR_VERSION, 10)).append("."); + str.append(QString::number(STIF_MINOR_VERSION, 10)).append("."); + str.append(QString::number(STIF_BUILD_VERSION, 10)); + str.append(" --").append(STIF_REL_DATE).append("\r\n"); + str.append("---"); + str.append("\r\nCopyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). All rights reserved. "); + + QMessageBox::information(this, tr("About"), str); + } + +void frmMain::on_actOpenFile_triggered() + { + QString fileName = QFileDialog::getOpenFileName(this, tr( + "Select ini file"), tr("c:\\"), tr( + "Ini Files (*.ini);;All Files (*)")); + if (!fileName.isEmpty()) + { + controller->OpenEngineIniFile(fileName); + this->loadModuleList(); + } + } + +void frmMain::on_actClearStatistics_triggered() + { + model->ClearCasesStatus(); + } diff -r ecff51f1e7fb -r 8a14024f954a stif/QtUI/StifQtUI/frmmain.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/stif/QtUI/StifQtUI/frmmain.h Mon Mar 15 12:46:13 2010 +0200 @@ -0,0 +1,179 @@ +/* +* 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: QT C++ based Class. +* frmMain is a QT based Window. +* Used to display STF executor main GUI. +* +*/ +#ifndef FRMMAIN_H +#define FRMMAIN_H + +#include +#include "istfqtuicontroller.h" +#include "istfqtuimodel.h" +#include "dlgoutput.h" +#include "uisetting.h" +#include "dlgsetting.h" + +QT_BEGIN_NAMESPACE +class QAction; +class QLabel; +class QMenu; +class QTabWidget; +class QWidget; +class QPushButton; +class QComboBox; +class QPlainTextEdit; +class QTreeWidget; +class QTreeWidgetItem; +class QListWidget; +class QCheckBox; +class QMessageBox; +class QFileDialog; +QT_END_NAMESPACE + +const QString QtUIVersion = "StfQtUI v1.0.1"; + +class frmMain : public QMainWindow, public IStfEventListener, public IStifModelEventListener +{ + Q_OBJECT + +public: + frmMain(); + ~frmMain(); + + +public: //Implement IStfEventListener + void OnGetMessage(const QString& aMessage); + void OnSetListChanged(); + void OnCaseOutputChanged(const IStfEventListener::CaseOutputCommand& cmd, const QString& index, const QString& msg); + + +public: //Implement IStifModelEventListener + void OnCaseStatisticChanged() ; + void OnRunningCaseChanged() ; + +protected slots: + void onTabWidgetSelectIndexChanged(); + + +private: + void createMenus(); + void LoadSubMenu(); + void load(); + void loadContent(); + void loadModuleList(); + void loadSetList(); + void loadStatistic(); + QList getSelectedCases(); + void reloadStatisticItem(QString name, QTreeWidgetItem* item, TSTFCaseStatusType type); + void setSetting(); + +private: + IStfQtUIController* controller; + IStfQtUIModel* model; + DlgOutput* dlgOutput; + UiSetting* uiSetting; + + +private: //UI Components + QWidget *MainWidget; + //menus and actions + QMenu *operateMenu; + //output panel + QPlainTextEdit *txtOutput; + //tab control. + QTabWidget *tabWidget; + QWidget *tabCase; + QWidget *tabSet; + QWidget *tabStarted; + QWidget *tabStatistic; + + //Cases Tab + QTreeWidget *treeModuleList; + + //Statistic Tab + QTreeWidget *treeStatistic; + QTreeWidgetItem *executedItems; + QTreeWidgetItem *passedItems; + QTreeWidgetItem *failedItems; + QTreeWidgetItem *abortedItems; + QTreeWidgetItem *crashedItems; + + + //Set Tab + QComboBox *cboSetList; + QListWidget *lstSetCases; + + //Started Tab + QListWidget *lstStartedCases; + QPushButton *btnPauseCase; + QPushButton *btnAbortCase; + QPlainTextEdit *txtCaseOutput; + + //menu actions + QAction *actExit; + QAction *actAbout; + + //cases actoins + QAction *actOpenFile; + QAction *actRunCaseSeq; + QAction *actRunCasePar; + QAction *actAddtoSet; + QAction *actSelectAll; + QAction *actExpandAll; + QAction *actCollapseAll; + QAction *actSetting; + //sets actions + QAction *actRunSetSeq; + QAction *actRunSetPar; + QAction *actNewSet; + QAction *actDelSet; + //running actions. + QAction *actPause; + QAction *actAbort; + //statistics actions + QAction *actClearStatistics; + +private slots: + void on_cboSetList_currentIndexChanged(QString ); + + void on_actAbout_triggered(); + void on_actOpenFile_triggered(); + void on_actRunCaseSeq_triggered(); + void on_actRunCasePar_triggered(); + void on_actAddtoSet_triggered(); + void on_actSelectAll_triggered(); + void on_actExpandAll_triggered(); + void on_actCollapseAll_triggered(); + void on_actSetting_triggered(); + + void on_actRunSetSeq_triggered(); + void on_actRunSetPar_triggered(); + void on_actNewSet_triggered(); + void on_actDelSet_triggered(); + void on_actPause_triggered(); + void on_actAbort_triggered(); + void on_actClearStatistics_triggered(); + void on_treeModuleList_itemClicked(QTreeWidgetItem* item, int column); + + + + + + + +}; + +#endif // FRMMAIN_H diff -r ecff51f1e7fb -r 8a14024f954a stif/QtUI/StifQtUI/istfqtuicontroller.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/stif/QtUI/StifQtUI/istfqtuicontroller.h Mon Mar 15 12:46:13 2010 +0200 @@ -0,0 +1,79 @@ +/* +* 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: QT C++ based Class. +* IStfQtUIController is interface of appliction controller. +* IStfEventListener is interface of Stf view observer. +* +*/ +#ifndef ISTFQTUICONTROLLER_H +#define ISTFQTUICONTROLLER_H +#include "cstfmodule.h" +#include "cstfcase.h" +#include +#include "istfqtuimodel.h" + +class IStfEventListener +{ +public: + enum CaseOutputCommand + { + ECreate, + EOutput, + EClose + }; +public: + virtual void OnGetMessage(const QString& aMessage) = 0; + virtual void OnSetListChanged() = 0; + virtual void OnCaseOutputChanged(const IStfEventListener::CaseOutputCommand& cmd, const QString& index, const QString& msg) = 0; +}; + +class IStfQtUIController +{ +public: + inline virtual ~IStfQtUIController(){} + //for cases + virtual bool OpenEngineIniFile(const QString& fileName) = 0; + virtual QList GetModuleList() = 0; + virtual QList GetCaseListByModule(const QString& moduleName) = 0; + virtual CSTFCase GetCase(const QString& moduleName, const int index) = 0; + virtual void RunCases(const QList& caseList, const TSTFCaseRunningType& type) = 0; + virtual void AddCaseToSet(const QList& aCase, const QString& setName) = 0; + + //for set + virtual QList GetSetList() = 0; + virtual QList GetCaseListBySet(const QString& setName) = 0; + virtual void CreateSet(const QString& setName) = 0; + virtual void DeleteSet(const QString& setName) = 0; + virtual void RunSets(const QString& setName, const TSTFCaseRunningType& type) = 0; + + //for Started + virtual void PauseCase() = 0; + virtual void ResumeCase() = 0; + virtual void AbortCase() = 0; + virtual bool ShowOutput() = 0; + virtual void SetShowOutput(bool isShow) = 0; + + //for staticstic + virtual QList GetCasesByStatus(const TSTFCaseStatusType& type) = 0; + + //listener + virtual void AddStfEventListener(IStfEventListener* listener) = 0; + virtual void RemoveStfEventListener(IStfEventListener* listener) = 0; + + +}; + + + +#endif // ISTFQTUICONTROLLER_H diff -r ecff51f1e7fb -r 8a14024f954a stif/QtUI/StifQtUI/istfqtuimodel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/stif/QtUI/StifQtUI/istfqtuimodel.h Mon Mar 15 12:46:13 2010 +0200 @@ -0,0 +1,55 @@ +/* +* 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: QT C++ based Class. +* IStfQtUIModel is interface of appliction data model. +* IStifModelEventListener is used to listen event from data model. +* +*/ +#ifndef ISTFQTUIMODEL_H +#define ISTFQTUIMODEL_H + +//#include +#include "cstfcase.h" +#include "cstfmodule.h" +#include +#include +#include + +class IStifModelEventListener + { +public: + virtual void OnCaseStatisticChanged() = 0; + virtual void OnRunningCaseChanged() = 0; + }; + +class IStfQtUIModel +{ +public: + inline virtual ~IStfQtUIModel(){} + virtual void ClearCasesStatus() = 0; + virtual QList GetCasesByStatus(const TSTFCaseStatusType& type) = 0; + virtual void AddRunningCase(const CStartedTestCase* startedCase, const CSTFCase& stfCase) = 0; + virtual void RemoveRunningCase(const CStartedTestCase* startedCase) = 0; + virtual void AddCaseByStatus(const TSTFCaseStatusType& type, const CSTFCase& aCase) = 0; + virtual void PauseCase() = 0; + virtual void ResumeCase() = 0; + virtual void AbortCase() = 0; + + virtual void AddStifModelEventListener(IStifModelEventListener* listener) = 0; + virtual void RemoveStifModelEventListener(IStifModelEventListener* listener) = 0; + + +}; + +#endif // ISTFQTUIMODEL_H diff -r ecff51f1e7fb -r 8a14024f954a stif/QtUI/StifQtUI/main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/stif/QtUI/StifQtUI/main.cpp Mon Mar 15 12:46:13 2010 +0200 @@ -0,0 +1,28 @@ +/* +* 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: QT C++ based Class. +* Application entrance. +* +*/ +#include +#include "frmmain.h" + +int main(int argc, char* argv[]) +{ + QApplication app(argc, argv); + frmMain win; + win.showMaximized(); + return app.exec(); +} + diff -r ecff51f1e7fb -r 8a14024f954a stif/QtUI/StifQtUI/stfqtuicontroller.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/stif/QtUI/StifQtUI/stfqtuicontroller.cpp Mon Mar 15 12:46:13 2010 +0200 @@ -0,0 +1,324 @@ +/* + * 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: QT C++ based Class. + * Stf Controller implementation. + * + */ +#include "stfqtuicontroller.h" +#include +#include +//#include "stiflogger.h" +#include + +const QString TEMPSETNAME = "TEMPSET"; +const QString DEFAULTINI = "c:\\testframework\\testframework.ini"; + +//__DECLARE_LOG + +StfQtUIController::StfQtUIController(IStfQtUIModel* aModel) : + model(aModel), isShowOutput(false) + { +// __OPENLOGL ("\\STFQtUI\\", "StifQtUi.log" ); + executor = new CStifExecutor(); + executor->OpenIniFile(DEFAULTINI); + executor->AddStifCaseUpdateListener(this); + } + +StfQtUIController::~StfQtUIController() + { + executor->RemoveStifCaseUpdateListener(this); + delete executor; + executor = NULL; +// __CLOSELOG; + } +//for cases + +bool StfQtUIController::OpenEngineIniFile(const QString& fileName) + { + delete executor; + executor = new CStifExecutor(); + bool rst = executor->OpenIniFile(fileName); + executor->AddStifCaseUpdateListener(this); + return rst; + } + +QList StfQtUIController::GetModuleList() + { + QList modules = executor->GetModuleList(); + QList moduleList; + foreach(CSTFModule m, modules) + { + moduleList.append(m.Name()); + } + return moduleList; + } + +CSTFModule StfQtUIController::GetModuleByName(const QString& moduleName) + { + QList modules = executor->GetModuleList(); + CSTFModule module; + foreach(CSTFModule m, modules) + { + if(m.Name() == moduleName) + { + module = m; + break; + } + } + return module; + + } + +QList StfQtUIController::GetCaseListByModule(const QString& moduleName) + { + QList caseList; + if (moduleName != "") + { + QList cases = executor->GetCaseList(moduleName); + foreach(CSTFCase c, cases) + { + caseList.append(c.Name()); + } + } + + return caseList; + } + +CSTFCase StfQtUIController::GetCase(const QString& moduleName, const int index) + { + CSTFCase rst; + if(moduleName != "") + { + QList cases = executor->GetCaseList(moduleName); + if(index < cases.length()) + { + rst = cases.at(index); + } + } + return rst; + } + +void StfQtUIController::RunCases(const QList& caseList, + const TSTFCaseRunningType& type) + { + if (caseList.size() == 1) + { + CSTFCase aCase = caseList.at(0); + QString msg = "Start execute case:" + aCase.Name(); + FireOnGetOutput(msg); + executor->ExecuteSingleCase(aCase.ModuleName(), aCase.Index()); + } + else + { + //create a temp set, append cases into the set and execute it. + executor->CreateSet(TEMPSETNAME); + foreach(CSTFCase aCase, caseList) + { + executor->AddtoSet(TEMPSETNAME, aCase); + } + RunSets(TEMPSETNAME, type); + executor->RemoveSet(TEMPSETNAME); + } + } + +void StfQtUIController::AddCaseToSet(const QList& caseList, + const QString& /*setName*/) + { + QString setName = QDateTime::currentDateTime().toString("hh_mm_ss"); + setName.append(".set"); + executor->CreateSet(setName); + foreach(CSTFCase aCase, caseList) + { + executor->AddtoSet(setName, aCase); + } + executor->SaveSet(setName); + executor->RemoveSet(setName); + FireOnSetListChanged(); + } + +//for set + +QList StfQtUIController::GetSetList() + { + return executor->GetSetList(); + } +QList StfQtUIController::GetCaseListBySet(const QString& setName) + { + QList cases = executor->GetCaseListFromSet(setName); + QList caseList; + foreach(CSTFCase c, cases) + { + caseList.append(c.Name()); + } + return caseList; + } + +void StfQtUIController::CreateSet(const QString& setName) + { + executor->CreateSet(setName); + //executor->SaveSet(setName); + FireOnSetListChanged(); + } + +void StfQtUIController::DeleteSet(const QString& setName) + { + executor->RemoveSet(setName); + //executor->SaveSet(setName); + FireOnSetListChanged(); + } + +void StfQtUIController::RunSets(const QString& setName, const TSTFCaseRunningType& type) + { + executor->ExecuteSet(setName, 0, type); + } + +//for Started +void StfQtUIController::PauseCase() + { + model->PauseCase(); + QString msg = "Execution Paused"; + FireOnGetOutput(msg); + } + +void StfQtUIController::ResumeCase() + { + model->ResumeCase(); + FireOnGetOutput("Execution Resumed"); + } + +void StfQtUIController::AbortCase() + { + model->AbortCase(); + FireOnGetOutput("Case Aborted"); + } + +bool StfQtUIController::ShowOutput() + { + return isShowOutput; + } + +void StfQtUIController::SetShowOutput(bool isShow) + { + isShowOutput = isShow; + } + +QList StfQtUIController::GetCasesByStatus(const TSTFCaseStatusType& type) + { + return model->GetCasesByStatus(type); + } + +void StfQtUIController::AddStfEventListener(IStfEventListener* listener) + { + if (!listenerList.contains(listener)) + { + listenerList.append(listener); + } + } +void StfQtUIController::RemoveStfEventListener(IStfEventListener* listener) + { + if (listenerList.contains(listener)) + { + listenerList.removeOne(listener); + } + } + +void StfQtUIController::OnGetCaseUpdated(CStartedTestCase* aCase, + CSTFCase& stfcase, int flags) + { + if (flags & CUIStoreIf::EPrintUpdate || aCase == NULL) + { + return; + } + QString msg = "case Name:"; + msg += stfcase.Name() + "\r\n Status:"; + flags = aCase->Status(); + if (flags & CUIStoreIf::EStatusRunning) + { + model->AddRunningCase(aCase, stfcase); + msg += "start running"; + FireOnCaseOutputChanged(IStfEventListener::ECreate, (int) aCase, + stfcase.Name()); + } + else if (flags & CUIStoreIf::EStatusAborted) + { + FireOnCaseOutputChanged(IStfEventListener::EClose, (int) aCase, ""); + model->RemoveRunningCase(aCase); + model->AddCaseByStatus(EStatusAborted, stfcase); + msg += "aborted"; + + } + else if (flags & CUIStoreIf::EStatusExecuted) + { + FireOnCaseOutputChanged(IStfEventListener::EClose, (int) aCase, ""); + model->RemoveRunningCase(aCase); + model->AddCaseByStatus(EStatusExecuted, stfcase); + + if (flags & CUIStoreIf::EStatusCrashed) + { + model->AddCaseByStatus(EStatusCrashed, stfcase); + msg += "crashed"; + } + else if (flags & CUIStoreIf::EStatusFailed) + { + model->AddCaseByStatus(EStatusFailed, stfcase); + msg += "failed"; + } + else if (flags & CUIStoreIf::EStatusPassed) + { + model->AddCaseByStatus(EStatusPassed, stfcase); + msg += "passed"; + } + + } + else + { + return; + } + + FireOnGetOutput(msg); + } + +void StfQtUIController::OnGetCaseOutput(CStartedTestCase* aCase, QString& msg) + { + FireOnCaseOutputChanged(IStfEventListener::EOutput, (int) aCase, msg); + } + +void StfQtUIController::FireOnCaseOutputChanged( + IStfEventListener::CaseOutputCommand cmd, int index, QString msg) + { + if (ShowOutput()) + { + foreach(IStfEventListener* listener, listenerList) + { + listener->OnCaseOutputChanged(cmd, + QString::number(index, 10), msg); + } + } + } + +void StfQtUIController::FireOnGetOutput(QString message) + { + foreach(IStfEventListener* listener, listenerList) + { + listener->OnGetMessage(message); + } + } + +void StfQtUIController::FireOnSetListChanged() + { + foreach(IStfEventListener* listener, listenerList) + { + listener->OnSetListChanged(); + } + } diff -r ecff51f1e7fb -r 8a14024f954a stif/QtUI/StifQtUI/stfqtuicontroller.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/stif/QtUI/StifQtUI/stfqtuicontroller.h Mon Mar 15 12:46:13 2010 +0200 @@ -0,0 +1,86 @@ +/* +* 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: QT C++ based Class. +* Application's controller. +* +*/ +#ifndef STFQTUICONTROLLER_H_ +#define STFQTUICONTROLLER_H_ + +#include "istfqtuicontroller.h" +#include "istfqtuimodel.h" +#include "stifexecutor.h" + +class StfQtUIController : public IStfQtUIController, public IStifCaseUpdateListener + { +public: + StfQtUIController(IStfQtUIModel* aModel); + ~StfQtUIController(); +public: //Implement IStfQtUIController. + //for cases + + bool OpenEngineIniFile(const QString& fileName); + QList GetModuleList(); + QList GetCaseListByModule(const QString& moduleName); + CSTFCase GetCase(const QString& moduleName, const int index); + void RunCases(const QList& caseList, const TSTFCaseRunningType& type); + void AddCaseToSet(const QList& aCase, const QString& setName); + + //for set + QList GetSetList(); + QList GetCaseListBySet(const QString& setName); + void CreateSet(const QString& setName); + void DeleteSet(const QString& setName); + void RunSets(const QString& setName, const TSTFCaseRunningType& type); + + //for Started + void PauseCase(); + void ResumeCase(); + void AbortCase(); + bool ShowOutput(); + void SetShowOutput(bool isShow); + + //for staticstic + QList GetCasesByStatus(const TSTFCaseStatusType& type); + + //listener + void AddStfEventListener(IStfEventListener* listener); + void RemoveStfEventListener(IStfEventListener* listener); + +public://implement IStifCaseUpdateListener + void OnGetCaseUpdated(CStartedTestCase* aCase, CSTFCase& stfcase, int flags); + void OnGetCaseOutput(CStartedTestCase* aCase, QString& msg); + +private: //Fire event + void FireOnGetOutput(QString message); + void FireOnSetListChanged(); + void FireOnCaseOutputChanged(IStfEventListener::CaseOutputCommand cmd, int index, QString msg); + +private://help methods + CSTFModule GetModuleByName(const QString& moduleName); + +private: + CStifExecutor* executor; + IStfQtUIModel* model; + QList listenerList; + bool isShowOutput; + + + + }; + + + + +#endif /* STFQTUICONTROLLER_H_ */ diff -r ecff51f1e7fb -r 8a14024f954a stif/QtUI/StifQtUI/stfqtuimodel.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/stif/QtUI/StifQtUI/stfqtuimodel.cpp Mon Mar 15 12:46:13 2010 +0200 @@ -0,0 +1,156 @@ +/* + * 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: QT C++ based Class. + * application model implementation. + * + */ +#include "stfqtuimodel.h" +#include + +StfQtUIModel::StfQtUIModel() + { + //nothing to do. + } + +StfQtUIModel::~StfQtUIModel() + { + //nothing to do. + } + +void StfQtUIModel::PauseCase() + { + foreach(const CStartedTestCase* startedCase, runningCaseList.keys()) + { + startedCase->UIEngineContainer().PauseTest(); + } + } + +void StfQtUIModel::ResumeCase() + { + foreach(const CStartedTestCase* startedCase, runningCaseList.keys()) + { + startedCase->UIEngineContainer().ResumeTest(); + } + } + +void StfQtUIModel::AbortCase() + { + foreach(const CStartedTestCase* startedCase, runningCaseList.keys()) + { + startedCase->UIEngineContainer().CancelTest(); + } + } + +void StfQtUIModel::AddRunningCase(const CStartedTestCase* startedCase, + const CSTFCase& stfCase) + { + runningCaseList.insert(startedCase, stfCase); + FireOnRunningCaseChangedEvent(); + } + +void StfQtUIModel::RemoveRunningCase(const CStartedTestCase* startedCase) + { + runningCaseList.remove(startedCase); + FireOnRunningCaseChangedEvent(); + } + +void StfQtUIModel::AddCaseByStatus(const TSTFCaseStatusType& type, const CSTFCase& aCase) + { + switch (type) + { + case EStatusRunning: + break; + case EStatusExecuted: + executedCaseList.append(aCase); + break; + case EStatusPassed: + passedCaseList.append(aCase); + break; + case EStatusFailed: + failedCaseList.append(aCase); + break; + case EStatusAborted: + abortCaseList.append(aCase); + break; + case EStatusCrashed: + crashedCaseList.append(aCase); + break; + } + FireOnCaseStatisticChangedEvent(); + } + +QList StfQtUIModel::GetCasesByStatus(const TSTFCaseStatusType& type) + { + switch (type) + { + case EStatusRunning: + return runningCaseList.values(); + case EStatusExecuted: + return executedCaseList; + case EStatusPassed: + return passedCaseList; + case EStatusFailed: + return failedCaseList; + case EStatusAborted: + return abortCaseList; + case EStatusCrashed: + return crashedCaseList; + } + QList list; + return list; + } + +void StfQtUIModel::AddStifModelEventListener( + IStifModelEventListener* listener) + { + if (!listenerList.contains(listener)) + { + listenerList.append(listener); + } + } + +void StfQtUIModel::RemoveStifModelEventListener( + IStifModelEventListener* listener) + { + if (!listenerList.contains(listener)) + { + listenerList.removeOne(listener); + } + } + +void StfQtUIModel::FireOnCaseStatisticChangedEvent() + { + foreach(IStifModelEventListener* listener, listenerList) + { + listener->OnCaseStatisticChanged(); + } + } + +void StfQtUIModel::FireOnRunningCaseChangedEvent() + { + foreach(IStifModelEventListener* listener, listenerList) + { + listener->OnRunningCaseChanged(); + } + } + +void StfQtUIModel::ClearCasesStatus() + { + executedCaseList.clear(); + passedCaseList.clear(); + failedCaseList.clear(); + abortCaseList.clear(); + crashedCaseList.clear(); + FireOnCaseStatisticChangedEvent(); + } diff -r ecff51f1e7fb -r 8a14024f954a stif/QtUI/StifQtUI/stfqtuimodel.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/stif/QtUI/StifQtUI/stfqtuimodel.h Mon Mar 15 12:46:13 2010 +0200 @@ -0,0 +1,57 @@ +/* +* 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: QT C++ based Class. +* application data model. +* +*/ +#include "istfqtuimodel.h" +#include "stifexecutor.h" +#include + +class StfQtUIModel : public IStfQtUIModel + { +public: + StfQtUIModel(); + virtual ~StfQtUIModel(); +public://implement IStfQtUIModel + void ClearCasesStatus(); + QList GetCasesByStatus(const TSTFCaseStatusType& type); + void AddRunningCase(const CStartedTestCase* startedCase, const CSTFCase& stfCase); + void RemoveRunningCase(const CStartedTestCase* startedCase); + void AddCaseByStatus(const TSTFCaseStatusType& type, const CSTFCase& aCase); + void AddStifModelEventListener(IStifModelEventListener* listener); + void RemoveStifModelEventListener(IStifModelEventListener* listener); + void PauseCase(); + void ResumeCase(); + void AbortCase(); + +private: + void FireOnCaseStatisticChangedEvent(); + void FireOnRunningCaseChangedEvent(); + +private: + QList listenerList; + QList executedCaseList; + QList passedCaseList; + QList failedCaseList; + QList abortCaseList; + QList crashedCaseList; + QHash runningCaseList; + + + + + + + }; diff -r ecff51f1e7fb -r 8a14024f954a stif/QtUI/StifQtUI/stifexecutor.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/stif/QtUI/StifQtUI/stifexecutor.cpp Mon Mar 15 12:46:13 2010 +0200 @@ -0,0 +1,360 @@ +/* + * 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: QT C++ and Symbian C++ combination Class. + * STIF UI interface and engine caller implementaion. + * + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include "stifexecutor.h" +#include "StifTFwIf.h" + + +CStifExecutor::CStifExecutor() : + listenerList(NULL) + { +// __LOG(_L("started")); + TInt result; + TRAP(result, CUIStoreIf::ConstructL()); +// __LOG1(_L("CUIStoreIf ConstructL, result=%d"), result); + if (result != KErrNone) + { + return; + } + TRAP(result, iBuffer = HBufC::NewL(500)); +// __LOG1(_L("Create Case Execution output buffer, result=%d"), result); + + } + +CStifExecutor::~CStifExecutor() + { + UIStore().Close(); + delete iBuffer; + if (listenerList) + { + delete listenerList; + listenerList = NULL; + } +// __LOG(_L("finished")); + } + +bool CStifExecutor::OpenIniFile(const QString& filename) + { + TInt result = UIStore().Open(QString2TPtrC(filename)); +// __LOG2(_L("Open ini file %s.result=%d"),QString2TPtrC(filename).Ptr(),result); + return (result == KErrNone); + } + +TPtrC CStifExecutor::QString2TPtrC(const QString& aString) + { + TPtrC ret(reinterpret_cast (aString.constData()), + aString.length()); + return ret; + } +QString CStifExecutor::TDesC2QString(const TDesC& des) + { + //#ifdef QT_NO_UNICODE + //return QString::fromLocal8Bit((char*)des.Ptr(), des.Length()); + //#else + QString rst = QString::fromUtf16(des.Ptr(), des.Length()); + return rst; + //#endif + } + +void CStifExecutor::AddStifCaseUpdateListener( + IStifCaseUpdateListener* listener) + { +// __LOG(_L("AddStifCaseUpdateListener")); + if (!listenerList) + { + listenerList = new QList (); + } + if (!listenerList->contains(listener)) + { + listenerList->append(listener); + } + } + +void CStifExecutor::RemoveStifCaseUpdateListener( + IStifCaseUpdateListener* listener) + { +// __LOG(_L("RemoveStifCaseUpdateListener")); + if (!listenerList) + { + return; + } + + if (listenerList->contains(listener)) + { + listenerList->removeOne(listener); + } + + } + +QList CStifExecutor::GetModuleList() + { + QList list; + RRefArray modules; +// __LOG(_L("GetModuleList")); + TInt ret = UIStore().Modules(modules); +// __LOG1(_L("LoadAllModules %d"), ret); +// __LOG1(_L("Modules number=%d"), modules.Count()); + for (TInt i = 0; i < modules.Count(); i++) + { +// __LOG1(_L("Get Module Names %d"), i); + CSTFModule module; + module.SetName(QString::fromUtf16(modules[i].Ptr(), + modules[i].Length())); + //module.SetName(TDesC2QString(modules[i])); + list.append(module); + } + modules.Reset(); + modules.Close(); + return list; + } + +QList CStifExecutor::GetCaseList(const QString& moduleName) + { + TPtrC name = QString2TPtrC(moduleName); + QList list; + RRefArray testCases; + TInt ret = UIStore().TestCases(testCases, name, KNullDesC); +// __LOG1(_L("Get TestCases: %d"), ret); + for (TInt i = 0; i < testCases.Count(); i++) + { +// __LOG1(_L("Case Number: %d"),testCases[i].TestCaseNum()); + CSTFCase testcase; + testcase.SetName(TDesC2QString(testCases[i].TestCaseTitle())); + testcase.SetIndex(i); + list.append(testcase); + } + testCases.Reset(); + testCases.Close(); + return list; + } + +void CStifExecutor::ExecuteSingleCase(const QString& moduleName, const int caseIndex) + { +// __LOG(_L("ExecuteCase start")); + TPtrC name = QString2TPtrC(moduleName); + RRefArray testCases; + TInt ret = UIStore().TestCases(testCases, name, KNullDesC); +// __LOG1(_L("Get TestCases return code=%d"), ret); + if (testCases.Count() > caseIndex) + { + TInt index; + UIStore().StartTestCase(testCases[caseIndex], index); +// __LOG1(_L("start test case index=%d"), index); + } + testCases.Reset(); + testCases.Close(); +// __LOG(_L("ExecuteCase end")); + + } + +QList CStifExecutor::GetSetList() + { + QList list; + RRefArray aArray; + TInt ret = UIStore().GetTestSetsList(aArray); +// __LOG1(_L("Get TestSet list return code=%d"), ret); + if (ret != KErrNone) //setInfos.Count() != 1 + { + return list; + } + for (int i = 0; i < aArray.Count(); i++) + { + list.append(TDesC2QString(aArray[i])); + } + aArray.Reset(); + aArray.Close(); + return list; + } + +QList CStifExecutor::GetCaseListFromSet(const QString& setName) + { +// __LOG(_L("GetCaseListFromSet start.")); + QList list; + TPtrC name = QString2TPtrC(setName); + + //__LOG(name); + if (name.Length() == 0) + { + return list; + } + +// __LOG1(_L("name.Length()=%d"), name.Length()); + TInt ret = UIStore().LoadTestSet(name); +// __LOG1(_L("Load Test Set return=%d"),ret); + const CTestSetInfo* set = NULL; + TRAP(ret , set = &UIStore().TestSetL(name)); +// __LOG(_L("GetCaseListFromSet TestSetL.")); + if(ret != KErrNone) + { + return list; + } + const RRefArray& testCases = set->TestCases(); +// __LOG(_L("GetCaseListFromSet TestCases.")); + TInt count = testCases.Count(); + for (TInt i = 0; i < count; i++) + { + CSTFCase testcase; + testcase.SetName(TDesC2QString(testCases[i].TestCaseTitle())); + testcase.SetIndex(testCases[i].TestCaseNum()); + testcase.SetModuleName(TDesC2QString(testCases[i].ModuleName())); + list.append(testcase); + } +// __LOG(_L("GetCaseListFromSet end.")); + return list; + } + +void CStifExecutor::CreateSet(const QString& setName) + { + TPtrC name = QString2TPtrC(setName); + TInt ret = UIStore().CreateTestSet(name); +// __LOG1(_L("CreateSet return: %d"), ret); +// ret = UIStore().LoadTestSet(name); +// __LOG1(_L("Load Set after CreateSet return: %d"), ret); + + + } + +void CStifExecutor::SaveSet(QString& setName) + { + TPtrC name = QString2TPtrC(setName); + TFileName testSetName; + testSetName.Copy(name); + TInt ret = UIStore().SaveTestSet(testSetName); + setName = TDesC2QString(testSetName); +// __LOG1(_L("SaveSet return: %d"),ret); + } + +void CStifExecutor::RemoveSet(const QString& setName) + { + //This method wil not work at this stage. + TPtrC name = QString2TPtrC(setName); + UIStore().RemoveTestSet(name); + } + +void CStifExecutor::AddtoSet(const QString& setName, CSTFCase& caseInfo) + { + //IMPORT_C TInt AddToTestSet( const TDesC& aSetName, const CTestInfo& aTestInfo ); + TPtrC modulename = QString2TPtrC(caseInfo.ModuleName()); + RRefArray testCases; + TInt ret = UIStore().TestCases(testCases, modulename, KNullDesC); +// __LOG1(_L("Get TestCases: %d"), ret); + for (TInt i = 0; i < testCases.Count(); i++) + { +// __LOG1(_L("Case Number: %d"),testCases[i].TestCaseNum()); + if (TDesC2QString(testCases[i].TestCaseTitle()) == caseInfo.Name() + && testCases[i].TestCaseNum() == caseInfo.Index()) + { + ret = UIStore().AddToTestSet(QString2TPtrC(setName), testCases[i]); +// __LOG1(_L("AddToTestSet: %d"), ret); + break; + } + } + testCases.Reset(); + testCases.Close(); + } + +void CStifExecutor::ExecuteSet(const QString& SetName, const int startIndex, + const TSTFCaseRunningType type) + { + CStartedTestSet::TSetType setType = CStartedTestSet::ESetSequential; + if (type == Parallel) + { + setType = CStartedTestSet::ESetParallel; + } + const CTestSetInfo* set = NULL; + TInt ret; + TBuf<30> test; + test.Append(QString2TPtrC(SetName)); +// __LOG(_L("StartTestSet GetSetName:")); +// __LOG(test); + TRAP(ret, set = &UIStore().TestSetL(test)); + + //const CTestSetInfo& set = UIStore().TestSetL(QString2TPtrC(SetName)); + if(ret != KErrNone) + { +// __LOG1(_L("StartTestSet GetTestSet Error return=%d"),ret); + return; + } + int a = startIndex; + ret = UIStore().StartTestSet(*set, a, setType); +// __LOG1(_L("StartTestSet return=%d"),ret); + } + +void CStifExecutor::Update(CStartedTestCase* aCase, int flags) + { +// __LOG1(_L("CStifExecutor::Update return case=%d"),aCase); +// __LOG1(_L("CStifExecutor::Update return status=%d"),flags); + + if(aCase == NULL) + { + return; + } + + if (flags & CUIStoreIf::EPrintUpdate) + { + //Cases output information update. + const RPointerArray printArray = aCase->PrintArray(); + TInt rows = aCase->PrintArray().Count(); + TPtr buffer(iBuffer->Des()); + buffer.Zero(); + for (int i = 0; i < rows; i++) + { + buffer.Append(_L("\r\n")); + buffer.Append(printArray[i]->iDescription); + buffer.Append(_L(" ")); + buffer.Append(printArray[i]->iText); + buffer.Append(_L("\r\n")); + } + QString msg = TDesC2QString(buffer); +// __LOG(_L("Get output msg:")); +// __LOG(buffer); + if (listenerList) + { + for (int i = 0; i < listenerList->size(); i++) + { + listenerList->at(i)->OnGetCaseOutput(aCase, msg); + } + } + + } + else + { + //case status changed update. + CSTFCase testcase; + testcase.SetName(TDesC2QString(aCase->TestInfo().TestCaseTitle())); + testcase.SetIndex(aCase->TestInfo().TestCaseNum()); + testcase.SetModuleName(TDesC2QString(aCase->TestInfo().ModuleName())); + if (listenerList) + { + for (int i = 0; i < listenerList->size(); i++) + { + listenerList->at(i)->OnGetCaseUpdated(aCase, testcase, flags); + } + } + + } + + } + diff -r ecff51f1e7fb -r 8a14024f954a stif/QtUI/StifQtUI/stifexecutor.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/stif/QtUI/StifQtUI/stifexecutor.h Mon Mar 15 12:46:13 2010 +0200 @@ -0,0 +1,73 @@ +/* +* 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: QT C++ and Symbian C++ combination Class. +* Call STIF UI engine and UI interface to perform test operation. +* All the public methods are QT C++ based object. +* +*/ +#ifndef STIFEXECUTOR_H_ +#define STIFEXECUTOR_H_ + +//#include +#include "cstfcase.h" +#include "cstfmodule.h" +#include +#include +#include +#include + +class IStifCaseUpdateListener + { +public: + virtual void OnGetCaseUpdated(CStartedTestCase* aCase,CSTFCase& stfcase, int flags) = 0; + virtual void OnGetCaseOutput(CStartedTestCase* aCase, QString& msg) = 0; + }; + + +class CStifExecutor : public CUIStoreIf + { +public: + CStifExecutor(); + ~CStifExecutor(); +public: + void AddStifCaseUpdateListener(IStifCaseUpdateListener* listener); + void RemoveStifCaseUpdateListener(IStifCaseUpdateListener* listener); + bool OpenIniFile(const QString& filename); + QList GetModuleList(); + QList GetCaseList(const QString& moduleName); + void ExecuteSingleCase(const QString& moduleName, int caseIndex); + QList GetSetList(); + QList GetCaseListFromSet(const QString& setName); + void CreateSet(const QString& setName); + void SaveSet(QString& setName); + void RemoveSet(const QString& setName); + void AddtoSet(const QString& setName, CSTFCase& caseInfo); + void ExecuteSet(const QString& SetName, const int startIndex, const TSTFCaseRunningType type); + +public://implement CUIStoreIf + void Update( CStartedTestCase* aTestCase, + TInt aFlags); + +public: + TPtrC QString2TPtrC(const QString& aString); + QString TDesC2QString(const TDesC& des); + //CTestInfo* GetTestInfo(CSTFCase aCase); +private: + QList *listenerList; + HBufC* iBuffer; + }; + + + +#endif /* STIFEXECUTOR_H_ */ diff -r ecff51f1e7fb -r 8a14024f954a stif/QtUI/StifQtUI/test/StfQtUITest.pro --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/stif/QtUI/StifQtUI/test/StfQtUITest.pro Mon Mar 15 12:46:13 2010 +0200 @@ -0,0 +1,45 @@ +HEADERS += ..\frmmain.h \ + ..\istfqtuicontroller.h \ + ..\stfqtuicontroller.h \ + ..\cstfcase.h \ + ..\cstfmodule.h \ + ..\istfqtuimodel.h \ + ..\stfqtuimodel.h \ + ..\dlgoutput.h \ + testcontroller.h +SOURCES += ..\frmmain.cpp \ + ..\stfqtuimodel.cpp \ + ..\stfqtuicontroller.cpp \ + ..\dlgoutput.cpp \ + testcontroller.cpp \ + main.cpp + +CONFIG += qtestlib + +RESOURCES += +symbian { + TARGET.UID3 = 0xA000C60B + #include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) + TARGET.EPOCALLOWDLLDATA = 1 + HEADERS += ../../../../inc/. + include(.\platform\stifinternal) + HEADERS += ../stifexecutor.h + SOURCES += ../stifexecutor.cpp + LIBS += -leuser \ + -lefsrv \ + -lstiftestinterface \ + -lstiftfwif \ + -lstiftestengine \ + -lecons \ + -lhal \ + -lflogger + TARGET.CAPABILITY = ReadUserData \ + WriteUserData + + # Export headers to SDK Epoc32/include directory + deploy.path = $$EPOCROOT + exportheaders.sources = $$PUBLIC_HEADERS + exportheaders.path = epoc32/include + for(header, exportheaders.sources) + :BLD_INF_RULES.prj_exports += "$$header $$deploy.path$$exportheaders.path/$$basename(header)" +} diff -r ecff51f1e7fb -r 8a14024f954a stif/QtUI/StifQtUI/test/main.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/stif/QtUI/StifQtUI/test/main.cpp Mon Mar 15 12:46:13 2010 +0200 @@ -0,0 +1,21 @@ +/* +* 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: QT C++ based Class. +* UnitTest Application entrance. +* +*/ +#include +#include "testcontroller.h" + +QTEST_MAIN(testcontroller) diff -r ecff51f1e7fb -r 8a14024f954a stif/QtUI/StifQtUI/test/readme.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/stif/QtUI/StifQtUI/test/readme.txt Mon Mar 15 12:46:13 2010 +0200 @@ -0,0 +1,4 @@ +Run StfQtUITest + +1, put files under "testsource" folder into "epoc32\winscw\c\testframework" +2, execute: stfqtuitest -o c:\stfqtuitest.log (the output file can be renamed or relocated) diff -r ecff51f1e7fb -r 8a14024f954a stif/QtUI/StifQtUI/test/testcontroller.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/stif/QtUI/StifQtUI/test/testcontroller.cpp Mon Mar 15 12:46:13 2010 +0200 @@ -0,0 +1,357 @@ +/* +* 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: QT C++ based Class. +* Unit Test to StfQtUI's controller and model. +* +*/ +#include "testcontroller.h" +#include "stfqtuimodel.h" +#include "stfqtuicontroller.h" +#include "cstfcase.h" +#include "cstfmodule.h" +#include + +const QString KConfigFile1 = "c:\\STFQTUI_Test\\testframework1.ini"; +const QString KConfigFile2 = "c:\\STFQTUI_Test\\testframework2.ini"; +const QString KDefaultModuleName = "demomodule"; +const QString KDefaultSetName = "stfqtuitesting.set"; + +testcontroller::testcontroller() + : OnSetListChangedFired(false), + OnCaseStatisticChangedFired(false), + OnRunningCaseChangedFired(false) + { + // TODO Auto-generated constructor stub + model = new StfQtUIModel(); + model->AddStifModelEventListener(this); + controller = new StfQtUIController(model); + controller->AddStfEventListener(this); + controller->OpenEngineIniFile(KConfigFile1); + } + +testcontroller::~testcontroller() + { + // TODO Auto-generated destructor stub + delete controller; + delete model; + } + + +void testcontroller::T_GetModuleList_ModuleNumber() + { + controller->OpenEngineIniFile(KConfigFile1); + int moduleSize = controller->GetModuleList().size(); + QCOMPARE(moduleSize, 1); + } + +void testcontroller::T_GetModuleList_ModuleName() + { + controller->OpenEngineIniFile(KConfigFile1); + QList moduleList = controller->GetModuleList(); + bool find = false; + foreach(QString m, moduleList) + { + if(m.toLower() == KDefaultModuleName) + { + find = true; + break; + } + } + QCOMPARE(find, true); + } + +void testcontroller::T_OpenEngineIniFile_ModuleNumber() + { + controller->OpenEngineIniFile(KConfigFile2); + int moduleSize = controller->GetModuleList().size(); + QCOMPARE(moduleSize, 2); + } + + + +void testcontroller::T_OpenEngineIniFile() + { + bool rst; + rst = controller->OpenEngineIniFile(KConfigFile2); + QCOMPARE(rst, true); + rst = controller->OpenEngineIniFile(KConfigFile1); + QCOMPARE(rst, true); + rst = controller->OpenEngineIniFile(KConfigFile2); + QCOMPARE(rst, true); + rst = controller->OpenEngineIniFile("z:\\abc.ini"); + //QCOMPARE(rst, false); + rst = controller->OpenEngineIniFile(KConfigFile1); + QCOMPARE(rst, true); + } + +void testcontroller::T_GetCaseListByModule() + { + controller->OpenEngineIniFile(KConfigFile1); + QList list = controller->GetCaseListByModule(KDefaultModuleName); + QCOMPARE(list.size(), 6); + list = controller->GetCaseListByModule("null"); + QCOMPARE(list.size(), 0); + + } +void testcontroller::T_GetCase() + { + CSTFCase theCase = controller->GetCase(KDefaultModuleName, 1); + QCOMPARE(theCase.Index(), 1); + theCase = controller->GetCase(KDefaultModuleName, 21); + QCOMPARE(theCase.Index(), -1); + QCOMPARE(theCase.Name(), QString("")); + theCase = controller->GetCase("null", 0); + QCOMPARE(theCase.Name(), QString("")); + } + +void testcontroller::T_GetSetList() + { + OnSetListChangedFired = false; + QList list = controller->GetSetList(); + bool find = false; + foreach(QString set, list) + { + if(set == KDefaultSetName) + { + find = true; + break; + } + } + QCOMPARE(find, true); + QCOMPARE(OnSetListChangedFired, false);//ensure SetListChanged does not be fired. + } + +void testcontroller::T_GetCaseListBySet() + { + OnSetListChangedFired = false; + QList list = controller->GetCaseListBySet(KDefaultSetName); + QCOMPARE(list.size(),5); + list = controller->GetCaseListBySet("null"); + QCOMPARE(list.size(),0); + QCOMPARE(OnSetListChangedFired, false);//ensure SetListChanged does not be fired. + } + +void testcontroller::T_AddCaseToSet() + { + OnSetListChangedFired = false; + QList list = controller->GetSetList(); + int before_count = list.count(); + QList cases; + QList caselist = controller->GetCaseListByModule(KDefaultModuleName); + for(int i=0;iGetCase(KDefaultModuleName, i); + cases.append(theCase); + } + controller->AddCaseToSet(cases, "test1"); + list = controller->GetSetList(); + int after_count = list.count(); + QCOMPARE(before_count + 1, after_count); + QCOMPARE(OnSetListChangedFired, true); + } + +void testcontroller::T_CreateSet() + { + //tested object is still not implemented. + } + +void testcontroller::T_DeleteSet() + { + //tested object is still not implemented. + } + +void testcontroller::T_ShowOutput() + { + QCOMPARE(controller->ShowOutput(), false); + controller->SetShowOutput(true); + QCOMPARE(controller->ShowOutput(), true); + controller->SetShowOutput(false); + QCOMPARE(controller->ShowOutput(), false); + } + +void testcontroller::T_Model_ClearCasesStatus() + { + OnCaseStatisticChangedFired = false; + model->ClearCasesStatus(); + QCOMPARE(OnCaseStatisticChangedFired, true); + QCOMPARE(model->GetCasesByStatus(EStatusExecuted).size(), 0); + QCOMPARE(model->GetCasesByStatus(EStatusPassed).size(), 0); + QCOMPARE(model->GetCasesByStatus(EStatusFailed).size(), 0); + QCOMPARE(model->GetCasesByStatus(EStatusAborted).size(), 0); + QCOMPARE(model->GetCasesByStatus(EStatusCrashed).size(), 0); + } + +void testcontroller::T_Model_AddRunningCase_RemoveRunningCase() + { + CStartedTestCase* startedCase = 0; + CSTFCase aCase; + OnRunningCaseChangedFired = false; + QCOMPARE(model->GetCasesByStatus(EStatusRunning).size(), 0); + model->AddRunningCase(startedCase, aCase); + QCOMPARE(OnRunningCaseChangedFired, true); + QCOMPARE(model->GetCasesByStatus(EStatusRunning).size(), 1); + + OnRunningCaseChangedFired = false; + model->RemoveRunningCase(startedCase); + QCOMPARE(OnRunningCaseChangedFired, true); + QCOMPARE(model->GetCasesByStatus(EStatusRunning).size(), 0); + } + +void testcontroller::T_Model_AddCaseByStatus_GetCasesByStatus() + { + CSTFCase aCase; + model->ClearCasesStatus(); + OnCaseStatisticChangedFired = false; + + QCOMPARE(model->GetCasesByStatus(EStatusExecuted).size(), 0); + model->AddCaseByStatus(EStatusExecuted,aCase); + QCOMPARE(OnCaseStatisticChangedFired, true); + QCOMPARE(model->GetCasesByStatus(EStatusExecuted).size(), 1); + + OnCaseStatisticChangedFired = false; + QCOMPARE(model->GetCasesByStatus(EStatusPassed).size(), 0); + model->AddCaseByStatus(EStatusPassed,aCase); + QCOMPARE(OnCaseStatisticChangedFired, true); + QCOMPARE(model->GetCasesByStatus(EStatusPassed).size(), 1); + + OnCaseStatisticChangedFired = false; + QCOMPARE(model->GetCasesByStatus(EStatusFailed).size(), 0); + model->AddCaseByStatus(EStatusFailed,aCase); + QCOMPARE(OnCaseStatisticChangedFired, true); + QCOMPARE(model->GetCasesByStatus(EStatusFailed).size(), 1); + + OnCaseStatisticChangedFired = false; + QCOMPARE(model->GetCasesByStatus(EStatusAborted).size(), 0); + model->AddCaseByStatus(EStatusAborted,aCase); + QCOMPARE(OnCaseStatisticChangedFired, true); + QCOMPARE(model->GetCasesByStatus(EStatusAborted).size(), 1); + + OnCaseStatisticChangedFired = false; + QCOMPARE(model->GetCasesByStatus(EStatusCrashed).size(), 0); + model->AddCaseByStatus(EStatusCrashed,aCase); + QCOMPARE(OnCaseStatisticChangedFired, true); + QCOMPARE(model->GetCasesByStatus(EStatusCrashed).size(), 1); + + model->ClearCasesStatus(); + + } + +void testcontroller::T_RunCase() + { + model->ClearCasesStatus(); + OnCaseStatisticChangedFired = false; + OnRunningCaseChangedFired = false; + controller->OpenEngineIniFile(KConfigFile1); + QList caseList; + caseList.append(controller->GetCase(KDefaultModuleName,2));//math test + controller->RunCases(caseList, Sequentially); + QTest::qWait(2000); + QCOMPARE(OnCaseStatisticChangedFired, true); + QCOMPARE(model->GetCasesByStatus(EStatusRunning).size(), 0); + QCOMPARE(model->GetCasesByStatus(EStatusExecuted).size(), 1); + QCOMPARE(model->GetCasesByStatus(EStatusPassed).size(), 1); + + model->ClearCasesStatus(); + } + + +void testcontroller::T_RunSet() + { + model->ClearCasesStatus(); + //controller->OpenEngineIniFile(KConfigFile1); + QList list = controller->GetCaseListBySet(KDefaultSetName); + QCOMPARE(list.size(),5); + controller->RunSets(KDefaultSetName,Parallel); + QTest::qWait(20000); + QCOMPARE(model->GetCasesByStatus(EStatusExecuted).size(), 5); + QCOMPARE(model->GetCasesByStatus(EStatusPassed).size(), 4); + QCOMPARE(model->GetCasesByStatus(EStatusFailed).size(), 0); + QCOMPARE(model->GetCasesByStatus(EStatusAborted).size(), 0); + QCOMPARE(model->GetCasesByStatus(EStatusCrashed).size(), 1); + model->ClearCasesStatus(); + } + + +void testcontroller::T_PauseCase_ResumeCase() + { + model->ClearCasesStatus(); + OnCaseStatisticChangedFired = false; + OnRunningCaseChangedFired = false; + controller->OpenEngineIniFile(KConfigFile1); + QList caseList; + caseList.append(controller->GetCase(KDefaultModuleName,0)); //loop test + controller->RunCases(caseList, Sequentially); + QTest::qWait(500); + QCOMPARE(OnRunningCaseChangedFired, true); + QCOMPARE(model->GetCasesByStatus(EStatusRunning).size(), 1); + QCOMPARE(model->GetCasesByStatus(EStatusExecuted).size(), 0); + controller->PauseCase(); + QTest::qWait(15000); + QCOMPARE(model->GetCasesByStatus(EStatusRunning).size(), 1); + controller->ResumeCase(); + QTest::qWait(15000); + QCOMPARE(OnCaseStatisticChangedFired, true); + QCOMPARE(model->GetCasesByStatus(EStatusRunning).size(), 0); + QCOMPARE(model->GetCasesByStatus(EStatusExecuted).size(), 1); + QCOMPARE(model->GetCasesByStatus(EStatusPassed).size(), 1); + + } + +void testcontroller::T_AbortCase() + { + model->ClearCasesStatus(); + OnCaseStatisticChangedFired = false; + OnRunningCaseChangedFired = false; + controller->OpenEngineIniFile(KConfigFile1); + QList caseList; + caseList.append(controller->GetCase(KDefaultModuleName,0)); //loop test + controller->RunCases(caseList, Sequentially); + QTest::qWait(500); + QCOMPARE(OnRunningCaseChangedFired, true); + QCOMPARE(model->GetCasesByStatus(EStatusRunning).size(), 1); + QCOMPARE(model->GetCasesByStatus(EStatusExecuted).size(), 0); + controller->AbortCase(); + QTest::qWait(1000); + QCOMPARE(OnCaseStatisticChangedFired, true); + QCOMPARE(model->GetCasesByStatus(EStatusRunning).size(), 0); + QCOMPARE(model->GetCasesByStatus(EStatusExecuted).size(), 0); + QCOMPARE(model->GetCasesByStatus(EStatusAborted).size(), 1); + } + + +//=========================================================== +void testcontroller::OnSetListChanged() + { + OnSetListChangedFired = true; + } + +void testcontroller::OnCaseStatisticChanged() + { + OnCaseStatisticChangedFired = true; + } + +void testcontroller::OnRunningCaseChanged() + { + OnRunningCaseChangedFired = true; + } + +void testcontroller::OnGetMessage(const QString& /*aMessage*/) + { + //nothing. + } + +void testcontroller::OnCaseOutputChanged(const CaseOutputCommand& /*cmd*/, + const QString& , const QString&) + {} + diff -r ecff51f1e7fb -r 8a14024f954a stif/QtUI/StifQtUI/test/testcontroller.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/stif/QtUI/StifQtUI/test/testcontroller.h Mon Mar 15 12:46:13 2010 +0200 @@ -0,0 +1,126 @@ +/* +* 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: QT C++ based Class. +* Unit Test to StfQtUI's controller and model. +* +*/ +#ifndef TESTCONTROLLER_H_ +#define TESTCONTROLLER_H_ +#include +#include "istfqtuicontroller.h" +#include "istfqtuimodel.h" + + +class testcontroller: public QObject, public IStfEventListener, public IStifModelEventListener + { + Q_OBJECT + private slots: + /* operation: + * GetModuleList(); + * check: + * module's number. + * */ + void T_GetModuleList_ModuleNumber(); + /* operation: + * GetModuleList(); + * check: + * module's name. + */ + void T_GetModuleList_ModuleName(); + /*operation: + * OpenEngineIniFile(); + * GetModuleList(); + * check: + * module's number. + * + * */ + void T_OpenEngineIniFile_ModuleNumber(); + + /*operation: + * OpenEngineIniFile(); + * check: + * return value; + * */ + void T_OpenEngineIniFile(); + + /*operation: + * GetCaseListByModule(); with currect moduleName + * check: + * case List number. + * */ + void T_GetCaseListByModule(); + + /*operation: + * GetCase(); + *check: + * return value of the case. + * */ + void T_GetCase(); + + void T_GetSetList(); + + void T_GetCaseListBySet(); + + void T_AddCaseToSet(); + + void T_CreateSet(); + + void T_DeleteSet(); + + void T_ShowOutput(); + + void T_RunCase(); + + void T_RunSet(); + + void T_PauseCase_ResumeCase(); + + void T_AbortCase(); + + void T_Model_ClearCasesStatus(); + + void T_Model_AddCaseByStatus_GetCasesByStatus(); + + void T_Model_AddRunningCase_RemoveRunningCase(); + + + +public: + testcontroller(); + virtual ~testcontroller(); + +public: //Implement IStfEventListener + void OnGetMessage(const QString& aMessage); + void OnSetListChanged(); + void OnCaseOutputChanged(const IStfEventListener::CaseOutputCommand& cmd, const QString& index, const QString& msg); + + +public: //Implement IStifModelEventListener + void OnCaseStatisticChanged() ; + void OnRunningCaseChanged() ; + + +private: + bool OnSetListChangedFired; + bool OnCaseStatisticChangedFired; + bool OnRunningCaseChangedFired; + +private: + IStfQtUIController* controller; + IStfQtUIModel* model; + + + }; + +#endif /* TESTCONTROLLER_H_ */ diff -r ecff51f1e7fb -r 8a14024f954a stif/QtUI/StifQtUI/test/testresource/TestFramework1.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/stif/QtUI/StifQtUI/test/testresource/TestFramework1.ini Mon Mar 15 12:46:13 2010 +0200 @@ -0,0 +1,217 @@ +# +# This is STIF initialization file +# Comment lines start with '#'-character. +# See STIF TestFramework users guide.doc for instructions + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set following test engine settings: +# - Set Test Reporting mode. TestReportMode's possible values are: +# + 'Summary': Summary of the tested test cases. +# + 'Environment': Hardware and software info. +# + 'TestCases': Test case report. +# + 'FullReport': Set of all above ones. +# + Example 'TestReportMode= Summary TestCases' +# +# - CreateTestReport setting controls report creation mode +# + YES, Test report will created. +# + NO, No Test report. +# +# - File path indicates the base path of the test report. +# - File name indicates the name of the test report. +# +# - File format indicates the type of the test report. +# + TXT, Test report file will be txt type, for example 'TestReport.txt'. +# + HTML, Test report will be html type, for example 'TestReport.html'. +# + XML, Test report will be xml type, for example 'TestReport.xml'. +# Note, that xml format is available only when output is set to FILE. +# +# - File output indicates output source of the test report. +# + FILE, Test report logging to file. +# + RDEBUG, Test report logging to using rdebug. +# +# - File Creation Mode indicates test report overwriting if file exist. +# + OVERWRITE, Overwrites if the Test report file exist. +# + APPEND, Continue logging after the old Test report information if +# report exist. +# - Sets a device reset module's dll name(Reboot). +# + If Nokia specific reset module is not available or it is not correct one +# StifHWResetStub module may use as a template for user specific reset +# module. +# - Sets STIF test measurement disable options. e.g. pluging1 and pluging2 disablation +# DisableMeasurement= stifmeasurementplugin01 stifmeasurementplugin02 +# + +[Engine_Defaults] + +TestReportMode= FullReport # Possible values are: 'Empty', 'Summary', 'Environment', + # 'TestCases' or 'FullReport' + +CreateTestReport= YES # Possible values: YES or NO + +TestReportFilePath= C:\LOGS\TestFramework\ +TestReportFileName= TestReport + +TestReportFormat= TXT # Possible values: TXT, HTML or XML +TestReportOutput= FILE # Possible values: FILE or RDEBUG +TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND + +DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting + +DisableMeasurement= stifmeasurementdisablenone # Possible values are: + # 'stifmeasurementdisablenone', 'stifmeasurementdisableall' + # 'stifmeasurementplugin01', 'stifmeasurementplugin02', + # 'stifmeasurementplugin03', 'stifmeasurementplugin04', + # 'stifmeasurementplugin05' or 'stifbappeaprofiler' + +Timeout= 0 # Default timeout value for each test case. In milliseconds +#UITestingSupport= YES # Possible values: YES or NO +#SeparateProcesses= YES # Possible values: YES or NO (default: NO) +[End_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Module configurations start +# Modules are added between module tags +# tags. Module name is specified after ModuleName= tag, like +# ModuleName= XXXXXXXXX +# Modules might have initialisation file, specified as +# IniFile= c:\testframework\YYYYYY +# Modules might have several configuration files, like +# TestCaseFile= c:\testframework\NormalCases.txt +# TestCaseFile= c:\testframework\SmokeCases.txt +# TestCaseFile= c:\testframework\ManualCases.txt + +# (TestCaseFile is synonym for old term ConfigFile) + +# Following case specifies demo module settings. Demo module +# does not read any settings from file, so tags +# IniFile and TestCaseFile are not used. +# In the simplest case it is enough to specify only the +# name of the test module when adding new test module + +[New_Module] +ModuleName= demomodule +[End_Module] + + +# Load testmoduleXXX, optionally with initialization file and/or test case files +#[New_Module] +#ModuleName= testmodulexxx + +#TestModuleXXX used initialization file +#IniFile= c:\testframework\init.txt + +#TestModuleXXX used configuration file(s) +#TestCaseFile= c:\testframework\testcases1.cfg +#TestCaseFile= c:\testframework\testcases2.cfg +#TestCaseFile= c:\testframework\manualtestcases.cfg + +#[End_Module] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set STIF logging overwrite parameters for Logger. +# Hardware and emulator environment logging path and styles can +# be configured from here to overwrite the Logger's implemented values. +# +# Settings description: +# - Indicates option for creation log directory/directories. If log directory/directories +# is/are not created by user they will make by software. +# + YES, Create log directory/directories if not allready exist. +# + NO, Log directory/directories not created. Only created one is used. +# +# - Overwrite emulator path setting. +# + Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined +# Logger's path 'D:\\LOGS\\Module\\' with those definition the path +# will be 'C:\LOGS\TestFramework\LOGS\Module\' +# +# - Overwrite emulator's logging format. +# + TXT, Log file(s) will be txt type(s), for example 'Module.txt'. +# + HTML, Log file(s) will be html type(s), for example 'Module.html'. +# +# - Overwrited emulator logging output source. +# + FILE, Logging to file(s). +# + RDEBUG, Logging to using rdebug(s). +# +# - Overwrite hardware path setting (Same description as above in emulator path). +# - Overwrite hardware's logging format(Same description as above in emulator format). +# - Overwrite hardware's logging output source(Same description as above in emulator output). +# +# - File Creation Mode indicates file overwriting if file exist. +# + OVERWRITE, Overwrites if file(s) exist. +# + APPEND, Continue logging after the old logging information if file(s) exist. +# +# - Will thread id include to the log filename. +# + YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'. +# + NO, No thread id to log file(s), Example filename 'Module.txt'. +# +# - Will time stamps include the to log file. +# + YES, Time stamp added to each line in log file(s). Time stamp is +# for example'12.Nov.2003 115958 LOGGING INFO' +# + NO, No time stamp(s). +# +# - Will line breaks include to the log file. +# + YES, Each logging event includes line break and next log event is in own line. +# + NO, No line break(s). +# +# - Will event ranking include to the log file. +# + YES, Event ranking number added to each line in log file(s). Ranking number +# depends on environment's tics, for example(includes time stamp also) +# '012 12.Nov.2003 115958 LOGGING INFO' +# + NO, No event ranking. +# +# - Will write log file in unicode format. +# + YES, Log file will be written in unicode format +# + NO, Log will be written as normal, not unicode, file. +# + +[Logger_Defaults] + +#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#' +#NOTE: TestEngine and TestServer logging settings cannot change here + +CreateLogDirectories= YES # Possible values: YES or NO + +EmulatorBasePath= C:\LOGS\TestFramework\ +EmulatorFormat= HTML # Possible values: TXT or HTML +EmulatorOutput= FILE # Possible values: FILE or RDEBUG + +HardwareBasePath= D:\LOGS\TestFramework\ +HardwareFormat= HTML # Possible values: TXT or HTML +HardwareOutput= FILE # Possible values: FILE or RDEBUG + +FileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND + +ThreadIdToLogFile= YES # Possible values: YES or NO +WithTimeStamp= YES # Possible values: YES or NO +WithLineBreak= YES # Possible values: YES or NO +WithEventRanking= YES # Possible values: YES or NO + +FileUnicode= YES # Possible values: YES or NO +AddTestCaseTitle= YES # Possible values: YES or NO +[End_Logger_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set filters to be used by ConsoleUI. +# If you want to use filter with ConsoleUI, simply remove comments +# from section below and provide valid filter entries. +# Each filter line has to start with "filter= " keyword. +# Filter can contain special wildcard characters: +# * which stands for none or any literal; +# ? which stands for single character. +# Filters are not case-sensitive. + +#[Filters] +#filter= *math* +#filter= *radio* +#[End_Filters] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +# End of file diff -r ecff51f1e7fb -r 8a14024f954a stif/QtUI/StifQtUI/test/testresource/TestFramework2.ini --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/stif/QtUI/StifQtUI/test/testresource/TestFramework2.ini Mon Mar 15 12:46:13 2010 +0200 @@ -0,0 +1,221 @@ +# +# This is STIF initialization file +# Comment lines start with '#'-character. +# See STIF TestFramework users guide.doc for instructions + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set following test engine settings: +# - Set Test Reporting mode. TestReportMode's possible values are: +# + 'Summary': Summary of the tested test cases. +# + 'Environment': Hardware and software info. +# + 'TestCases': Test case report. +# + 'FullReport': Set of all above ones. +# + Example 'TestReportMode= Summary TestCases' +# +# - CreateTestReport setting controls report creation mode +# + YES, Test report will created. +# + NO, No Test report. +# +# - File path indicates the base path of the test report. +# - File name indicates the name of the test report. +# +# - File format indicates the type of the test report. +# + TXT, Test report file will be txt type, for example 'TestReport.txt'. +# + HTML, Test report will be html type, for example 'TestReport.html'. +# + XML, Test report will be xml type, for example 'TestReport.xml'. +# Note, that xml format is available only when output is set to FILE. +# +# - File output indicates output source of the test report. +# + FILE, Test report logging to file. +# + RDEBUG, Test report logging to using rdebug. +# +# - File Creation Mode indicates test report overwriting if file exist. +# + OVERWRITE, Overwrites if the Test report file exist. +# + APPEND, Continue logging after the old Test report information if +# report exist. +# - Sets a device reset module's dll name(Reboot). +# + If Nokia specific reset module is not available or it is not correct one +# StifHWResetStub module may use as a template for user specific reset +# module. +# - Sets STIF test measurement disable options. e.g. pluging1 and pluging2 disablation +# DisableMeasurement= stifmeasurementplugin01 stifmeasurementplugin02 +# + +[Engine_Defaults] + +TestReportMode= FullReport # Possible values are: 'Empty', 'Summary', 'Environment', + # 'TestCases' or 'FullReport' + +CreateTestReport= YES # Possible values: YES or NO + +TestReportFilePath= C:\LOGS\TestFramework\ +TestReportFileName= TestReport + +TestReportFormat= TXT # Possible values: TXT, HTML or XML +TestReportOutput= FILE # Possible values: FILE or RDEBUG +TestReportFileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND + +DeviceResetDllName= StifResetForNokia.dll # e.g. 'StifHWResetStub.dll' for user specific reseting + +DisableMeasurement= stifmeasurementdisablenone # Possible values are: + # 'stifmeasurementdisablenone', 'stifmeasurementdisableall' + # 'stifmeasurementplugin01', 'stifmeasurementplugin02', + # 'stifmeasurementplugin03', 'stifmeasurementplugin04', + # 'stifmeasurementplugin05' or 'stifbappeaprofiler' + +Timeout= 0 # Default timeout value for each test case. In milliseconds +#UITestingSupport= YES # Possible values: YES or NO +#SeparateProcesses= YES # Possible values: YES or NO (default: NO) +[End_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Module configurations start +# Modules are added between module tags +# tags. Module name is specified after ModuleName= tag, like +# ModuleName= XXXXXXXXX +# Modules might have initialisation file, specified as +# IniFile= c:\testframework\YYYYYY +# Modules might have several configuration files, like +# TestCaseFile= c:\testframework\NormalCases.txt +# TestCaseFile= c:\testframework\SmokeCases.txt +# TestCaseFile= c:\testframework\ManualCases.txt + +# (TestCaseFile is synonym for old term ConfigFile) + +# Following case specifies demo module settings. Demo module +# does not read any settings from file, so tags +# IniFile and TestCaseFile are not used. +# In the simplest case it is enough to specify only the +# name of the test module when adding new test module + +[New_Module] +ModuleName= demomodule +[End_Module] + + +[New_Module] +ModuleName= stf_ut +[End_Module] + +# Load testmoduleXXX, optionally with initialization file and/or test case files +#[New_Module] +#ModuleName= testmodulexxx + +#TestModuleXXX used initialization file +#IniFile= c:\testframework\init.txt + +#TestModuleXXX used configuration file(s) +#TestCaseFile= c:\testframework\testcases1.cfg +#TestCaseFile= c:\testframework\testcases2.cfg +#TestCaseFile= c:\testframework\manualtestcases.cfg + +#[End_Module] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set STIF logging overwrite parameters for Logger. +# Hardware and emulator environment logging path and styles can +# be configured from here to overwrite the Logger's implemented values. +# +# Settings description: +# - Indicates option for creation log directory/directories. If log directory/directories +# is/are not created by user they will make by software. +# + YES, Create log directory/directories if not allready exist. +# + NO, Log directory/directories not created. Only created one is used. +# +# - Overwrite emulator path setting. +# + Example: If 'EmulatorBasePath= C:\LOGS\TestFramework\' and in code is defined +# Logger's path 'D:\\LOGS\\Module\\' with those definition the path +# will be 'C:\LOGS\TestFramework\LOGS\Module\' +# +# - Overwrite emulator's logging format. +# + TXT, Log file(s) will be txt type(s), for example 'Module.txt'. +# + HTML, Log file(s) will be html type(s), for example 'Module.html'. +# +# - Overwrited emulator logging output source. +# + FILE, Logging to file(s). +# + RDEBUG, Logging to using rdebug(s). +# +# - Overwrite hardware path setting (Same description as above in emulator path). +# - Overwrite hardware's logging format(Same description as above in emulator format). +# - Overwrite hardware's logging output source(Same description as above in emulator output). +# +# - File Creation Mode indicates file overwriting if file exist. +# + OVERWRITE, Overwrites if file(s) exist. +# + APPEND, Continue logging after the old logging information if file(s) exist. +# +# - Will thread id include to the log filename. +# + YES, Thread id to log file(s) name, Example filename 'Module_b9.txt'. +# + NO, No thread id to log file(s), Example filename 'Module.txt'. +# +# - Will time stamps include the to log file. +# + YES, Time stamp added to each line in log file(s). Time stamp is +# for example'12.Nov.2003 115958 LOGGING INFO' +# + NO, No time stamp(s). +# +# - Will line breaks include to the log file. +# + YES, Each logging event includes line break and next log event is in own line. +# + NO, No line break(s). +# +# - Will event ranking include to the log file. +# + YES, Event ranking number added to each line in log file(s). Ranking number +# depends on environment's tics, for example(includes time stamp also) +# '012 12.Nov.2003 115958 LOGGING INFO' +# + NO, No event ranking. +# +# - Will write log file in unicode format. +# + YES, Log file will be written in unicode format +# + NO, Log will be written as normal, not unicode, file. +# + +[Logger_Defaults] + +#NOTE: If you want to set Logger using next setting(s) remove comment(s)'#' +#NOTE: TestEngine and TestServer logging settings cannot change here + +CreateLogDirectories= YES # Possible values: YES or NO + +EmulatorBasePath= C:\LOGS\TestFramework\ +EmulatorFormat= HTML # Possible values: TXT or HTML +EmulatorOutput= FILE # Possible values: FILE or RDEBUG + +HardwareBasePath= D:\LOGS\TestFramework\ +HardwareFormat= HTML # Possible values: TXT or HTML +HardwareOutput= FILE # Possible values: FILE or RDEBUG + +FileCreationMode= OVERWRITE # Possible values: OVERWRITE or APPEND + +ThreadIdToLogFile= YES # Possible values: YES or NO +WithTimeStamp= YES # Possible values: YES or NO +WithLineBreak= YES # Possible values: YES or NO +WithEventRanking= YES # Possible values: YES or NO + +FileUnicode= YES # Possible values: YES or NO +AddTestCaseTitle= YES # Possible values: YES or NO +[End_Logger_Defaults] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + + + +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- +# Set filters to be used by ConsoleUI. +# If you want to use filter with ConsoleUI, simply remove comments +# from section below and provide valid filter entries. +# Each filter line has to start with "filter= " keyword. +# Filter can contain special wildcard characters: +# * which stands for none or any literal; +# ? which stands for single character. +# Filters are not case-sensitive. + +#[Filters] +#filter= *math* +#filter= *radio* +#[End_Filters] +# -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- + +# End of file diff -r ecff51f1e7fb -r 8a14024f954a stif/QtUI/StifQtUI/test/testresource/stfqtuitesting.set --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/stif/QtUI/StifQtUI/test/testresource/stfqtuitesting.set Mon Mar 15 12:46:13 2010 +0200 @@ -0,0 +1,50 @@ +[TestSetStart] +TestSetName= stfqtuitesting.set +LastStartedCaseIndex= 0000000000 + +[TestSetCaseStart] +ModuleName= demomodule +Title= Loop test +TestCaseNum= 0 +Priority= 0 +Timeout= 0 0 +ExpectedResult= 0 +[TestSetCaseEnd] + +[TestSetCaseStart] +ModuleName= demomodule +Title= Math test +TestCaseNum= 2 +Priority= 0 +Timeout= 0 0 +ExpectedResult= 0 +[TestSetCaseEnd] + +[TestSetCaseStart] +ModuleName= demomodule +Title= Print test +TestCaseNum= 3 +Priority= 0 +Timeout= 0 0 +ExpectedResult= 0 +[TestSetCaseEnd] + +[TestSetCaseStart] +ModuleName= demomodule +Title= Heap memory allocation with OOM (aborts) +TestCaseNum= 4 +Priority= 0 +Timeout= 0 0 +ExpectedResult= 0 +[TestSetCaseEnd] + +[TestSetCaseStart] +ModuleName= demomodule +Title= Heap memory allocation (passes) +TestCaseNum= 5 +Priority= 0 +Timeout= 0 0 +ExpectedResult= 0 +[TestSetCaseEnd] + +[TestSetEnd] diff -r ecff51f1e7fb -r 8a14024f954a stif/QtUI/StifQtUI/uisetting.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/stif/QtUI/StifQtUI/uisetting.cpp Mon Mar 15 12:46:13 2010 +0200 @@ -0,0 +1,104 @@ +/* + * uisetting.cpp + * + * Created on: 2010-2-8 + * Author: y183zhan + */ + +#include +#include +#include +#include "uisetting.h" +const QString SETTINGFILE = "c:\\TestFramework\\StfQtUISetting.ini"; + +UiSetting::UiSetting() + { + if(!load()) + { + loadDefault(); + } + } + +UiSetting::~UiSetting() + { + } + +QString UiSetting::ReadSetting(const QString& item) + { + QString value = ""; + if(settingList.contains(item)) + { + value = settingList.value(item); + } + return value; + } + + +void UiSetting::SetSetting(const QString& item, const QString& value) + { + if(settingList.contains(item)) + { + settingList.remove(item); + } + settingList.insert(item, value); + save(); + } + + +void UiSetting::loadDefault() + { + settingList.clear(); + settingList.insert("showoutput", "true"); + //add mor default setting here. + } + + +bool UiSetting::load() + { + QFile file(SETTINGFILE); + if(!file.open(QIODevice::ReadOnly)) + { + return false; + } + QTextStream in(&file); + QString line, item, value; + int index; + while(!in.atEnd()) + { + line = in.readLine().trimmed().toLower(); + if(!line.startsWith("//")) + { + index = line.indexOf("="); + if(index > 0 && index < line.length() - 1) + { + item = line.left(index).trimmed(); + value = line.right(line.length() - index -1); + settingList.insert(item, value); + } + } + //end while. + } + return true; + } + +bool UiSetting::save() + { + QFile file(SETTINGFILE); + if(!file.open(QIODevice::WriteOnly)) + { + return false; + } + QTextStream in(&file); + in << "//STFQtUI Setting.\r\n"; + in << "//Created at: " + QDateTime::currentDateTime().toString("yyyy.mm.dd hh:mm::ss"); + in << "\r\n"; + for(int i=0;i< settingList.size();i++) + { + in << settingList.keys()[i]; + in << "="; + in << settingList.value(settingList.keys()[i]); + in << "\r\n"; + } + return true; + } + diff -r ecff51f1e7fb -r 8a14024f954a stif/QtUI/StifQtUI/uisetting.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/stif/QtUI/StifQtUI/uisetting.h Mon Mar 15 12:46:13 2010 +0200 @@ -0,0 +1,31 @@ +/* + * uisetting.h + * + * Created on: 2010-2-8 + * Author: y183zhan + */ + +#ifndef UISETTING_H_ +#define UISETTING_H_ +#include + +class UiSetting + { +public: + UiSetting(); + ~UiSetting(); + +public: + QString ReadSetting(const QString& item); + void SetSetting(const QString& item,const QString& value); + +private: + bool load(); + bool save(); + void loadDefault(); + +private: + QHash settingList; + }; + +#endif /* UISETTING_H_ */ diff -r ecff51f1e7fb -r 8a14024f954a stif/QtUI/StifQtUI/version.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/stif/QtUI/StifQtUI/version.h Mon Mar 15 12:46:13 2010 +0200 @@ -0,0 +1,29 @@ +/* +* 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: STIF version declaration +* +*/ + +#ifndef VERSION_H_ +#define VERSION_H_ + +#define STIF_MAJOR_VERSION 7 +#define STIF_MINOR_VERSION 3 +#define STIF_BUILD_VERSION 26 + +#define STIF_REL_DATE "09th Feb 2010" + +#define TO_UNICODE(text) _L(text) + +#endif /*VERSION_H_*/ diff -r ecff51f1e7fb -r 8a14024f954a stif/QtUI/readme.txt --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/stif/QtUI/readme.txt Mon Mar 15 12:46:13 2010 +0200 @@ -0,0 +1,6 @@ +StifQtUI project is written by QT C++ and Symbian C++. +It should be compiled by QT for S60 4.6.0 under proper S60 SDK. + +You can get QT for S60 from: http://qt.nokia.com/downloads/downloads + + diff -r ecff51f1e7fb -r 8a14024f954a stif/TestInterface/src/TestInterface.cpp --- a/stif/TestInterface/src/TestInterface.cpp Fri Mar 12 15:50:45 2010 +0200 +++ b/stif/TestInterface/src/TestInterface.cpp Mon Mar 15 12:46:13 2010 +0200 @@ -430,13 +430,21 @@ TPtr moduleName = cmdLine->Des(); User().CommandLine( moduleName ); - RDebug::Print (moduleName); + RDebug::Print(_L("StartSession() Received data [%S]"), &moduleName); + + // Extract semaphore name passed in data + TInt index = moduleName.Find(_L(" ")); + RDebug::Print(_L("StartSession() Space separator found at position [%d]"), index); + TPtrC semaphoreName = moduleName.Mid(index + 1); + moduleName = moduleName.Left(index); + + RDebug::Print(_L("StartSession() Extracted module name [%S] and sempahore name [%S]"), &moduleName, &semaphoreName); // Open start-up synchronization semaphore RSemaphore startup; - RDebug::Print(_L(" Openingstart-up semaphore")); - TName semaphoreName = _L("startupSemaphore"); - semaphoreName.Append( moduleName ); + RDebug::Print(_L(" Opening start-up semaphore")); +// TName semaphoreName = _L("startupSemaphore"); +// semaphoreName.Append( moduleName ); TInt res = startup.OpenGlobal(semaphoreName); RDebug::Print(_L("Opening result %d"), res); @@ -448,7 +456,7 @@ if ( r == KErrAlreadyExists ) { // Ok, server was already started - RDebug::Print(_L("Server already started, signaling semaphore and existing")); + RDebug::Print(_L("Server already started, signaling semaphore and exiting")); startup.Signal(); //__UHEAP_MARKEND; diff -r ecff51f1e7fb -r 8a14024f954a stif/TestModuleTemplates/HardCodedTestModuleXXX/group/HardCodedTestModuleXXX_DoxyFile.txt --- a/stif/TestModuleTemplates/HardCodedTestModuleXXX/group/HardCodedTestModuleXXX_DoxyFile.txt Fri Mar 12 15:50:45 2010 +0200 +++ b/stif/TestModuleTemplates/HardCodedTestModuleXXX/group/HardCodedTestModuleXXX_DoxyFile.txt Mon Mar 15 12:46:13 2010 +0200 @@ -2,13 +2,14 @@ # 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 "Eclipse Public License v1.0" +# 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: diff -r ecff51f1e7fb -r 8a14024f954a stif/TestModuleTemplates/TemplateKernelScriptXXX/group/TemplateKernelScriptXXX_DoxyFile.txt --- a/stif/TestModuleTemplates/TemplateKernelScriptXXX/group/TemplateKernelScriptXXX_DoxyFile.txt Fri Mar 12 15:50:45 2010 +0200 +++ b/stif/TestModuleTemplates/TemplateKernelScriptXXX/group/TemplateKernelScriptXXX_DoxyFile.txt Mon Mar 15 12:46:13 2010 +0200 @@ -2,13 +2,14 @@ # 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 "Eclipse Public License v1.0" +# 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: diff -r ecff51f1e7fb -r 8a14024f954a stif/TestModuleTemplates/TemplateScriptXXX/group/TemplateScriptXXX_DoxyFile.txt --- a/stif/TestModuleTemplates/TemplateScriptXXX/group/TemplateScriptXXX_DoxyFile.txt Fri Mar 12 15:50:45 2010 +0200 +++ b/stif/TestModuleTemplates/TemplateScriptXXX/group/TemplateScriptXXX_DoxyFile.txt Mon Mar 15 12:46:13 2010 +0200 @@ -2,13 +2,14 @@ # 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 "Eclipse Public License v1.0" +# 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: diff -r ecff51f1e7fb -r 8a14024f954a stif/TestModuleTemplates/TestModuleTemplates.zip Binary file stif/TestModuleTemplates/TestModuleTemplates.zip has changed diff -r ecff51f1e7fb -r 8a14024f954a stif/TestModuleTemplates/TestModuleXXX/group/TestModuleXXX_DoxyFile.txt --- a/stif/TestModuleTemplates/TestModuleXXX/group/TestModuleXXX_DoxyFile.txt Fri Mar 12 15:50:45 2010 +0200 +++ b/stif/TestModuleTemplates/TestModuleXXX/group/TestModuleXXX_DoxyFile.txt Mon Mar 15 12:46:13 2010 +0200 @@ -2,13 +2,14 @@ # 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 "Eclipse Public License v1.0" +# 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: diff -r ecff51f1e7fb -r 8a14024f954a stif/TestServer/src/TestServerClient.cpp --- a/stif/TestServer/src/TestServerClient.cpp Fri Mar 12 15:50:45 2010 +0200 +++ b/stif/TestServer/src/TestServerClient.cpp Mon Mar 15 12:46:13 2010 +0200 @@ -103,16 +103,37 @@ { TFileName serverName; - TInt ret; + TInt ret = KErrNone; - // Create global semaphore start-up + // Create global semaphore start-up. It will be indexed (if given name already exsists, index will be increased) RSemaphore startSemaphore; TName semaphoreName = _L("startupSemaphore"); semaphoreName.Append( aModuleName ); - ret = startSemaphore.CreateGlobal( semaphoreName, 0); - if ( ret != KErrNone ) + TInt x = 0; + RBuf semName; + ret = semName.Create(KMaxName); + if(ret != KErrNone) + { + RDebug::Print(_L("RTestServer::Connect() Could not create buffer for semaphore name [%d]"), ret); + return ret; + } + do { - startSemaphore.Close(); + semName.Format(_L("%S%d"), &semaphoreName, x); + ret = startSemaphore.CreateGlobal(semName, 0); + RDebug::Print(_L("RTestServer::Connect() Creating global semaphore [%S] with result [%d]"), &semName, ret); + if(ret != KErrAlreadyExists) + { + semaphoreName.Copy(semName); + break; + } + x++; + } while (ETrue); + semName.Close(); + + if ( ret != KErrNone ) + { + startSemaphore.Close(); return ret; } @@ -129,7 +150,18 @@ RProcess pr; - ret = KErrNone; + // Data to be passed to new process. It will contain module name and synchronization semaphore name separated with space. + // I.e. it will be: "mymodule startupSemaphore0" + RBuf data; + ret = data.Create(KMaxName); + if(ret != KErrNone) + { + RDebug::Print(_L("RTestServer::Connect() Could not create buffer for data to be passed to process [%d]"), ret); + return ret; + } + data.Format(_L("%S %S"), &aModuleName, &semaphoreName); + RDebug::Print(_L("RTestServer::Connect() Data for new process prepared [%S]"), &data); + // Indication is Create() operation needed TBool doCreate( ETrue ); @@ -138,11 +170,11 @@ // Create without path(Uses Symbian default path). // Note: If TestScriter used then module name is format: // testscripter_testcasefilename - ret = pr.Create( aModuleName, aModuleName ); + + ret = pr.Create( aModuleName, data ); if( ret == KErrNone ) { - RDebug::Print( _L( "Combination (1): Caps modifier[%S], Module[%S]" ), - &aModuleName, &aModuleName ); + RDebug::Print(_L("RTestServer::Connect() Combination (1): Caps modifier [%S], Data [%S]"), &aModuleName, &data); doCreate = EFalse; } #endif // __WINS__ @@ -161,17 +193,16 @@ ret_caps = GetCapsModifier( aConfigFile, capsModifierName ); if( ret_caps != KErrNone ) { - RDebug::Print( _L( "Caps modifier was not defined. Default modifier will be used" ) ); + RDebug::Print( _L( "RTestServer::Connect() Caps modifier was not defined. Default modifier will be used" ) ); } else { #ifdef __WINS__ // CodeWarrior(emulator) // Create without path(Uses Symbian default path) - ret = pr.Create( capsModifierName, aModuleName ); + ret = pr.Create( capsModifierName, data ); if( ret == KErrNone ) { - RDebug::Print( _L( "Combination (2): Caps modifier[%S], Module[%S]" ), - &capsModifierName, &aModuleName ); + RDebug::Print( _L( "RTestServer::Connect() Combination (2): Caps modifier [%S], Data [%S]"), &capsModifierName, &data); doCreate = EFalse; } #endif // __WINS__ @@ -200,7 +231,7 @@ if( find_ret != KErrNone ) { // Module was not found, using default exe: testserverstarter.exe - RDebug::Print( _L( "Correct caps modifier module not found, capabilities cannot set" ) ); + RDebug::Print( _L( "RTestServer::Connect() Correct caps modifier module not found, capabilities cannot set" ) ); if ( aModuleName.Find( _L( "testscripter_ui_" ) ) == 0 ) { pathAndExeModule.Copy( KDefaultUiExeName ); @@ -213,8 +244,9 @@ if( trapd_ret != KErrNone ) { // FindExeL fails - RDebug::Print( _L( "Caps modifier module searching fails with error: %d" ), trapd_ret ); + RDebug::Print( _L( "RTestServer::Connect() Caps modifier module searching fails with error: %d" ), trapd_ret ); startSemaphore.Close(); + data.Close(); return trapd_ret; } @@ -222,16 +254,17 @@ if ( doCreate ) { - ret = pr.Create( pathAndExeModule, aModuleName ); + ret = pr.Create( pathAndExeModule, data ); RDebug::Print( - _L( "Combination (3): Caps modifier[%S], Module[%S]. Result: %d" ), - &pathAndExeModule, &aModuleName, ret ); + _L( "RTestServer::Connect() Combination (3): Caps modifier [%S], Data [%S], Result [%d]" ), + &pathAndExeModule, &data, ret ); } - + data.Close(); + if ( ret != KErrNone ) { - startSemaphore.Close(); + startSemaphore.Close(); return ret; } diff -r ecff51f1e7fb -r 8a14024f954a stif/TestServer/src/Testserversession.cpp --- a/stif/TestServer/src/Testserversession.cpp Fri Mar 12 15:50:45 2010 +0200 +++ b/stif/TestServer/src/Testserversession.cpp Mon Mar 15 12:46:13 2010 +0200 @@ -646,8 +646,14 @@ // Get data from message TFileName config; TRAPD( res, aMessage.ReadL( 0, config ) ); - if( res != KErrNone ) + if(res == KErrDied) { + RDebug::Print(_L("CTestModule::EnumerateTestCasesL() Reading from RMessage ended with KErrDied. Client is not alive anymore and this request will be ignored")); + return res; + } + else if( res != KErrNone ) + { + RDebug::Print(_L("CTestModule::EnumerateTestCasesL() #1 Panic client with [%d], res=[%d]"), EBadDescriptor, res); PanicClient( EBadDescriptor, aMessage ); return res; } @@ -702,8 +708,14 @@ TPckgBuf countPckg( testCases->Count() ); TRAP( res, aMessage.WriteL( 1, countPckg ) ); - if( res != KErrNone ) + if(res == KErrDied) { + RDebug::Print(_L("CTestModule::EnumerateTestCasesL() Writing to RMessage ended with KErrDied. Client is not alive anymore and this request will be ignored")); + return res; + } + else if( res != KErrNone ) + { + RDebug::Print(_L("CTestModule::EnumerateTestCasesL() #2 Panic client with [%d], res=[%d], config=[%S]"), EBadDescriptor, res, &config); PanicClient( EBadDescriptor, aMessage ); return res; } diff -r ecff51f1e7fb -r 8a14024f954a stif/TestServerStarter/src/TestServerStarter.cpp --- a/stif/TestServerStarter/src/TestServerStarter.cpp Fri Mar 12 15:50:45 2010 +0200 +++ b/stif/TestServerStarter/src/TestServerStarter.cpp Mon Mar 15 12:46:13 2010 +0200 @@ -50,7 +50,7 @@ GLDEF_C TInt E32Main() { - RDebug::Print(_L("New process starting")); + RDebug::Print(_L("STIF: New process starting")); // Get module name from command line const TInt length = User().CommandLineLength(); @@ -66,13 +66,21 @@ User().CommandLine( moduleName ); - RDebug::Print (moduleName); + RDebug::Print(_L("STIF: Received data [%S]"), &moduleName); + + // Extract semaphore name passed in data + TInt index = moduleName.Find(_L(" ")); + RDebug::Print(_L("STIF: Space separator found at position [%d]"), index); + TPtrC semaphoreName = moduleName.Mid(index + 1); + moduleName = moduleName.Left(index); + + RDebug::Print(_L("STIF: Extracted module name [%S] and sempahore name [%S]"), &moduleName, &semaphoreName); // Open start-up synchronization semaphore RSemaphore startup; RDebug::Print(_L(" Openingstart-up semaphore")); - TName semaphoreName = _L("startupSemaphore"); - semaphoreName.Append( moduleName ); + //TName semaphoreName = _L("startupSemaphore"); + //semaphoreName.Append( moduleName ); TInt res = startup.OpenGlobal(semaphoreName); RDebug::Print(_L("Opening result %d"), res); diff -r ecff51f1e7fb -r 8a14024f954a stif/examples/STIFTestMeasurementStub/group/STIFTestMeasurementStub_DoxyFile.txt --- a/stif/examples/STIFTestMeasurementStub/group/STIFTestMeasurementStub_DoxyFile.txt Fri Mar 12 15:50:45 2010 +0200 +++ b/stif/examples/STIFTestMeasurementStub/group/STIFTestMeasurementStub_DoxyFile.txt Mon Mar 15 12:46:13 2010 +0200 @@ -2,13 +2,14 @@ # 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 "Eclipse Public License v1.0" +# 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: diff -r ecff51f1e7fb -r 8a14024f954a stif/group/ReleaseNote.txt --- a/stif/group/ReleaseNote.txt Fri Mar 12 15:50:45 2010 +0200 +++ b/stif/group/ReleaseNote.txt Mon Mar 15 12:46:13 2010 +0200 @@ -1,5 +1,5 @@ ======================================================================== -RELEASE NOTE FOR STIF - STIF_201006 (7.3.26) +RELEASE NOTE FOR STIF - STIF_201008 (7.3.27) SUPPORTING SERIES 60 3.0 -> ======================================================================== diff -r ecff51f1e7fb -r 8a14024f954a stif/inc/version.h --- a/stif/inc/version.h Fri Mar 12 15:50:45 2010 +0200 +++ b/stif/inc/version.h Mon Mar 15 12:46:13 2010 +0200 @@ -20,9 +20,9 @@ #define STIF_MAJOR_VERSION 7 #define STIF_MINOR_VERSION 3 -#define STIF_BUILD_VERSION 26 +#define STIF_BUILD_VERSION 27 -#define STIF_REL_DATE "09th Feb 2010" +#define STIF_REL_DATE "23th Feb 2010" #define TO_UNICODE(text) _L(text) diff -r ecff51f1e7fb -r 8a14024f954a stif/sis/Stif_31.sis Binary file stif/sis/Stif_31.sis has changed