【发布时间】:2012-04-14 22:31:58
【问题描述】:
我正在使用自动测试,并添加了挂钩来运行我的集成测试。在工作时,每当我做出影响任何集成测试的更改时,所有集成测试都会重新运行。如果可能的话,这是我想改变的行为。 (我使用 rspec 和 webrat 进行测试,没有黄瓜)
对于非集成测试,模式是如果您更改测试或其描述内容,它会在同一个规范文件(或描述块?)中重新运行测试。所以,假设我们有 page_controller.rb 和 page_controller_spec.rb。 autotest 知道,如果您更改其中一个文件,它只会运行 page_controller_spec 中的测试,然后,如果它通过,它会运行所有测试。我想对我的集成测试进行类似的测试 - 只需先运行文件中包含失败测试的测试,然后运行所有测试(如果它们通过)。
我的 .autotest 文件如下所示
require "autotest/growl"
require "autotest/fsevent"
Autotest.add_hook :initialize do |autotest|
autotest.add_mapping(/^spec\/integration\/.*_spec\.rb$/) do
autotest.files_matching(/^spec\/integration\/.*_spec\.rb$/)
end
end
【问题讨论】:
标签: ruby-on-rails continuous-integration autotest