在一切变绿后,如何让 autospec/test 不运行完整的测试套件?
与 twitter 中的 waloeiii 相同的问题:
如何让 autospec/test 不运行 一切之后的完整测试套件 变绿了? 我写的下一个测试将 变红了!
我宁愿手动运行完整的测试套件。
顺便说一句,我尝试添加一个失败的规范:
it "should flunk" do
flunk
end
但 autospec 似乎在感觉需要时忽略它。
Same question as waloeiii in twitter:
How can I have autospec/test not run
the full test suite after everything
goes green? The next test I write will
be red!
I'd rather run the full test suite manually.
By the way, I tried adding a failing spec:
it "should flunk" do
flunk
end
but autospec seems to ignore it when it feels like it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
有点晚了,但我也在寻找这个,所以我想发布我的解决方案:
将以下内容添加到 ~/.autotest:
Bit late but I was looking for this as well so thought I'd post my solution:
Add the following to ~/.autotest:
您确定您对自动测试启发式的预期行为没有感到困惑吗?
我的理解是,它会针对已更改的内容运行测试,并将继续运行失败的测试,直到它们通过,然后一旦通过,它就会运行整个测试套件,以确保没有其他任何问题。
实际上,它是保守的,并确保您没有引入破坏其他不相关测试的副作用,这可能是一件好事。 当然,问题是,如果您正在进行快速的红绿循环,您将需要大量运行全套套件。
如果您想更改这些行为,则需要编辑 zentest 的
rails_autotest.rb
文件中的启发式方法。Are you sure you are not confused about the intended behaviour of autotest's heuristics?
My understanding is that it runs tests for what has changed and will keep running failed tests until they pass and then once they pass it runs the whole test suite to make sure nothing else broke.
In effect it is being conservative and making sure you haven't introduced side effects that break other unrelated tests which is probably a good thing. The problem of course is that if you are doing fast red - green cycles you are going to be running your full suite a lot.
If you want to change these behaviours you need to edit the heuristics in the
rails_autotest.rb
file for zentest.您可以使用以下选项来避免这种行为 -
You can use the following option to avoid this behavior -
我认为这是设计使然 - 如果您修复了失败的规范,并且该部分中的所有其他规范都是绿色的,那么 autospec 将重新运行整个套件 - 这将告诉您应用于项目某个区域的修复是否已失效另一个或没有。
如果您只想随时运行您正在处理的规范,那么您可以从命令行执行此操作:
或在 Textmate 中通过按规范文件中的 cmd+r 来执行此操作。 无论如何,您都应该重新运行整个套件,否则您可能会丢失失败的规范。
I think that this is by design - if you fix a failing spec, and all other specs in the section are green, then autospec will rerun the entire suite - this will tell you if the fix you applied to one area of your project has b0rked another or not.
If you just want to run the specs you are working on at any one time, then you can do it from the command line:
or from within Textmate by pressing cmd+r from your spec file. You should rerun your entire suite as you go anyway, otherwise you might be missing failing specs.