add support for capturing stdout in tests