using testng listeners and maven

1,984 views
Skip to first unread message

Roman Bogorodskiy

unread,
Oct 27, 2008, 8:54:20 AM10/27/08
to testng...@googlegroups.com
Hello,

I have a question about using testng listeners with maven. Here's
testng-realated configuration in
pom.xml:

<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>5.8</version>
<classifier>jdk15</classifier>
<scope>test</scope>
</dependency>

..............

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.4.2</version>
<configuration>
<suiteXmlFiles>
<suiteXmlFile>src/test-data/testng.xml</suiteXmlFile>
</suiteXmlFiles>
</configuration>
</plugin>


I followed this instruction:
http://testng.org/doc/documentation-main.html#logging-listeners
and created a listener and then added it to testng.xml this way:

<suite name="TestSuite">
<listeners>
<listener-name class-name="com.foo.bar.TestListener"/>
</listeners>

And it doesn't seem to be executed. Nothing happens as well when I
replace my class with
"org.testng.reporters.DotTestListener" or even "i.do.not.exist" - I
don't see errors nor warnings.

I've tried to configure listeners inside maven surefire plugin, like
it's described in its documentation:
http://maven.apache.org/plugins/maven-surefire-plugin//examples/testng.html
(<property><name>listener</name>...).

What am I doing wrong?

Roman Bogorodskiy

Rishi

unread,
May 3, 2014, 10:35:38 AM5/3/14
to testng...@googlegroups.com
I am also facing the same problem but while compiling the code I am getting the following exception

Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project WebdriverWithTestNG: Compilation failure: Compilation failure:
[ERROR] \GitHubProjects\WebdriverWithTestNG\src\main\java\org\testng\utilities\ScreenshotListener.java:[10,17] error: cannot find symbol
[ERROR] \GitHubProjects\WebdriverWithTestNG\src\main\java\org\testng\utilities\ScreenshotListener.java:[11,17] error: cannot find symbol
[ERROR] \GitHubProjects\WebdriverWithTestNG\src\main\java\org\testng\utilities\ScreenshotListener.java:[14,40] error: cannot find symbol
[ERROR] \GitHubProjects\WebdriverWithTestNG\src\main\java\org\testng\utilities\ScreenshotListener.java:[16,27] error: cannot find symbol
[ERROR] \GitHubProjects\WebdriverWithTestNG\src\main\java\org\testng\utilities\ScreenshotListener.java:[15,1] error: method does not override or implement a method from a supertype
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:

Krishnan Mahadevan

unread,
May 6, 2014, 12:01:41 AM5/6/14
to testng...@googlegroups.com
You seem to get this fixed at your end. Not sure what symbol is missing here, but am guessing that you perhaps don’t have the TestNG libraries in your dependency.

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Technical Scribbings @ http://rationaleemotions.wordpress.com/


--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to testng-users...@googlegroups.com.
To post to this group, send email to testng...@googlegroups.com.
Visit this group at http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.

djangofan

unread,
May 13, 2014, 11:42:56 AM5/13/14
to testng...@googlegroups.com
I have been able to run Listener from a Maven Surefire project just fine.  This project on Github (that I created) shows that it works:
-Jon

Krishnan Mahadevan

unread,
May 13, 2014, 12:14:53 PM5/13/14
to testng...@googlegroups.com
Wow Jon you are on a rampage :)

~ Krishnan

iSent. iPhone. iReget.iTypos!
--
Reply all
Reply to author
Forward
0 new messages