问题描述
根据以下page,可以通过以下方式为 TestNG 指定自定义侦听器:
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.0.0-M5</version>
<configuration>
<properties>
<property>
<name>listener</name>
<value>
com.mycompany.MyResultListener,com.mycompany.MyAnnotationTransformer,com.mycompany.MyMethodInterceptor
</value>
</property>
</properties>
</configuration>
</plugin>
我的问题是如何通过命令行执行相同的操作(以提供自定义侦听器)?
解决方法
你可以简单地定义一个属性,比如 tCustomListener
<properties>
<tCustomListener>intelligent_default_listener</value>
</properties>
并使用 <value>
${tCustomListener}
使用 -DtCustomListener=yourvalues 运行