Refactor test_case to separate functionality

Now the test machinery can use different input and output directories,
and name for the test case, which will be useful for new functionality
that wants to run the same test case in a different mode and keep the
output separate.

Added some more detail to output strings where it might not always
have been clear which test case was producing the output.

Refs #1337

Change-Id: Ic3de4202e1445af36c263ffeed2663a7e0b3a26e