So I'm not doing any unit testing. But I've had an idea to make it more appropriate for my field of use. Yet it's not clear if something like this exists, and if, how it would possibly be called.
Ordinary unit tests combine the test logic and the expected outcome. In essence the testing framework only checks for booleans (did this match, did the expected result result). To generalize, the test code itself references the audited functions, and also explicites the result values like so:
unit::assert( test_me() == 17 )
What I'm looking for is a separation of concerns. The test itself should only contain the tested logic. The outcome and result data should be handled by the unit testing or assertion framework. As example:
unit::probe( test_me() )
probe actually doubles as collector in the first run, and afterwards as verification method. The expected
17 is not mentioned in the test code, but stored or managed elsewhere.
How is this scheme called? Or how would you call it? I hope I can find some actual implementations with the proper terminology.
Obviously such a pattern is unfit for TDD. It's strictly for regression testing. Also obviously, it cannot be used for all cases. Only the simpler test subjects can be analyzed that way, for anything else the ordinary unit test setup and assertion steps are required. And yes, this could be manually accomplished by crafting a ResultWhateverObject, but that would still require hardwiring that to the test logic.
Also keep in mind that I'm inquiring for use with scripting languages, and not about Java. I'm aware that the xUnit pattern originates there, and why it's hence as elaborate as it is.
Btw, I've discovered one test execution framework which allows for shortening simple test notations to:
test_me(); // 17
While thus the result data is no longer coded in (it's a comment), that's still not a complete separation and of course would work only for scalar results.