Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
TestNG unable to detect IInvokedMethodListener
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  14 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
S M Humayun  
View profile  
 More options Nov 4, 6:52 am
From: S M Humayun <smhuma...@gmail.com>
Date: Wed, 4 Nov 2009 03:52:02 -0800 (PST)
Local: Wed, Nov 4 2009 6:52 am
Subject: TestNG unable to detect IInvokedMethodListener
Hi,

I created a class that implements both IInvokedMethodListener and
ITestListener:

public class TestMethodListener implements IInvokedMethodListener,
ITestListener

And then configured it as follows:

<suite...>
    <listeners>
        <listener class-
name="com.iblgrp.common.core.test.helper.TestMethodListener"/>
    </listeners>
    <test...>
</suite>

When I ran tests only ITestListener callback methods were called and
not those of IInvokedMethodListener. Is it supposed to work that way
or am I missing some thing?

regards,

Humayun.


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Cédric Beust ♔  
View profile  
 More options Nov 4, 1:08 pm
From: Cédric Beust ♔ <cbe...@google.com>
Date: Wed, 4 Nov 2009 10:08:50 -0800
Local: Wed, Nov 4 2009 1:08 pm
Subject: Re: [testng-users] TestNG unable to detect IInvokedMethodListener

Hi Humayun,

I just tested with a class that implements both interfaces and I see all the
callbacks being invoked correctly.

Are you using Eclipse?  Can you try with the command line only?

--
***Cédric
*

On Wed, Nov 4, 2009 at 3:52 AM, S M Humayun <smhuma...@gmail.com> wrote:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "IAnnotationTransformer2 with @Factory" by Pranav
Pranav  
View profile  
 More options Nov 4, 6:51 pm
From: Pranav <pranav.ve...@gmail.com>
Date: Wed, 04 Nov 2009 15:51:41 -0800
Local: Wed, Nov 4 2009 6:51 pm
Subject: IAnnotationTransformer2 with @Factory
List,

I was trying to implement IAnnotationTransformer2 based listener for my
TestNG Factory.  Right now though my factory runs multiple testcases,
the listener only gets called once. it calls both of the following
method once

public void transform(ITestAnnotation annotation, Class
testClass,Constructor testConstructor, Method testMethod)
public void transform(IFactoryAnnotation arg0, Method arg1)

but I was expecting it to call them once for each testcase.

just to give you guys context, I am trying to transform group
annotations for each of my @factory testcase.

is there some other way to achieve it?

Best,
Pranav


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Cédric Beust ♔  
View profile  
 More options Nov 4, 6:57 pm
From: Cédric Beust ♔ <cbe...@google.com>
Date: Wed, 4 Nov 2009 15:57:58 -0800
Local: Wed, Nov 4 2009 6:57 pm
Subject: Re: [testng-users] IAnnotationTransformer2 with @Factory

Can you post the source of your factory and your XML file?

Thanks.

--
Cedric

--
***Cédric
*

    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Pranav  
View profile  
 More options Nov 4, 8:28 pm
From: Pranav <pranav.ve...@gmail.com>
Date: Wed, 04 Nov 2009 17:28:37 -0800
Local: Wed, Nov 4 2009 8:28 pm
Subject: Re: [testng-users] Re: IAnnotationTransformer2 with @Factory

i have attached the zipped src folder with this mail. please have a
look. if you run it , you will see this output

java -classpath .:../Lib/testng-5.9-jdk15.jar org.testng.TestNG testng.xml
[Parser] Running:
Itest/src/testng.xml

called : transform(IFactoryAnnotation arg0, Method arg1)
called : transform(ITestAnnotation annotation, Class
testClass,Constructor testConstructor, Method testMethod)
ITest:getTestName Called
ITest:getTestName Called
ITest:getTestName Called
ITest:getTestName Called
ITest:getTestName Called
PASSED: someTest (Test1)
PASSED: someTest (Test4)
PASSED: someTest (Test0)
PASSED: someTest (Test3)
PASSED: someTest (Test2)

