Scripting help with JSESSIONID

View: New views
5 Messages — Rating Filter:   Alert me  

Scripting help with JSESSIONID

by Tom Johnson-7 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

Hello,

 

   I am fairly new to grinder but not new to automated load testing tools (several years experience with LoadRunner). I am working with Grinder 3 and have hit a snag with what I believe to be an issue with a JSESSIONID in my script. When I run the script, it gets to the login and I get a 408 repsonse timeout and the only thing that makes sense is that Grinder is not doing a good job with the session cookie. I have researched through the listgroup and gleaned some code out to access the cookies but am am coming up short on exactly how to code it and where exactly to put the code. I have copied the key parts of the script where it handles the session cookie and follows with the login. As you can see in the code by stuff I have commented out that I have attempted some of the suggestions. Can anybody shed some light on how to properly capture the JSESSIONID and plug it back in? Here is my script:

 

 
# The Grinder 3.2
# HTTP script recorded by TCPProxy at Oct 25, 2009 6:17:35 AM

 

from net.grinder.script import Test
from net.grinder.script.Grinder import grinder
from net.grinder.plugin.http import HTTPPluginControl, HTTPRequest
from HTTPClient import Cookie, CookieModule, CookiePolicyHandler
from HTTPClient import NVPair
connectionDefaults = HTTPPluginControl.getConnectionDefaults()
httpUtilities = HTTPPluginControl.getHTTPUtilities()

 

# To use a proxy server, uncomment the next line and set the host and port.
# connectionDefaults.setProxyServer("localhost", 8001)

 

# These definitions at the top level of the file are evaluated once,
# when the worker process is started.

 

connectionDefaults.defaultHeaders = \
  ( NVPair('User-Agent', 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729)'),
    NVPair('Accept-Language', 'en-us'), )

 

<snip>

 

headers4= \
  ( NVPair('Accept', 'image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-ms-application, application/x-ms-xbap, application/vnd.ms-xpsdocument, application/xaml+xml, */*'), )

headers5= \
  ( NVPair('Accept', '*/*'),
    NVPair('Referer', 'http://site/system/'), )

headers6= \
  ( NVPair('Accept', 'image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-ms-application, application/x-ms-xbap, application/vnd.ms-xpsdocument, application/xaml+xml, */*'),
    NVPair('Referer', 'http://site/system/'), )

 

<snip>

 

url4 = 'http://site:80'

 

# Open the login file
t = open("c:\grinder\logins.txt",'r')

 

# Create an HTTPRequest for each request, then replace the
# reference to the HTTPRequest with an instrumented version.
# You can access the unadorned instance using request101.__target__.

 

<snip>

 

request1101 = HTTPRequest(url=url4, headers=headers4)
request1101 = Test(1101, 'GET system').wrap(request1101)

request1102 = HTTPRequest(url=url4, headers=headers4)
request1102 = Test(1102, 'GET /').wrap(request1102)

request1103 = HTTPRequest(url=url4, headers=headers5)
request1103 = Test(1103, 'GET global.css').wrap(request1103)

request1104 = HTTPRequest(url=url4, headers=headers5)
request1104 = Test(1104, 'GET banner_left.jpg').wrap(request1104)

request1105 = HTTPRequest(url=url4, headers=headers5)
request1105 = Test(1105, 'GET banner_right.jpg').wrap(request1105)

request1201 = HTTPRequest(url=url4, headers=headers5)
request1201 = Test(1201, 'GET fill.gif').wrap(request1201)

request1202 = HTTPRequest(url=url4, headers=headers5)
request1202 = Test(1202, 'GET fill.gif').wrap(request1202)

request1203 = HTTPRequest(url=url4, headers=headers5)
request1203 = Test(1203, 'GET dashline.gif').wrap(request1203)

request1301 = HTTPRequest(url=url4, headers=headers6)
request1301 = Test(1301, 'POST j_security_check').wrap(request1301)

request1302 = HTTPRequest(url=url4, headers=headers6)
request1302 = Test(1302, 'GET /').wrap(request1302)

 

<snip>

 

class TestRunner:
  """A TestRunner instance is created for each worker thread."""

 

  # A method for each recorded page.

 

<snip>

 

  def page11(self):
    """GET system (requests 1101-1105)."""
   
    # Expecting 302 'Found'
    result = request1101.GET('/system')
    # uristring =  result.getEffectiveURI().toExternalForm()
    # grinder.logger.output("uristring1 %s" % uristring)
    # uristring.substring(lastIndexOf("jsessionid= ")+11, uristring.length())
    # grinder.logger.output("uristring2 %s" % uristring)
    # grinder.logger.output("sessionID %s" % sessionID)

    grinder.sleep(31)
    request1102.GET('/system/')

    grinder.sleep(46)
    request1103.GET('/system/css/global.css')

    grinder.sleep(31)
    request1104.GET('/system/gifs/banner_left.jpg')

    grinder.sleep(78)
    request1105.GET('/system/gifs/banner_right.jpg')

    return result

 

  def page12(self):
    """GET fill.gif (requests 1201-1203)."""

    self.token_jsessionid = \
      'C00D3980D51E2A5DBFCDDC7D70629856.systemuatappsystem'
    result = request1201.GET('/system/gifs/fill.gif;jsessionid=' +
      self.token_jsessionid)

    grinder.sleep(47)
    request1202.GET('/system/gifs/fill.gif')

    request1203.GET('/system/gifs/dashline.gif')

    return result

 

  def page13(self):
    """POST j_security_check (requests 1301-1302)."""

    # Get the Agent number and Thread number to create the username
    # Lagent = getAgentNumber()
    # Lthread = getThreadNumber()
    # username = 'LoadTest' & getAgentNumber() & getThreadNumber()
    # t.readline()
    username = (t.readline())
    # password = t[1]
    grinder.logger.output("The username is %s" % username)
    # grinder.logger.output("The username is %s" % username)
   
    # Expecting 302 'Moved Temporarily'
    result = request1301.POST('/system/j_security_check',
      ( NVPair('j_username', 'loadtest1_0_0'),
        NVPair('j_password', 'password1'),
        NVPair('SubmitButton', 'Submit'), ),
      ( NVPair('Content-Type', 'application/x-www-form-urlencoded'), ))

    grinder.sleep(32)
    request1302.GET('/system/')

    return result

 

<snip>

 

  def __call__(self):
    """This method is called for every run performed by the worker thread."""

