Selenium is a great way to test your app automatically through a browser. See how it works in this episode.
script/plugin install git://github.com/ryanb/selenium-on-rails.git
script/generate selenium destroy_product.rsel
# test/selenium/destroy_product.rsel
setup :fixtures => :all
product = Product.first
open '/'
click "css=#product_#{product.id} a:contains('Destroy')"
assert_confirmation('*')
wait_for_element_present "css=#flash_notice"
assert_element_not_present "css=#product_#{product.id}"
refresh
assert_element_not_present "css=#product_#{product.id}"
# config/selenium.yml
environments:
- test
browsers:
firefox: '/Applications/Firefox.app/Contents/MacOS/firefox-bin'
Selenium自动化测试
本文介绍了一种使用Selenium进行自动化浏览器测试的方法,并提供了一个具体的测试脚本示例。该脚本能够自动打开应用并测试产品删除功能,展示了如何设置测试环境、执行操作以及验证结果。
1393

被折叠的 条评论
为什么被折叠?



