The formula here was to run tests over and over again, and each time look at the slowest tests and fix any double-digit test methods. At some point i could run gradle tests a few times in a row and i didn't have any double-digit test methods anymore, so i stopped
I also looked for problematic patterns (e.g. analyzers random tests) and tried to address them across the board.
It gives a more consistent build time because a lot of tests that can be really slow under certain circumstances are dealt with.