views:

85

answers:

2

We are at the start of a project to test a new web application written in jQuery and are planning to do it using WATIR and FireWATIR.

During the proof of concepts test I've discovered differences in how WATIR and FireWATIR represent URLs, for example a script which passes in FireWATIR generates this error in WATIR.

assert_equal(expandImage.src,"../WebToolKit/images/closed.jpg")

testBrowserGadget2(WebClientHomePage) [002_pub_browser.rb:108]:
<"http://172.24.4.125:8081/WebToolKit/images/closed.jpg"&gt; expected but was
<"../WebToolKit/images/closed.jpg">.

Is there any setting in either WATIR or FireWATIR I can enable so that the URL value is consistent between when running against IE and Firefox?

+1  A: 

you could use assert_match http://en.wikibooks.org/wiki/Ruby_Programming/Unit_testing

rogerdpack
+2  A: 

I use the uri module ...

e.g. require 'uri'

URI.parse("http://google.com/image/path.jpg").path => "/image/path.jpg"

i.e. assert_equal(URI.parse(expandImage.src).path,"../WebToolKit/images/closed.jpg")

Tim Koopmans