Redirect the output of a test to a temporary file to prevent messing up
the test environment.