why isn't Gradle running my TestNG testlistener?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

why isn't Gradle running my TestNG testlistener?

Todd Bradley
Hi, I have a test listener, creatively named oracle.cloudstorage.qa.testListener.testListener. When I run TestNG tests from the command line using the -listener command line argument, my listener is instantiated and invoked as part of the TestNG startup, as expected. But when I run the tests from Gradle, using the TestNG plugin, my listener isn't invoked.

My build.gradle file has this as the task:

task productionTestMild(type: Test) {
useTestNG() {
includeGroups "production-mild"
excludeGroups "bug"
include 'com/cloudstorage/qa/**'
useDefaultListeners = true

options {
options.parallel = "classes"
options.threadCount = 3
// This doesn't seem to actually work
options.listeners << "com.cloudstorage.qa.testListener.testListener"
}
}
}

The options.parallel and options.threadCount seem to be honored, but not options.listeners. Can you see what I'm doing wrong? I'm using TestNG 6.11 and Gradle 2.13.

Thanks,
Todd.

--
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: why isn't Gradle running my TestNG testlistener?

⇜Krishnan Mahadevan⇝

I was able to have the listener invoked by adding it as below :

 

useTestNG() {
    suites
'src/test/resources/krmahadevan.xml'
   
systemProperties(System.getProperties())
    options {
        listeners.add(
"com.rationaleemotions.EchoListener")
    }
}

 

Thanks & Regards

Krishnan Mahadevan

 

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"

My Scribblings @ http://wakened-cognition.blogspot.com/

My Technical Scribbings @ http://rationaleemotions.wordpress.com/

 

From: <[hidden email]> on behalf of Todd Bradley <[hidden email]>
Reply-To: <[hidden email]>
Date: Monday, September 11, 2017 at 9:05 PM
To: testng-users <[hidden email]>
Subject: [testng-users] why isn't Gradle running my TestNG testlistener?

 

Hi, I have a test listener, creatively named oracle.cloudstorage.qa.testListener.testListener. When I run TestNG tests from the command line using the -listener command line argument, my listener is instantiated and invoked as part of the TestNG startup, as expected. But when I run the tests from Gradle, using the TestNG plugin, my listener isn't invoked.

My build.gradle file has this as the task:

 

task productionTestMild(type: Test) {
    useTestNG() {
        includeGroups
"production-mild"
       
excludeGroups "bug"
       
include 'com/cloudstorage/qa/**'
       
useDefaultListeners = true

       
options {
            options.parallel =
"classes"
           
options.threadCount = 3
           
// This doesn't seem to actually work
           
options.listeners << "com.cloudstorage.qa.testListener.testListener"
       
}
    }
}
 

The options.parallel and options.threadCount seem to be honored, but not options.listeners. Can you see what I'm doing wrong? I'm using TestNG 6.11 and Gradle 2.13.

 

Thanks,

Todd.

--
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: why isn't Gradle running my TestNG testlistener?

Todd Bradley-2
Thanks, Krishnan. It was completely user error. I was using the wrong listener. But I did switch to your style of configuring it, except that my "listeners.add" isn't inside of options {}. It's just inside useTestNG() {}. It still seems to work.

On Mon, Sep 11, 2017 at 9:53 AM, Krishnan Mahadevan <[hidden email]> wrote:

I was able to have the listener invoked by adding it as below :

 

useTestNG() {
    suites
'src/test/resources/krmahadevan.xml'
   
systemProperties(System.getProperties())
    options {
        listeners.add(
"com.rationaleemotions.EchoListener")
    }
}

 

Thanks & Regards

Krishnan Mahadevan

 

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"

My Scribblings @ http://wakened-cognition.blogspot.com/

My Technical Scribbings @ http://rationaleemotions.wordpress.com/

 

From: <[hidden email]> on behalf of Todd Bradley <[hidden email]>
Reply-To: <[hidden email]>
Date: Monday, September 11, 2017 at 9:05 PM
To: testng-users <[hidden email]>
Subject: [testng-users] why isn't Gradle running my TestNG testlistener?

 

Hi, I have a test listener, creatively named oracle.cloudstorage.qa.testListener.testListener. When I run TestNG tests from the command line using the -listener command line argument, my listener is instantiated and invoked as part of the TestNG startup, as expected. But when I run the tests from Gradle, using the TestNG plugin, my listener isn't invoked.

My build.gradle file has this as the task:

 

task productionTestMild(type: Test) {
    useTestNG() {
        includeGroups
"production-mild"
       
excludeGroups "bug"
       
include 'com/cloudstorage/qa/**'
       
useDefaultListeners = true

       
options {
            options.parallel =
"classes"
           
options.threadCount = 3
           
// This doesn't seem to actually work
           
options.listeners << "com.cloudstorage.qa.testListener.testListener"
       
}
    }
}
 

The options.parallel and options.threadCount seem to be honored, but not options.listeners. Can you see what I'm doing wrong? I'm using TestNG 6.11 and Gradle 2.13.

 

Thanks,

Todd.

--
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.

--
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.