Annotation Transformer

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

Annotation Transformer

tarun3kumar

Hi,
i implemented IAnnotationTransformers and inside the transform method i'm doing this:
annotation.setTimeOut(1000); (1000 just to see it realy timesout)

but nothing times out...

am i doing something wrong ?
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.opensymphony.com/thread.jspa?threadID=53979&messageID=108320#108320


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Annotation Transformer

Cédric Beust ♔
Can you post your code?

--
Cedric


On 12/17/06, Aviram <[hidden email] > wrote:

Hi,
i implemented IAnnotationTransformers and inside the transform method i'm doing this:
annotation.setTimeOut(1000); (1000 just to see it realy timesout)

but nothing times out...

am i doing something wrong ?
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.opensymphony.com/thread.jspa?threadID=53979&messageID=108320#108320



--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Annotation Transformer

tarun3kumar

public class TimeoutTransformer implements IAnnotationTransformer {
    public void transform(ITest annotation, Class testClass, Constructor testConstructor,  
                                   Method testMethod) {
        annotation.setTimeOut(1000);
    }
}
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.opensymphony.com/thread.jspa?threadID=53979&messageID=108331#108331


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Annotation Transformer

Cédric Beust ♔
And the test method you are running this transformer on?

And how do you invoke TestNG?

--
Cedric


On 12/17/06, Aviram <[hidden email]> wrote:

public class TimeoutTransformer implements IAnnotationTransformer {
    public void transform(ITest annotation, Class testClass, Constructor testConstructor,
                                   Method testMethod) {
        annotation.setTimeOut(1000);
    }
}
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.opensymphony.com/thread.jspa?threadID=53979&messageID=108331#108331


--
Cédric
--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Annotation Transformer

tarun3kumar

i'm running testNG from ant (with the listener attribute)

the @Test annotation is at the class and have only groups

i tried looking what i get everytime transfrom is called

iget 2 testClasses (both that class with the @Test)
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.opensymphony.com/thread.jspa?threadID=53979&messageID=108409#108409


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Annotation Transformer

Cédric Beust ♔
Does any of your test method take longer than 1 second?

--
Cedric


On 12/17/06, Aviram <[hidden email]> wrote:

i'm running testNG from ant (with the listener attribute)

the @Test annotation is at the class and have only groups

i tried looking what i get everytime transfrom is called

iget 2 testClasses (both that class with the @Test)
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.opensymphony.com/thread.jspa?threadID=53979&messageID=108409#108409


--
Cédric
--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Annotation Transformer

tarun3kumar

yes, a lot more than one second
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.opensymphony.com/thread.jspa?threadID=53979&messageID=108413#108413


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Annotation Transformer

Alexandru Popescu ☀

Can you send a reduced test case for this? Including your annotation
transformer. Then I can look into it.

TIA,

./alex
--
.w( the_mindstorm )p.
  TestNG co-founder
EclipseTestNG Creator


On 12/17/06, Aviram <[hidden email]> wrote:
>
> yes, a lot more than one second
> ---------------------------------------------------------------------
> Posted via Jive Forums
> http://forums.opensymphony.com/thread.jspa?threadID=53979&messageID=108413#108413
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Annotation Transformer

tarun3kumar

i'll try creating a simple test if i'll have time on thursday
the current tests are huge
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.opensymphony.com/thread.jspa?threadID=53979&messageID=108823#108823


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Annotation Transformer

tarun3kumar
test - 10seconds
timeout transformed to 1sec

test succeed

running:
java.exe -classpath .;testng-5.4-jdk15.jar org.testng.TestNG -listener TimeoutTransformer -testclass Test1
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.opensymphony.com/thread.jspa?threadID=53979&messageID=109364#109364

--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en
-~----------~----~----~----~------~----~------~--~---


