Add (and use) a new test helper method for capturing output from stdout