===============================================
ItestDemo
Tests run: 5, Failures: 0, Skips: 0
===============================================

===============================================
testSuite
Total tests run: 5, Failures: 0, Skips: 0
===============================================

  src.zip
18K Download

    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "TestNG unable to detect IInvokedMethodListener" by S M Humayun
S M Humayun  
View profile  
 More options Nov 4, 11:27 pm
From: S M Humayun <smhuma...@gmail.com>
Date: Wed, 4 Nov 2009 20:27:57 -0800 (PST)
Local: Wed, Nov 4 2009 11:27 pm
Subject: Re: TestNG unable to detect IInvokedMethodListener
I am using TestNG 5.9 with Maven Surefire Plugin configured as
follows:

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

Do note that I didn't mention any version in the plugin config above.

I've already posted the testng.xml in my previous email quoted below
and I am using JetBrain's Intellij IDEA.

- Humayun.

On Nov 4, 11:08 pm, Cédric Beust ♔ <cbe...@google.com> wrote:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Cédric Beust ♔  
View profile  
 More options Nov 4, 11:35 pm
From: Cédric Beust ♔ <cbe...@google.com>
Date: Wed, 4 Nov 2009 20:35:37 -0800
Local: Wed, Nov 4 2009 11:35 pm
Subject: Re: [testng-users] Re: TestNG unable to detect IInvokedMethodListener

Can you try without Surefire?  This Maven plug-in seems to cause a lot of
problems...

--
Cedric

On Wed, Nov 4, 2009 at 8:27 PM, S M Humayun <smhuma...@gmail.com> wrote:

--
***Cédric
*

    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "IAnnotationTransformer2 with @Factory" by Pranav
Pranav  
View profile  
 More options Nov 5, 2:51 am
