New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add log-on-failure mode #22
Conversation
/** | ||
* Capture the writes to the stream. On test failure write to the original stream. | ||
*/ | ||
LOG_ONLY_ON_FAILURE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about LOG_AND_WRITE_TO_STREAM_ON_FAILURE_ONLY
?
Looks fine. Just a few coding style issues. |
Let's see how well the comment suggestions were applied with commit 7ba13ea, |
@binkley Are you using the rule for verifying the log or do you simply mute System.out and System.err? |
Sorry for long delay, job change & returning to US after working overseas. I do verify log. Muting is nice to quiet Spring, but my real intent is to Cheers, On Tue, Feb 17, 2015 at 5:18 PM, Stefan Birkner notifications@github.com
|
If you verify the log, why do you need to print it to |
Good question. For some cases I do want the output as well as the test For those tests where I just want to silence the output, not test it (I'm Cheers, On Thu, Mar 5, 2015 at 5:05 PM, Stefan Birkner notifications@github.com
|
Would a few new rules |
Yes, sir. Cheers, On Fri, Mar 6, 2015 at 12:34 PM, Stefan Birkner notifications@github.com
|
Great :-) |
In case of a failed test it is sometimes helpful to see the output to {@code System.err} and {@code System.out}. Therefore {@code SystemErrRule} and {@code SystemOutRule} have a new method {@code muteForSuccessfulTests(). @rule public final SystemErrRule systemErrRule = new SystemErrRule().muteForSuccessfulTests(); @rule public final SystemOutRule systemOutRule = new SystemOutRule().muteForSuccessfulTests();
In case of a failed test it is sometimes helpful to see the output to `System.errr` and `System.out`. Therefore `SystemErrRule` and `SystemOutRule` have a new method `muteForSuccessfulTests()`. @rule public final SystemErrRule systemErrRule = new SystemErrRule().muteForSuccessfulTests(); @rule public final SystemOutRule systemOutRule = new SystemOutRule().muteForSuccessfulTests();
In case of a failed test it is sometimes helpful to see the output to `System.errr` and `System.out`. Therefore `SystemErrRule` and `SystemOutRule` have a new method `muteForSuccessfulTests()`. @rule public final SystemErrRule systemErrRule = new SystemErrRule().muteForSuccessfulTests(); @rule public final SystemOutRule systemOutRule = new SystemOutRule().muteForSuccessfulTests();
In case of a failed test it is sometimes helpful to see the output to `System.errr` and `System.out`. Therefore `SystemErrRule` and `SystemOutRule` have a new method `muteForSuccessfulTests()`. @rule public final SystemErrRule systemErrRule = new SystemErrRule().muteForSuccessfulTests(); @rule public final SystemOutRule systemOutRule = new SystemOutRule().muteForSuccessfulTests();
In case of a failed test it is sometimes helpful to see the output to `System.errr` and `System.out`. Therefore `SystemErrRule` and `SystemOutRule` have a new method `muteForSuccessfulTests()`. @rule public final SystemErrRule systemErrRule = new SystemErrRule().muteForSuccessfulTests(); @rule public final SystemOutRule systemOutRule = new SystemOutRule().muteForSuccessfulTests();
In case of a failed test it is sometimes helpful to see the output to `System.errr` and `System.out`. Therefore `SystemErrRule` and `SystemOutRule` have a new method `muteForSuccessfulTests()`. @rule public final SystemErrRule systemErrRule = new SystemErrRule().muteForSuccessfulTests(); @rule public final SystemOutRule systemOutRule = new SystemOutRule().muteForSuccessfulTests();
In case of a failed test it is sometimes helpful to see the output to `System.errr` and `System.out`. Therefore `SystemErrRule` and `SystemOutRule` have a new method `muteForSuccessfulTests()`. @rule public final SystemErrRule systemErrRule = new SystemErrRule().muteForSuccessfulTests(); @rule public final SystemOutRule systemOutRule = new SystemOutRule().muteForSuccessfulTests();
In case of a failed test it is sometimes helpful to see the output to `System.errr` and `System.out`. Therefore `SystemErrRule` and `SystemOutRule` have a new method `muteForSuccessfulTests()`. @rule public final SystemErrRule systemErrRule = new SystemErrRule().muteForSuccessfulTests(); @rule public final SystemOutRule systemOutRule = new SystemOutRule().muteForSuccessfulTests();
In case of a failed test it is sometimes helpful to see the output to `System.errr` and `System.out`. Therefore `SystemErrRule` and `SystemOutRule` have a new method `muteForSuccessfulTests()`. @rule public final SystemErrRule systemErrRule = new SystemErrRule().muteForSuccessfulTests(); @rule public final SystemOutRule systemOutRule = new SystemOutRule().muteForSuccessfulTests();
Add a new mode, log-on-failure. It should:
Rebased as suggested. I also squashed some commits to make it clearer what you are getting:
PrintStreamLog
extendsTestWatcher
rather thanExternalResource
TestWatcher#failed(Throwable, Description)
.Cheers,
--binkley