[Webtest] Basic authentication
ben.nisbet@bt.com
ben.nisbet@bt.com
Tue, 7 Aug 2007 11:31:08 +0100
This is a multi-part message in MIME format.
------_=_NextPart_001_01C7D8DE.11390A74
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
I've been tasked with choosing an automated web testng tool for our
application and had WebTest
recommended to me but haven't yet had any success as we're using basic
http authentication for logging in.
I have set up the correct username and password as attributes of the
invoke step but receive a MalformedChallengeException. :-
INFO (com.canoo.webtest.ant.WebtestTask) - Starting webtest "myTest"
(D:\webtest\simple-test.xml:17: )
INFO (com.canoo.webtest.ant.WebtestTask) - Canoo Webtest: R_1594.
INFO (com.canoo.webtest.engine.Configuration) - Creating result
directory: D:\webtest\webtest-results
INFO (com.canoo.webtest.engine.Configuration) - Surfing with browser
Mozilla/4.0 (compatible; MSIE 6.0b; Windows 98)
INFO (com.canoo.webtest.steps.Step) - >>>> Start Step: steps (1/2)
INFO (com.canoo.webtest.steps.Step) - >>>> Start Step: invoke "Get the
page" (1/2)
INFO (com.canoo.webtest.steps.request.AbstractTargetAction) - ->
gotoTarget by URL:
http://localhost:7001/ros.bops.presentation.ui/ros/bops/presentation/ui/
workflow/pageflows/begin.do
INFO (com.canoo.webtest.steps.request.TargetHelper) - getting response
for url:
http://localhost:7001/ros.bops.presentation.ui/ros/bops/presentation/ui/
workflow/pageflows/begin.do
INFO (com.canoo.webtest.steps.request.TargetHelper) - Setting password
for username: Bops_admin
INFO (org.apache.commons.httpclient.auth.AuthChallengeProcessor) -
basic authentication scheme selected
ERROR (org.apache.commons.httpclient.HttpMethodDirector) - Invalid
challenge: Basic
org.apache.commons.httpclient.auth.MalformedChallengeException: Invalid
challenge: Basic
at
org.apache.commons.httpclient.auth.AuthChallengeParser.extractParams(Aut
hChallengeParser.java:97)
at
org.apache.commons.httpclient.auth.RFC2617Scheme.processChallenge(RFC261
7Scheme.java:93)
at
org.apache.commons.httpclient.auth.BasicScheme.processChallenge(BasicSch
eme.java:111)
at
org.apache.commons.httpclient.auth.AuthChallengeProcessor.processChallen
ge(AuthChallengeProcessor.java:161)
at
org.apache.commons.httpclient.HttpMethodDirector.processWWWAuthChallenge
(HttpMethodDirector.java:689)
at
org.apache.commons.httpclient.HttpMethodDirector.processAuthenticationRe
sponse(HttpMethodDirector.java:663)
at
org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMetho
dDirector.java:192)
at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:3
96)
at
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:3
46)
at
com.gargoylesoftware.htmlunit.HttpWebConnection.getResponse(HttpWebConne
ction.java:126)
at
com.gargoylesoftware.htmlunit.WebClient.loadWebResponseFromWebConnection
(WebClient.java:1424)
at
com.gargoylesoftware.htmlunit.WebClient.loadWebResponse(WebClient.java:1
381)
at
com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:332)
at
com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:399)
at
com.canoo.webtest.steps.request.TargetHelper.getResponse(TargetHelper.ja
va:69)
at
com.canoo.webtest.steps.request.AbstractTargetAction.getResponse(Abstrac
tTargetAction.java:68)
at
com.canoo.webtest.steps.request.InvokePage.findTarget(InvokePage.java:13
4)
at
com.canoo.webtest.steps.request.AbstractTargetAction$1.call(AbstractTarg
etAction.java:108)
at
com.canoo.webtest.steps.request.TargetHelper.protectedGoto(TargetHelper.
java:88)
at
com.canoo.webtest.steps.request.AbstractTargetAction.gotoTarget(Abstract
TargetAction.java:106)
at
com.canoo.webtest.steps.request.AbstractTargetAction.doExecute(AbstractT
argetAction.java:78)
at com.canoo.webtest.steps.Step.execute(Step.java:104)
at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
at org.apache.tools.ant.Task.perform(Task.java:364)
at
com.canoo.webtest.ant.TestStepSequence.executeSteps(TestStepSequence.jav
a:43)
at
com.canoo.webtest.ant.TestStepSequence.doExecute(TestStepSequence.java:3
1)
at com.canoo.webtest.steps.Step.execute(Step.java:104)
at org.apache.tools.ant.Task.perform(Task.java:364)
at
com.canoo.webtest.ant.WebtestTask.execute(WebtestTask.java:164)
at
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)
at org.apache.tools.ant.Task.perform(Task.java:364)
at org.apache.tools.ant.Target.execute(Target.java:341)
at org.apache.tools.ant.Target.performTasks(Target.java:369)
at
org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)
at org.apache.tools.ant.Project.executeTarget(Project.java:1185)
at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecut
or.java:40)
at
org.apache.tools.ant.Project.executeTargets(Project.java:1068)
at org.apache.tools.ant.Main.runBuild(Main.java:668)
at org.apache.tools.ant.Main.startAnt(Main.java:187)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)
INFO (com.gargoylesoftware.htmlunit.WebClient) - statusCode=3D[401]
contentType=3D[text/html]
INFO (com.gargoylesoftware.htmlunit.WebClient) - <!DOCTYPE HTML PUBLIC
"-//W3C//DTD HTML 4.0 Draft//EN">
<HTML>
<HEAD>
<TITLE>Error 401--Unauthorized</TITLE>
<META NAME=3D"GENERATOR" CONTENT=3D"WebLogic Server">
</HEAD>
<BODY bgcolor=3D"white">
<FONT FACE=3DHelvetica><BR CLEAR=3Dall>
<TABLE border=3D0 cellspacing=3D5><TR><TD><BR CLEAR=3Dall>
<FONT FACE=3D"Helvetica" COLOR=3D"black" SIZE=3D"3"><H2>Error
401--Unauthorized</H2>
</FONT></TD></TR>
</TABLE>
<TABLE border=3D0 width=3D100% cellpadding=3D10><TR><TD VALIGN=3Dtop =
WIDTH=3D100%
BGCOLOR=3Dwhite><FONT FACE=3D"Courier New"><FONT FACE=3D"Helvetica"
SIZE=3D"3"><H3>From RFC 2068 <i>Hypertext Transfer Protocol --
HTTP/1.1</i>:</H3>
</FONT><FONT FACE=3D"Helvetica" SIZE=3D"3"><H4>10.4.2 401 =
Unauthorized</H4>
</FONT><P><FONT FACE=3D"Courier New">The request requires user
authentication. The response MUST include a WWW-Authenticate header
field (section 14.46) containing a challenge applicable to the requested
resource. The client MAY repeat the request with a suitable
Authorization header field (section 14.8). If the request already
included Authorization credentials, then the 401 response indicates that
authorization has been refused for those credentials. If the 401
response contains the same challenge as the prior response, and the user
agent has already attempted authentication at least once, then the user
SHOULD be presented the entity that was given in the response, since
that entity MAY include relevant diagnostic information. HTTP access
authentication is explained in section 11.</FONT></P>
</FONT></TD></TR>
</TABLE>
</BODY>
</HTML>
I've used a http header analyser to confirm the server response contains
the challenge header in the correct format.
Just wanted to check if anyone else had experienced a similar problem or
if there is another means for submitting the=20
username & password. Thanks,
Ben Nisbet
------_=_NextPart_001_01C7D8DE.11390A74
Content-Type: text/html;
charset="us-ascii"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
<HEAD>
<META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; =
charset=3Dus-ascii">
<META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version =
6.5.7652.24">
<TITLE>Basic authentication</TITLE>
</HEAD>
<BODY>
<!-- Converted from text/rtf format -->
<P><FONT SIZE=3D2 FACE=3D"Arial">I've been tasked with choosing an =
automated web testng tool for our application and had WebTest</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">recommended to me but haven't yet had =
any success as we're using basic http authentication for logging =
in.</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">I have set up the correct username and =
password as attributes of the invoke step but receive a =
MalformedChallengeException. :-</FONT></P>
<P><FONT SIZE=3D2 FACE=3D"Arial"> INFO =
(com.canoo.webtest.ant.WebtestTask) - Starting webtest =
"myTest" (D:\webtest\simple-test.xml:17: )</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial"> INFO =
(com.canoo.webtest.ant.WebtestTask) - Canoo Webtest: R_1594.</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial"> INFO =
(com.canoo.webtest.engine.Configuration) - Creating result directory: =
D:\webtest\webtest-results</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial"> INFO =
(com.canoo.webtest.engine.Configuration) - Surfing with browser =
Mozilla/4.0 (compatible; MSIE 6.0b; Windows 98)</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial"> INFO =
(com.canoo.webtest.steps.Step) - >>>> Start Step: steps =
(1/2)</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial"> INFO =
(com.canoo.webtest.steps.Step) - >>>> Start Step: invoke =
"Get the page" (1/2)</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial"> INFO =
(com.canoo.webtest.steps.request.AbstractTargetAction) - -> =
gotoTarget by URL: </FONT><A =
HREF=3D"http://localhost:7001/ros.bops.presentation.ui/ros/bops/presentat=
ion/ui/workflow/pageflows/begin.do"><U><FONT COLOR=3D"#0000FF" SIZE=3D2 =
FACE=3D"Arial">http://localhost:7001/ros.bops.presentation.ui/ros/bops/pr=
esentation/ui/workflow/pageflows/begin.do</FONT></U></A></P>
<P><FONT SIZE=3D2 FACE=3D"Arial"> INFO =
(com.canoo.webtest.steps.request.TargetHelper) - getting response for =
url: </FONT><A =
HREF=3D"http://localhost:7001/ros.bops.presentation.ui/ros/bops/presentat=
ion/ui/workflow/pageflows/begin.do"><U><FONT COLOR=3D"#0000FF" SIZE=3D2 =
FACE=3D"Arial">http://localhost:7001/ros.bops.presentation.ui/ros/bops/pr=
esentation/ui/workflow/pageflows/begin.do</FONT></U></A></P>
<P><FONT SIZE=3D2 FACE=3D"Arial"> INFO =
(com.canoo.webtest.steps.request.TargetHelper) - Setting password for =
username: Bops_admin</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial"> INFO =
(org.apache.commons.httpclient.auth.AuthChallengeProcessor) - basic =
authentication scheme selected</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">ERROR =
(org.apache.commons.httpclient.HttpMethodDirector) - Invalid challenge: =
Basic</FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial">org.apache.commons.httpclient.auth.MalformedChallengeExcep=
tion: Invalid challenge: Basic</FONT>
<BR> <FONT SIZE=3D2 =
FACE=3D"Arial">at =
org.apache.commons.httpclient.auth.AuthChallengeParser.extractParams(Auth=
ChallengeParser.java:97)</FONT>
<BR> <FONT SIZE=3D2 =
FACE=3D"Arial">at =
org.apache.commons.httpclient.auth.RFC2617Scheme.processChallenge(RFC2617=
Scheme.java:93)</FONT>
<BR> <FONT SIZE=3D2 =
FACE=3D"Arial">at =
org.apache.commons.httpclient.auth.BasicScheme.processChallenge(BasicSche=
me.java:111)</FONT>
<BR> <FONT SIZE=3D2 =
FACE=3D"Arial">at =
org.apache.commons.httpclient.auth.AuthChallengeProcessor.processChalleng=
e(AuthChallengeProcessor.java:161)</FONT>
<BR> <FONT SIZE=3D2 =
FACE=3D"Arial">at =
org.apache.commons.httpclient.HttpMethodDirector.processWWWAuthChallenge(=
HttpMethodDirector.java:689)</FONT>
<BR> <FONT SIZE=3D2 =
FACE=3D"Arial">at =
org.apache.commons.httpclient.HttpMethodDirector.processAuthenticationRes=
ponse(HttpMethodDirector.java:663)</FONT>
<BR> <FONT SIZE=3D2 =
FACE=3D"Arial">at =
org.apache.commons.httpclient.HttpMethodDirector.executeMethod(HttpMethod=
Director.java:192)</FONT>
<BR> <FONT SIZE=3D2 =
FACE=3D"Arial">at =
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:39=
6)</FONT>
<BR> <FONT SIZE=3D2 =
FACE=3D"Arial">at =
org.apache.commons.httpclient.HttpClient.executeMethod(HttpClient.java:34=
6)</FONT>
<BR> <FONT SIZE=3D2 =
FACE=3D"Arial">at =
com.gargoylesoftware.htmlunit.HttpWebConnection.getResponse(HttpWebConnec=
tion.java:126)</FONT>
<BR> <FONT SIZE=3D2 =
FACE=3D"Arial">at =
com.gargoylesoftware.htmlunit.WebClient.loadWebResponseFromWebConnection(=
WebClient.java:1424)</FONT>
<BR> <FONT SIZE=3D2 =
FACE=3D"Arial">at =
com.gargoylesoftware.htmlunit.WebClient.loadWebResponse(WebClient.java:13=
81)</FONT>
<BR> <FONT SIZE=3D2 =
FACE=3D"Arial">at =
com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:332)</FONT=
>
<BR> <FONT SIZE=3D2 =
FACE=3D"Arial">at =
com.gargoylesoftware.htmlunit.WebClient.getPage(WebClient.java:399)</FONT=
>
<BR> <FONT SIZE=3D2 =
FACE=3D"Arial">at =
com.canoo.webtest.steps.request.TargetHelper.getResponse(TargetHelper.jav=
a:69)</FONT>
<BR> <FONT SIZE=3D2 =
FACE=3D"Arial">at =
com.canoo.webtest.steps.request.AbstractTargetAction.getResponse(Abstract=
TargetAction.java:68)</FONT>
<BR> <FONT SIZE=3D2 =
FACE=3D"Arial">at =
com.canoo.webtest.steps.request.InvokePage.findTarget(InvokePage.java:134=
)</FONT>
<BR> <FONT SIZE=3D2 =
FACE=3D"Arial">at =
com.canoo.webtest.steps.request.AbstractTargetAction$1.call(AbstractTarge=
tAction.java:108)</FONT>
<BR> <FONT SIZE=3D2 =
FACE=3D"Arial">at =
com.canoo.webtest.steps.request.TargetHelper.protectedGoto(TargetHelper.j=
ava:88)</FONT>
<BR> <FONT SIZE=3D2 =
FACE=3D"Arial">at =
com.canoo.webtest.steps.request.AbstractTargetAction.gotoTarget(AbstractT=
argetAction.java:106)</FONT>
<BR> <FONT SIZE=3D2 =
FACE=3D"Arial">at =
com.canoo.webtest.steps.request.AbstractTargetAction.doExecute(AbstractTa=
rgetAction.java:78)</FONT>
<BR> <FONT SIZE=3D2 =
FACE=3D"Arial">at =
com.canoo.webtest.steps.Step.execute(Step.java:104)</FONT>
<BR> <FONT SIZE=3D2 =
FACE=3D"Arial">at =
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)</FON=
T>
<BR> <FONT SIZE=3D2 =
FACE=3D"Arial">at =
org.apache.tools.ant.Task.perform(Task.java:364)</FONT>
<BR> <FONT SIZE=3D2 =
FACE=3D"Arial">at =
com.canoo.webtest.ant.TestStepSequence.executeSteps(TestStepSequence.java=
:43)</FONT>
<BR> <FONT SIZE=3D2 =
FACE=3D"Arial">at =
com.canoo.webtest.ant.TestStepSequence.doExecute(TestStepSequence.java:31=
)</FONT>
<BR> <FONT SIZE=3D2 =
FACE=3D"Arial">at =
com.canoo.webtest.steps.Step.execute(Step.java:104)</FONT>
<BR> <FONT SIZE=3D2 =
FACE=3D"Arial">at =
org.apache.tools.ant.Task.perform(Task.java:364)</FONT>
<BR> <FONT SIZE=3D2 =
FACE=3D"Arial">at =
com.canoo.webtest.ant.WebtestTask.execute(WebtestTask.java:164)</FONT>
<BR> <FONT SIZE=3D2 =
FACE=3D"Arial">at =
org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:275)</FON=
T>
<BR> <FONT SIZE=3D2 =
FACE=3D"Arial">at =
org.apache.tools.ant.Task.perform(Task.java:364)</FONT>
<BR> <FONT SIZE=3D2 =
FACE=3D"Arial">at =
org.apache.tools.ant.Target.execute(Target.java:341)</FONT>
<BR> <FONT SIZE=3D2 =
FACE=3D"Arial">at =
org.apache.tools.ant.Target.performTasks(Target.java:369)</FONT>
<BR> <FONT SIZE=3D2 =
FACE=3D"Arial">at =
org.apache.tools.ant.Project.executeSortedTargets(Project.java:1216)</FON=
T>
<BR> <FONT SIZE=3D2 =
FACE=3D"Arial">at =
org.apache.tools.ant.Project.executeTarget(Project.java:1185)</FONT>
<BR> <FONT SIZE=3D2 =
FACE=3D"Arial">at =
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecuto=
r.java:40)</FONT>
<BR> <FONT SIZE=3D2 =
FACE=3D"Arial">at =
org.apache.tools.ant.Project.executeTargets(Project.java:1068)</FONT>
<BR> <FONT SIZE=3D2 =
FACE=3D"Arial">at =
org.apache.tools.ant.Main.runBuild(Main.java:668)</FONT>
<BR> <FONT SIZE=3D2 =
FACE=3D"Arial">at =
org.apache.tools.ant.Main.startAnt(Main.java:187)</FONT>
<BR> <FONT SIZE=3D2 =
FACE=3D"Arial">at =
org.apache.tools.ant.launch.Launcher.run(Launcher.java:246)</FONT>
<BR> <FONT SIZE=3D2 =
FACE=3D"Arial">at =
org.apache.tools.ant.launch.Launcher.main(Launcher.java:67)</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial"> INFO =
(com.gargoylesoftware.htmlunit.WebClient) - statusCode=3D[401] =
contentType=3D[text/html]</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial"> INFO =
(com.gargoylesoftware.htmlunit.WebClient) - <!DOCTYPE HTML PUBLIC =
"-//W3C//DTD HTML 4.0 Draft//EN"></FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial"><HTML></FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial"><HEAD></FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial"><TITLE>Error =
401--Unauthorized</TITLE></FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial"><META NAME=3D"GENERATOR" =
CONTENT=3D"WebLogic Server"></FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial"></HEAD></FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial"><BODY =
bgcolor=3D"white"></FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial"><FONT FACE=3DHelvetica><BR =
CLEAR=3Dall></FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial"><TABLE border=3D0 =
cellspacing=3D5><TR><TD><BR CLEAR=3Dall></FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial"><FONT FACE=3D"Helvetica" =
COLOR=3D"black" SIZE=3D"3"><H2>Error =
401--Unauthorized</H2></FONT>
<BR><FONT SIZE=3D2 =
FACE=3D"Arial"></FONT></TD></TR></FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial"></TABLE></FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial"><TABLE border=3D0 width=3D100% =
cellpadding=3D10><TR><TD VALIGN=3Dtop WIDTH=3D100% =
BGCOLOR=3Dwhite><FONT FACE=3D"Courier New"><FONT =
FACE=3D"Helvetica" SIZE=3D"3"><H3>From RFC =
2068 <i>Hypertext Transfer Protocol -- =
HTTP/1.1</i>:</H3></FONT></P>
<P><FONT SIZE=3D2 FACE=3D"Arial"></FONT><FONT =
FACE=3D"Helvetica" SIZE=3D"3"><H4>10.4.2 =
401 Unauthorized</H4></FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial"></FONT><P><FONT =
FACE=3D"Courier New">The request requires user =
authentication. The response MUST include a WWW-Authenticate header =
field (section 14.46) containing a challenge applicable to the requested =
resource. The client MAY repeat the request with a suitable =
Authorization header field (section 14.8). If the request already =
included Authorization credentials, then the 401 response indicates that =
authorization has been refused for those credentials. If the 401 =
response contains the same challenge as the prior response, and the user =
agent has already attempted authentication at least once, then the user =
SHOULD be presented the entity that was given in the response, since =
that entity MAY include relevant diagnostic information. HTTP access =
authentication is explained in section =
11.</FONT></P></FONT></P>
<P><FONT SIZE=3D2 =
FACE=3D"Arial"></FONT></TD></TR></FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial"></TABLE></FONT>
</P>
<P><FONT SIZE=3D2 FACE=3D"Arial"></BODY></FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial"></HTML></FONT>
</P>
<BR>
<P><FONT SIZE=3D2 FACE=3D"Arial">I've used a http header analyser to =
confirm the server response contains the challenge header in the correct =
format.</FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">Just wanted to check if anyone else =
had experienced a similar problem or if there is another means for =
submitting the </FONT>
<BR><FONT SIZE=3D2 FACE=3D"Arial">username & password. =
Thanks,</FONT>
</P>
<P><FONT SIZE=3D2 FACE=3D"Arial">Ben Nisbet</FONT>
</P>
</BODY>
</HTML>
------_=_NextPart_001_01C7D8DE.11390A74--