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?
> 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?
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.
On Wed, Nov 4, 2009 at 3:51 PM, Pranav <pranav.ve...@gmail.com> wrote:
> 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.
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)
Cédric Beust ♔ wrote:
> Can you post the source of your factory and your XML file?
> Thanks.
> -- > Cedric
> On Wed, Nov 4, 2009 at 3:51 PM, Pranav <pranav.ve...@gmail.com > <mailto:pranav.ve...@gmail.com>> wrote:
> 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.
> > 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?
> > > 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?
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 .
> Cédric Beust ♔ wrote:
>> Can you post the source of your factory and your XML file?
>> Thanks.
>> -- >> Cedric
>> On Wed, Nov 4, 2009 at 3:51 PM, Pranav <pranav.ve...@gmail.com >> <mailto:pranav.ve...@gmail.com>> wrote:
>> 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.
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.
> On Wed, Nov 4, 2009 at 11:51 PM, Pranav <pranav.ve...@gmail.com > <mailto: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.
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.
>> > > 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?
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.
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.