[ptt-users] Logging
Paul Cuda
pcuda at cellularspecialties.com
Thu Oct 26 16:00:53 PDT 2006
I can't find where _init_ string lies
Here is the code:
'''
Agent name: SunCom102556142
Created on: October 26 2006 AD 12:44 PM
Created by: TestMaker New Agent Wizard Recorder
Note:
Turn this functional test into a scalability and load
test using XSTest found in testmaker_home/XSTest
Turn this functional test into a Quality of Service monitor
using PushToTest Service Monitor System (SMS) found at
http://www.pushtotest.com/Services/slmsolution.html
For details on TestMaker see http://www.pushtotest.com
'''
from com.pushtotest.tool.protocolhandler import ProtocolHandler,
HTTPProtocol
from com.pushtotest.tool.response import Response
import junit
from java.util import Date
import sys, re, time
from java.lang import Exception
from com.pushtotest.tool.util import URLCodec
# Base class of functions that support this test agent
# find this in testmaker_home/lib/agentbase.py
import agentbase
reload(agentbase)
class SunCom102556142( agentbase.agentbase, junit.framework.TestCase ):
'''
Base class implements abstract methods need by recorded test agent
script.
'''
def __init__( self, debuglevel = 0, logto="console",
follow_redirects=0, \
successcodes="20.|300|301|302|303|304|307|401|403|408|41.", \
logpath="log.txt", sleeptime_min=0, sleeptime_max=0,
imagesleeptime=0, \
loadimgtags = "1", imagecache = "1", agentname="test", openlog=1 ):
''' Initialize this test '''
junit.framework.TestCase.__init__(self, agentname)
# Call the agentbase superclass's init method
agentbase.agentbase.__init__( self, debuglevel, logto,
follow_redirects, \
successcodes, logpath, sleeptime_min, sleeptime_max,
imagesleeptime, \
loadimgtags, imagecache, agentname, openlog )
def setUp( self ):
''' Add any needed set-up code here. '''
self.log( 1, "test: setUp" )
self.config()
def runTest( self ):
''' Run the test '''
self.log( 1, "test: runTest" )
self.get( '''http://10.25.56.142/login''')
self.params = [ [ '''a''', '''default''' ],[ '''b''', '''user'''
],[ '''c''', '''Submit''' ],[ '''q''', '''AAAAAAAA''' ] ]
self.get( '''http://10.25.56.142/status.htm''', self.params)
self.params = [ [ '''a''', '''BDA #1 (A PCS) Status''' ],[
'''b''', '''Submit''' ],[ '''q''', '''ADNMLOBD''' ] ]
self.get( '''http://10.25.56.142/summout.htm''', self.params)
self.params = [ [ '''a''', '''Refresh''' ],[ '''b''',
'''Submit''' ],[ '''n''', '''1''' ],[ '''q''', '''ADNMLOBD''' ] ]
self.get( '''http://10.25.56.142/statout.htm''', self.params)
self.params = [ [ '''a''', '''Home''' ],[ '''b''', '''Submit'''
],[ '''n''', '''1''' ],[ '''q''', '''ADNMLOBD''' ] ]
self.get( '''http://10.25.56.142/statout.htm''', self.params)
self.params = [ [ '''a''', '''Logout''' ],[ '''b''',
'''Submit''' ],[ '''q''', '''ADNMLOBD''' ] ]
self.get( '''http://10.25.56.142/summout.htm''', self.params)
# ^^^ Insert new recordings here. (Do not remove this line.)
def tearDown( self ):
''' Add any needed code to end the test here. '''
self.log( 3, "test: tearDown" )
'''
Convenience main method for running this test by itself
otherwise, plug this into XSTest to turn it into a scalability
and load test, and the Service Monitor System (SMS) for
a Quality of Service (QOS) monitor.
'''
if __name__ == 'main':
print '======================================================='
print 'SunCom102556142: Functional test of a Web application '
print '======================================================='
print 'Test created by TestMaker from http://www.pushtotest.com'
print
print
'''
The test class takes the following parameters. See
testmaker_home/lib/agentbase.py
for implementations of these options.
log level = 0- no logging, 1- informational messages, 2- detailed
messages, 3- Everything
log destination = console - to the screen, file - to a file,
response - to the log file in xml form with the
host response,
database - to a JDBC datasource
follow_redirects = 0 - do not follow HTTP 302 response codes, 1 -
follow them automatically
successcodes = Regular Expression (regex) defining HTTP success
response codes
logpath = path and file name to store log file
sleeptime_min = minimum amount of time in seconds to sleep between
requests to the host
sleeptime_max = maximum amount of time to sleep between requests to
the host
imagesleeptime = time in seconds to sleep between requests for <img>
tag references
loadimgtags = 1 - load <img> tag references, 0 - skip them
imagecache = 1 - emulate a browser cache of <img> tag references, 0
- load all <img> tags
logfirst = 1 - add <testmaker> element to head new log files, 0 -
ignore
The settings below were found in the Advanced Options panel of the
Recorder.
'''
test = SunCom102556142( 1, 'console file ', 0,
'20.|300|301|302|303|304|307|401|403|408|41.', 'log.xml', 5, 10, 2, 1,
1, 'SunCom102556142', 1 )
test.setUp()
test.runTest()
test.tearDown()
test.closelog()
print "done"
Perhaps its not in the code as recorded?
Paul Cuda
More information about the Users
mailing list