Hi Rob,
This is supposed to work out of the box.
The following works for me:
<target name="main">
<property name="expectedFile" location="savedLogo.gif"/>
<property name="testUrl"
value="http://www.asert.com.au/images/ASERT_logo_white_on_midnightblue_sml.gif"/>
<!-- <property name="testUrl"
value="http://www.asert.com.au/images/asert_slogo_welcome.gif"/> -->
<webtest name="compare jpeg">
&sharedConfig;
<steps>
<invoke description="Request image" url="${testUrl}" />
<!-- Compare the current response with the expected value. -->
<compareToExpected toFile="${expectedFile}" />
</steps>
</webtest>
</target>
Run it once to save the expected image then again will compare it.
Swap to the other "testUrl" and it should then fail.
We had to do a few tweaks a few months back to make it work for
PDFs as earlier versions were corrupting the binary input file
under certain circumstances. What version are you using?
Cheers, Paul.
Rob Manthey wrote:
I've not been able to get webtest or groovy to do a diff on a remote
image vs a local file. Can anyone suggest a probable way to do this?
I've tried using various combinations of code scraps as follows -
<invoke description="Invoking URL"
url="http://localhost:8080/t3000/images/logo.jpg"/>
<compareToExpected description="Comparing Images"
toFile="../../src/web/images/logo.jpg" />
In groovy I've tried various uses of com.jj.javadiff.Diff java.net.URL
sun.awt.image.URLImageSource without luck. I'm thinking that I need to
somehow download the binary and save it to a local file using
streams/printwriters then run the comparison on the local files, but
have not been able to find any good reference mateial on bridging from
the URL to the saved image file (ie: not text) ... is there a shorthand
groovy way to just download a networked binary file from a url to a
local filespec?
Incidentally I have to eventually make it work for png files, not jpgs
as the images are dynamic, created by cewolf, and supplied as png ie:
url =
http://localhost:8080/t3000/cewolf;jsessionid=4EE13F8F6EF6FC4914269138E8B0BB43?img=-314416359&width=570&height=500&iehack=.png
I've managed to scrape the url out of the page, and it "invoke"s ok (as
shown in the reports), but I don't think the compare knows to treat it
as a binary/png for the JavaDiff ... ?
Any tips/tricks/admonitions ?
Thanks
Rob
_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest
_______________________________________________
WebTest mailing list
[email protected]
http://lists.canoo.com/mailman/listinfo/webtest