Forum Discussion
Let me understand your question,
For ex: You have 15 different test steps that needs to be performed with time condition.
1 Hr - 1 to 4
2 Hr - 5 to 10
3 Hr - 11 to 15
Is this what you expecting to do?
exactly, thanks for your question.
- shankar_r8 years agoCommunity Hero
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)
- leeasdf98 years agoFrequent Contributor
Hi Shankar,
Many thanks for your time and script, that is a very nice solution and also what i would do.
i just did hope there is also another way besides script, e.g. on keyword level.
Thanks again and kind regards,
Lee
Related Content
- 4 years agoDavid_D
Recent Discussions
- 36 minutes agodhundley
- 48 minutes agosimonaferrara
- 5 hours agoAli2