Reputation: 191
Is there a way to run JUnit programmatically in which I could pass custom PrintStream for all output of JUnit framework itself and leave standard output for test cases?
I see that JUnit internally is using JUnitSystem and TextListener to achieve this but I don't see intended entry point to use it without modifying or extending JUnitCore.
Does anyone have idea how to achieve this?
Upvotes: 0
Views: 464
Reputation: 123986
I don't think that JUnitCore
and the classes used underneath print anything to standard out. The notable exception is JUnitCore.main
, but this is just the main method for direct command-line execution. Instead you should use one of the run
or runClasses
methods. Your own RunListener
can then output whatever/however it desires.
Upvotes: 3