From: Pranav <pranav.ve...@gmail.com>
Date: Wed, 04 Nov 2009 23:51:31 -0800
Local: Thurs, Nov 5 2009 2:51 am
Subject: Re: [testng-users] Re: IAnnotationTransformer2 with @Factory
on second thoughts, this is never suppose to happen, coz if I understand
right, testng scans/loads annotations at the start, hence transforming
should happen at that time only....and I wanted to change them during
the test run. It probably against the design to up[date the annotations
during test execution... can somebody please confirm that ?

right now we have implemented groups feature, by adding some custom
filtering logic in my Factory class...... it works just fine for us .

Best,
Pranav


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Cédric Beust ♔  
View profile  
 More options Nov 5, 2:59 am
From: Cédric Beust ♔ <cbe...@google.com>
Date: Wed, 4 Nov 2009 23:59:21 -0800
Local: Thurs, Nov 5 2009 2:59 am
Subject: Re: [testng-users] Re: IAnnotationTransformer2 with @Factory

Hi Pranav,

On Wed, Nov 4, 2009 at 11:51 PM, Pranav <pranav.ve...@gmail.com> wrote:

> on second thoughts, this is never suppose to happen, coz if I understand
> right, testng scans/loads annotations at the start, hence transforming
> should happen at that time only....and I wanted to change them during
> the test run. It probably against the design to up[date the annotations
> during test execution... can somebody please confirm that ?

Correct, the annotation transformers modify the annotations before the
TestNG engine sees them.

--
***Cédric
*


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Pranav  
View profile  
 More options Nov 5, 3:45 am
From: Pranav <pranav.ve...@gmail.com>
Date: Thu, 05 Nov 2009 00:45:17 -0800
Local: Thurs, Nov 5 2009 3:45 am
Subject: Re: [testng-users] Re: IAnnotationTransformer2 with @Factory
Thanks for the confirmation Cédric :)

Best,
Pranav


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Discussion subject changed to "TestNG unable to detect IInvokedMethodListener" by S M Humayun
S M Humayun  
View profile  
 More options Nov 5, 4:21 am
From: S M Humayun <smhuma...@gmail.com>
Date: Thu, 5 Nov 2009 14:21:03 +0500
Local: Thurs, Nov 5 2009 4:21 am
Subject: Re: [testng-users] Re: TestNG unable to detect IInvokedMethodListener
Are there any other plugins available to integrate Maven with TestNG?

Though, I've managed to do the same using ITestListener, which is
working fine. Actually, I just wanted to log following:

--- <TestMethodName> : START ---

before test and following:

--- <TestMethodName> : END ---

after test.

You might ask why I didn't use @Before and @After annotations, thats
because I didn't find a way to get the actual test method name and
then I stumble upon IInvokedMethodListener and ITestListener and the
later one did the trick for me. Is there a better way of doing this?
provided that I have to use TestNG with Maven.

--------------------------------------------
S M Humayun
Software Architect, IBL Group
--------------------------------------------
Email : smhuma...@iblgrp.com
MSN   : smhumayun2...@hotmail.com
Skype : smhumayun
Cell  : 92.321.8707783
Blog  : http://smhumayun.blogspot.com
Link  : http://www.linkedin.com/in/smhumayun
Facebook : http://www.facebook.com/smhumayun
Twitter : http://twitter.com/smhumayun
--------------------------------------------

2009/11/5 Cédric Beust ♔ <cbe...@google.com>:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Cédric Beust ♔  
View profile  
 More options Nov 5, 10:48 am
From: Cédric Beust ♔ <cbe...@google.com>
Date: Thu, 5 Nov 2009 07:48:54 -0800
Local: Thurs, Nov 5 2009 10:48 am
Subject: Re: [testng-users] Re: TestNG unable to detect IInvokedMethodListener

On Thu, Nov 5, 2009 at 1:21 AM, S M Humayun <smhuma...@gmail.com> wrote:

Just declare a parameter of type Method in your @BeforeMethod and TestNG
will inject the test method for you.

--
***Cédric
*


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
S M Humayun  
View profile  
 More options Nov 6, 12:19 am
From: S M Humayun <smhuma...@gmail.com>
Date: Fri, 6 Nov 2009 10:19:31 +0500
Local: Fri, Nov 6 2009 12:19 am
Subject: Re: [testng-users] Re: TestNG unable to detect IInvokedMethodListener
Thanx for the pointer.

I am using 5.9, which does not supports ITestResult parameter
injection in @AfterMethod and I tried using Method parameter injection
and it works ! However, nowhere in the doc
(http://testng.org/doc/documentation-main.html#dependency-injection)
is mentioned that @AfterMethod also supports Method parameter
injection.

--------------------------------------------
S M Humayun
Software Architect, IBL Group
--------------------------------------------
Email : smhuma...@iblgrp.com
MSN   : smhumayun2...@hotmail.com
Skype : smhumayun
Cell  : 92.321.8707783
Blog  : http://smhumayun.blogspot.com
Link  : http://www.linkedin.com/in/smhumayun
Facebook : http://www.facebook.com/smhumayun
Twitter : http://twitter.com/smhumayun
--------------------------------------------

2009/11/5 Cédric Beust ♔ <cbe...@google.com>:


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Cédric Beust ♔  
View profile  
 More options Nov 6, 12:25 am
From: Cédric Beust ♔ <cbe...@google.com>
Date: Thu, 5 Nov 2009 21:25:50 -0800
Local: Fri, Nov 6 2009 12:25 am
Subject: Re: [testng-users] Re: TestNG unable to detect IInvokedMethodListener

On Thu, Nov 5, 2009 at 9:19 PM, S M Humayun <smhuma...@gmail.com> wrote:

> Thanx for the pointer.

> I am using 5.9, which does not supports ITestResult parameter
> injection in @AfterMethod and I tried using Method parameter injection
> and it works ! However, nowhere in the doc
> (http://testng.org/doc/documentation-main.html#dependency-injection)
> is mentioned that @AfterMethod also supports Method parameter
> injection.

Good catch, I must have missed it.  I fixed it on the web site.

Thanks!

--
***Cédric
*


    Reply    Reply to author    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2009 Google