Difference between revisions of "Meeting.py"

From PeformIQ Upgrade
Jump to navigation Jump to search
(New page: =Source= Script to generate randomized meeting times for data input to a LoadRunner script. <pre> #!/usr/bin/env python # # $Id:$ # #---------------------------------------------------...)
 
 
Line 45: Line 45:
[[Category:LoadRunner ]]
[[Category:LoadRunner ]]
[[Category:Python]]
[[Category:Python]]
[[Category:Examples]]

Latest revision as of 17:12, 19 July 2009

Source

Script to generate randomized meeting times for data input to a LoadRunner script.

#!/usr/bin/env python
#
#   $Id:$
#
#---------------------------------------------------------------------

import sys

from random import randint

#---------------------------------------------------------------------

def event():
   duration    = randint(1,30)
   s_duration  = '%02d:%02d' %  (duration / 60, duration % 60)

   t_start     = randint(0,204) * 5
   s_start     = '%02d:%02d' %  (t_start / 60, t_start % 60)

   t_end       = t_start + duration
   s_end       = '%02d:%02d' %  (t_end / 60, t_end % 60)

   return '%s,%s,%s' % (s_start, s_end, s_duration)

#---------------------------------------------------------------------

def main():
   print "StartTime,EndTime,Duration"

   for i in range(500):
      print event()

#---------------------------------------------------------------------

main()

#---------------------------------------------------------------------