Getting warning for listeners in the module - TESTNG RAW PROJECT STRUCTURE PART 3 - ADDING SCREENSHOTS, GROUPING .... | Selenium Forum
K
Karan V Atreya Posted on 20/03/2022

Hi,

 

I am getting the below warning when I try to run the TestNG.xml file.

Can you please help out.

 

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE suite SYSTEM "https://testng.org/testng-1.0.dtd">
<suite name="My Test Suite">
<groups>
<run>
<!-- <include name="smoke"></include> -->
<include name="sanity"></include>
<exclude name="smoke"></exclude>
</run></groups>
<listeners>
<listener class-name="listener.MyListener"></listener>
</listeners>
<suite-files>
<suite-file path="suitea.xml"></suite-file>
<suite-file path="suiteb.xml"></suite-file>
<suite-file path="suitec.xml"></suite-file>
</suite-files>

</suite>

 

Output for the above code-

[RemoteTestNG] detected TestNG version 7.4.0
[TestNG] [WARN] Ignoring duplicate listener : listener.MyListener
[TestNG] [WARN] Ignoring duplicate listener : listener.MyListener
[TestNG] [WARN] Ignoring duplicate listener : listener.MyListener

===============================================
Suite A
Total tests run: 0, Passes: 0, Failures: 0, Skips: 0
===============================================


===============================================
Suite B
Total tests run: 0, Passes: 0, Failures: 0, Skips: 0
===============================================


===============================================
Suite C
Total tests run: 0, Passes: 0, Failures: 0, Skips: 0
===============================================


===============================================
My Test Suite
Total tests run: 0, Passes: 0, Failures: 0, Skips: 0
===============================================

 

Thanks


A
Ashish Replied on 21/03/2022

Please define listener in suite xml files


K
Karan V Atreya Replied on 24/03/2022

Thanks Ashish sir for the help, it is working fine now.