-
Notifications
You must be signed in to change notification settings - Fork 71
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
SystemOutRule.getLog() does not work when I running all tests in a Test file #45
Comments
@July-G I had a similar problem when using a logging library and some of the tests were changing the appenders, removing the one that logs to the console and replacing it with an asynchronous one that had 80% success rate... could you provide us with a sample project (minimum code to reproduce the problem)? |
Actually it's quite a simple test, the two test methods are like below:
|
Dear July, I'm afraid that code alone is not enough to reproduce the problem on it's own. Maybe the clue is in your What kind of logging library are you using? |
LOGGERSlog4j.rootLogger=info, other, console APPENDERSlog4j.appender.console=org.apache.log4j.ConsoleAppender #消息 |
@July-G can you post the list of dependencies from the log file and the complete test class? We need to know how you configure logging in the test and in other tests that run at the same time. |
This problem is very similar to #40. It looks like you're using Log4J 1.x. The problem is that You can test that your Java code creates the correct logging events with a rule like in junit-team/junit4#1230. |
Using system-rules 1.16 with Junit, Intellij IDEA and Maven
It works just fine when I run my test one by one from my IDEA right click menu, say "Run 'testCanNotRestart()'".
But does not work when I run all test methods in the test file, in my case there are other 4 test methods there.
Also, it will fail when i run "maven test”.
In the above two fail cases, the SystemOutRule.getLog() just return nothing.
The text was updated successfully, but these errors were encountered: