Generating LoadRunner PRM file
Revision as of 12:17, 2 April 2009 by PeterHarding (talk | contribs)
Simple Script Example
#!/usr/bin/env python # # $Id:$ # #------------------------------------------------------------------------------- import os import re #------------------------------------------------------------------------------- fmt = """ [parameter:FirstName] Delimiter="," ParamName="FirstName" TableLocation="C:\lr\XXX\scripts\<SCRIPT>\Parameters" ColumnName="FirstName" Table="Users.dat" GenerateNewVal="EachIteration" Type="Table" value_for_each_vuser="" OriginalValue="" auto_allocate_block_size="1" SelectNextRow="Same line as AGS_Number" StartRow="49" OutOfRangePolicy="ContinueWithLast" [parameter:Username] Delimiter="," ParamName="Username" TableLocation="C:\lr\XXX\scripts\<SCRIPT>\Parameters" ColumnName="Username" Table="Users.dat" GenerateNewVal="EachIteration" Type="Table" value_for_each_vuser="" OriginalValue="" auto_allocate_block_size="1" SelectNextRow="Same line as UserId" StartRow="49" OutOfRangePolicy="ContinueWithLast" ... """ #------------------------------------------------------------------------------- def setup(): wrk_path = os.getcwd() xpath = wrk_path.split('/') script_name = xpath[len(xpath) - 1] parameters = re.sub('<SCRIPT>', script_name, fmt) ofd = open('%s.prm' % script_name, 'w') ofd.write(parameters) ofd.close() if not os.path.exists('Parameters'): os.mkdir('Parameters') os.system('cp ../Parameters/*.dat Parameters') os.system('chgrp -R Users .') #------------------------------------------------------------------------------- setup() #-------------------------------------------------------------------------------