[Webtest] pdftests using invoke

etienne studer webtest@lists.canoo.com
Thu, 8 Apr 2004 10:15:23 +0200


Hi Lisa

Have a look at your stacktrace below:
Exception raised: com.canoo.webtest.engine.StepExecutionException: File does
not have extension '.pdf''

Obviously, the document returned is not a pdf document. Or at least it does
not have the .pdf extension.
I hope this helps for further debugging.

Best regards, Etienne



-----Original Message-----
From: lisa.crispin@att.net [mailto:lisa.crispin@att.net]
Sent: Donnerstag, 8. April 2004 02:31
To: webtest@lists.canoo.com
Cc: etienne studer; Webtest
Subject: Re: [Webtest] pdftests using invoke


Hi Etienne,
I had originally had my scripts as you say, using clicklink to click on the
link to the PDF file.  At that time, there was no pdf support in WebTest so
all I could do was <previousresponse> and go back.  It was useful in that it
would fail if the PDF file was missing.

After installing a build that had the PDF support, the clicklinks on the
links to PDF files stopped working.  I noticed all the examples in the
"Available Extension Steps" doc have invoke rather than clicklink, so I used
invoke, but wasn't happy that I couldn't use clicklink.  Just now I tried
clicklink as you suggested, with the latest build (432).  I still get an
error trying to use clicklink. I do have an invoke at the start of the test,
then there are man Here's my test:

	<invoke stepid="go to step 4"
               	url="control.jsp?site=erStart&amp;page=step4"/>
	<clicklink stepid="Click program agreement"
		label="Program Agreement"/>

Here's the relevant HTML:

<li class="body"><a class="bodyLink" target="_blank"
href="/pdfsend?type=4103&ts=46297">Program Agreement</a></li>

Here is the error:

BUILD FAILED
file:c:/canoo/SmokeTest/PlanEstTourTest.xml:21: Test failed.
Exception raised: com.canoo.webtest.engine.StepExecutionException: File does
not
 have extension '.pdf''), Step: VerifyPdfDocumentTitleStep at
file:../modules/pl
anDocs.xml:10:  with (title="Program Agreement", stepId="verify program
agreemen
t",
stepType="verifyPdfTitle")com.canoo.webtest.engine.StepExecutionException: F
ile does not have extension '.pdf''), Step: VerifyPdfDocumentTitleStep at
file:.
./modules/planDocs.xml:10:  with (title="Program Agreement", stepId="verify
prog
ram agreement", stepType="verifyPdfTitle")
        at
com.canoo.webtest.steps.pdftest.AbstractVerifyPdfStep.verifyLastRespo
nseFileNameAvailable(AbstractVerifyPdfStep.java:89)
        at
com.canoo.webtest.steps.pdftest.AbstractVerifyPdfStep.doExecute(Abstr
actVerifyPdfStep.java:73)
        at com.canoo.webtest.steps.Step.execute(Step.java:99)
        at com.canoo.webtest.engine.Engine.executeSteps(Engine.java:26)
        at
com.canoo.webtest.ant.TestSpecificationTask.execute(TestSpecification
Task.java:68)
        at org.apache.tools.ant.Task.perform(Task.java:341)
        at org.apache.tools.ant.Target.execute(Target.java:309)
        at org.apache.tools.ant.Target.performTasks(Target.java:336)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1339)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1255)
        at org.apache.tools.ant.Main.runBuild(Main.java:609)
        at org.apache.tools.ant.Main.start(Main.java:196)
        at org.apache.tools.ant.Main.main(Main.java:235)

It works if I do this instead, but then, I am only able to check the
contents of the PDF file, I'm not able to know for sure that clicking on
this link gets me the correct PDF file.  I'm not sure why this worked in a
build of WebTest that predated the PDF support, but doesn't work now.

	<invoke stepid="get program agreement document"
               	url="pdfsend?type=4103"/>

What may I do in my test to be able to see that clicking on a particular
link that should bring up a PDF file, actually does?
thank you very much,
Lisa



> Hi Lisa
>
> Testing PDF documents works with invoke as well as with clicklink.
> See example below using clicklink.
>
> Best regards, Etienne
>
>
> <invoke
>   stepid="Go to overview page"
>   url="index.html"/>
> <clicklink
>   label="PDF Doku A"/>
> <verifyPdfTitle
>   title="TestDokuA"/>
> <previousresponse stepid="Go back to overview page"/>
> <clicklink
>   label="PDF Doku B"/>
> <decryptPdfDocument
>   password="mymaster"/>
> <verifyPdfTitle
>   title="TestDokuB"/>
>
>
>
> Hello,
> The new PDF support is really swell!  We're making good use of it.  Thank
> you for providing this immensely useful functionality!
>
> I have a question which I hope isn't too dumb.  Before the PDF support was
> introduced, I just did a clicklink on the link to get the PDF, I couldn't
> check it so I just used previousresponse to go back, but I could see the
PDF
> documents in the result folder.
>
> So I was doing something like this:
> 	 <clicklink stepid="Click adoption agreement"
> 		label="Plan Adoption Agreement"/>
>
> Now, I use the invoke to get the PDF doc via the URL, which works fine.
The
> clicklink doesn't appear to bring up the correct PDF anymore.  If I have
one
> invoke in my test, the clicklink will just keep bringing up the same PDF
> file as invoked via the URL, no matter what link it's clicking on.  If I
> don't have any invoke for the PDF URL, I don't get errors but it doesn't
> save the PDF docs at all, so I imagine it isn't even bringing them up.  In
> fact, my server sends me the same sort of errors I would get if I clicked
a
> link in a real session and then hit the stop button on the PDF popup
without
> letting it finish rendering.
>
> So the dumb part of this question is, by invoking the PDF via the URL, how
> can I be sure that when a user clicks on the link on the page to get to
the
> URL, they will get the correct PDF document?  Is there any way to do this
> via the clicklink instead of the invoke?
>
> Many thanks,
> Lisa
>
> _______________________________________________
> WebTest mailing list
> WebTest@lists.canoo.com
> http://lists.canoo.com/mailman/listinfo/webtest