的Watir測試對黃瓜/測試的Watir工作來測試一個像器/循環工作。我的策略是通過css類抓取旋轉器中的活動圖像並將其轉儲到變量中。然後我點擊下一步按鈕,抓住活動圖像(現在應該是一個新的圖像)通過css類肩並轉存到第二個變量。然後,我應該可以說img_rot_1!= img_rot_2並讓測試返回true或false。這是我遇到麻煩的部分。平等
我是新來的Ruby,所以我可能失去了一些東西簡單。這是測試。
require 'step_definition/setup'
test_setup = Wsetup.new 'http://loginurl', 'uname', 'pass' # browser object created here as # test_setup.b
img_rot_1 = String.new
img_rot_2 = String.new
When /^I click the next image button$/ do
test_setup.do_login
test_setup.b.goto('http://psu.dev1.fayze2.com/node/56')
img_rot_1 = test_setup.b.li(:class => 'flex-active-slide').img.src
test_setup.b.link(:class => 'flex-next').click
end
Then /^the rotator should move to the next image$/ do
img_rot_2 = test_setup.b.li(:class => 'flex-active-slide').img.src
img_rot_1 != img_rot_2
end
img_rot_1!= img_rot_2 and img_rot_1 == img_rot_2 both pass - so what I I missing?