Difference between revisions of "Generating LoadRunner PRM file"

From PeformIQ Upgrade
Jump to navigation Jump to search
(New page: =Script= <pre> #!/usr/bin/env python # # $Id:$ # #------------------------------------------------------------------------------- import os import re #---------------------------------...)
 
 
(8 intermediate revisions by the same user not shown)
Line 1: Line 1:
=Script=
=Simple Script Example=
 


<pre>
<pre>
Line 13: Line 14:
#-------------------------------------------------------------------------------
#-------------------------------------------------------------------------------


fmt = """\
fmt = """
[parameter:CostCenter]
Delimiter=","
ParamName="CostCenter"
TableLocation="C:\lr\XXX\scripts\<SCRIPT>\Parameters"
ColumnName="CostCenter"
GenerateNewVal="EachIteration"
Table="Users.dat"
Type="Table"
value_for_each_vuser=""
OriginalValue=""
auto_allocate_block_size="1"
SelectNextRow="Same line as AGS_Number"
StartRow="49"
OutOfRangePolicy="ContinueWithLast"
[parameter:FirstName]
[parameter:FirstName]
Delimiter=","
Delimiter=","
Line 53: Line 40:
OriginalValue=""
OriginalValue=""
auto_allocate_block_size="1"
auto_allocate_block_size="1"
SelectNextRow="Same line as AGS_Number"
SelectNextRow="Same line as UserId"
StartRow="49"
OutOfRangePolicy="ContinueWithLast"
[parameter:System]
Delimiter=","
ParamName="System"
TableLocation="C:\lr\XXX\scripts\<SCRIPT>\Parameters"
ColumnName="System"
Table="System.dat"
GenerateNewVal="Once"
Type="Table"
value_for_each_vuser=""
OriginalValue="test403d.auspost.com.au"
auto_allocate_block_size="1"
SelectNextRow="Sequential"
StartRow="1"
OutOfRangePolicy="ContinueWithLast"
[parameter:CreditCardNumber]
Delimiter=","
ParamName="CreditCardNumber"
TableLocation="C:\lr\XXX\scripts\<SCRIPT>\Parameters"
ColumnName="CreditCardNumber"
GenerateNewVal="EachIteration"
Table="Users.dat"
Type="Table"
value_for_each_vuser=""
OriginalValue=""
auto_allocate_block_size="1"
SelectNextRow="Same line as AGS_Number"
StartRow="49"
OutOfRangePolicy="ContinueWithLast"
[parameter:Password]
Delimiter=","
ParamName="Password"
TableLocation="C:\lr\XXX\scripts\<SCRIPT>\Parameters"
ColumnName="Password"
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:AGS_Number]
Delimiter=","
ParamName="AGS_Number"
TableLocation="C:\lr\XXX\scripts\<SCRIPT>\Parameters"
ColumnName="AGS_Number"
Table="Users.dat"
GenerateNewVal="EachIteration"
Type="Table"
value_for_each_vuser=""
OriginalValue=""
auto_allocate_block_size="1"
SelectNextRow="Sequential"
StartRow="49"
StartRow="49"
OutOfRangePolicy="ContinueWithLast"
OutOfRangePolicy="ContinueWithLast"
...
"""
"""



Latest revision as of 12:18, 2 April 2009

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()

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