如何告诉自动测试正确跟踪应用程序源中的更改? [英] how to tell autotest to correctly track changes in app source?

查看:80
本文介绍了如何告诉自动测试正确跟踪应用程序源中的更改?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

只要我的Rails应用程序的相关文件之一发生更改,我都希望获得自动测试以运行Steak接受测试.在研究了Rspec和Cucumber自己的自动测试配置之后,我正在尝试以下映射:

I want to get autotest to run Steak acceptance tests whenever one of my rails app's relevant files is changed. After studying Rspec's and Cucumber's own autotest configs, I'm trying the following mappings:


Autotest.add_hook :initialize do |at|
  at.add_mapping(%r%^spec/acceptance/.*_spec.rb$%, true) { |filename, _|
    filename
  }

at.add_mapping(%r%^app/(models|controllers|helpers|lib)/.rb$%) { at.files_matching %r%^spec/acceptance/._spec.rb$% }

at.add_mapping(%r%^app/(models|controllers|helpers|lib)/.rb$%) { at.files_matching %r%^spec/acceptance/._spec.rb$% }

at.add_mapping(%r%^app/views/(.*)/.rb$%) { at.files_matching %r%^spec/acceptance/._spec.rb$% } end

at.add_mapping(%r%^app/views/(.*)/.rb$%) { at.files_matching %r%^spec/acceptance/._spec.rb$% } end

第一个有效:只要改变Steak规格,它就会再次运行.

the first one works: whenever a Steak spec is changed, it gets run again.

但是第二和第三不.更改/app子目录下的任何源文件只会被忽略.

but the second and third don't. changing any source files under the /app subdirectories just gets ignored.

使这些映射正常工作的正确方法是什么?

what's the correct way to get these mappings to work?

谢谢 奥利弗(Oliver)

thanks Oliver

推荐答案

我刚刚更改了我的.autotest文件以添加:

I just changed my .autotest file to add:

Autotest.add_hook :initialize do |at|
  at.add_mapping(%r%^spec/acceptance/.*_spec.rb$%, true) { |filename, _|
    filename
  }

  at.add_mapping(%r%^app/(models|controllers|helpers|lib)/.*rb$%, true) {
    at.files_matching %r%^spec/acceptance/.*_spec.rb$%
  }

  at.add_mapping(%r%^app/views/(.*)$%, true) {
    at.files_matching %r%^spec/acceptance/.*_spec.rb$%
  }
end

这是可行的,但我不知道先进行验收测试的附带影响(add_mapping上的true标志)

And this is working but I don't know the collateral effects of invoking acceptance tests before others (the true flag on add_mapping)

这篇关于如何告诉自动测试正确跟踪应用程序源中的更改?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