Closed chanjarster closed 9 years ago
This is because of multiple <test>
tags in your xml, I gues this is a bug in testng, I too observed it and reported here, but not reply yet.
Yes I met the same problem, I tested it in testng 6.8.8 and testng 6.8.17。 No only that.
If I have multiple suite files,I declare my custom IReporter or IExecutionListener in maven-surefire-plugin like
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>src/test/resources/testng.xml</suiteXmlFile>
<suiteXmlFile>src/test/resources/testng2.xml</suiteXmlFile>
</suiteXmlFiles>
<properties>
<property>
<name>listener</name>
<value>com.ctrip.cap.reporter.MyReporter,com.ctrip.cap.reporter.MyReporter</value>
</property>
</properties>
</configuration>
or I use @ Anotation Listeners in super class, or I use testng's xml configuration in testng.xml and testng2.xml like
<listeners>
<listener class-name="com.ctrip.cap.internal.suite.MyExecutionListener " />
<listener class-name="com.ctrip.cap.reporter.MyReporter" />
</listeners>
They all called multiple times.
My Question is that why not make Listener's Class Container as a Set,and no matter how to register it,The Listener of the same Class and same type should be called once time.
I am facing the same issue . In my scenario, there is only one testcase in single class. I am using Testing version 7.1.0 and I am facing the issue. I have tried testing version below 6.10 but facing the same. Kindly help.
@Abhijitdatta can you show us a complete sample that can be used to reproduce this problem ?
Hi
I'm using testng 6.3.1. I got a weird result if i declare a
@Listeners
, which define my implementation ofISuiteListener
, on a base class and define multiple test elements, each of which include only one test class inherited from that base class, in the xml configration file.Here is my testng.xml file:
My implementation of
ISuiteListener
TestBase.java
TestA.java
TestB.java
After I run the test, the console output is
I am confused about the result.
SuiteListener.onStart
method is called twice, is that the expected result ?Can I make
SuiteListener.onStart
method called only once?Thanks in advance.