How can I have autospec/test not run the full test suite after everything goes green?

混江龙づ霸主 提交于 2019-12-04 16:03:26

问题


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.


回答1:


Bit late but I was looking for this as well so thought I'd post my solution:

Add the following to ~/.autotest:

class Autotest
  def rerun_all_tests
  end
end



回答2:


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.




回答3:


You can use the following option to avoid this behavior -

autospec --no-full-after-failed



回答4:


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:

ruby spec/controllers/my_spec.rb

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.



来源:https://stackoverflow.com/questions/1047118/how-can-i-have-autospec-test-not-run-the-full-test-suite-after-everything-goes-g

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!