-
Notifications
You must be signed in to change notification settings - Fork 567
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question: What's the best way to run groups of tests in the same process? #549
Comments
What part of it makes you unhappy and why? |
Good question. I'm not sure any of them are deal-breakers, but I just thought there might be a more "official" way. One small thing is that I seem to need to Another thing is having to call One last thing which isn't an issue in my example project is when doing this kind of thing in a project which makes use of |
Some simple questions... If a "fast" test fails, what should happen? Should it stop? Should it continue on to the slow tests? |
If any "fast" test fails then none of the "slow" tests should be run. |
OK. So I'm working on your problem and I think I've addressed (most of?) the undesirable side-effects you mentioned. Specifically, there needs to be a hack in place to bypass minitest/autorun. Here's the output of my runs:
As you can see, when The code isn't much different than yours: require "minitest"
module Minitest
@@installed_at_exit = true
end
def minitest_phase
yield
if Minitest.run ARGV.dup then
Minitest::Runnable.reset
else
exit 1
end
end
minitest_phase do
require "./fast.rb"
end
minitest_phase do
require "./slow.rb"
end As far as "official" goes? There is no "official" way to do what you want because there is no usecase for it. I would say that your code is the right way to do it tho. |
Thanks for looking into it. FWIW I think I do have a valid use case. Historically projects (including Rails apps) used to run groups of their tests in a series of However, since this commit all Rails tests are run in a single group and in a single process. While this saves laoding the Rails environment multiple times, it also means that typically some/many integration/functional tests run before unit tests. Personally I think this is undesirable, because unit tests are intended to give the fastest and most specific feedback and consequently they should run first. So I was trying to work out whether I could find a way to retain the idea of running all unit tests first, while not re-introducing the performance overhead of multiple processes. However, if there's no official way of doing this with Minitest, I guess I'm not going to get a PR accepted by Rails. Closing. |
This is a question rather than a problem per se.
I'd like to be able to run all my unit tests first (albeit in a random order) before any of my integration tests and I want all the tests to run in the same process.
I've come up with a solution of sorts in this repo, but I'm not very happy with the code. Can anyone suggest a better solution?
Thanks.
The text was updated successfully, but these errors were encountered: