我领导的团队开发基于 Ruby on Rails 的应用程序。由于应用程序很小,自动化测试并没有被赋予太多重要性。但最近它的规模开始扩大。我正在认真考虑在团队中强制执行测试纪律。
对于提交的所有新代码,我希望我的开发人员实现 100% 的代码覆盖率。但问题是他们不愿意为 UI 相关的更改编写测试。我在网上看到 Selenium 是 UI 测试的解决方案之一。
任何人都可以给我一个博客或教程的链接,教我如何为 Rails 设置 Selenium 或其他一些自动化 UI 测试。我使用的版本是2.3.8。
最佳答案
查看两个主流的验收测试框架:
最佳起点(在我看来):Railscasts。试试 beginning with cucumber rails 广播。
你的“代码”最终会变成这样
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
关于ruby-on-rails - 在为 Rails 应用程序设置基于 UI 的测试方面需要帮助,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5851527/