Maven, displaying unit test currently running

后端 未结 2 630
春和景丽
春和景丽 2020-12-17 20:15

My company has recently switched to maven, and the transition was very smooth, but there is one this that annoys me. So earlier, in pre-maven era you could see which test is

相关标签:
2条回答
  • 2020-12-17 20:33

    If you use JUnit, you could use a @Rule for this.

    If you only want it to apply to when Maven runs the tests, use a System property to en-/disable the output.

    0 讨论(0)
  • 2020-12-17 20:51

    You can configure a listener that will print the currently run test on the console. See the sections Using custom listeners and reporters of the junit maven-surefire-plugin documentation or the testng maven-surefire-plugin documentation

      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-surefire-plugin</artifactId>
        <version>2.19.1</version>
        <configuration>
          <properties>
            <property>
              <name>listener</name>
              <value>com.mycompany.MyResultListener,com.mycompany.MyResultListener2</value>
            </property>
          </properties>
        </configuration>
      </plugin>
    
    0 讨论(0)
提交回复
热议问题