Past, present, and future for Rust testing

Hey, thanks for writing all that it is very informative! I totally agree that Rust testing needs an overhaul and I'm keen to see it on the 2018 roadmap. I have not, however, thought much about the specifics.

Some random thoughts:

  • procedural macros/plugins are a bad fit for testing. A test harness should be a tool which interacts with the compiler and Cargo some how, it should not be a code transformation. We should think in terms of what the correct APIs in rustc and Cargo are for making custom test harnesses trivial to use.
  • #[test] is not flexible enough, we probably need more attributes if we're going to do things like setup/teardown. Compiling down to just using #[test] seems nice in theory, but in practice I think it will make it hard to get good error messages, etc. It might be that we use tool attributes (e.g, #[rustfmt::skip]) or we might want to allow test as a prefix for test-specific attributes (while allowing the individual test tools to decide what to read)
  • this model does not support the division between test harness and test framework, afaict
  • bench should be removed, not stabilised. A benchmarking tool should exist and we might need to add something to the compiler to support that, but it is a mistake to have the whole thing baked in.
  • we should think about the long-term situation for #[test] and libtest - should it exist as a 'basic' test framework? Should we try and make it the default test tool and try and make it awesome? Should we deprecate it?
  • we should carefully design the testing API so doctests can Just Work without too much special casing. I fear having too much of a parallel system here.

This post might be better off on internals.r-l.o