<snip>

 

    grinder.sleep(12736)
    self.page11()     # GET system (requests 1101-1105)
    self.page12()     # GET fill.gif (requests 1201-1203)

    grinder.sleep(17204)
    self.page13()     # POST j_security_check (requests 1301-1302)

 

<snip>

 

I think the response from page 11 is where the server feeds back the session ID which is than used in page 12.

 

Thanks in advance for any assistance.

 

Tom Johnson


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
grinder-use mailing list
grinder-use@...
https://lists.sourceforge.net/lists/listinfo/grinder-use

Re: Scripting help with JSESSIONID

by Philip Aston-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

The Grinder's cookie handling is pretty solid. But the server doesn't
know that cookies are supported until it has received one back from The
Grinder. I wonder whether the "stale" jsession ID provided in the URL
for page 12 is causing problems. As a quick check, try commenting out
the page12() call, or editing it not to supply the jsessionid parameter
(the grinder will be supplying it in a cookie anyway).

Also, a 408 is a pretty weird response for "unknown session".

If you are still having problems, follow this FAQ -
http://grinder.sourceforge.net/faq.html#use-the-tcpproxy

- Phil


Tom Johnson wrote:

>
> Hello,
>
>  
>
>    I am fairly new to grinder but not new to automated load testing
> tools (several years experience with LoadRunner). I am working with
> Grinder 3 and have hit a snag with what I believe to be an issue with
> a JSESSIONID in my script. When I run the script, it gets to the login
> and I get a 408 repsonse timeout and the only thing that makes sense
> is that Grinder is not doing a good job with the session cookie. I
> have researched through the listgroup and gleaned some code out to
> access the cookies but am am coming up short on exactly how to code it
> and where exactly to put the code. I have copied the key parts of the
> script where it handles the session cookie and follows with the login.
> As you can see in the code by stuff I have commented out that I have
> attempted some of the suggestions. Can anybody shed some light on how
> to properly capture the JSESSIONID and plug it back in? Here is my script:
>
>  
>
>  
> # The Grinder 3.2
> # HTTP script recorded by TCPProxy at Oct 25, 2009 6:17:35 AM
>
>  
>
> from net.grinder.script import Test
> from net.grinder.script.Grinder import grinder
> from net.grinder.plugin.http import HTTPPluginControl, HTTPRequest
> from HTTPClient import Cookie, CookieModule, CookiePolicyHandler
> from HTTPClient import NVPair
> connectionDefaults = HTTPPluginControl.getConnectionDefaults()
> httpUtilities = HTTPPluginControl.getHTTPUtilities()
>
>  
>
> # To use a proxy server, uncomment the next line and set the host and
> port.
> # connectionDefaults.setProxyServer("localhost", 8001)
>
>  
>
> # These definitions at the top level of the file are evaluated once,
> # when the worker process is started.
>
>  
>
> connectionDefaults.defaultHeaders = \
>   ( NVPair('User-Agent', 'Mozilla/4.0 (compatible; MSIE 6.0; Windows
> NT 5.1; SV1; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR
> 3.5.30729)'),
>     NVPair('Accept-Language', 'en-us'), )
>
>  
>
> <snip>
>
>  
>
> headers4= \
>   ( NVPair('Accept', 'image/gif, image/x-xbitmap, image/jpeg,
> image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel,
> application/vnd.ms-powerpoint, application/msword,
> application/x-ms-application, application/x-ms-xbap,
> application/vnd.ms-xpsdocument, application/xaml+xml, */*'), )
>
> headers5= \
>   ( NVPair('Accept', '*/*'),
>     NVPair('Referer', 'http://site/system/'), )
>
> headers6= \
>   ( NVPair('Accept', 'image/gif, image/x-xbitmap, image/jpeg,
> image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel,
> application/vnd.ms-powerpoint, application/msword,
> application/x-ms-application, application/x-ms-xbap,
> application/vnd.ms-xpsdocument, application/xaml+xml, */*'),
>     NVPair('Referer', 'http://site/system/'), )
>
>  
>
> <snip>
>
>  
>
> url4 = 'http://site:80'
>
>  
>
> # Open the login file
> t = open("c:\grinder\logins.txt",'r')
>
>  
>
> # Create an HTTPRequest for each request, then replace the
> # reference to the HTTPRequest with an instrumented version.
> # You can access the unadorned instance using request101.__target__.
>
>  
>
> <snip>
>
>  
>
> request1101 = HTTPRequest(url=url4, headers=headers4)
> request1101 = Test(1101, 'GET system').wrap(request1101)
>
> request1102 = HTTPRequest(url=url4, headers=headers4)
> request1102 = Test(1102, 'GET /').wrap(request1102)
>
> request1103 = HTTPRequest(url=url4, headers=headers5)
> request1103 = Test(1103, 'GET global.css').wrap(request1103)
>
> request1104 = HTTPRequest(url=url4, headers=headers5)
> request1104 = Test(1104, 'GET banner_left.jpg').wrap(request1104)
>
> request1105 = HTTPRequest(url=url4, headers=headers5)
> request1105 = Test(1105, 'GET banner_right.jpg').wrap(request1105)
>
> request1201 = HTTPRequest(url=url4, headers=headers5)
> request1201 = Test(1201, 'GET fill.gif').wrap(request1201)
>
> request1202 = HTTPRequest(url=url4, headers=headers5)
> request1202 = Test(1202, 'GET fill.gif').wrap(request1202)
>
> request1203 = HTTPRequest(url=url4, headers=headers5)
> request1203 = Test(1203, 'GET dashline.gif').wrap(request1203)
>
> request1301 = HTTPRequest(url=url4, headers=headers6)
> request1301 = Test(1301, 'POST j_security_check').wrap(request1301)
>
> request1302 = HTTPRequest(url=url4, headers=headers6)
> request1302 = Test(1302, 'GET /').wrap(request1302)
>
>  
>
> <snip>
>
>  
>
> class TestRunner:
>   """A TestRunner instance is created for each worker thread."""
>
>  
>
>   # A method for each recorded page.
>
>  
>
> <snip>
>
>  
>
>   def page11(self):
>     """GET system (requests 1101-1105)."""
>    
>     # Expecting 302 'Found'
>     result = request1101.GET('/system')
>     # uristring =  result.getEffectiveURI().toExternalForm()
>     # grinder.logger.output("uristring1 %s" % uristring)
>     # uristring.substring(lastIndexOf("jsessionid= ")+11,
> uristring.length())
>     # grinder.logger.output("uristring2 %s" % uristring)
>     # grinder.logger.output("sessionID %s" % sessionID)
>
>     grinder.sleep(31)
>     request1102.GET('/system/')
>
>     grinder.sleep(46)
>     request1103.GET('/system/css/global.css')
>
>     grinder.sleep(31)
>     request1104.GET('/system/gifs/banner_left.jpg')
>
>     grinder.sleep(78)
>     request1105.GET('/system/gifs/banner_right.jpg')
>
>     return result
>
>  
>
>   def page12(self):
>     """GET fill.gif (requests 1201-1203)."""
>
>     self.token_jsessionid = \
>       'C00D3980D51E2A5DBFCDDC7D70629856.systemuatappsystem'
>     result = request1201.GET('/system/gifs/fill.gif;jsessionid=' +
>       self.token_jsessionid)
>
>     grinder.sleep(47)
>     request1202.GET('/system/gifs/fill.gif')
>
>     request1203.GET('/system/gifs/dashline.gif')
>
>     return result
>
>  
>
>   def page13(self):
>     """POST j_security_check (requests 1301-1302)."""
>
>     # Get the Agent number and Thread number to create the username
>     # Lagent = getAgentNumber()
>     # Lthread = getThreadNumber()
>     # username = 'LoadTest' & getAgentNumber() & getThreadNumber()
>     # t.readline()
>     username = (t.readline())
>     # password = t[1]
>     grinder.logger.output("The username is %s" % username)
>     # grinder.logger.output("The username is %s" % username)
>    
>     # Expecting 302 'Moved Temporarily'
>     result = request1301.POST('/system/j_security_check',
>       ( NVPair('j_username', 'loadtest1_0_0'),
>         NVPair('j_password', 'password1'),
>         NVPair('SubmitButton', 'Submit'), ),
>       ( NVPair('Content-Type', 'application/x-www-form-urlencoded'), ))
>
>     grinder.sleep(32)
>     request1302.GET('/system/')
>
>     return result
>
>  
>
> <snip>
>
>  
>
>   def __call__(self):
>     """This method is called for every run performed by the worker
> thread."""
>
> <snip>
>
>  
>
>     grinder.sleep(12736)
>     self.page11()     # GET system (requests 1101-1105)
>     self.page12()     # GET fill.gif (requests 1201-1203)
>
>     grinder.sleep(17204)
>     self.page13()     # POST j_security_check (requests 1301-1302)
>
>  
>
> <snip>
>
>  
>
> I think the response from page 11 is where the server feeds back the
> session ID which is than used in page 12.
>
>  
>
> Thanks in advance for any assistance.
>
>  
>
> Tom Johnson
>


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
grinder-use mailing list
grinder-use@...
https://lists.sourceforge.net/lists/listinfo/grinder-use

Parent Message unknown Re: Scripting help with JSESSIONID

by Tom Johnson-7 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.

Hello Phil and everybody,

 

   Well, I tried a couple of different things based on Phil's reply but I am still getting the 408's.

 

   Here is waht all I tried:

 

      The first thing I tried was to comment out the following from under the def __call__(self): section

 

         self.page12() # GET fill.gif (requests 1201-1203)

 

               * Result was still 408's on all the request1301's

 

      My second attempt I commented out the following code under the def page12(self): section (I did uncomment the code from above)

 

         self.token_jsessionid = \
            'C00D3980D51E2A5DBFCDDC7D70629856.systemuatappsystem'
         result = request1201.GET('/system/gifs/fill.gif;jsessionid=' +
            self.token_jsessionid)

 

               * This of course gave me a nasty little no return error since I had commented out the result line

      My third attempt I commented out the following code under the def page12(self): section again and added a new line

 

         # self.token_jsessionid = \
         #    'C00D3980D51E2A5DBFCDDC7D70629856.systemuatappsystem'
         # result = request1201.GET('/system/gifs/fill.gif;jsessionid=' +
         #    self.token_jsessionid)

         result = request1201.GET('/system/gifs/fill.gif')

 

               * Result was still 408's on all the request1301's

 

   I did go to the noted link and read everything there but I did not glean any new insights from the page. I am thinking that I need to take the code that is commented out under the def page11(self): section and use it either where it is or move it to the def page12(self): section before the JSESSIONID call in order to get what I needed. The unfortunate part is that I am not very Python/Jython literate yet. Any more ideas or help is greatly appreciated. Here is the code I am refering to:

 

      uristring = result.getEffectiveURI().toExternalForm()
      grinder.logger.output("uristring1 %s" % uristring)
      uristring.substring(lastIndexOf("jsessionid= ")+11, uristring.length())
      grinder.logger.output("uristring2 %s" % uristring)
      grinder.logger.output("sessionID %s" % sessionID)

   I am unfortunately getting a NameError on the lastIndexOf line (3rd line). The logging lines are purely to see what is coming out for each part. The uristring1 is giving me http://oursite/oursystem and am suspecting there should be more coming back?

 

Again, any help is very much appreciated,

 

Tom Johnson

 

------------------------------------------------------------------------------------------------------------------------------------------------------------

Phil wrote:

The Grinder's cookie handling is pretty solid. But the server doesn't
know that cookies are supported until it has received one back from The
Grinder. I wonder whether the "stale" jsession ID provided in the URL
for page 12 is causing problems. As a quick check, try commenting out
the page12() call, or editing it not to supply the jsessionid parameter
(the grinder will be supplying it in a cookie anyway).

Also, a 408 is a pretty weird response for "unknown session".

If you are still having problems, follow this FAQ -
http://grinder.sourceforge.net/faq.html#use-the-tcpproxy

- Phil


Tom Johnson wrote:


>
> Hello,
>
>
>
> I am fairly new to grinder but not new to automated load testing
> tools (several years experience with LoadRunner). I am working with
> Grinder 3 and have hit a snag with what I believe to be an issue with
> a JSESSIONID in my script. When I run the script, it gets to the login
> and I get a 408 repsonse timeout and the only thing that makes sense
> is that Grinder is not doing a good job with the session cookie. I
> have researched through the listgroup and gleaned some code out to
> access the cookies but am am coming up short on exactly how to code it
> and where exactly to put the code. I have copied the key parts of the
> script where it handles the session cookie and follows with the login.
> As you can see in the code by stuff I have commented out that I have
> attempted some of the suggestions. Can anybody shed some light on how
> to properly capture the JSESSIONID and plug it back in? Here is my script:
>
>
>
>
> # The Grinder 3.2
> # HTTP script recorded by TCPProxy at Oct 25, 2009 6:17:35 AM
>
>
>
> from net.grinder.script import Test
> from net.grinder.script.Grinder import grinder
> from net.grinder.plugin.http import HTTPPluginControl, HTTPRequest
> from HTTPClient import Cookie, CookieModule, CookiePolicyHandler
> from HTTPClient import NVPair
> connectionDefaults = HTTPPluginControl.getConnectionDefaults()
> httpUtilities = HTTPPluginControl.getHTTPUtilities()
>
>
>
> # To use a proxy server, uncomment the next line and set the host and
> port.
> # connectionDefaults.setProxyServer("localhost", 8001)
>
>
>
> # These definitions at the top level of the file are evaluated once,
> # when the worker process is started.
>
>
>
> connectionDefaults.defaultHeaders = \
> ( NVPair('User-Agent', 'Mozilla/4.0 (compatible; MSIE 6.0; Windows
> NT 5.1; SV1; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR
> 3.5.30729)'),
> NVPair('Accept-Language', 'en-us'), )
>
>
>
> <snip>
>
>
>
> headers4= \
> ( NVPair('Accept', 'image/gif, image/x-xbitmap, image/jpeg,
> image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel,
> application/vnd.ms-powerpoint, application/msword,
> application/x-ms-application, application/x-ms-xbap,
> application/vnd.ms-xpsdocument, application/xaml+xml, */*'), )
>
> headers5= \
> ( NVPair('Accept', '*/*'),
> NVPair('Referer', 'http://site/system/'), )
>
> headers6= \
> ( NVPair('Accept', 'image/gif, image/x-xbitmap, image/jpeg,
> image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel,
> application/vnd.ms-powerpoint, application/msword,
> application/x-ms-application, application/x-ms-xbap,
> application/vnd.ms-xpsdocument, application/xaml+xml, */*'),
> NVPair('Referer', 'http://site/system/'), )
>
>
>
> <snip>
>
>
>
> url4 = 'http://site:80'
>
>
>
> # Open the login file
> t = open("c:\grinder\logins.txt",'r')
>
>
>
> # Create an HTTPRequest for each request, then replace the
> # reference to the HTTPRequest with an instrumented version.
> # You can access the unadorned instance using request101.__target__.
>
>
>
> <snip>
>
>
>
> request1101 = HTTPRequest(url=url4, headers=headers4)
> request1101 = Test(1101, 'GET system').wrap(request1101)
>
> request1102 = HTTPRequest(url=url4, headers=headers4)
> request1102 = Test(1102, 'GET /').wrap(request1102)
>
> request1103 = HTTPRequest(url=url4, headers=headers5)
> request1103 = Test(1103, 'GET global.css').wrap(request1103)
>
> request1104 = HTTPRequest(url=url4, headers=headers5)
> request1104 = Test(1104, 'GET banner_left.jpg').wrap(request1104)
>
> request1105 = HTTPRequest(url=url4, headers=headers5)
> request1105 = Test(1105, 'GET banner_right.jpg').wrap(request1105)
>
> request1201 = HTTPRequest(url=url4, headers=headers5)
> request1201 = Test(1201, 'GET fill.gif').wrap(request1201)
>
> request1202 = HTTPRequest(url=url4, headers=headers5)
> request1202 = Test(1202, 'GET fill.gif').wrap(request1202)
>
> request1203 = HTTPRequest(url=url4, headers=headers5)
> request1203 = Test(1203, 'GET dashline.gif').wrap(request1203)
>
> request1301 = HTTPRequest(url=url4, headers=headers6)
> request1301 = Test(1301, 'POST j_security_check').wrap(request1301)
>
> request1302 = HTTPRequest(url=url4, headers=headers6)
> request1302 = Test(1302, 'GET /').wrap(request1302)
>
>
>
> <snip>
>
>
>
> class TestRunner:
> """A TestRunner instance is created for each worker thread."""
>
>
>
> # A method for each recorded page.
>
>
>
> <snip>
>
>
>
> def page11(self):
> """GET system (requests 1101-1105)."""
>
> # Expecting 302 'Found'
> result = request1101.GET('/system')
> # uristring = result.getEffectiveURI().toExternalForm()
> # grinder.logger.output("uristring1 %s" % uristring)
> # uristring.substring(lastIndexOf("jsessionid= ")+11,
> uristring.length())
> # grinder.logger.output("uristring2 %s" % uristring)
> # grinder.logger.output("sessionID %s" % sessionID)
>
> grinder.sleep(31)
> request1102.GET('/system/')
>
> grinder.sleep(46)
> request1103.GET('/system/css/global.css')
>
> grinder.sleep(31)
> request1104.GET('/system/gifs/banner_left.jpg')
>
> grinder.sleep(78)
> request1105.GET('/system/gifs/banner_right.jpg')
>
> return result
>
>
>
> def page12(self):
> """GET fill.gif (requests 1201-1203)."""
>
> self.token_jsessionid = \
> 'C00D3980D51E2A5DBFCDDC7D70629856.systemuatappsystem'
> result = request1201.GET('/system/gifs/fill.gif;jsessionid=' +
> self.token_jsessionid)
>
> grinder.sleep(47)
> request1202.GET('/system/gifs/fill.gif')
>
> request1203.GET('/system/gifs/dashline.gif')
>
> return result
>
>
>
> def page13(self):
> """POST j_security_check (requests 1301-1302)."""
>
> # Get the Agent number and Thread number to create the username
> # Lagent = getAgentNumber()
> # Lthread = getThreadNumber()
> # username = 'LoadTest' & getAgentNumber() & getThreadNumber()
> # t.readline()
> username = (t.readline())
> # password = t[1]
> grinder.logger.output("The username is %s" % username)
> # grinder.logger.output("The username is %s" % username)
>
> # Expecting 302 'Moved Temporarily'
> result = request1301.POST('/system/j_security_check',
> ( NVPair('j_username', 'loadtest1_0_0'),
> NVPair('j_password', 'password1'),
> NVPair('SubmitButton', 'Submit'), ),
> ( NVPair('Content-Type', 'application/x-www-form-urlencoded'), ))
>
> grinder.sleep(32)
> request1302.GET('/system/')
>
> return result
>
>
>
> <snip>
>
>
>
> def __call__(self):
> """This method is called for every run performed by the worker
> thread."""
>
> <snip>
>
>
>
> grinder.sleep(12736)
> self.page11() # GET system (requests 1101-1105)
> self.page12() # GET fill.gif (requests 1201-1203)
>
> grinder.sleep(17204)
> self.page13() # POST j_security_check (requests 1301-1302)
>
>
>
> <snip>
>
>
>
> I think the response from page 11 is where the server feeds back the
> session ID which is than used in page 12.
>
>
>
> Thanks in advance for any assistance.
>
>
>
> Tom Johnson
>


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
grinder-use mailing list
grinder-use@...
https://lists.sourceforge.net/lists/listinfo/grinder-use

Re: Scripting help with JSESSIONID

by Philip Aston-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message


Before going further, I strongly advise using the TCPProxy in echo mode
and comparing the interaction of a browser with the server with that
produced by The Grinder. The FAQ I referred to has details of how to do
this.

Your coding problem is that you are expecting urlstring to be a
java.lang.String, whereas its actually a Python string (so doesn't
understand .substring). You can fix this by saying:

from java.lang import String

and

uristring = String(result.getEffectiveURI().toExternalForm())

At which point you'll find the second error. (Hint, lastIndexOf is a
method, not a standalone function).

- Phil

Tom Johnson wrote:

>
> Hello Phil and everybody,
>
>  
>
>    Well, I tried a couple of different things based on Phil's reply
> but I am still getting the 408's.
>
>  
>
>    Here is waht all I tried:
>
>  
>
>       The first thing I tried was to comment out the following from
> under the def __call__(self): section
>
>  
>
>          self.page12() # GET fill.gif (requests 1201-1203)
>
>  
>
>                * Result was still 408's on all the request1301's
>
>  
>
>       My second attempt I commented out the following code under the
> def page12(self): section (I did uncomment the code from above)
>
>  
>
>          self.token_jsessionid = \
>             'C00D3980D51E2A5DBFCDDC7D70629856.systemuatappsystem'
>          result = request1201.GET('/system/gifs/fill.gif;jsessionid=' +
>             self.token_jsessionid)
>
>  
>
>                * This of course gave me a nasty little no return error
> since I had commented out the result line
>
>       My third attempt I commented out the following code under the
> def page12(self): section again and added a new line
>
>  
>
>          # self.token_jsessionid = \
>          #    'C00D3980D51E2A5DBFCDDC7D70629856.systemuatappsystem'
>          # result = request1201.GET('/system/gifs/fill.gif;jsessionid=' +
>          #    self.token_jsessionid)
>
>          result = request1201.GET('/system/gifs/fill.gif')
>
>  
>
>                * Result was still 408's on all the request1301's
>
>  
>
>    I did go to the noted link and read everything there but I did not
> glean any new insights from the page. I am thinking that I need to
> take the code that is commented out under the def page11(self):
> section and use it either where it is or move it to the def
> page12(self): section before the JSESSIONID call in order to get what
> I needed. The unfortunate part is that I am not very Python/Jython
> literate yet. Any more ideas or help is greatly appreciated. Here is
> the code I am refering to:
>
>  
>
>       uristring = result.getEffectiveURI().toExternalForm()
>       grinder.logger.output("uristring1 %s" % uristring)
>       uristring.substring(lastIndexOf("jsessionid= ")+11,
> uristring.length())
>       grinder.logger.output("uristring2 %s" % uristring)
>       grinder.logger.output("sessionID %s" % sessionID)
>
>    I am unfortunately getting a NameError on the lastIndexOf line (3rd
> line). The logging lines are purely to see what is coming out for each
> part. The uristring1 is giving me http://oursite/oursystem and am
> suspecting there should be more coming back?
>
>  
>
> Again, any help is very much appreciated,
>
>  
>
> Tom Johnson
>
>  
>
> ------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Phil wrote:
>
> The Grinder's cookie handling is pretty solid. But the server doesn't
> know that cookies are supported until it has received one back from The
> Grinder. I wonder whether the "stale" jsession ID provided in the URL
> for page 12 is causing problems. As a quick check, try commenting out
> the page12() call, or editing it not to supply the jsessionid parameter
> (the grinder will be supplying it in a cookie anyway).
>
> Also, a 408 is a pretty weird response for "unknown session".
>
> If you are still having problems, follow this FAQ -
> http://grinder.sourceforge.net/faq.html#use-the-tcpproxy
>
> - Phil
>
>
> Tom Johnson wrote:
> >
> > Hello,
> >
> >
> >
> > I am fairly new to grinder but not new to automated load testing
> > tools (several years experience with LoadRunner). I am working with
> > Grinder 3 and have hit a snag with what I believe to be an issue with
> > a JSESSIONID in my script. When I run the script, it gets to the login
> > and I get a 408 repsonse timeout and the only thing that makes sense
> > is that Grinder is not doing a good job with the session cookie. I
> > have researched through the listgroup and gleaned some code out to
> > access the cookies but am am coming up short on exactly how to code it
> > and where exactly to put the code. I have copied the key parts of the
> > script where it handles the session cookie and follows with the login.
> > As you can see in the code by stuff I have commented out that I have
> > attempted some of the suggestions. Can anybody shed some light on how
> > to properly capture the JSESSIONID and plug it back in? Here is my
> script:
> >
> >
> >
> >
> > # The Grinder 3.2
> > # HTTP script recorded by TCPProxy at Oct 25, 2009 6:17:35 AM
> >
> >
> >
> > from net.grinder.script import Test
> > from net.grinder.script.Grinder import grinder
> > from net.grinder.plugin.http import HTTPPluginControl, HTTPRequest
> > from HTTPClient import Cookie, CookieModule, CookiePolicyHandler
> > from HTTPClient import NVPair
> > connectionDefaults = HTTPPluginControl.getConnectionDefaults()
> > httpUtilities = HTTPPluginControl.getHTTPUtilities()
> >
> >
> >
> > # To use a proxy server, uncomment the next line and set the host and
> > port.
> > # connectionDefaults.setProxyServer("localhost", 8001)
> >
> >
> >
> > # These definitions at the top level of the file are evaluated once,
> > # when the worker process is started.
> >
> >
> >
> > connectionDefaults.defaultHeaders = \
> > ( NVPair('User-Agent', 'Mozilla/4.0 (compatible; MSIE 6.0; Windows
> > NT 5.1; SV1; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR
> > 3.5.30729)'),
> > NVPair('Accept-Language', 'en-us'), )
> >
> >
> >
> > <snip>
> >
> >
> >
> > headers4= \
> > ( NVPair('Accept', 'image/gif, image/x-xbitmap, image/jpeg,
> > image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel,
> > application/vnd.ms-powerpoint, application/msword,
> > application/x-ms-application, application/x-ms-xbap,
> > application/vnd.ms-xpsdocument, application/xaml+xml, */*'), )
> >
> > headers5= \
> > ( NVPair('Accept', '*/*'),
> > NVPair('Referer', 'http://site/system/' <http://site/system/%27>), )
> >
> > headers6= \
> > ( NVPair('Accept', 'image/gif, image/x-xbitmap, image/jpeg,
> > image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel,
> > application/vnd.ms-powerpoint, application/msword,
> > application/x-ms-application, application/x-ms-xbap,
> > application/vnd.ms-xpsdocument, application/xaml+xml, */*'),
> > NVPair('Referer', 'http://site/system/' <http://site/system/%27>), )
> >
> >
> >
> > <snip>
> >
> >
> >
> > url4 = 'http://site:80' <http://site:80%27/>
> >
> >
> >
> > # Open the login file
> > t = open("c:\grinder\logins.txt",'r')
> >
> >
> >
> > # Create an HTTPRequest for each request, then replace the
> > # reference to the HTTPRequest with an instrumented version.
> > # You can access the unadorned instance using request101.__target__.
> >
> >
> >
> > <snip>
> >
> >
> >
> > request1101 = HTTPRequest(url=url4, headers=headers4)
> > request1101 = Test(1101, 'GET system').wrap(request1101)
> >
> > request1102 = HTTPRequest(url=url4, headers=headers4)
> > request1102 = Test(1102, 'GET /').wrap(request1102)
> >
> > request1103 = HTTPRequest(url=url4, headers=headers5)
> > request1103 = Test(1103, 'GET global.css').wrap(request1103)
> >
> > request1104 = HTTPRequest(url=url4, headers=headers5)
> > request1104 = Test(1104, 'GET banner_left.jpg').wrap(request1104)
> >
> > request1105 = HTTPRequest(url=url4, headers=headers5)
> > request1105 = Test(1105, 'GET banner_right.jpg').wrap(request1105)
> >
> > request1201 = HTTPRequest(url=url4, headers=headers5)
> > request1201 = Test(1201, 'GET fill.gif').wrap(request1201)
> >
> > request1202 = HTTPRequest(url=url4, headers=headers5)
> > request1202 = Test(1202, 'GET fill.gif').wrap(request1202)
> >
> > request1203 = HTTPRequest(url=url4, headers=headers5)
> > request1203 = Test(1203, 'GET dashline.gif').wrap(request1203)
> >
> > request1301 = HTTPRequest(url=url4, headers=headers6)
> > request1301 = Test(1301, 'POST j_security_check').wrap(request1301)
> >
> > request1302 = HTTPRequest(url=url4, headers=headers6)
> > request1302 = Test(1302, 'GET /').wrap(request1302)
> >
> >
> >
> > <snip>
> >
> >
> >
> > class TestRunner:
> > """A TestRunner instance is created for each worker thread."""
> >
> >
> >
> > # A method for each recorded page.
> >
> >
> >
> > <snip>
> >
> >
> >
> > def page11(self):
> > """GET system (requests 1101-1105)."""
> >
> > # Expecting 302 'Found'
> > result = request1101.GET('/system')
> > # uristring = result.getEffectiveURI().toExternalForm()
> > # grinder.logger.output("uristring1 %s" % uristring)
> > # uristring.substring(lastIndexOf("jsessionid= ")+11,
> > uristring.length())
> > # grinder.logger.output("uristring2 %s" % uristring)
> > # grinder.logger.output("sessionID %s" % sessionID)
> >
> > grinder.sleep(31)
> > request1102.GET('/system/')
> >
> > grinder.sleep(46)
> > request1103.GET('/system/css/global.css')
> >
> > grinder.sleep(31)
> > request1104.GET('/system/gifs/banner_left.jpg')
> >
> > grinder.sleep(78)
> > request1105.GET('/system/gifs/banner_right.jpg')
> >
> > return result
> >
> >
> >
> > def page12(self):
> > """GET fill.gif (requests 1201-1203)."""
> >
> > self.token_jsessionid = \
> > 'C00D3980D51E2A5DBFCDDC7D70629856.systemuatappsystem'
> > result = request1201.GET('/system/gifs/fill.gif;jsessionid=' +
> > self.token_jsessionid)
> >
> > grinder.sleep(47)
> > request1202.GET('/system/gifs/fill.gif')
> >
> > request1203.GET('/system/gifs/dashline.gif')
> >
> > return result
> >
> >
> >
> > def page13(self):
> > """POST j_security_check (requests 1301-1302)."""
> >
> > # Get the Agent number and Thread number to create the username
> > # Lagent = getAgentNumber()
> > # Lthread = getThreadNumber()
> > # username = 'LoadTest' & getAgentNumber() & getThreadNumber()
> > # t.readline()
> > username = (t.readline())
> > # password = t[1]
> > grinder.logger.output("The username is %s" % username)
> > # grinder.logger.output("The username is %s" % username)
> >
> > # Expecting 302 'Moved Temporarily'
> > result = request1301.POST('/system/j_security_check',
> > ( NVPair('j_username', 'loadtest1_0_0'),
> > NVPair('j_password', 'password1'),
> > NVPair('SubmitButton', 'Submit'), ),
> > ( NVPair('Content-Type', 'application/x-www-form-urlencoded'), ))
> >
> > grinder.sleep(32)
> > request1302.GET('/system/')
> >
> > return result
> >
> >
> >
> > <snip>
> >
> >
> >
> > def __call__(self):
> > """This method is called for every run performed by the worker
> > thread."""
> >
> > <snip>
> >
> >
> >
> > grinder.sleep(12736)
> > self.page11() # GET system (requests 1101-1105)
> > self.page12() # GET fill.gif (requests 1201-1203)
> >
> > grinder.sleep(17204)
> > self.page13() # POST j_security_check (requests 1301-1302)
> >
> >
> >
> > <snip>
> >
> >
> >
> > I think the response from page 11 is where the server feeds back the
> > session ID which is than used in page 12.
> >
> >
> >
> > Thanks in advance for any assistance.
> >
> >
> >
> > Tom Johnson
> >
>


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
grinder-use mailing list
grinder-use@...
https://lists.sourceforge.net/lists/listinfo/grinder-use

Re: Scripting help with JSESSIONID

by anil_jacob :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Some parts of this message have been removed. Learn more about Nabble's security policy.
I don't know if this thread is still active/answered, however here is how I retrieved the JSESSIONID

 value = str(CookieModule.listAllCookies(HTTPPluginControl.getThreadHTTPClientContext()).pop(0)).lstrip('JSESSIONID=').split(';')[0]

Anil


----- Original Message -----
From: "Philip Aston" <philip.aston@...>
To: "grinder-use" <grinder-use@...>
Sent: Monday, November 2, 2009 12:39:22 PM GMT -08:00 US/Canada Pacific
Subject: Re: [Grinder-use] Scripting help with JSESSIONID


Before going further, I strongly advise using the TCPProxy in echo mode
and comparing the interaction of a browser with the server with that
produced by The Grinder. The FAQ I referred to has details of how to do
this.

Your coding problem is that you are expecting urlstring to be a
java.lang.String, whereas its actually a Python string (so doesn't
understand .substring). You can fix this by saying:

from java.lang import String

and

uristring = String(result.getEffectiveURI().toExternalForm())

At which point you'll find the second error. (Hint, lastIndexOf is a
method, not a standalone function).

- Phil

Tom Johnson wrote:

>
> Hello Phil and everybody,
>
>  
>
>    Well, I tried a couple of different things based on Phil's reply
> but I am still getting the 408's.
>
>  
>
>    Here is waht all I tried:
>
>  
>
>       The first thing I tried was to comment out the following from
> under the def __call__(self): section
>
>  
>
>          self.page12() # GET fill.gif (requests 1201-1203)
>
>  
>
>                * Result was still 408's on all the request1301's
>
>  
>
>       My second attempt I commented out the following code under the
> def page12(self): section (I did uncomment the code from above)
>
>  
>
>          self.token_jsessionid = \
>             'C00D3980D51E2A5DBFCDDC7D70629856.systemuatappsystem'
>          result = request1201.GET('/system/gifs/fill.gif;jsessionid=' +
>             self.token_jsessionid)
>
>  
>
>                * This of course gave me a nasty little no return error
> since I had commented out the result line
>
>       My third attempt I commented out the following code under the
> def page12(self): section again and added a new line
>
>  
>
>          # self.token_jsessionid = \
>          #    'C00D3980D51E2A5DBFCDDC7D70629856.systemuatappsystem'
>          # result = request1201.GET('/system/gifs/fill.gif;jsessionid=' +
>          #    self.token_jsessionid)
>
>          result = request1201.GET('/system/gifs/fill.gif')
>
>  
>
>                * Result was still 408's on all the request1301's
>
>  
>
>    I did go to the noted link and read everything there but I did not
> glean any new insights from the page. I am thinking that I need to
> take the code that is commented out under the def page11(self):
> section and use it either where it is or move it to the def
> page12(self): section before the JSESSIONID call in order to get what
> I needed. The unfortunate part is that I am not very Python/Jython
> literate yet. Any more ideas or help is greatly appreciated. Here is
> the code I am refering to:
>
>  
>
>       uristring = result.getEffectiveURI().toExternalForm()
>       grinder.logger.output("uristring1 %s" % uristring)
>       uristring.substring(lastIndexOf("jsessionid= ")+11,
> uristring.length())
>       grinder.logger.output("uristring2 %s" % uristring)
>       grinder.logger.output("sessionID %s" % sessionID)
>
>    I am unfortunately getting a NameError on the lastIndexOf line (3rd
> line). The logging lines are purely to see what is coming out for each
> part. The uristring1 is giving me http://oursite/oursystem and am
> suspecting there should be more coming back?
>
>  
>
> Again, any help is very much appreciated,
>
>  
>
> Tom Johnson
>
>  
>
> ------------------------------------------------------------------------------------------------------------------------------------------------------------
>
> Phil wrote:
>
> The Grinder's cookie handling is pretty solid. But the server doesn't
> know that cookies are supported until it has received one back from The
> Grinder. I wonder whether the "stale" jsession ID provided in the URL
> for page 12 is causing problems. As a quick check, try commenting out
> the page12() call, or editing it not to supply the jsessionid parameter
> (the grinder will be supplying it in a cookie anyway).
>
> Also, a 408 is a pretty weird response for "unknown session".
>
> If you are still having problems, follow this FAQ -
> http://grinder.sourceforge.net/faq.html#use-the-tcpproxy
>
> - Phil
>
>
> Tom Johnson wrote:
> >
> > Hello,
> >
> >
> >
> > I am fairly new to grinder but not new to automated load testing
> > tools (several years experience with LoadRunner). I am working with
> > Grinder 3 and have hit a snag with what I believe to be an issue with
> > a JSESSIONID in my script. When I run the script, it gets to the login
> > and I get a 408 repsonse timeout and the only thing that makes sense
> > is that Grinder is not doing a good job with the session cookie. I
> > have researched through the listgroup and gleaned some code out to
> > access the cookies but am am coming up short on exactly how to code it
> > and where exactly to put the code. I have copied the key parts of the
> > script where it handles the session cookie and follows with the login.
> > As you can see in the code by stuff I have commented out that I have
> > attempted some of the suggestions. Can anybody shed some light on how
> > to properly capture the JSESSIONID and plug it back in? Here is my
> script:
> >
> >
> >
> >
> > # The Grinder 3.2
> > # HTTP script recorded by TCPProxy at Oct 25, 2009 6:17:35 AM
> >
> >
> >
> > from net.grinder.script import Test
> > from net.grinder.script.Grinder import grinder
> > from net.grinder.plugin.http import HTTPPluginControl, HTTPRequest
> > from HTTPClient import Cookie, CookieModule, CookiePolicyHandler
> > from HTTPClient import NVPair
> > connectionDefaults = HTTPPluginControl.getConnectionDefaults()
> > httpUtilities = HTTPPluginControl.getHTTPUtilities()
> >
> >
> >
> > # To use a proxy server, uncomment the next line and set the host and
> > port.
> > # connectionDefaults.setProxyServer("localhost", 8001)
> >
> >
> >
> > # These definitions at the top level of the file are evaluated once,
> > # when the worker process is started.
> >
> >
> >
> > connectionDefaults.defaultHeaders = \
> > ( NVPair('User-Agent', 'Mozilla/4.0 (compatible; MSIE 6.0; Windows
> > NT 5.1; SV1; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR
> > 3.5.30729)'),
> > NVPair('Accept-Language', 'en-us'), )
> >
> >
> >
> > <snip>
> >
> >
> >
> > headers4= \
> > ( NVPair('Accept', 'image/gif, image/x-xbitmap, image/jpeg,
> > image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel,
> > application/vnd.ms-powerpoint, application/msword,
> > application/x-ms-application, application/x-ms-xbap,
> > application/vnd.ms-xpsdocument, application/xaml+xml, */*'), )
> >
> > headers5= \
> > ( NVPair('Accept', '*/*'),
> > NVPair('Referer', 'http://site/system/' <http://site/system/%27>), )
> >
> > headers6= \
> > ( NVPair('Accept', 'image/gif, image/x-xbitmap, image/jpeg,
> > image/pjpeg, application/x-shockwave-flash, application/vnd.ms-excel,
> > application/vnd.ms-powerpoint, application/msword,
> > application/x-ms-application, application/x-ms-xbap,
> > application/vnd.ms-xpsdocument, application/xaml+xml, */*'),
> > NVPair('Referer', 'http://site/system/' <http://site/system/%27>), )
> >
> >
> >
> > <snip>
> >
> >
> >
> > url4 = 'http://site:80' <http://site:80%27/>
> >
> >
> >
> > # Open the login file
> > t = open("c:\grinder\logins.txt",'r')
> >
> >
> >
> > # Create an HTTPRequest for each request, then replace the
> > # reference to the HTTPRequest with an instrumented version.
> > # You can access the unadorned instance using request101.__target__.
> >
> >
> >
> > <snip>
> >
> >
> >
> > request1101 = HTTPRequest(url=url4, headers=headers4)
> > request1101 = Test(1101, 'GET system').wrap(request1101)
> >
> > request1102 = HTTPRequest(url=url4, headers=headers4)
> > request1102 = Test(1102, 'GET /').wrap(request1102)
> >
> > request1103 = HTTPRequest(url=url4, headers=headers5)
> > request1103 = Test(1103, 'GET global.css').wrap(request1103)
> >
> > request1104 = HTTPRequest(url=url4, headers=headers5)
> > request1104 = Test(1104, 'GET banner_left.jpg').wrap(request1104)
> >
> > request1105 = HTTPRequest(url=url4, headers=headers5)
> > request1105 = Test(1105, 'GET banner_right.jpg').wrap(request1105)
> >
> > request1201 = HTTPRequest(url=url4, headers=headers5)
> > request1201 = Test(1201, 'GET fill.gif').wrap(request1201)
> >
> > request1202 = HTTPRequest(url=url4, headers=headers5)
> > request1202 = Test(1202, 'GET fill.gif').wrap(request1202)
> >
> > request1203 = HTTPRequest(url=url4, headers=headers5)
> > request1203 = Test(1203, 'GET dashline.gif').wrap(request1203)
> >
> > request1301 = HTTPRequest(url=url4, headers=headers6)
> > request1301 = Test(1301, 'POST j_security_check').wrap(request1301)
> >
> > request1302 = HTTPRequest(url=url4, headers=headers6)
> > request1302 = Test(1302, 'GET /').wrap(request1302)
> >
> >
> >
> > <snip>
> >
> >
> >
> > class TestRunner:
> > """A TestRunner instance is created for each worker thread."""
> >
> >
> >
> > # A method for each recorded page.
> >
> >
> >
> > <snip>
> >
> >
> >
> > def page11(self):
> > """GET system (requests 1101-1105)."""
> >
> > # Expecting 302 'Found'
> > result = request1101.GET('/system')
> > # uristring = result.getEffectiveURI().toExternalForm()
> > # grinder.logger.output("uristring1 %s" % uristring)
> > # uristring.substring(lastIndexOf("jsessionid= ")+11,
> > uristring.length())
> > # grinder.logger.output("uristring2 %s" % uristring)
> > # grinder.logger.output("sessionID %s" % sessionID)
> >
> > grinder.sleep(31)
> > request1102.GET('/system/')
> >
> > grinder.sleep(46)
> > request1103.GET('/system/css/global.css')
> >
> > grinder.sleep(31)
> > request1104.GET('/system/gifs/banner_left.jpg')
> >
> > grinder.sleep(78)
> > request1105.GET('/system/gifs/banner_right.jpg')
> >
> > return result
> >
> >
> >
> > def page12(self):
> > """GET fill.gif (requests 1201-1203)."""
> >
> > self.token_jsessionid = \
> > 'C00D3980D51E2A5DBFCDDC7D70629856.systemuatappsystem'
> > result = request1201.GET('/system/gifs/fill.gif;jsessionid=' +
> > self.token_jsessionid)
> >
> > grinder.sleep(47)
> > request1202.GET('/system/gifs/fill.gif')
> >
> > request1203.GET('/system/gifs/dashline.gif')
> >
> > return result
> >
> >
> >
> > def page13(self):
> > """POST j_security_check (requests 1301-1302)."""
> >
> > # Get the Agent number and Thread number to create the username
> > # Lagent = getAgentNumber()
> > # Lthread = getThreadNumber()
> > # username = 'LoadTest' & getAgentNumber() & getThreadNumber()
> > # t.readline()
> > username = (t.readline())
> > # password = t[1]
> > grinder.logger.output("The username is %s" % username)
> > # grinder.logger.output("The username is %s" % username)
> >
> > # Expecting 302 'Moved Temporarily'
> > result = request1301.POST('/system/j_security_check',
> > ( NVPair('j_username', 'loadtest1_0_0'),
> > NVPair('j_password', 'password1'),
> > NVPair('SubmitButton', 'Submit'), ),
> > ( NVPair('Content-Type', 'application/x-www-form-urlencoded'), ))
> >
> > grinder.sleep(32)
> > request1302.GET('/system/')
> >
> > return result
> >
> >
> >
> > <snip>
> >
> >
> >
> > def __call__(self):
> > """This method is called for every run performed by the worker
> > thread."""
> >
> > <snip>
> >
> >
> >
> > grinder.sleep(12736)
> > self.page11() # GET system (requests 1101-1105)
> > self.page12() # GET fill.gif (requests 1201-1203)
> >
> > grinder.sleep(17204)
> > self.page13() # POST j_security_check (requests 1301-1302)
> >
> >
> >
> > <snip>
> >
> >
> >
> > I think the response from page 11 is where the server feeds back the
> > session ID which is than used in page 12.
> >
> >
> >
> > Thanks in advance for any assistance.
> >
> >
> >
> > Tom Johnson
> >
>


------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
grinder-use mailing list
grinder-use@...
https://lists.sourceforge.net/lists/listinfo/grinder-use

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day
trial. Simplify your report design, integration and deployment - and focus on
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
grinder-use mailing list
grinder-use@...
https://lists.sourceforge.net/lists/listinfo/grinder-use