[ptt-users] HTTP params in agentbase script
Geoff Meakin
geoffm at gamesys.co.uk
Fri Dec 1 01:59:31 PST 2006
I've worked out your problem
your lines should read
self.params=
and not
self=params=
the second version will do nothing so your params will be the same as before
Didnt spot that the first time round!
hope that helps
Cheers
-Geoff
-----Original Message-----
From: users-bounces at lists.pushtotest.com on behalf of Mark.Lutton at thomson.com
Sent: Thu 30/11/2006 18:12
To: users at lists.pushtotest.com
Subject: FW: [ptt-users] HTTP params in agentbase script
Thanks for the help. The results of the test are even stranger.
Here is the beginning of the test, interspersed with Tomcat's localhost_access_log output:
self.params = [ [ '''test''', '''maker''' ] ]
self.get( ''http://localhost:8080/tomcat.gif''', self.params)
"GET /tomcat.gif?test=maker HTTP/1.1"
self=params = [ [ '''start''', '''true''' ], [ '''foo''', '''bar''' ] ]
self.get( '''http://localhost:8080/myApp/quickStartFake.do''', self.params)
"GET /myApp/quickStartFakeSession.do?start=true&foo=bar HTTP/1.1"
"GET /myApp/images/MyAppFake.gif HTTP/1.1"
"GET /myApp/images/app_logo_sm.gif HTTP/1.1"
self.params = [ ]
self.get( '''http://localhost:8080/myApp''' )
self.get( '''http://localhost:8080/myApp/''' )
"GET /myApp/?start=true&foo=bar HTTP/1.1"
self.get( '''http://localhost:8080/myApp/index2.jsp''' )
"GET /myApp/index2.jsp?start=true&foo=bar HTTP/1.1"
self.get( '''http://localhost:8080/myApp/appFramer.do''' )
"GET /myApp/appFramer.do?start=true&foo=bar HTTP/1.1"
self.params = [ [ '''userName''', '''manager''' ], [ '''password''', '''manager''' ], [ '''submit''', '''Logon''' ] ]
self.post( '''http://localhost:8080/myApp/logon.do''', self.params)
"POST /myApp/logon.do?start=true&foo=bar HTTP/1.1"
I have to assume the Tomcat log shows the request exactly as it is received, so the problem is on the client side.
If I change the quickStart to a POST, I get this:
self.params = [ [ '''test''', '''maker''' ] ]
self.get( ''http://localhost:8080/tomcat.gif''', self.params)
"GET /tomcat.gif?test=maker HTTP/1.1"
self=params = [ [ '''start''', '''true''' ], [ '''foo''', '''bar''' ] ]
self.post( '''http://localhost:8080/myApp/quickStartFake.do''', self.params)
"POST /myApp/quickStartFakeSession.do?test=maker HTTP/1.1"
Why are the parameters put into the query line for a GET but not for a POST? GET and POST both allow for a query line and for parameters. (GET and POST should work identically. The only difference between them is a semantic detail. GET requests are supposed to have no side effects; POST requests are assumed to have side effects. On Windows I have a shortcut to http://localhost:8080/myApp/quickStartFake.do?start=true which does a GET (I don't think a shortcut can do a POST) so this is a rare case of a GET with a side effect.)
I can solve my problem for this script by using a POST, but I would like to understand what is going on here. Otherwise, the queries I construct in the script are not going to match the queries seen in production.
Mark Lutton
Business Intelligence Services, a Thomson Business
________________________________
From: users-bounces at lists.pushtotest.com on behalf of Geoff Meakin
Sent: Thu 11/30/2006 5:15 AM
To: TestMaker users list
Subject: RE: [ptt-users] HTTP params in agentbase script
I suggest you don't use that format, but the first format
self.params = [ [ '''start''', '''true''' ] ]
self.get('''http://localhost:8080/myApp/quickStartFake.do''')
Hopefully this will help?
Cheers
-Geoff
-----Original Message-----
From: users-bounces at lists.pushtotest.com
[mailto:users-bounces at lists.pushtotest.com] On Behalf Of
Mark.Lutton at thomson.com
Sent: 30 November 2006 01:20
To: users at lists.pushtotest.com
Subject: [ptt-users] HTTP params in agentbase script
Hello!
I'm just beginning to use TestMaker and I have a problem that I don't
understand. (TestMaker 4.4; Tomcat 5.0.28 on the server side.)
I used the Recorder to create a script. This has a number of self.get()
statements in it.
Here is part of the script:
self.params = [ [ '''userName''', '''manager''' ], ['''password''',
'''manager''' ], [ '''submit''', '''Logon''' ] ]
self.post( '''http://localhost:8080/myApp/logon.do''', self.params)
On the server side I have the application print the parameters from the
HTTP request:
Logon: parameter: password=manager
Logon: parameter: submit=Logon
Logon: parameter: userName=manager
My application has a "magic URL" which, if called as the very first
request on start up, sets it to a local test mode. So I added the
following to the script before any other self.get or self.post:
self.get('''http://localhost:8080/myApp/quickStartFake.do?start=true''')
This is followed by several other get's and then the post as seen above.
But now here's what happens in the logon request:
Logon: parameter: password=manager
Logon: parameter: submit=Logon
Logon: parameter: userName=manager
Logon: parameter: start=true
It should still have only the three parameters password, submit and
userName. I don't think the problem is on the server side. The
parameter is not cached, and it's not being put into the request by the
application. I can't force this to happen from the browser.
Here is what I see in the Tomcat log. In the first case (no
quickStartFake):
"POST /myApp/logon.do HTTP/1.1"
"GET /myApp/managerConsole.do HTTP/1.1" etc.
In the second case:
"GET /myApp/quickStartFake.do?start=true HTTP/1.1"
"POST /myApp/logon.do?start=true HTTP/1.1"
"GET /myApp/managerConsole.do?start=true HTTP/1.1" etc.
It appears that the query parameter is extracted from the first get and
appended to each succeeding get or post. I can't see how this is
happening in agentbase.py, or any way to fix this.
Can anyone explain what is happening? Thanks.
Mark Lutton
Business Intelligence Services, a Thomson Business
_______________________________________________
Users mailing list
Users at lists.pushtotest.com
http://lists.pushtotest.com/mailman/listinfo/users
_______________________________________________
Users mailing list
Users at lists.pushtotest.com
http://lists.pushtotest.com/mailman/listinfo/users
_______________________________________________
Users mailing list
Users at lists.pushtotest.com
http://lists.pushtotest.com/mailman/listinfo/users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://cake.pushtotest.com/pipermail/users/attachments/20061201/7de79a52/attachment-0001.htm
More information about the Users
mailing list