Parallel testing dividing test methods to forked processes by test classes


Long story short. I posted this issue earlier which explains things pretty well what is the problem.

Issue is I’ve been using minitest-hooks gem to get before_all() and after_all() methods to test classes to setup database before setup() and each test class. Currently this feature is broken with parallel testing because Active Support issues one test method at the time to the forked processes. Tests are not grouped by their test class and each process get to execute tests from same class. This works with just setup() method, but not with before_all() and after_all() methods. And currently tests are not even runnable with parallel testing on which was how this issue began but now it seems to turn something else.

So I was thinking is it possible to change parallel testing behavior so that one process executes one test class and all it’s test methods? This way before_all() and after_all() kind implementation will work just fine. This is also how Python Django framework implements parallel testing I think this is because Python unit test library has before_all() and after_all() like feature built in. What community thinks about this? Could this be implemented this way? If not then there should be some information somewhere that these kind of minitest plugins doesn’t work with parallel testing.

1 Like