[ptt-users] Stress Test data from input file
Thieme.Geoff
Geoff.Thieme at we-energies.com
Thu Dec 21 15:29:45 PST 2006
I tested and found that self.agentid could be read from test.py when
running the master.py stress test. This code in test.py worked:
raise NameError, "ERROR agent id :%s:" % (self.agentid)
And adding "test.agentid=0" after the
test = test( 1, 'console file '...
line in test.py allowed me to still use that script as a functional
testing script.
So opening/reading the inputfile based on self.agentid is an option.
Thanks for your help,
Geoff
________________________________
From: users-bounces at lists.pushtotest.com
[mailto:users-bounces at lists.pushtotest.com] On Behalf Of Carl Herder
Sent: Wednesday, December 20, 2006 6:22 PM
To: TestMaker users list
Subject: RE: [ptt-users] Stress Test data from input file
1. Variables set in properties.py are inherited by your script
2. agentbase.py, the base class for your script, has a self.agentid
variable that is set when master.py calls setloginfo() in its
constructor. I haven't tried this, but you should be able to access this
variable.
"Thieme.Geoff" <Geoff.Thieme at we-energies.com> wrote:
I would like each agent to get a unique data row from my input
file. If I made changes in Properties.py, it don't think this would be
possible.
Alternatively, each agent could open the input file and loop
though it using a unique data row for each test. If I added
userdata=open('S:\\d3a\\docs\\TestMakerStressTesting\\xstest\\userdata.t
sv', 'r')
in the Properties.py file, would my test.py script be able to
see the userdata variable and get a new row for each test?
________________________________
From: users-bounces at lists.pushtotest.com
[mailto:users-bounces at lists.pushtotest.com] On Behalf Of Carl Herder
Sent: Wednesday, December 20, 2006 5:27 PM
To: TestMaker users list
Subject: Re: [ptt-users] Stress Test data from input file
I may be misunderstanding what you mean by "When I open the
input file as userdata in master.py". You should not need to change
master.py. Properties.py should load your test.py. Master.py knows to
look for properties.py.
Carl
"Thieme.Geoff" <Geoff.Thieme at we-energies.com> wrote:
I'm using TestMaker 4.4. I created an xstest\test.py
file that reads input data from a file. My code works for running just
test.py and getting variable user data from userdata.tsv. Now I'm trying
to use xstest\master.py to create a stress test which will use a
different row of data from my input file for each test.
I tried a couple approaches but neithor worked. When I
open the input file as userdata in master.py, test.py is unable to
access the userdata variable to do a readline().
Any suggests on getting this to work? I found no example
scripts which get test data from input files.
Working code from test.py:
...
def setUp( self ):
''' Add any needed set-up code here. '''
# Remove header line from input file
self.log( 1, "Using the userdata values :%s:" %
( userdata.readline() ) )
self.log( 1, "test: setUp" )
self.config()
def runTest( self ):
''' Run the test '''
self.log( 1, "test: runTest" )
# Read data from input files
self.log( 1, "Testing with:")
# Get 3 tab seperated data values, ignore any
extra values listed on that line
userid, passwd, billid =
userdata.readline().rstrip().split( '\t' , 2 )
self.log( 1, "userid :%s:" % ( userid ) )
self.log( 1, "passwd :%s:" % ( passwd ) )
self.log( 1, "bill id :%s:" % ( billid ) )
...
The settings below were found in the Advanced
Options panel of the Recorder.
'''
test = test( 1, 'console file ', 1,
'20.|300|301|302|303|304|307|401|403|408|41.', 'log.xml', 0, 1, 1, 1, 1,
'test', 1 )
# Run test using userdata input file
try:
userdata=open('S:\\d3a\\docs\\TestMakerStressTesting\\xstest\\userdata.t
sv', 'r')
test.setUp()
test.runTest()
test.tearDown()
finally:
userdata.close()
test.closelog()
print "done"
Thanks for any help,
Geoff
_______________________________________________
Users mailing list
Users at lists.pushtotest.com
http://lists.pushtotest.com/mailman/listinfo/users
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
_______________________________________________
Users mailing list
Users at lists.pushtotest.com
http://lists.pushtotest.com/mailman/listinfo/users
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://cake.pushtotest.com/pipermail/users/attachments/20061221/d3d38e12/attachment.htm
More information about the Users
mailing list