Using TestWise for existing Watir scripts

By mark

TestWise IDE v1.2 adds better support for running Watir scripts directly.

The demo project (project file c:\TestWise\samples\demo\demo.tpr) now includes one test case (TestWise_ajax_xxx) implemented in four different falvours:

  • rWebUnit
  • rWebUnit in RSpec
  • Watir script
  • Watir in RSpec
, which all can be executed in TestWise IDE.
 

If you are not familiar with RSpec, don't worry, You will be in less than 30 seconds (at least for your testing purposes): RSpec in Nutshell. In a short summary, RSpec can provide you nice and structure for your test scripts.

The recommended rWebUnit in RSpec syntax gets maximum support from TestWise. Please note you can use Watir script syntax directly in rWebUnit.

Watir script
      browser = Watir::IE.start  "http://TestWise.com/demo"
browser.link(:text, "NetBank").click
browser.select_list(:name, "account").set("Cheque")
browser.text_field(:name, "amount").set("123.00")
browser.button(:value,"Transfer").click
sleep 10 # wait certain time even server might respond early
assert_equal(Time.now.strftime('%d/%m/%Y'), browser.label(:id, "date").text)
    
rWebUnit script
      open_browser "http://TestWise.com/demo"
click_link "NetBank"
select_option "account", "Savings"
enter_text "amount", "100"
click_button "Transfer"
repeat_try { label_with_id("date").should == today }