[Webtest] RE: RE: RE: problem with NT authentication

Michael Dunn webtest@lists.canoo.com
Tue, 25 Apr 2006 11:49:12 -0700


marc,

I created a separate webtest with the <groovy> code you suggested below.
the webtest is as follows:
    <target name=3D"groovyhtmlunit">
        <webtest name=3D"try htmlunit through groovy">
            &config;
            <steps>  =20
                <groovy description=3D"htmlunit in groovy">
                    def prov =3D new
com.gargoylesoftware.htmlunit.DefaultCredentialsProvider();
                    prov.addCredentials("*username*","*password*");
                    def webClient =3D step.context.webClient
                    webClient.setCredentialsProvider(prov);
                </groovy>
            </steps>  =20
        </webtest>
    </target>  =20

it seems to work fine as the debug output shows:

Buildfile:
C:\projects\Projects\Boxcar\main\src\test\webtest\test\talus\test_teamtr
ack.xml
Trying to override old definition of task sleep
groovyhtmlunit:
  [webtest] DEBUG (com.canoo.webtest.ant.TestStepSequence) - Creating
TestStepSequence
  [webtest] DEBUG (com.canoo.webtest.boundary.AntBoundary) - Task
'groovy' configured with ant
  [webtest] DEBUG (com.canoo.webtest.steps.AbstractStepContainer) -
Adding WebTest Step: GroovyStep at
C:\projects\Projects\Boxcar\main\src\test\webtest\test\talus\test_teamtr
ack.xml:91:  with (description=3D"htmlunit in groovy", =
stepType=3D"groovy")
  [webtest] INFO (com.canoo.webtest.ant.WebtestTask) - Canoo Webtest:
R_1217.
  [webtest] DEBUG (com.canoo.webtest.engine.Engine) - Executing
configuration task
   [config] DEBUG (com.canoo.webtest.engine.Configuration) - Result
file:
C:\projects\Projects\Boxcar\main\src\doc\webtest-results\webtest-results
.xml
   [config] DEBUG (com.canoo.webtest.engine.Configuration) - Headers: []
   [config] INFO (com.canoo.webtest.engine.Configuration) - Surfing with
browser Mozilla/4.0 (compatible; MSIE 6.0b; Windows 98)
   [config] DEBUG (com.canoo.webtest.engine.Configuration) - Configured
a parser listener to collect messages generated while parsing html
DEBUG (com.canoo.webtest.engine.Engine) - Executing steps...
DEBUG (com.canoo.webtest.engine.Engine) - Executing step GroovyStep at
C:\projects\Projects\Boxcar\main\src\test\webtest\test\talus\test_teamtr
ack.xml:91:  with (description=3D"htmlunit in groovy", =
stepType=3D"groovy")
   [groovy] DEBUG (com.canoo.webtest.steps.Step) - Expanding properties
for groovy "htmlunit in groovy" (1/1)
   [groovy] INFO (com.canoo.webtest.steps.Step) - >>>> Start Step:
groovy "htmlunit in groovy" (1/1)
   [groovy] DEBUG (com.canoo.webtest.steps.Step) - Executing groovy
"htmlunit in groovy" (1/1)
   [groovy] DEBUG
(com.gargoylesoftware.htmlunit.DefaultCredentialsProvider) - Flushed
marked answers
   [groovy] DEBUG (com.canoo.webtest.steps.Step) - Finished groovy
"htmlunit in groovy" (1/1)
   [groovy] DEBUG (com.canoo.webtest.steps.Step) - Completed Step:
groovy "htmlunit in groovy" (1/1)
   [groovy] DEBUG (com.canoo.webtest.steps.Step) - <<<< Successful Step:
groovy "htmlunit in groovy" (1/1)
DEBUG (com.canoo.webtest.engine.Engine) - Step execution finished
DEBUG (com.canoo.webtest.ant.WebtestTask) - Writing test report using
Report class: com.canoo.webtest.reporting.XmlReporter
DEBUG (com.canoo.webtest.reporting.XmlReporter) - Reading file
C:\projects\Projects\Boxcar\main\src\doc\webtest-results\webtest-results
.xml
INFO (com.canoo.webtest.ant.WebtestTask) - Test report successfully
created.
DEBUG (com.canoo.webtest.ant.WebtestTask) - stopBuildIfNeeded 1
DEBUG (com.canoo.webtest.ant.WebtestTask) - stopBuildIfNeeded 2
BUILD SUCCESSFUL
Total time: 5 seconds

if I move just the groovy section to be right before my <invoke> step in
my original test, the groovy step works fine, but the invoke fails as
before.

if you give me more specific instructions on how to change the htmlunit
test to mimic the logic in the webtest, then I can give that a try.

later,
mikey

Michael Dunn=20
Product Test Manager=20
Adaptis=20
206 342 7478=20


-----Original Message-----
From: webtest-admin@lists.canoo.com
[mailto:webtest-admin@lists.canoo.com] On Behalf Of Marc Guillemot
Sent: Tuesday, April 25, 2006 1:09 AM
To: webtest@lists.canoo.com
Subject: [Webtest] RE: RE: RE: problem with NT authentication


Hi Mike,

Webtest doesn't set a new CredentialProvider at it knows that the
default one is ok and just "fill" it.
Can you try to change your htmlunit test to use the same logic to check
that it still work?

What is really strange is that the credentials seem to be found but not
correct. I could understand that it comes from the fact the
NTCredentials are expected but why isn't it the case when you test
directly with htmlunit.

Can you try to put your htmlunit code that seem to work directly in
webtest for instance with a Groovy step before the request to the
restricted page:
<groovy>
def prov =3D new
com.gargoylesoftware.htmlunit.DefaultCredentialsProvider();
prov.addCredentials("*username*","*password*");
def webClient =3D step.context.webClient
webClient.setCredentialsProvider(prov);
</groovy>

Marc.
--
View this message in context:
http://www.nabble.com/RE%3A-RE%3A-RE%3A-problem-with-NT-authentication-t
1488973.html#a4078243
Sent from the WebTest forum at Nabble.com.

_______________________________________________
WebTest mailing list
WebTest@lists.canoo.com
http://lists.canoo.com/mailman/listinfo/webtest