How to print current executing JUnit test method while running all tests in a class or suite using ANT?

前端 未结 6 1323
野性不改
野性不改 2021-01-20 10:24

I have a set of JUnit Test Cases and I execute them from ANT using the junit task. While executing the tests, in the console I get to see only which test case (i.e. Java cla

6条回答
  •  盖世英雄少女心
    2021-01-20 10:47

    You can make use of the TestName rule. Just add the following code to your test class:

    @Rule
    public TestName testName = new TestName();
    
    @Before
    public void printTestMethod() {
        System.out.println("Running " + testName.getMethodName());
    }
    

提交回复
热议问题