Prevent a LoadRunner script from running between two times

Some scripts cannot be run between certain times, this is especially the case when we are running long duration tests or preparing test data by data-seeding overnight.

In these cases it may be useful to specify times when you don’t want a script to run, for example you might want to schedule a script so that it can’t run when backups or system restarts are taking place.

The attached script contains an example of a function (CheckExclusionTime) which can prevent a script from running between certain times. The script is made more complicated by the fact that you might want to prevent a script from running between 23:50 one day and 00:15 the next day. To achieve the desired result it is necessary to convert any time into an integer value representing the number of minutes which have passed from 00:00 on Monday until the current time and then calculating if the current time falls within the excluded period.

2016-10-06-12_45_30-timeexclusion-hp-virtual-user-generator-web-http_htmlThe integers 1 through to 7 represent the days Monday through to Sunday.

Other integers are used to represent the exclusion start time and exclusion end time.

Author: Richard Bishop

http://about.me/richard_bishop