Loadrunner Batch Scheduler – Excel Version

I’ve made a start on the Loadrunner Batch Scheduler – There is still a long long way to go, but the basis of the underlying code and the basic design is done, I guess.

The Dashboard


The Code

The code below implements a timer – showing the current time in cell A1.

Pushing the start button fires StartBtn_Click, which reads our run variables into an array, and starts the timer.
StopBtn_Click stops the timer.
Then there is next_tick which checks our array of times against the current time. If it takes longer than a second to parse the array I suppose it’s possible to not fire the code, but I’m only allowing for 14 runs at the moment.

I’ll look to build 10 seconds of tolerance into it at some point, but then it will need to know that it’s executed on the 1st second so as not to try to fire on the 9 subsequent ones. (A “done” flag essentially).

Dim ArrTimes(14)

Dim StopTimer As Boolean
Dim SchdTime As Date
Dim Etime As Date
Const OneSec As Date = 1 / 86400#

Sub StopBtn_Click()
StopTimer = True
Etime = Now
[A1].Value = Time()
End Sub

Sub StartBtn_Click()

StopTimer = False
SchdTime = Now()
[A1].Value = Format(Etime, "hh:mm:ss")
Application.OnTime SchdTime + OneSec, "Sheet1.NextTick"

For i = 0 To 13
RangeObject = "D" & i + 6
If Range(RangeObject).Value <> "" Then
ArrTimes(i) = Range(RangeObject).Value
End If

Next i

End Sub

Sub NextTick()
If StopTimer Then
'Don't reschedule update
[A1].Value = Format(Etime, "hh:mm:ss")
SchdTime = SchdTime + OneSec
Application.OnTime SchdTime, "Sheet1.NextTick"
Etime = Now + OneSec

For i = 0 To UBound(ArrTimes)
If [A1].Value = ArrTimes(i) Then
Application.StatusBar = "Running test id: " & Range("A" & i + 6).Value

End If
Next i
End If

End Sub

I should add by way of a disclaimer, I have absolutely no idea if this is going to work at all, let alone reliably, at this point. But It’s a promising start in my opinion. Oh, and I do indent my code in the IDE, but WordPress or this theme, wipe that out. My code is pretty, honestly.

Leave a Reply

Your email address will not be published. Required fields are marked *