Gradle does it, although only at the task level. In fact, Gradle does this for all tasks, not just running tests, so re-running a command is always as cheap as possible.
Well, with some caveats. Firstly, tasks have to be written to support this mechanism, and although the built-in tasks are, not all third-party ones are, and those will always be re-run. Secondly, if a test task fails, it will be re-run. That makes it easy to re-run tests which failed for extraneous reasons.
In your mondo case, to take advantage of this, you'd want to break your test suite up into multiple tasks. You already get a task per subproject, but you could easily define multiple tasks per subproject. I've often had separate tasks for unit tests, integration tests, and browser tests.
Make also does this if you describe tests as a rule to create a test report.
https://bazel.build/ supports this. Bazel is Google’s build system, open-sourced.
From reading https://bazel.build/versions/master/docs/test-encyclopedia.h... , it looks like Bazel's rules are quite strict (not to mention Unix-specific), and requires writing a separate rules file to configure test behavior (e.g. an "external" tag to denote tests that cannot be cached). I anticipate that it would be difficult to retrofit such things onto Go's existing ecosystem in-place (or any language's, for that matter), especially without sacrificing Go's minimalist philosophy (i.e. "this function is a test if its identifier begins with `Test`, end of story"), especially considering Go's documented aversion to config files WRT package management.
As an optional external tool it may work quite nicely, however.
Bazel's rules are extremely strict. For what it's worth when I was at Google all the Go code was built with Bazel. Most of the google engineers don't experience this pain internally I imagine.
Re:My Go Resolutions for 2017
by paulddraper on Wednesday January 18, 2017 @02:01PM
(#13429237)
I'm not sure that operates at the same granularity though.
Well, for one thing, the Go compiler itself already only compiles things that have changed, at least as long as you are doing `go build -i` and such. Only test what you had to compile seems like a pretty easy thing to do.
I'll be curious to see how this pans out, because it sounds like a very deep rabbit hole. Is there any precedent for this in other language toolchains? I've seen some mondo test suites in Java that could desperately use it.