Ruby界面鞋和自动测试工具Watir

时间:2014-07-21 05:23:55

标签: ruby watir watir-webdriver web-testing shoes

我安装并使用Watir成功地对我的网页进行自动测试。在此之后,我尝试为我的测试代码创建一个Shoes界面。我想点击一个按钮,然后运行我的Watir测试代码。

如果我在终端中运行它,我的测试代码会起作用。但是,如果涉及鞋子,它会在“require'watir-webdriver'”的步骤停止。所以,我可以看到警报1和2,但从来没有3和之后没有。我的代码在这里:

Shoes.app do

def xxxx(from, to)

alert "1"
puts "my message abcdefg"
alert "2"
require 'watir-webdriver'
alert "3"

browser = Watir::Browser.new
browser.goto 'http://my.page.url.......'
alert "4"

# login
browser.link(:text => 'Login').click
browser.text_field(:id => 'username').set 'xxxx'
browser.text_field(:id => 'password').set 'yyyy'
browser.button(:text => 'Login').click

# some other staff... nothing wrong here

browser.close()
end

# build the interface
@s = stack :width=>200, do

    username = edit_line
    password = edit_line

    button "Login" do
        xxxx(1, 2)   # just call the function
    end
end

@left=(@s.parent.width-@s.style[:width])/2
@s.move(@left,0)

end

我使用鞋子错了吗?我根本没有任何错误,但它只是停止了。你会建议其他什么界面?我需要一个接口让用户加载一个txt文件,然后根据文件中的信息执行测试。

非常感谢。

1 个答案:

答案 0 :(得分:0)

好吧,鞋子没有加载watir-webdriver和shoes4有这个问题'无法激活selenium-webdriver-2.42.0,因为rubyzip-0.9.9与rubyzip冲突(〜> 1.0) ' ...

到目前为止还没有解决方案......