需要帮助为Rails应用程序设置基于UI的测试

时间:2011-05-01 21:27:10

标签: ruby-on-rails testing selenium integration

我正在领导一个基于Ruby on Rails开发应用程序的团队。由于应用程序很小,因此自动化测试并不重要。但最近它的规模已经开始增长。我正在认真考虑在团队中执行测试规程。

对于所有提交的新代码,我希望我的开发人员能够进行100%的代码覆盖。但问题是他们不能为UI相关的更改编写测试。我在网上看到Selenium是用户界面测试的解决方案之一。

任何人都可以与我分享一个指向博客或教程的链接,该链接教我如何为Rails设置Selenium或其他一些自动UI测试。我使用的版本是2.3.8。

1 个答案:

答案 0 :(得分:3)

查看两个主流验收测试框架:

最佳起点(在我看来):Railscasts。试试beginning with cucumber railscast。

您的“代码”最终会像

一样
Feature: pay bill on-line
  In order to reduce the time I spend paying bills
  As a bank customer with a checking account
  I want to pay my bills on-line

  Scenario: pay a bill
    Given checking account with $50
    And a payee named Acme
    And an Acme bill for $37
    When I pay the Acme bill
    Then I should have $13 remaining in my checking account
    And the payment of $37 to Acme should be listed in Recent Payments

http://iain.nl/2011/01/cucumber-vs-steak/

上的代码