--- a/stifui/qt/src/stfqtuicontroller.cpp Fri Jun 11 13:39:09 2010 +0300
+++ b/stifui/qt/src/stfqtuicontroller.cpp Wed Jun 23 18:13:31 2010 +0300
@@ -26,7 +26,12 @@
StfQtUIController::StfQtUIController(IStfQtUIModel* aModel) :
- model(aModel), isShowOutput(false)
+ model(aModel),
+ isShowOutput(false),
+ iCurrentRunPos(0),
+ isLoopInfinitely(false),
+ loopTimes(0)
+
{
executor = new CStifExecutor();
executor->OpenIniFile(DEFAULTINI);
@@ -135,6 +140,51 @@
}
}
+// run cases repeatly.
+// By default, loopTimes = -1 means loop infinitely util user stop it.
+void StfQtUIController::RepeatRunCases(const QList<CSTFCase>& aCaseList, const bool aIsLoopInfinitely, const int aLoopTimes)
+ {
+ InitRepeatSetting(aIsLoopInfinitely, aLoopTimes);
+ repeatRunCaseList = aCaseList;
+
+ Execution();
+
+ }
+
+void StfQtUIController::InitRepeatSetting(const bool aIsLoopInfinitely, const int aLoopTimes)
+ {
+ loopTimes = aLoopTimes;
+ isLoopInfinitely = aIsLoopInfinitely;
+ iCurrentRunPos = 0;
+ }
+
+void StfQtUIController::ResetRepeatSetting()
+ {
+ iCurrentRunPos = 0;
+ isLoopInfinitely = false;
+ loopTimes = 0;
+ }
+
+// Repeat execution cases
+void StfQtUIController::Execution()
+ {
+ if(loopTimes > 0 || isLoopInfinitely)
+ {
+ int count = repeatRunCaseList.count();
+ CSTFCase aCase = repeatRunCaseList.at(iCurrentRunPos);
+ QString msg = "Start execute case:" + aCase.Name();
+ FireOnGetOutput(msg);
+ executor->ExecuteSingleCase(aCase.ModuleName(), aCase.Index());
+
+ iCurrentRunPos++;
+ if( iCurrentRunPos >= count )
+ {
+ iCurrentRunPos = 0;
+ loopTimes --;
+ }
+ }
+ }
+
bool StfQtUIController::AddCaseToSet(const QList<CSTFCase>& caseList,
const QString& setName)
{
@@ -283,6 +333,9 @@
model->RemoveRunningCase(aCase);
model->AddCaseByStatus(EStatusAborted, stfcase);
msg += "aborted";
+
+ //reset repeat execution information
+ ResetRepeatSetting();
}
else if (flags & CUIStoreIf::EStatusExecuted)
@@ -306,7 +359,12 @@
model->AddCaseByStatus(EStatusPassed, stfcase);
msg += "passed";
}
-
+
+ // if repeat execution is choosed, start to execution again.
+ if(loopTimes > 0 || isLoopInfinitely)
+ {
+ Execution();
+ }
}
else
{