Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7548965
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T09:49:52+00:00 2026-05-30T09:49:52+00:00

Problem description: The setup is executing Ant build script with TestNG target, which then

  • 0

Problem description:

The setup is executing Ant build script with TestNG target, which then loads testng.xml file. There is a possibility to specify listeners in both Ant file and testng.xml.

The questions arising are following:

  1. Will both set up ways be supported? Will all the listeners specified in both configuration location be used during test execution?
  2. Will any of listeners be prioritized over another? If yes, how?

Sample set up:

Ant file:

<project>
<property name="classes.dir" path="<my_classes_dir>" />
<property name="test.dir" path="<my_test_dir>" />
<target name="run-test">
    <testng useDefaultListeners="false"
          listeners="org.testng.reporters.EmailableReporter, org.testng.reporters.XMLReporter, com.example.MyCustomReporter">
        <classpath>
          <path path="${classes.dir}" />
        </classpath>
      <xmlfileset dir="${test.dir}" includes="testng.xml" />
    </testng>
</target>
</project>

TestNG.xml:

<suite name="MyTestSuite">
    <listeners>
        <listener class-name="com.example.MyListener" />
        <listener class-name="org.testng.reporters.FailedReporter" />
    </listeners>
    <test name="MyTest1">
        <classes>
            <class name="com.example.MyTest1" />
        </classes>
    </test>
</suite>

Background:

I have to support existing project which uses set up similar to the one described above. The Ant build file disables default reporters. Without touching Ant build file, I would like to specify additional report listeners (FailedReporter and/or any custom ones) for my tests in testng.xml.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T09:49:53+00:00Added an answer on May 30, 2026 at 9:49 am

    I believe all listeners should be run, in your build file as well as in your testng.xml.
    The testng.xml listeners would be executed second.
    If the same listener is listed in both, build file and testng.xml, it would be executed twice.

    This is based on my experience with Maven, but I guess, with ant it should be the same.
    Also the order of listeners specified in testng.xml cannot be guaranteed in case both are implementing the same set of interfaces.

    Hope it helps.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Problem description: Read an xml file, traverse to a particular node (element), if it
Given the following xml fragment: <Problems> <Problem> <File>file1</File> <Description>desc1</Description> </Problem> <Problem> <File>file1</File> <Description>desc2</Description> </Problem>
Short description of my setup: There is an SQLObject base class which has an
I have the following in my Inno Setup file which creates a desktop icon
Expanding this question on how I learnt to pass from problem description to code
SHORT DESCRIPTION OF PROBLEM: I want to set the text of a searchbar without
Uhm I'm not sure if anyone has encountered this problem a brief description is
I'm having a problem with this: -(id)initWithName:(NSString *)n description:(NSString *)d url:(NSString *)u { I'm
Ok here is my problem : Before i start the description, let me to
I have a problem with the query below in postgres SELECT u.username,l.description,l.ip,SUBSTRING(l.createdate,0,11) as createdate,l.action

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.