So, After a long confusion in my mind i found a way to do this logic. I tried with minutes it is working fine.
If you want change the logic to Minutes or Seconds then Just change the Highlighted keyword to like GetMinutes or GetSeconds
function ExecutionStepswithTimeCondition()
{
var timeConfiguration = Sys.OleObject("Scripting.Dictionary");
var exestartTime = null,f_goandExecute = false,int_teststep_no = 0,currentHour = 1,previousHour = 0,no_ofSteps = 0;
stopFile = "C:\\StopFile.txt"
//Configure the number of test steps needs to be for the coressponding hour
//timeConfiguration.Add("<nth Hour>",<Num of test steps>);
timeConfiguration.Add(1,4);
timeConfiguration.Add(2,10);
timeConfiguration.Add(3,15);
timeConfiguration.Add(4,0);
timeConfiguration.Add(5,12);
DDT.ExcelDriver("D:\\Nectar_Automation\\01202017_Execution_Scripts\\Nectar_Automation_Project\\TestData.xls", "Master");
exestartTime = aqDateTime.Time();
while (! DDT.CurrentDriver.EOF())
{
if(aqFile.Exists(stopFile))//To stop the execution when file present the specified location
{
if(aqDateTime.GetHours(aqDateTime.TimeInterval(exestartTime,aqDateTime.Time())) <= currentHour)
{
if(aqDateTime.GetHours(aqDateTime.TimeInterval(exestartTime,aqDateTime.Time())) >= previousHour)
{
no_ofSteps = timeConfiguration.Item(currentHour);
if(int_teststep_no <= no_ofSteps)
{
f_goandExecute = true;
}
}
}
else
{
int_teststep_no = 0;
previousHour = currentHour;
currentHour = currentHour + 1;
if(timeConfiguration.Item(currentHour) > 0)
{
f_goandExecute = true;
}
}
if(f_goandExecute)
{
//Test steps...Start
Log.Message(int_teststep_no + " - " + aqDateTime.Time());
//Test steps End
//********************************************************************
DDT.CurrentDriver.Next();
int_teststep_no = int_teststep_no + 1
f_goandExecute = false;
}
}
}
}
If you like to stop the execution then you just need to place a file in the specified path.(If you are giving shared drive path then you can stop the execution from any machine)