I’ve been playing with running tests in their own threads for a while now (in particular with reference to GUI testing) and am starting to feel comfortable with my approach. Today I was working on running tests in parallel with JUnit.
Looking more into recent versions of JUnit, there seems to be lots of integration points for you to play with. I’ve been playing with
Runners mostly and when creating your own
BlockJUnit4ClassRunner, I spotted you can override the scheduler which schedules the actual test methods to be run.
After experimenting with much less straight forward integrations, overriding the scheduler gave the following.
This results in all the test methods within a given class running in parallel. I’m excited about speeding up the execution time of my tests, next step would be run all tests across classes in parallel.
This is all available to use via the tempus-fugit project by the way.