Data Provider Parallelism : Programatically

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

Data Provider Parallelism : Programatically

Musaffir Lp
Hello,

We have the wonderfurl @DataProvider feature which can be set with the attribute parallell=true to acheive the parallel execution of different data supllied
ex:


  @DataProvider(name = "parallelDataProvider", parallel=true)
   public Object[][] parallelDataProvider(Method testMethod) 
   {

       // some code
  }

Instead of, I hardocde this attribute like this .... can I pass it programatically ?
Why I am looking for this : beacuse I want my data provider to behave differently....i don't want it to supply the data in parallel always to the test methods.. i should be able to easily modify its behaviour...
and at the same time I do not want to come back here and update the attribute of the data provider method based on my need ...it should be able to change at run time ...


Thanks & Warm Regards
Musaffir



--
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: Data Provider Parallelism : Programatically

Krishnan Mahadevan
The following steps should help you with your use-case.
  • Build an implementation of org.testng.IAnnotationTransformer2
  • Plugin your transformation logic within org.testng.IAnnotationTransformer2#transform(org.testng.annotations.IDataProviderAnnotation, java.lang.reflect.Method)
  • Wire in this listener using the <listeners> tag or using Service loaders.

That should suffice.


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/

On Thu, Oct 5, 2017 at 1:43 PM, Musaffir lp <[hidden email]> wrote:
Hello,

We have the wonderfurl @DataProvider feature which can be set with the attribute parallell=true to acheive the parallel execution of different data supllied
ex:


  @DataProvider(name = "parallelDataProvider", parallel=true)
   public Object[][] parallelDataProvider(Method testMethod) 
   {

       // some code
  }

Instead of, I hardocde this attribute like this .... can I pass it programatically ?
Why I am looking for this : beacuse I want my data provider to behave differently....i don't want it to supply the data in parallel always to the test methods.. i should be able to easily modify its behaviour...
and at the same time I do not want to come back here and update the attribute of the data provider method based on my need ...it should be able to change at run time ...


Thanks & Warm Regards
Musaffir



--
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: Data Provider Parallelism : Programatically

Musaffir Lp
Thank you Krishnan
I already have a listener class which implements -  org.testng.internal.annotations.IAnnotationTransformer , where I was delibrately looking for this option....
Now I will look in to - org.testng.IAnnotationTransformer2
Thakns again


~ Musaffir


On Thursday, October 5, 2017 at 4:19:02 PM UTC+8, Krishnan Mahadevan wrote:
The following steps should help you with your use-case.
  • Build an implementation of org.testng.IAnnotationTransformer2
  • Plugin your transformation logic within org.testng.IAnnotationTransformer2#transform(org.testng.annotations.IDataProviderAnnotation, java.lang.reflect.Method)
  • Wire in this listener using the <listeners> tag or using Service loaders.

That should suffice.


Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ <a href="http://wakened-cognition.blogspot.com/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwakened-cognition.blogspot.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwakened-cognition.blogspot.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ&#39;;return true;">http://wakened-cognition.blogspot.com/
My Technical Scribbings @ <a href="http://rationaleemotions.wordpress.com/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Frationaleemotions.wordpress.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEcBOKyRn0lpL8LDbBuyAlKdwgXwQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Frationaleemotions.wordpress.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEcBOKyRn0lpL8LDbBuyAlKdwgXwQ&#39;;return true;">http://rationaleemotions.wordpress.com/

On Thu, Oct 5, 2017 at 1:43 PM, Musaffir lp <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="CKFuCFL7AAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">musaf...@...> wrote:
Hello,

We have the wonderfurl @DataProvider feature which can be set with the attribute parallell=true to acheive the parallel execution of different data supllied
ex:


  @DataProvider(name = "parallelDataProvider", parallel=true)
   public Object[][] parallelDataProvider(Method testMethod) 
   {

       // some code
  }

Instead of, I hardocde this attribute like this .... can I pass it programatically ?
Why I am looking for this : beacuse I want my data provider to behave differently....i don't want it to supply the data in parallel always to the test methods.. i should be able to easily modify its behaviour...
and at the same time I do not want to come back here and update the attribute of the data provider method based on my need ...it should be able to change at run time ...


Thanks & Warm Regards
Musaffir



--
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 <a href="javascript:" target="_blank" gdf-obfuscated-mailto="CKFuCFL7AAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">testng-users...@googlegroups.com.
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="CKFuCFL7AAAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">testng...@....
Visit this group at <a href="https://groups.google.com/group/testng-users" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/group/testng-users&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/group/testng-users&#39;;return true;">https://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">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.