Test1.java (290 bytes) Download Attachment
TimeoutTransformer.java (562 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Annotation Transformer

Alexandru Popescu ☀

Thanks Aviram. I'm gonna look into it.

./alex
--
.w( the_mindstorm )p.
  TestNG co-founder
EclipseTestNG Creator


On 12/21/06, Aviram <[hidden email]> wrote:

> test - 10seconds
> timeout transformed to 1sec
>
> test succeed
>
> running:
> java.exe -classpath .;testng-5.4-jdk15.jar org.testng.TestNG -listener TimeoutTransformer -testclass Test1
> ---------------------------------------------------------------------
> Posted via Jive Forums
> http://forums.opensymphony.com/thread.jspa?threadID=53979&messageID=109364#109364
>
> >
>
>
>

--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Annotation Transformer

Alexandru Popescu ☀

By running your code I see the following output:

===============================================
Command line suite
Total tests run: 1, Failures: 1, Skips: 0
===============================================

If I increase the loglevel to 2: -log 2 I am seeing:

FAILED: testMethod1
org.testng.internal.thread.ThreadTimeoutException: Method public void
test.annotationtransformer.timeout.TestClass.testMethod1() throws
java.lang.InterruptedException didn't finish within the time-out 1000
... Removed 17 stack frames

===============================================
    Command line test
    Tests run: 1, Failures: 1, Skips: 0
===============================================


===============================================
Command line suite
Total tests run: 1, Failures: 1, Skips: 0
===============================================

./alex
--
.w( the_mindstorm )p.
  TestNG co-founder
EclipseTestNG Creator




On 12/21/06, Alexandru Popescu <[hidden email]> wrote:

> Thanks Aviram. I'm gonna look into it.
>
> ./alex
> --
> .w( the_mindstorm )p.
>   TestNG co-founder
> EclipseTestNG Creator
>
>
> On 12/21/06, Aviram <[hidden email]> wrote:
> > test - 10seconds
> > timeout transformed to 1sec
> >
> > test succeed
> >
> > running:
> > java.exe -classpath .;testng-5.4-jdk15.jar org.testng.TestNG -listener TimeoutTransformer -testclass Test1
> > ---------------------------------------------------------------------
> > Posted via Jive Forums
> > http://forums.opensymphony.com/thread.jspa?threadID=53979&messageID=109364#109364
> >
> > > >
> >
> >
> >
>

--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Annotation Transformer

tarun3kumar

don't know what to tell you
i get

C:\test>w:\JDKs\pure_java\1.5.0_06\bin\javac.exe -classpath testng-5.4-jdk15.jar *.java

C:\test>w:\JDKs\pure_java\1.5.0_06\bin\java.exe -classpath .;testng-5.4-jdk15.jar org.testng.TestNG -listener TimeoutTransformer -testclass Test1 -log 2
[Parser] Running:
  Command line suite

PASSED: testMethod1

===============================================
    Command line test
    Tests run: 1, Failures: 0, Skips: 0
===============================================


===============================================
Command line suite
Total tests run: 1, Failures: 0, Skips: 0
===============================================

(and i counted 10 seconds)
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.opensymphony.com/thread.jspa?threadID=53979&messageID=109486#109486


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Annotation Transformer

Cédric Beust ♔


On 12/21/06, Aviram <[hidden email]> wrote:

don't know what to tell you
i get

C:\test>w:\JDKs\pure_java\1.5.0_06\bin\javac.exe -classpath testng-5.4-jdk15.jar *.java

C:\test>w:\JDKs\pure_java\1.5.0_06\bin\java.exe -classpath .;testng- 5.4-jdk15.jar org.testng.TestNG -listener TimeoutTransformer -testclass Test1 -log 2

Are you sure TimeoutTransformer is on your classpath?  It doesn't look like it is,  based on your command line.

I wonder if it's not being found and TestNG is not showing you the ClassNotFoundException.

Can you try

javap -classpath .;testng-5.4-jdk15.jar TimeoutTransformer

?

--
Cédric
--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Annotation Transformer

Alexandru Popescu ☀
On 12/21/06, C dric Beust   <[hidden email]> wrote:

>
>
> On 12/21/06, Aviram <[hidden email]> wrote:
> >
> > don't know what to tell you
> > i get
> >
> > C:\test>w:\JDKs\pure_java\1.5.0_06\bin\javac.exe
> -classpath testng-5.4-jdk15.jar *.java
> >
> > C:\test>w:\JDKs\pure_java\1.5.0_06\bin\java.exe
> -classpath .;testng- 5.4-jdk15.jar org.testng.TestNG -listener
> TimeoutTransformer -testclass Test1 -log 2
>
> Are you sure TimeoutTransformer is on your classpath?  It doesn't look like
> it is,  based on your command line.
>

It happened to me and the exception is correctly shown.

./alex
--
.w( the_mindstorm )p.
  TestNG co-founder
EclipseTestNG Creator

> I wonder if it's not being found and TestNG is not showing you the
> ClassNotFoundException.
>
> Can you try
>
> javap -classpath .;testng-5.4-jdk15.jar TimeoutTransformer
>
> ?
>
> --
>  C dric
>
>  >
>

--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Annotation Transformer

tarun3kumar
In reply to this post by Cédric Beust ♔

C:\test>w:\JDKs\pure_java\1.5.0_06\bin\javap.exe -classpath .;testng-5.4-jdk15.jar TimeoutTransformer
Compiled from "TimeoutTransformer.java"
public class TimeoutTransformer extends java.lang.Object implements org.testng.internal.annotations.IAnnotationTransform
er{
    public TimeoutTransformer();
    public void transform(org.testng.internal.annotations.ITest, java.lang.Class, java.lang.reflect.Constructor, java.la
ng.reflect.Method);
}
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.opensymphony.com/thread.jspa?threadID=53979&messageID=109510#109510


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Annotation Transformer

Alexandru Popescu ☀

Aviram, can you please try the test by using packages in your classes?
It is the only thing I can think of.

./alex
--
.w( the_mindstorm )p.
  TestNG co-founder
EclipseTestNG Creator


On 12/21/06, Aviram <[hidden email]> wrote:

>
> C:\test>w:\JDKs\pure_java\1.5.0_06\bin\javap.exe -classpath .;testng-5.4-jdk15.jar TimeoutTransformer
> Compiled from "TimeoutTransformer.java"
> public class TimeoutTransformer extends java.lang.Object implements org.testng.internal.annotations.IAnnotationTransform
> er{
>     public TimeoutTransformer();
>     public void transform(org.testng.internal.annotations.ITest, java.lang.Class, java.lang.reflect.Constructor, java.la
> ng.reflect.Method);
> }
> ---------------------------------------------------------------------
> Posted via Jive Forums
> http://forums.opensymphony.com/thread.jspa?threadID=53979&messageID=109510#109510
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Annotation Transformer

tarun3kumar

i'll be at work sunday i'll check it out again
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.opensymphony.com/thread.jspa?threadID=53979&messageID=109552#109552


--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply | Threaded
Open this post in threaded view
|

Re: Annotation Transformer

tarun3kumar
please check this out...
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.opensymphony.com/thread.jspa?threadID=53979&messageID=109555#109555

--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en
-~----------~----~----~----~------~----~------~--~---


TestNG.rar (60K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Annotation Transformer

Alexandru Popescu ☀

On 12/21/06, Aviram <[hidden email]> wrote:
> please check this out...

The problem seems to be the fact that you are using a class level
@Test annotation. If you annotate the method, then the test correctly
fails.

I guess this may be considered a bug.  For further reference: the
annotation transformer gets called with the Class argument, but the
changed value seems to be further ignored.

And the workaround for now is to use method level annotation.

Thanks for the testcase Aviram.

./alex
--
.w( the_mindstorm )p.
  TestNG co-founder
EclipseTestNG Creator

> ---------------------------------------------------------------------
> Posted via Jive Forums
> http://forums.opensymphony.com/thread.jspa?threadID=53979&messageID=109555#109555
>
> >
>
>
>

--~--~---------~--~----~------------~-------~--~----~
 You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to [hidden email]
To unsubscribe from this group, send email to [hidden email]
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en
-~----------~----~----~----~------~----~------~--~---

12