How make JUnit print assertion results

前端 未结 4 853
说谎
说谎 2021-02-01 03:48

How can I get the results of my JUnit assertions to be printed [to standard output]?

I have some tests like this:

@Test
public void test01()
{
    Position         


        
4条回答
  •  闹比i
    闹比i (楼主)
    2021-02-01 04:08

    Existing Answers/Comments here contain enough info to understand how to print something based on JUnit assertions - but they also explain how doing so is probably not what you actually want to do, and is probably missing the point of running unit tests in the first place.

    You should be viewing the results of the tests themselves, instead of trying to print something while you don't understand how/where to view test results themselves.

    Now then how/where to view results themselves depends on how you are running your tests - you need to understand how you are running your tests, and then research how to view test results according to how you are running them. Here are a few (but not limited to) examples:

    • Running tests in IntelliJ
    • Running tests in Eclipse
    • Running tests on command line
    • Running tests in Jenkins

提交回复
热议问题