0

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?

4

1 回答 1

3

我不认为那JUnitCore和下面使用的类打印任何标准输出。值得注意的例外是JUnitCore.main,但这只是直接命令行执行的主要方法。相反,您应该使用runorrunClasses方法之一。然后你自己的RunListener可以输出任何/无论如何它想要的。

于 2013-09-26T13:24:14.167 回答