AnnotationTransformer called for methods not selected

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

AnnotationTransformer called for methods not selected

Thomas H
Hi,

I use the IAnnotationTransformer to disable test cases in run-time, based on criteria annotated on the test methods.

If the suite XML file lists individual test methods, like this:

<test name="My test">
<classes>
<class name="MyTestClass">
<methods>
<include name="myTestMethod1"></include>
</methods>
</class>
...

then the transformer is called for all test methods in the class (MyTestClass).
This is problematic for me. I would like the transformer to only be called for the test methods that are going to run.

Is this how it is intended? Can it be changed?

Is there a way for me to know in the transformer if the method is selected by the suite XML?


/Thomas

--
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
|  
Report Content as Inappropriate

Re: AnnotationTransformer called for methods not selected

Krishnan Mahadevan

Cedric/Julien,

Do you think we should change AnnotationTransformer such that its applied after a method selector is done with the filtering logic of pruning the *in-eligible* methods? Please advise.

 

Thomas,

 

I would be curious to understand why you feel that its problematic for your AnnotationTransformer implementation to get access to all methods (even the ones which will be filtered out and not executed)?

 

I am not sure if it’s the intended behavior or not. Perhaps Cedric/Julien can add more context around it.

 

I currently don’t see any negative impact because of this behavior (Except for an additional execution time, because TestNG has to spend time on applying the transformer on all methods). Maybe you could help elaborate your specific issue on why this is problematic for you.

 

 

 

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 Thomas H <[hidden email]>
Reply-To: <[hidden email]>
Date: Tuesday, June 13, 2017 at 7:05 PM
To: testng-users <[hidden email]>
Subject: [testng-users] AnnotationTransformer called for methods not selected

 

Hi,

 

I use the IAnnotationTransformer to disable test cases in run-time, based on criteria annotated on the test methods.

 

If the suite XML file lists individual test methods, like this:

 

            <test name="My test">

                        <classes>

                                    <class name="MyTestClass">

                                                <methods>

                                                            <include name="myTestMethod1"></include>

                                                </methods>

                                    </class>

                                    ...

 

then the transformer is called for all test methods in the class (MyTestClass).

This is problematic for me. I would like the transformer to only be called for the test methods that are going to run.

 

Is this how it is intended? Can it be changed?

 

Is there a way for me to know in the transformer if the method is selected by the suite XML?

 

 

/Thomas

--
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
|  
Report Content as Inappropriate

Re: AnnotationTransformer called for methods not selected

Thomas H
Hi,

I have two reasons,
In my transformer I create a report that states which tests that were disabled and which will run. We use this report to feedback to other systems. We use this report as the output when we do a "dry run".

One of the criteria we annotate our tests with is the required test equipment. Some of which are shared resources. One idea was to reserve the equipment if available, and otherwise disable the test. But we don't want to reserve equipment if the test is not going to run. If we wait until later then we don't have the option to disable the test.
Maybe I could use IMethodInterceptor instead.

This is all part of a large continuous integration environment running in automated test labs.

/Thomas

--
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
|  
Report Content as Inappropriate

Re: AnnotationTransformer called for methods not selected

Krishnan Mahadevan

Thomas,

 

I think you might want to consider using IMethodInterceptor (as you also pointed out) instead of the IAnnotationTransformer.

 

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 Thomas H <[hidden email]>
Reply-To: <[hidden email]>
Date: Wednesday, June 14, 2017 at 8:28 PM
To: testng-users <[hidden email]>
Subject: Re: [testng-users] AnnotationTransformer called for methods not selected

 

Hi,

 

I have two reasons,

In my transformer I create a report that states which tests that were disabled and which will run. We use this report to feedback to other systems. We use this report as the output when we do a "dry run".

 

One of the criteria we annotate our tests with is the required test equipment. Some of which are shared resources. One idea was to reserve the equipment if available, and otherwise disable the test. But we don't want to reserve equipment if the test is not going to run. If we wait until later then we don't have the option to disable the test.

Maybe I could use IMethodInterceptor instead.

 

This is all part of a large continuous integration environment running in automated test labs.

 

/Thomas

 

--
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.
Loading...