[ptt-users] RE: Stress Test data from input file

Thieme.Geoff Geoff.Thieme at we-energies.com
Wed Dec 20 15:33:22 PST 2006


Is there any way to read the agentid variable (it is set to 1 for test
#1 and 2 for test #2) set in master.py (or equivalent) from within the
test.py script?

Then I could open my input data file from each test.py script, and skip
to line #x (get x from agentid variable) for test data. Performance wise
this would cause more file I/O, but it might work as a quick fix.

> _____________________________________________ 
> From: 	Thieme.Geoff  
> Sent:	Wednesday, December 20, 2006 5:04 PM
> To:	TestMaker users list
> Cc:	Thieme.Geoff
> Subject:	Stress Test data from input file
> 
> 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
> .tsv', 'r')
>       
>       test.setUp()
>       test.runTest()
>       test.tearDown()
>     finally:
>       userdata.close()
> 
> 
>     test.closelog()
>     print "done"
> 
> 
> Thanks for any help,
> Geoff
> 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://cake.pushtotest.com/pipermail/users/attachments/20061220/7fb77017/attachment-0001.htm


More information about the Users mailing list