Data Provider -How to either change run time testName for each run or call @Test methods based on @Test(data provider) received value.

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

Data Provider -How to either change run time testName for each run or call @Test methods based on @Test(data provider) received value.

QA Lead
Hi,



Using @DataProvider(name="runMode"), I am able get runMode and then using @DataProvider(name=testCases") I am able to read each tests from one or more sheets along with corresponding value from data sheet (used @DataProvider(name="runMode") data-provider). But my @Test(Data-Provider="testCases") gives same name for each run. Let us say it run 50 times then it will show like below

ReadSuite.testDataPr
ovi(java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String)

for each run. I want it should give 50 names based on keyword.

--
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 http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: Data Provider -How to either change run time testName for each run or call @Test methods based on @Test(data provider) received value.

Krishnan Mahadevan
You can refer to my blog post : http://rationaleemotions.wordpress.com/2013/07/31/pretty-printing-with-testng/ and see if that helps you get started. 

On Friday, January 31, 2014, QA Lead <[hidden email]> wrote:
Hi,



Using @DataProvider(name="runMode"), I am able get runMode and then using @DataProvider(name=testCases") I am able to read each tests from one or more sheets along with corresponding value from data sheet (used @DataProvider(name="runMode") data-provider). But my @Test(Data-Provider="testCases") gives same name for each run. Let us say it run 50 times then it will show like below

ReadSuite.testDataPr
ovi(java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String)

for each run. I want it should give 50 names based on keyword.

--
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:_e(%7B%7D,&#39;cvml&#39;,&#39;testng-users%2Bunsubscribe@googlegroups.com&#39;);" target="_blank">testng-users+unsubscribe@....
To post to this group, send email to <a href="javascript:_e(%7B%7D,&#39;cvml&#39;,&#39;testng-users@googlegroups.com&#39;);" target="_blank">testng-users@....
Visit this group at http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/groups/opt_out.


--
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/

--
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 http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: Data Provider -How to either change run time testName for each run or call @Test methods based on @Test(data provider) received value.

QA Lead
Hi Krishnan,

Thanks for reply but it seems your blog is not going to provide solution for this scenario. Please have a look at my actual sample output
PASSED TESTS -null
Class Method Time
(ms)
Status
[TestClass name=class selenium.bu.ReadSuite]   ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                           3147 PASSED
[TestClass name=class selenium.bu.ReadSuite]    ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                               154 PASSED
[TestClass name=class selenium.bu.ReadSuite]   ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                                  79 PASSED
[TestClass name=class selenium.bu.ReadSuite]   ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                                      1 PASSED

where in actual I want, report should look like
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.browse()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]           3147 PASSED
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.checkToolTip()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]    154 PASSED
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.clear()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]                 79 PASSED
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.clearAll()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]               1 PASSED

On Friday, January 31, 2014 2:11:25 PM UTC+5:30, Krishnan wrote:
You can refer to my blog post : <a href="http://rationaleemotions.wordpress.com/2013/07/31/pretty-printing-with-testng/" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Frationaleemotions.wordpress.com%2F2013%2F07%2F31%2Fpretty-printing-with-testng%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNGItBWrwaEbg-_De8ubg-wyA4oIQA';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Frationaleemotions.wordpress.com%2F2013%2F07%2F31%2Fpretty-printing-with-testng%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNGItBWrwaEbg-_De8ubg-wyA4oIQA';return true;">http://rationaleemotions.wordpress.com/2013/07/31/pretty-printing-with-testng/ and see if that helps you get started. 

On Friday, January 31, 2014, QA Lead <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="kjO_d_dH500J" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">sanjee...@...> wrote:
Hi,



Using @DataProvider(name="runMode"), I am able get runMode and then using @DataProvider(name=testCases") I am able to read each tests from one or more sheets along with corresponding value from data sheet (used @DataProvider(name="runMode") data-provider). But my @Test(Data-Provider="testCases") gives same name for each run. Let us say it run 50 times then it will show like below

ReadSuite.testDataPr
ovi(java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String)

for each run. I want it should give 50 names based on keyword.

--
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 testng-users+unsubscribe@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users';return true;" onclick="this.href='http://groups.google.com/group/testng-users';return true;">http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/groups/opt_out" target="_blank" onmousedown="this.href='https://groups.google.com/groups/opt_out';return true;" onclick="this.href='https://groups.google.com/groups/opt_out';return true;">https://groups.google.com/groups/opt_out.


--
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" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;">http://wakened-cognition.blogspot.com/

--
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 http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: Data Provider -How to either change run time testName for each run or call @Test methods based on @Test(data provider) received value.

Krishnan Mahadevan
Sanjeev
Please have your DataProvider accept a POJO [ Plain Old Java Object] as a parameter and have it implement a custom toString() method which gives out the output as you need.

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/


On Sat, Feb 1, 2014 at 10:56 AM, QA Lead <[hidden email]> wrote:
Hi Krishnan,

Thanks for reply but it seems your blog is not going to provide solution for this scenario. Please have a look at my actual sample output
PASSED TESTS -null
Class Method Time
(ms)
Status
[TestClass name=class selenium.bu.ReadSuite]   ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                           3147 PASSED
[TestClass name=class selenium.bu.ReadSuite]    ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                               154 PASSED
[TestClass name=class selenium.bu.ReadSuite]   ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                                  79 PASSED
[TestClass name=class selenium.bu.ReadSuite]   ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                                      1 PASSED

where in actual I want, report should look like
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.browse()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]           3147 PASSED
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.checkToolTip()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]    154 PASSED
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.clear()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]                 79 PASSED
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.clearAll()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]               1 PASSED

On Friday, January 31, 2014 2:11:25 PM UTC+5:30, Krishnan wrote:
You can refer to my blog post : http://rationaleemotions.wordpress.com/2013/07/31/pretty-printing-with-testng/ and see if that helps you get started. 

On Friday, January 31, 2014, QA Lead <[hidden email]> wrote:
Hi,



Using @DataProvider(name="runMode"), I am able get runMode and then using @DataProvider(name=testCases") I am able to read each tests from one or more sheets along with corresponding value from data sheet (used @DataProvider(name="runMode") data-provider). But my @Test(Data-Provider="testCases") gives same name for each run. Let us say it run 50 times then it will show like below

ReadSuite.testDataPr
ovi(java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String)

for each run. I want it should give 50 names based on keyword.

--
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 testng-users+unsubscribe@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/groups/opt_out.


--
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/

--
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 http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/groups/opt_out.

--
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 http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: Data Provider -How to either change run time testName for each run or call @Test methods based on @Test(data provider) received value.

QA Lead
Hi Krishnan,

  Thanks for the solution which you have mentioned.
  Can you provide me little help about POJO as I never used this one.

On Monday, February 3, 2014 12:20:55 PM UTC+5:30, Krishnan wrote:
Sanjeev
Please have your DataProvider accept a POJO [ Plain Old Java Object] as a parameter and have it implement a custom toString() method which gives out the output as you need.

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" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;">http://wakened-cognition.blogspot.com/


On Sat, Feb 1, 2014 at 10:56 AM, QA Lead <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="_0ArsNIZtngJ" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">sanjee...@...> wrote:
Hi Krishnan,

Thanks for reply but it seems your blog is not going to provide solution for this scenario. Please have a look at my actual sample output
PASSED TESTS -null
Class Method Time
(ms)
Status
[TestClass name=class selenium.bu.ReadSuite]   ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                           3147 PASSED
[TestClass name=class selenium.bu.ReadSuite]    ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                               154 PASSED
[TestClass name=class selenium.bu.ReadSuite]   ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                                  79 PASSED
[TestClass name=class selenium.bu.ReadSuite]   ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                                      1 PASSED

where in actual I want, report should look like
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.browse()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]           3147 PASSED
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.checkToolTip()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]    154 PASSED
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.clear()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]                 79 PASSED
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.clearAll()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]               1 PASSED

On Friday, January 31, 2014 2:11:25 PM UTC+5:30, Krishnan wrote:
You can refer to my blog post : <a href="http://rationaleemotions.wordpress.com/2013/07/31/pretty-printing-with-testng/" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Frationaleemotions.wordpress.com%2F2013%2F07%2F31%2Fpretty-printing-with-testng%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNGItBWrwaEbg-_De8ubg-wyA4oIQA';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Frationaleemotions.wordpress.com%2F2013%2F07%2F31%2Fpretty-printing-with-testng%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNGItBWrwaEbg-_De8ubg-wyA4oIQA';return true;">http://rationaleemotions.wordpress.com/2013/07/31/pretty-printing-with-testng/ and see if that helps you get started. 

On Friday, January 31, 2014, QA Lead <[hidden email]> wrote:
Hi,



Using @DataProvider(name="runMode"), I am able get runMode and then using @DataProvider(name=testCases") I am able to read each tests from one or more sheets along with corresponding value from data sheet (used @DataProvider(name="runMode") data-provider). But my @Test(Data-Provider="testCases") gives same name for each run. Let us say it run 50 times then it will show like below

ReadSuite.testDataPr
ovi(java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String)

for each run. I want it should give 50 names based on keyword.

--
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 testng-users+unsubscribe@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users';return true;" onclick="this.href='http://groups.google.com/group/testng-users';return true;">http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/groups/opt_out" target="_blank" onmousedown="this.href='https://groups.google.com/groups/opt_out';return true;" onclick="this.href='https://groups.google.com/groups/opt_out';return true;">https://groups.google.com/groups/opt_out.


--
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" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;">http://wakened-cognition.blogspot.com/

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

--
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 http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

RE: Data Provider -How to either change run time testName for each run or call @Test methods based on @Test(data provider) received value.

Alexander Poulikakos

See wiki about POJO: http://en.wikipedia.org/wiki/Plain_Old_Java_Object

 

/Alex

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of QA Lead
Sent: den 3 februari 2014 10:53
To: [hidden email]
Subject: Re: [testng-users] Data Provider -How to either change run time testName for each run or call @Test methods based on @Test(data provider) received value.

 

Hi Krishnan,

  Thanks for the solution which you have mentioned.
  Can you provide me little help about POJO as I never used this one.

On Monday, February 3, 2014 12:20:55 PM UTC+5:30, Krishnan wrote:

Sanjeev

Please have your DataProvider accept a POJO [ Plain Old Java Object] as a parameter and have it implement a custom toString() method which gives out the output as you need.


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/

 

On Sat, Feb 1, 2014 at 10:56 AM, QA Lead <<a href="javascript:" target="_blank">sanjee...@...> wrote:

Hi Krishnan,

Thanks for reply but it seems your blog is not going to provide solution for this scenario. Please have a look at my actual sample output
PASSED TESTS -null
Class Method Time
(ms)
Status
[TestClass name=class selenium.bu.ReadSuite]   ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                           3147 PASSED
[TestClass name=class selenium.bu.ReadSuite]    ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                               154 PASSED
[TestClass name=class selenium.bu.ReadSuite]   ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                                  79 PASSED
[TestClass name=class selenium.bu.ReadSuite]   ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                                      1 PASSED

where in actual I want, report should look like
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.browse()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]           3147 PASSED
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.checkToolTip()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]    154 PASSED
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.clear()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]                 79 PASSED
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.clearAll()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]               1 PASSED

On Friday, January 31, 2014 2:11:25 PM UTC+5:30, Krishnan wrote:

You can refer to my blog post : http://rationaleemotions.wordpress.com/2013/07/31/pretty-printing-with-testng/ and see if that helps you get started. 

On Friday, January 31, 2014, QA Lead <[hidden email]> wrote:

Hi,



Using @DataProvider(name="runMode"), I am able get runMode and then using @DataProvider(name=testCases") I am able to read each tests from one or more sheets along with corresponding value from data sheet (used @DataProvider(name="runMode") data-provider). But my @Test(Data-Provider="testCases") gives same name for each run. Let us say it run 50 times then it will show like below

ReadSuite.testDataPr
ovi(java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String)

for each run. I want it should give 50 names based on keyword.

--
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 http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/groups/opt_out.



--
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/

--
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">testng-users...@....
To post to this group, send email to <a href="javascript:" target="_blank">testng...@....
Visit this group at http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/groups/opt_out.

 

--
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 http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/groups/opt_out.

--
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 http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: Data Provider -How to either change run time testName for each run or call @Test methods based on @Test(data provider) received value.

QA Lead
Hi Alex,

 Even this wiki does not contain much info about POJO.

On Monday, February 3, 2014 3:28:46 PM UTC+5:30, drapostolos wrote:

See wiki about POJO: <a href="http://en.wikipedia.org/wiki/Plain_Old_Java_Object" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FPlain_Old_Java_Object\46sa\75D\46sntz\0751\46usg\75AFQjCNFYKc3_17ZH6X3vfpUU6AzEsxGTYQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FPlain_Old_Java_Object\46sa\75D\46sntz\0751\46usg\75AFQjCNFYKc3_17ZH6X3vfpUU6AzEsxGTYQ';return true;">http://en.wikipedia.org/wiki/Plain_Old_Java_Object

 

/Alex

 

From: <a href="javascript:" target="_blank" gdf-obfuscated-mailto="PnvvLqGZqWAJ" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">testng...@... [mailto:<a href="javascript:" target="_blank" gdf-obfuscated-mailto="PnvvLqGZqWAJ" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">testng...@googlegroups.com] On Behalf Of QA Lead
Sent: den 3 februari 2014 10:53
To: <a href="javascript:" target="_blank" gdf-obfuscated-mailto="PnvvLqGZqWAJ" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">testng...@...
Subject: Re: [testng-users] Data Provider -How to either change run time testName for each run or call @Test methods based on @Test(data provider) received value.

 

Hi Krishnan,

  Thanks for the solution which you have mentioned.
  Can you provide me little help about POJO as I never used this one.

On Monday, February 3, 2014 12:20:55 PM UTC+5:30, Krishnan wrote:

Sanjeev

Please have your DataProvider accept a POJO [ Plain Old Java Object] as a parameter and have it implement a custom toString() method which gives out the output as you need.


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" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;"> http://wakened-cognition.blogspot.com/

 

On Sat, Feb 1, 2014 at 10:56 AM, QA Lead <[hidden email]> wrote:

Hi Krishnan,

Thanks for reply but it seems your blog is not going to provide solution for this scenario. Please have a look at my actual sample output
PASSED TESTS -null
Class Method Time
(ms)
Status
[TestClass name=class selenium.bu.ReadSuite]   ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                           3147 PASSED
[TestClass name=class selenium.bu.ReadSuite]    ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                               154 PASSED
[TestClass name=class selenium.bu.ReadSuite]   ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                                  79 PASSED
[TestClass name=class selenium.bu.ReadSuite]   ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                                      1 PASSED

where in actual I want, report should look like
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.browse()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]           3147 PASSED
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.checkToolTip()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]    154 PASSED
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.clear()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]                 79 PASSED
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.clearAll()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]               1 PASSED

On Friday, January 31, 2014 2:11:25 PM UTC+5:30, Krishnan wrote:

You can refer to my blog post : <a href="http://rationaleemotions.wordpress.com/2013/07/31/pretty-printing-with-testng/" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Frationaleemotions.wordpress.com%2F2013%2F07%2F31%2Fpretty-printing-with-testng%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNGItBWrwaEbg-_De8ubg-wyA4oIQA';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Frationaleemotions.wordpress.com%2F2013%2F07%2F31%2Fpretty-printing-with-testng%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNGItBWrwaEbg-_De8ubg-wyA4oIQA';return true;">http://rationaleemotions.wordpress.com/2013/07/31/pretty-printing-with-testng/ and see if that helps you get started. 

On Friday, January 31, 2014, QA Lead <[hidden email]> wrote:

Hi,



Using @DataProvider(name="runMode"), I am able get runMode and then using @DataProvider(name=testCases") I am able to read each tests from one or more sheets along with corresponding value from data sheet (used @DataProvider(name="runMode") data-provider). But my @Test(Data-Provider="testCases") gives same name for each run. Let us say it run 50 times then it will show like below

ReadSuite.testDataPr
ovi(java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String)

for each run. I want it should give 50 names based on keyword.

--
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="PnvvLqGZqWAJ" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">testng-users...@googlegroups.com.
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="PnvvLqGZqWAJ" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;"> testn...@....
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users';return true;" onclick="this.href='http://groups.google.com/group/testng-users';return true;"> http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/groups/opt_out" target="_blank" onmousedown="this.href='https://groups.google.com/groups/opt_out';return true;" onclick="this.href='https://groups.google.com/groups/opt_out';return true;"> https://groups.google.com/groups/opt_out.



--
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" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;"> http://wakened-cognition.blogspot.com/

--
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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users';return true;" onclick="this.href='http://groups.google.com/group/testng-users';return true;"> http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/groups/opt_out" target="_blank" onmousedown="this.href='https://groups.google.com/groups/opt_out';return true;" onclick="this.href='https://groups.google.com/groups/opt_out';return true;"> https://groups.google.com/groups/opt_out.

 

--
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="PnvvLqGZqWAJ" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">testng-users...@googlegroups.com.
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="PnvvLqGZqWAJ" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;"> testn...@....
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users';return true;" onclick="this.href='http://groups.google.com/group/testng-users';return true;">http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/groups/opt_out" target="_blank" onmousedown="this.href='https://groups.google.com/groups/opt_out';return true;" onclick="this.href='https://groups.google.com/groups/opt_out';return true;">https://groups.google.com/groups/opt_out.

--
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 http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

RE: Data Provider -How to either change run time testName for each run or call @Test methods based on @Test(data provider) received value.

Alexander Poulikakos

Hi

 

A POJO (Plain Old Java Object) is just a simple java class. For example this is a POJO:

 

public class MyPojo {

    private String a;

 

    public MyPojo(String a) {

        this.a = a;

    }

    public String getA() {

        return a;

    }

    @Override

    public String toString() {

        return a;

    }

}

 

 

You can have your DataProvider return POJO’s, and your @Test methods can take POJO’s as arguments.

 

/Alex

 

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of QA Lead
Sent: den 3 februari 2014 16:01
To: [hidden email]
Subject: Re: [testng-users] Data Provider -How to either change run time testName for each run or call @Test methods based on @Test(data provider) received value.

 

Hi Alex,

 Even this wiki does not contain much info about POJO.

On Monday, February 3, 2014 3:28:46 PM UTC+5:30, drapostolos wrote:

See wiki about POJO: http://en.wikipedia.org/wiki/Plain_Old_Java_Object

 

/Alex

 

From: <a href="javascript:" target="_blank">testng...@... [mailto:<a href="javascript:" target="_blank">testng...@...] On Behalf Of QA Lead
Sent: den 3 februari 2014 10:53
To: <a href="javascript:" target="_blank">testng...@...
Subject: Re: [testng-users] Data Provider -How to either change run time testName for each run or call @Test methods based on @Test(data provider) received value.

 

Hi Krishnan,

  Thanks for the solution which you have mentioned.
  Can you provide me little help about POJO as I never used this one.

On Monday, February 3, 2014 12:20:55 PM UTC+5:30, Krishnan wrote:

Sanjeev

Please have your DataProvider accept a POJO [ Plain Old Java Object] as a parameter and have it implement a custom toString() method which gives out the output as you need.


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/

 

On Sat, Feb 1, 2014 at 10:56 AM, QA Lead <[hidden email]> wrote:

Hi Krishnan,

Thanks for reply but it seems your blog is not going to provide solution for this scenario. Please have a look at my actual sample output
PASSED TESTS -null
Class Method Time
(ms)
Status
[TestClass name=class selenium.bu.ReadSuite]   ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                           3147 PASSED
[TestClass name=class selenium.bu.ReadSuite]    ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                               154 PASSED
[TestClass name=class selenium.bu.ReadSuite]   ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                                  79 PASSED
[TestClass name=class selenium.bu.ReadSuite]   ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                                      1 PASSED

where in actual I want, report should look like
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.browse()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]           3147 PASSED
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.checkToolTip()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]    154 PASSED
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.clear()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]                 79 PASSED
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.clearAll()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]               1 PASSED

On Friday, January 31, 2014 2:11:25 PM UTC+5:30, Krishnan wrote:

You can refer to my blog post : http://rationaleemotions.wordpress.com/2013/07/31/pretty-printing-with-testng/ and see if that helps you get started. 

On Friday, January 31, 2014, QA Lead <[hidden email]> wrote:

Hi,



Using @DataProvider(name="runMode"), I am able get runMode and then using @DataProvider(name=testCases") I am able to read each tests from one or more sheets along with corresponding value from data sheet (used @DataProvider(name="runMode") data-provider). But my @Test(Data-Provider="testCases") gives same name for each run. Let us say it run 50 times then it will show like below

ReadSuite.testDataPr
ovi(java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String)

for each run. I want it should give 50 names based on keyword.

--
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">testng-users...@....
To post to this group, send email to <a href="javascript:" target="_blank">testn...@....
Visit this group at http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/groups/opt_out.



--
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/

--
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 http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/groups/opt_out.

 

--
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">testng-users...@....
To post to this group, send email to <a href="javascript:" target="_blank">testn...@....
Visit this group at http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/groups/opt_out.

--
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 http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/groups/opt_out.

--
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 http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: Data Provider -How to either change run time testName for each run or call @Test methods based on @Test(data provider) received value.

Giannis Papadakis
You can use reflection to set the name of the method in results.

public void SetResultTestName(String methodName) {

try 
{
ITestResult result=Reporter.getCurrentTestResult();
BaseTestMethod bm = (BaseTestMethod)result.getMethod();
Field f = bm.getClass().getSuperclass().getDeclaredField("m_methodName");
f.setAccessible(true);
f.set(bm,methodName);        

}
catch (Exception ex) {
System.out.println("ex" + ex.getMessage());
}}

Giannis


2014-02-03 Alexander Poulikakos <[hidden email]>:

Hi

 

A POJO (Plain Old Java Object) is just a simple java class. For example this is a POJO:

 

public class MyPojo {

    private String a;

 

    public MyPojo(String a) {

        this.a = a;

    }

    public String getA() {

        return a;

    }

    @Override

    public String toString() {

        return a;

    }

}

 

 

You can have your DataProvider return POJO’s, and your @Test methods can take POJO’s as arguments.

 

/Alex

 

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of QA Lead
Sent: den 3 februari 2014 16:01
To: [hidden email]


Subject: Re: [testng-users] Data Provider -How to either change run time testName for each run or call @Test methods based on @Test(data provider) received value.

 

Hi Alex,

 Even this wiki does not contain much info about POJO.

On Monday, February 3, 2014 3:28:46 PM UTC+5:30, drapostolos wrote:

See wiki about POJO: http://en.wikipedia.org/wiki/Plain_Old_Java_Object

 

/Alex

 

From: [hidden email] [mailto:[hidden email]] On Behalf Of QA Lead
Sent: den 3 februari 2014 10:53
To: [hidden email]
Subject: Re: [testng-users] Data Provider -How to either change run time testName for each run or call @Test methods based on @Test(data provider) received value.

 

Hi Krishnan,

  Thanks for the solution which you have mentioned.
  Can you provide me little help about POJO as I never used this one.

On Monday, February 3, 2014 12:20:55 PM UTC+5:30, Krishnan wrote:

Sanjeev

Please have your DataProvider accept a POJO [ Plain Old Java Object] as a parameter and have it implement a custom toString() method which gives out the output as you need.


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/

 

On Sat, Feb 1, 2014 at 10:56 AM, QA Lead <[hidden email]> wrote:

Hi Krishnan,

Thanks for reply but it seems your blog is not going to provide solution for this scenario. Please have a look at my actual sample output
PASSED TESTS -null
Class Method Time
(ms)
Status
[TestClass name=class selenium.bu.ReadSuite]   ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                           3147 PASSED
[TestClass name=class selenium.bu.ReadSuite]    ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                               154 PASSED
[TestClass name=class selenium.bu.ReadSuite]   ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                                  79 PASSED
[TestClass name=class selenium.bu.ReadSuite]   ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                                      1 PASSED

where in actual I want, report should look like
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.browse()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]           3147 PASSED
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.checkToolTip()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]    154 PASSED
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.clear()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]                 79 PASSED
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.clearAll()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]               1 PASSED

On Friday, January 31, 2014 2:11:25 PM UTC+5:30, Krishnan wrote:

You can refer to my blog post : http://rationaleemotions.wordpress.com/2013/07/31/pretty-printing-with-testng/ and see if that helps you get started. 

On Friday, January 31, 2014, QA Lead <[hidden email]> wrote:

Hi,



Using @DataProvider(name="runMode"), I am able get runMode and then using @DataProvider(name=testCases") I am able to read each tests from one or more sheets along with corresponding value from data sheet (used @DataProvider(name="runMode") data-provider). But my @Test(Data-Provider="testCases") gives same name for each run. Let us say it run 50 times then it will show like below

ReadSuite.testDataPr
ovi(java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String)

for each run. I want it should give 50 names based on keyword.

--
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 http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/groups/opt_out.



--
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/

--
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 http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/groups/opt_out.

 

--
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 http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/groups/opt_out.

--
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 http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/groups/opt_out.

--
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 http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/groups/opt_out.

--
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 http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: Data Provider -How to either change run time testName for each run or call @Test methods based on @Test(data provider) received value.

QA Lead
In reply to this post by Alexander Poulikakos
Hi Alex,

Thanks for the solution but I am facing problem when used POJO, have created POJO class as well
@DataProvider(name = "runTest")
    public TestProvider myTest() throws BiffException, IOException, Exception
    {  
    //code was there file reading ...
        testsWorkbook = Workbook.getWorkbook(file);
        Object[][] testCaseList=null;
        int totalRows=0;
        TestProvider testp = new TestProvider();// Creating POJO object
    int i, j;
    i=0;
        for(int row=0;row<10;row++) //Assuming maximum row is 10
        {
       
            j=0;
 
            for (int col = 1; col < 5; ) //Assuming maximum column is 5
            {
               
        testCaseList[i][j]=tab[col][row]

                        // Initializing POJO
                testp.setTest_Step_id((String) testCaseList[i][j++]);
                testp.setTest_step((String) testCaseList[i][j++]);
                testp.setObject_val((String) testCaseList[i][j++]);
                testp.setDsClm_name((String) testCaseList[i][j++]);
                testp.setAssert_val((String) testCaseList[i][j++]);
                testp.setDescription((String) testCaseList[i][j++]);
                testp.setAsrt_val_ds((String) testCaseList[i][j++]);

                //testCaseList[i][j]=testp;
                        // end of POJO initialization
            }
        }  
        //return testCaseList;
        return testp;
    }

 public void testDataProvi(String s1,String s2,String s3,String s4,String s5,String s6,String s7) throws Exception
    {
      now I want logic like
      if s2.equals("click")
           testClick() //calling test function
      .....
    }

testClick()
{
  ....
}
 when it will run, it should say in report that ReadSuite.testClick()  PASSED
and so on for others ...

On Tuesday, February 4, 2014 12:23:25 AM UTC+5:30, drapostolos wrote:

Hi

 

A POJO (Plain Old Java Object) is just a simple java class. For example this is a POJO:

 

public class MyPojo {

    private String a;

 

    public MyPojo(String a) {

        this.a = a;

    }

    public String getA() {

        return a;

    }

    @Override

    public String toString() {

        return a;

    }

}

 

 

You can have your DataProvider return POJO’s, and your @Test methods can take POJO’s as arguments.

 

/Alex

 

 

From: <a href="javascript:" target="_blank" gdf-obfuscated-mailto="8EYy1E1L-MEJ" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">testng...@... [mailto:<a href="javascript:" target="_blank" gdf-obfuscated-mailto="8EYy1E1L-MEJ" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">testng...@googlegroups.com] On Behalf Of QA Lead
Sent: den 3 februari 2014 16:01
To: <a href="javascript:" target="_blank" gdf-obfuscated-mailto="8EYy1E1L-MEJ" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">testng...@...
Subject: Re: [testng-users] Data Provider -How to either change run time testName for each run or call @Test methods based on @Test(data provider) received value.

 

Hi Alex,

 Even this wiki does not contain much info about POJO.

On Monday, February 3, 2014 3:28:46 PM UTC+5:30, drapostolos wrote:

See wiki about POJO: <a href="http://en.wikipedia.org/wiki/Plain_Old_Java_Object" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FPlain_Old_Java_Object\46sa\75D\46sntz\0751\46usg\75AFQjCNFYKc3_17ZH6X3vfpUU6AzEsxGTYQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FPlain_Old_Java_Object\46sa\75D\46sntz\0751\46usg\75AFQjCNFYKc3_17ZH6X3vfpUU6AzEsxGTYQ';return true;">http://en.wikipedia.org/wiki/Plain_Old_Java_Object

 

/Alex

 

From: [hidden email] [mailto:testng...@googlegroups.com] On Behalf Of QA Lead
Sent: den 3 februari 2014 10:53
To: [hidden email]
Subject: Re: [testng-users] Data Provider -How to either change run time testName for each run or call @Test methods based on @Test(data provider) received value.

 

Hi Krishnan,

  Thanks for the solution which you have mentioned.
  Can you provide me little help about POJO as I never used this one.

On Monday, February 3, 2014 12:20:55 PM UTC+5:30, Krishnan wrote:

Sanjeev

Please have your DataProvider accept a POJO [ Plain Old Java Object] as a parameter and have it implement a custom toString() method which gives out the output as you need.


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" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;"> http://wakened-cognition.blogspot.com/

 

On Sat, Feb 1, 2014 at 10:56 AM, QA Lead <[hidden email]> wrote:

Hi Krishnan,

Thanks for reply but it seems your blog is not going to provide solution for this scenario. Please have a look at my actual sample output
PASSED TESTS -null
Class Method Time
(ms)
Status
[TestClass name=class selenium.bu.ReadSuite]   ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                           3147 PASSED
[TestClass name=class selenium.bu.ReadSuite]    ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                               154 PASSED
[TestClass name=class selenium.bu.ReadSuite]   ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                                  79 PASSED
[TestClass name=class selenium.bu.ReadSuite]   ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                                      1 PASSED

where in actual I want, report should look like
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.browse()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]           3147 PASSED
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.checkToolTip()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]    154 PASSED
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.clear()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]                 79 PASSED
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.clearAll()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]               1 PASSED

On Friday, January 31, 2014 2:11:25 PM UTC+5:30, Krishnan wrote:

You can refer to my blog post : <a href="http://rationaleemotions.wordpress.com/2013/07/31/pretty-printing-with-testng/" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Frationaleemotions.wordpress.com%2F2013%2F07%2F31%2Fpretty-printing-with-testng%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNGItBWrwaEbg-_De8ubg-wyA4oIQA';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Frationaleemotions.wordpress.com%2F2013%2F07%2F31%2Fpretty-printing-with-testng%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNGItBWrwaEbg-_De8ubg-wyA4oIQA';return true;">http://rationaleemotions.wordpress.com/2013/07/31/pretty-printing-with-testng/ and see if that helps you get started. 

On Friday, January 31, 2014, QA Lead <[hidden email]> wrote:

Hi,



Using @DataProvider(name="runMode"), I am able get runMode and then using @DataProvider(name=testCases") I am able to read each tests from one or more sheets along with corresponding value from data sheet (used @DataProvider(name="runMode") data-provider). But my @Test(Data-Provider="testCases") gives same name for each run. Let us say it run 50 times then it will show like below

ReadSuite.testDataPr
ovi(java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String)

for each run. I want it should give 50 names based on keyword.

--
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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users';return true;" onclick="this.href='http://groups.google.com/group/testng-users';return true;"> http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/groups/opt_out" target="_blank" onmousedown="this.href='https://groups.google.com/groups/opt_out';return true;" onclick="this.href='https://groups.google.com/groups/opt_out';return true;"> https://groups.google.com/groups/opt_out.



--
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" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;"> http://wakened-cognition.blogspot.com/

--
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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users';return true;" onclick="this.href='http://groups.google.com/group/testng-users';return true;"> http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/groups/opt_out" target="_blank" onmousedown="this.href='https://groups.google.com/groups/opt_out';return true;" onclick="this.href='https://groups.google.com/groups/opt_out';return true;"> https://groups.google.com/groups/opt_out.

 

--
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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users';return true;" onclick="this.href='http://groups.google.com/group/testng-users';return true;"> http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/groups/opt_out" target="_blank" onmousedown="this.href='https://groups.google.com/groups/opt_out';return true;" onclick="this.href='https://groups.google.com/groups/opt_out';return true;"> https://groups.google.com/groups/opt_out.

--
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="8EYy1E1L-MEJ" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">testng-users...@googlegroups.com.
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="8EYy1E1L-MEJ" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;"> testn...@....
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users';return true;" onclick="this.href='http://groups.google.com/group/testng-users';return true;">http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/groups/opt_out" target="_blank" onmousedown="this.href='https://groups.google.com/groups/opt_out';return true;" onclick="this.href='https://groups.google.com/groups/opt_out';return true;">https://groups.google.com/groups/opt_out.

--
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 http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: Data Provider -How to either change run time testName for each run or call @Test methods based on @Test(data provider) received value.

QA Lead
In reply to this post by Giannis Papadakis

Hi Giannis,

Thanks for your answer !
Should I call this reflection method in listner which I have created or how to call it ?

On Tuesday, February 4, 2014 1:57:56 PM UTC+5:30, John Papadakis wrote:
You can use reflection to set the name of the method in results.

public void SetResultTestName(String methodName) {

try 
{
ITestResult result=Reporter.getCurrentTestResult();
BaseTestMethod bm = (BaseTestMethod)result.getMethod();
Field f = bm.getClass().getSuperclass().getDeclaredField("m_methodName");
f.setAccessible(true);
f.set(bm,methodName);        

}
catch (Exception ex) {
System.out.println("ex" + ex.getMessage());
}}

Giannis


2014-02-03 Alexander Poulikakos <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="lQwsWOgu7dIJ" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">alexander....@ericsson.com>:

Hi

 

A POJO (Plain Old Java Object) is just a simple java class. For example this is a POJO:

 

public class MyPojo {

    private String a;

 

    public MyPojo(String a) {

        this.a = a;

    }

    public String getA() {

        return a;

    }

    @Override

    public String toString() {

        return a;

    }

}

 

 

You can have your DataProvider return POJO’s, and your @Test methods can take POJO’s as arguments.

 

/Alex

 

 

From: <a href="javascript:" target="_blank" gdf-obfuscated-mailto="lQwsWOgu7dIJ" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">testng...@... [mailto:<a href="javascript:" target="_blank" gdf-obfuscated-mailto="lQwsWOgu7dIJ" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">testng...@googlegroups.com] On Behalf Of QA Lead
Sent: den 3 februari 2014 16:01
To: <a href="javascript:" target="_blank" gdf-obfuscated-mailto="lQwsWOgu7dIJ" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">testng...@...


Subject: Re: [testng-users] Data Provider -How to either change run time testName for each run or call @Test methods based on @Test(data provider) received value.

 

Hi Alex,

 Even this wiki does not contain much info about POJO.

On Monday, February 3, 2014 3:28:46 PM UTC+5:30, drapostolos wrote:

See wiki about POJO: <a href="http://en.wikipedia.org/wiki/Plain_Old_Java_Object" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FPlain_Old_Java_Object\46sa\75D\46sntz\0751\46usg\75AFQjCNFYKc3_17ZH6X3vfpUU6AzEsxGTYQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FPlain_Old_Java_Object\46sa\75D\46sntz\0751\46usg\75AFQjCNFYKc3_17ZH6X3vfpUU6AzEsxGTYQ';return true;">http://en.wikipedia.org/wiki/Plain_Old_Java_Object

 

/Alex

 

From: [hidden email] [mailto:testng...@googlegroups.com] On Behalf Of QA Lead
Sent: den 3 februari 2014 10:53
To: [hidden email]
Subject: Re: [testng-users] Data Provider -How to either change run time testName for each run or call @Test methods based on @Test(data provider) received value.

 

Hi Krishnan,

  Thanks for the solution which you have mentioned.
  Can you provide me little help about POJO as I never used this one.

On Monday, February 3, 2014 12:20:55 PM UTC+5:30, Krishnan wrote:

Sanjeev

Please have your DataProvider accept a POJO [ Plain Old Java Object] as a parameter and have it implement a custom toString() method which gives out the output as you need.


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" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;"> http://wakened-cognition.blogspot.com/

 

On Sat, Feb 1, 2014 at 10:56 AM, QA Lead <[hidden email]> wrote:

Hi Krishnan,

Thanks for reply but it seems your blog is not going to provide solution for this scenario. Please have a look at my actual sample output
PASSED TESTS -null
Class Method Time
(ms)
Status
[TestClass name=class selenium.bu.ReadSuite]   ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                           3147 PASSED
[TestClass name=class selenium.bu.ReadSuite]    ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                               154 PASSED
[TestClass name=class selenium.bu.ReadSuite]   ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                                  79 PASSED
[TestClass name=class selenium.bu.ReadSuite]   ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                                      1 PASSED

where in actual I want, report should look like
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.browse()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]           3147 PASSED
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.checkToolTip()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]    154 PASSED
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.clear()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]                 79 PASSED
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.clearAll()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]               1 PASSED

On Friday, January 31, 2014 2:11:25 PM UTC+5:30, Krishnan wrote:

You can refer to my blog post : <a href="http://rationaleemotions.wordpress.com/2013/07/31/pretty-printing-with-testng/" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Frationaleemotions.wordpress.com%2F2013%2F07%2F31%2Fpretty-printing-with-testng%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNGItBWrwaEbg-_De8ubg-wyA4oIQA';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Frationaleemotions.wordpress.com%2F2013%2F07%2F31%2Fpretty-printing-with-testng%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNGItBWrwaEbg-_De8ubg-wyA4oIQA';return true;">http://rationaleemotions.wordpress.com/2013/07/31/pretty-printing-with-testng/ and see if that helps you get started. 

On Friday, January 31, 2014, QA Lead <[hidden email]> wrote:

Hi,



Using @DataProvider(name="runMode"), I am able get runMode and then using @DataProvider(name=testCases") I am able to read each tests from one or more sheets along with corresponding value from data sheet (used @DataProvider(name="runMode") data-provider). But my @Test(Data-Provider="testCases") gives same name for each run. Let us say it run 50 times then it will show like below

ReadSuite.testDataPr
ovi(java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String)

for each run. I want it should give 50 names based on keyword.

--
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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users';return true;" onclick="this.href='http://groups.google.com/group/testng-users';return true;"> http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/groups/opt_out" target="_blank" onmousedown="this.href='https://groups.google.com/groups/opt_out';return true;" onclick="this.href='https://groups.google.com/groups/opt_out';return true;"> https://groups.google.com/groups/opt_out.



--
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" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;"> http://wakened-cognition.blogspot.com/

--
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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users';return true;" onclick="this.href='http://groups.google.com/group/testng-users';return true;"> http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/groups/opt_out" target="_blank" onmousedown="this.href='https://groups.google.com/groups/opt_out';return true;" onclick="this.href='https://groups.google.com/groups/opt_out';return true;"> https://groups.google.com/groups/opt_out.

 

--
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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users';return true;" onclick="this.href='http://groups.google.com/group/testng-users';return true;"> http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/groups/opt_out" target="_blank" onmousedown="this.href='https://groups.google.com/groups/opt_out';return true;" onclick="this.href='https://groups.google.com/groups/opt_out';return true;"> https://groups.google.com/groups/opt_out.

--
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="lQwsWOgu7dIJ" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">testng-users...@googlegroups.com.
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="lQwsWOgu7dIJ" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;"> testn...@....
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users';return true;" onclick="this.href='http://groups.google.com/group/testng-users';return true;">http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/groups/opt_out" target="_blank" onmousedown="this.href='https://groups.google.com/groups/opt_out';return true;" onclick="this.href='https://groups.google.com/groups/opt_out';return true;">https://groups.google.com/groups/opt_out.

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

--
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 http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: Data Provider -How to either change run time testName for each run or call @Test methods based on @Test(data provider) received value.

Giannis Papadakis
You can call it inside the listener or inside your dataProvider. It always returns the currentTestResult from Reporter class which is thread local variable (for multiple threads.)


2014-02-04 QA Lead <[hidden email]>:

Hi Giannis,

Thanks for your answer !
Should I call this reflection method in listner which I have created or how to call it ?


On Tuesday, February 4, 2014 1:57:56 PM UTC+5:30, John Papadakis wrote:
You can use reflection to set the name of the method in results.

public void SetResultTestName(String methodName) {

try 
{
ITestResult result=Reporter.getCurrentTestResult();
BaseTestMethod bm = (BaseTestMethod)result.getMethod();
Field f = bm.getClass().getSuperclass().getDeclaredField("m_methodName");
f.setAccessible(true);
f.set(bm,methodName);        

}
catch (Exception ex) {
System.out.println("ex" + ex.getMessage());
}}

Giannis


2014-02-03 Alexander Poulikakos <alexander....@ericsson.com>:

Hi

 

A POJO (Plain Old Java Object) is just a simple java class. For example this is a POJO:

 

public class MyPojo {

    private String a;

 

    public MyPojo(String a) {

        this.a = a;

    }

    public String getA() {

        return a;

    }

    @Override

    public String toString() {

        return a;

    }

}

 

 

You can have your DataProvider return POJO’s, and your @Test methods can take POJO’s as arguments.

 

/Alex

 

 

From: [hidden email] [mailto:testng...@googlegroups.com] On Behalf Of QA Lead
Sent: den 3 februari 2014 16:01
To: [hidden email]


Subject: Re: [testng-users] Data Provider -How to either change run time testName for each run or call @Test methods based on @Test(data provider) received value.

 

Hi Alex,

 Even this wiki does not contain much info about POJO.

On Monday, February 3, 2014 3:28:46 PM UTC+5:30, drapostolos wrote:

See wiki about POJO: http://en.wikipedia.org/wiki/Plain_Old_Java_Object

 

/Alex

 

From: [hidden email] [mailto:testng...@googlegroups.com] On Behalf Of QA Lead
Sent: den 3 februari 2014 10:53
To: [hidden email]
Subject: Re: [testng-users] Data Provider -How to either change run time testName for each run or call @Test methods based on @Test(data provider) received value.

 

Hi Krishnan,

  Thanks for the solution which you have mentioned.
  Can you provide me little help about POJO as I never used this one.

On Monday, February 3, 2014 12:20:55 PM UTC+5:30, Krishnan wrote:

Sanjeev

Please have your DataProvider accept a POJO [ Plain Old Java Object] as a parameter and have it implement a custom toString() method which gives out the output as you need.


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/

 

On Sat, Feb 1, 2014 at 10:56 AM, QA Lead <[hidden email]> wrote:

Hi Krishnan,

Thanks for reply but it seems your blog is not going to provide solution for this scenario. Please have a look at my actual sample output
PASSED TESTS -null
Class Method Time
(ms)
Status
[TestClass name=class selenium.bu.ReadSuite]   ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                           3147 PASSED
[TestClass name=class selenium.bu.ReadSuite]    ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                               154 PASSED
[TestClass name=class selenium.bu.ReadSuite]   ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                                  79 PASSED
[TestClass name=class selenium.bu.ReadSuite]   ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                                      1 PASSED

where in actual I want, report should look like
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.browse()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]           3147 PASSED
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.checkToolTip()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]    154 PASSED
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.clear()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]                 79 PASSED
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.clearAll()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]               1 PASSED

On Friday, January 31, 2014 2:11:25 PM UTC+5:30, Krishnan wrote:

You can refer to my blog post : http://rationaleemotions.wordpress.com/2013/07/31/pretty-printing-with-testng/ and see if that helps you get started. 

On Friday, January 31, 2014, QA Lead <[hidden email]> wrote:

Hi,



Using @DataProvider(name="runMode"), I am able get runMode and then using @DataProvider(name=testCases") I am able to read each tests from one or more sheets along with corresponding value from data sheet (used @DataProvider(name="runMode") data-provider). But my @Test(Data-Provider="testCases") gives same name for each run. Let us say it run 50 times then it will show like below

ReadSuite.testDataPr
ovi(java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String)

for each run. I want it should give 50 names based on keyword.

--
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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/groups/opt_out.



--
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/

--
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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/groups/opt_out.

 

--
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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/groups/opt_out.

--
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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/groups/opt_out.

--
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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/groups/opt_out.

--
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 http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/groups/opt_out.

--
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 http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: Data Provider -How to either change run time testName for each run or call @Test methods based on @Test(data provider) received value.

QA Lead
Hi Giannis,

Thanks for the answer. I called it from @Test (DataProvider="xyz") but getting same result and expected result is not coming. I am expecting result like
[TestClass name=class selenium.bu.ReadSuite]   ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
           
                                          

where in actual I want, report should look like
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.browse()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]           


On Tuesday, February 4, 2014 8:10:56 PM UTC+5:30, John Papadakis wrote:
You can call it inside the listener or inside your dataProvider. It always returns the currentTestResult from Reporter class which is thread local variable (for multiple threads.)


2014-02-04 QA Lead <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="dj4AwNG-LG8J" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">sanjee...@...>:

Hi Giannis,

Thanks for your answer !
Should I call this reflection method in listner which I have created or how to call it ?


On Tuesday, February 4, 2014 1:57:56 PM UTC+5:30, John Papadakis wrote:
You can use reflection to set the name of the method in results.

public void SetResultTestName(String methodName) {

try 
{
ITestResult result=Reporter.getCurrentTestResult();
BaseTestMethod bm = (BaseTestMethod)result.getMethod();
Field f = bm.getClass().getSuperclass().getDeclaredField("m_methodName");
f.setAccessible(true);
f.set(bm,methodName);        

}
catch (Exception ex) {
System.out.println("ex" + ex.getMessage());
}}

Giannis


2014-02-03 Alexander Poulikakos <alexander....@ericsson.com>:

Hi

 

A POJO (Plain Old Java Object) is just a simple java class. For example this is a POJO:

 

public class MyPojo {

    private String a;

 

    public MyPojo(String a) {

        this.a = a;

    }

    public String getA() {

        return a;

    }

    @Override

    public String toString() {

        return a;

    }

}

 

 

You can have your DataProvider return POJO’s, and your @Test methods can take POJO’s as arguments.

 

/Alex

 

 

From: [hidden email] [mailto:testng...@googlegroups.com] On Behalf Of QA Lead
Sent: den 3 februari 2014 16:01
To: [hidden email]


Subject: Re: [testng-users] Data Provider -How to either change run time testName for each run or call @Test methods based on @Test(data provider) received value.

 

Hi Alex,

 Even this wiki does not contain much info about POJO.

On Monday, February 3, 2014 3:28:46 PM UTC+5:30, drapostolos wrote:

See wiki about POJO: <a href="http://en.wikipedia.org/wiki/Plain_Old_Java_Object" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FPlain_Old_Java_Object\46sa\75D\46sntz\0751\46usg\75AFQjCNFYKc3_17ZH6X3vfpUU6AzEsxGTYQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FPlain_Old_Java_Object\46sa\75D\46sntz\0751\46usg\75AFQjCNFYKc3_17ZH6X3vfpUU6AzEsxGTYQ';return true;">http://en.wikipedia.org/wiki/Plain_Old_Java_Object

 

/Alex

 

From: [hidden email] [mailto:testng...@googlegroups.com] On Behalf Of QA Lead
Sent: den 3 februari 2014 10:53
To: [hidden email]
Subject: Re: [testng-users] Data Provider -How to either change run time testName for each run or call @Test methods based on @Test(data provider) received value.

 

Hi Krishnan,

  Thanks for the solution which you have mentioned.
  Can you provide me little help about POJO as I never used this one.

On Monday, February 3, 2014 12:20:55 PM UTC+5:30, Krishnan wrote:

Sanjeev

Please have your DataProvider accept a POJO [ Plain Old Java Object] as a parameter and have it implement a custom toString() method which gives out the output as you need.


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" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;"> http://wakened-cognition.blogspot.com/

 

On Sat, Feb 1, 2014 at 10:56 AM, QA Lead <[hidden email]> wrote:

Hi Krishnan,

Thanks for reply but it seems your blog is not going to provide solution for this scenario. Please have a look at my actual sample output
PASSED TESTS -null
Class Method Time
(ms)
Status
[TestClass name=class selenium.bu.ReadSuite]   ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                           3147 PASSED
[TestClass name=class selenium.bu.ReadSuite]    ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                               154 PASSED
[TestClass name=class selenium.bu.ReadSuite]   ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                                  79 PASSED
[TestClass name=class selenium.bu.ReadSuite]   ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                                      1 PASSED

where in actual I want, report should look like
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.browse()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]           3147 PASSED
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.checkToolTip()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]    154 PASSED
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.clear()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]                 79 PASSED
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.clearAll()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]               1 PASSED

On Friday, January 31, 2014 2:11:25 PM UTC+5:30, Krishnan wrote:

You can refer to my blog post : <a href="http://rationaleemotions.wordpress.com/2013/07/31/pretty-printing-with-testng/" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Frationaleemotions.wordpress.com%2F2013%2F07%2F31%2Fpretty-printing-with-testng%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNGItBWrwaEbg-_De8ubg-wyA4oIQA';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Frationaleemotions.wordpress.com%2F2013%2F07%2F31%2Fpretty-printing-with-testng%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNGItBWrwaEbg-_De8ubg-wyA4oIQA';return true;">http://rationaleemotions.wordpress.com/2013/07/31/pretty-printing-with-testng/ and see if that helps you get started. 

On Friday, January 31, 2014, QA Lead <[hidden email]> wrote:

Hi,



Using @DataProvider(name="runMode"), I am able get runMode and then using @DataProvider(name=testCases") I am able to read each tests from one or more sheets along with corresponding value from data sheet (used @DataProvider(name="runMode") data-provider). But my @Test(Data-Provider="testCases") gives same name for each run. Let us say it run 50 times then it will show like below

ReadSuite.testDataPr
ovi(java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String)

for each run. I want it should give 50 names based on keyword.

--
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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users';return true;" onclick="this.href='http://groups.google.com/group/testng-users';return true;"> http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/groups/opt_out" target="_blank" onmousedown="this.href='https://groups.google.com/groups/opt_out';return true;" onclick="this.href='https://groups.google.com/groups/opt_out';return true;"> https://groups.google.com/groups/opt_out.



--
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" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;"> http://wakened-cognition.blogspot.com/

--
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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users';return true;" onclick="this.href='http://groups.google.com/group/testng-users';return true;"> http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/groups/opt_out" target="_blank" onmousedown="this.href='https://groups.google.com/groups/opt_out';return true;" onclick="this.href='https://groups.google.com/groups/opt_out';return true;"> https://groups.google.com/groups/opt_out.

 

--
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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users';return true;" onclick="this.href='http://groups.google.com/group/testng-users';return true;"> http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/groups/opt_out" target="_blank" onmousedown="this.href='https://groups.google.com/groups/opt_out';return true;" onclick="this.href='https://groups.google.com/groups/opt_out';return true;"> https://groups.google.com/groups/opt_out.

--
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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users';return true;" onclick="this.href='http://groups.google.com/group/testng-users';return true;">http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/groups/opt_out" target="_blank" onmousedown="this.href='https://groups.google.com/groups/opt_out';return true;" onclick="this.href='https://groups.google.com/groups/opt_out';return true;">https://groups.google.com/groups/opt_out.

--
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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users';return true;" onclick="this.href='http://groups.google.com/group/testng-users';return true;">http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/groups/opt_out" target="_blank" onmousedown="this.href='https://groups.google.com/groups/opt_out';return true;" onclick="this.href='https://groups.google.com/groups/opt_out';return true;">https://groups.google.com/groups/opt_out.

--
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="dj4AwNG-LG8J" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">testng-users...@googlegroups.com.
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="dj4AwNG-LG8J" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">testng...@....
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users';return true;" onclick="this.href='http://groups.google.com/group/testng-users';return true;">http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/groups/opt_out" target="_blank" onmousedown="this.href='https://groups.google.com/groups/opt_out';return true;" onclick="this.href='https://groups.google.com/groups/opt_out';return true;">https://groups.google.com/groups/opt_out.

--
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 http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: Data Provider -How to either change run time testName for each run or call @Test methods based on @Test(data provider) received value.

QA Lead
In reply to this post by Alexander Poulikakos
Hi,
Thanks for providing sample POJO.
I implemented it but @DataProvider(name = "runTest")    public Object[][] myTest() {} normally return Object type variable and when I am trying to return as POJO variable, it prompts return type error.

On Tuesday, February 4, 2014 12:23:25 AM UTC+5:30, drapostolos wrote:

Hi

 

A POJO (Plain Old Java Object) is just a simple java class. For example this is a POJO:

 

public class MyPojo {

    private String a;

 

    public MyPojo(String a) {

        this.a = a;

    }

    public String getA() {

        return a;

    }

    @Override

    public String toString() {

        return a;

    }

}

 

 

You can have your DataProvider return POJO’s, and your @Test methods can take POJO’s as arguments.

 

/Alex

 

 

From: <a href="javascript:" target="_blank" gdf-obfuscated-mailto="8EYy1E1L-MEJ" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">testng...@... [mailto:<a href="javascript:" target="_blank" gdf-obfuscated-mailto="8EYy1E1L-MEJ" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">testng...@googlegroups.com] On Behalf Of QA Lead
Sent: den 3 februari 2014 16:01
To: <a href="javascript:" target="_blank" gdf-obfuscated-mailto="8EYy1E1L-MEJ" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">testng...@...
Subject: Re: [testng-users] Data Provider -How to either change run time testName for each run or call @Test methods based on @Test(data provider) received value.

 

Hi Alex,

 Even this wiki does not contain much info about POJO.

On Monday, February 3, 2014 3:28:46 PM UTC+5:30, drapostolos wrote:

See wiki about POJO: <a href="http://en.wikipedia.org/wiki/Plain_Old_Java_Object" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FPlain_Old_Java_Object\46sa\75D\46sntz\0751\46usg\75AFQjCNFYKc3_17ZH6X3vfpUU6AzEsxGTYQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FPlain_Old_Java_Object\46sa\75D\46sntz\0751\46usg\75AFQjCNFYKc3_17ZH6X3vfpUU6AzEsxGTYQ';return true;">http://en.wikipedia.org/wiki/Plain_Old_Java_Object

 

/Alex

 

From: [hidden email] [mailto:testng...@googlegroups.com] On Behalf Of QA Lead
Sent: den 3 februari 2014 10:53
To: [hidden email]
Subject: Re: [testng-users] Data Provider -How to either change run time testName for each run or call @Test methods based on @Test(data provider) received value.

 

Hi Krishnan,

  Thanks for the solution which you have mentioned.
  Can you provide me little help about POJO as I never used this one.

On Monday, February 3, 2014 12:20:55 PM UTC+5:30, Krishnan wrote:

Sanjeev

Please have your DataProvider accept a POJO [ Plain Old Java Object] as a parameter and have it implement a custom toString() method which gives out the output as you need.


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" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;"> http://wakened-cognition.blogspot.com/

 

On Sat, Feb 1, 2014 at 10:56 AM, QA Lead <[hidden email]> wrote:

Hi Krishnan,

Thanks for reply but it seems your blog is not going to provide solution for this scenario. Please have a look at my actual sample output
PASSED TESTS -null
Class Method Time
(ms)
Status
[TestClass name=class selenium.bu.ReadSuite]   ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                           3147 PASSED
[TestClass name=class selenium.bu.ReadSuite]    ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                               154 PASSED
[TestClass name=class selenium.bu.ReadSuite]   ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                                  79 PASSED
[TestClass name=class selenium.bu.ReadSuite]   ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                                      1 PASSED

where in actual I want, report should look like
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.browse()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]           3147 PASSED
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.checkToolTip()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]    154 PASSED
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.clear()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]                 79 PASSED
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.clearAll()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]               1 PASSED

On Friday, January 31, 2014 2:11:25 PM UTC+5:30, Krishnan wrote:

You can refer to my blog post : <a href="http://rationaleemotions.wordpress.com/2013/07/31/pretty-printing-with-testng/" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Frationaleemotions.wordpress.com%2F2013%2F07%2F31%2Fpretty-printing-with-testng%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNGItBWrwaEbg-_De8ubg-wyA4oIQA';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Frationaleemotions.wordpress.com%2F2013%2F07%2F31%2Fpretty-printing-with-testng%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNGItBWrwaEbg-_De8ubg-wyA4oIQA';return true;">http://rationaleemotions.wordpress.com/2013/07/31/pretty-printing-with-testng/ and see if that helps you get started. 

On Friday, January 31, 2014, QA Lead <[hidden email]> wrote:

Hi,



Using @DataProvider(name="runMode"), I am able get runMode and then using @DataProvider(name=testCases") I am able to read each tests from one or more sheets along with corresponding value from data sheet (used @DataProvider(name="runMode") data-provider). But my @Test(Data-Provider="testCases") gives same name for each run. Let us say it run 50 times then it will show like below

ReadSuite.testDataPr
ovi(java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String)

for each run. I want it should give 50 names based on keyword.

--
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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users';return true;" onclick="this.href='http://groups.google.com/group/testng-users';return true;"> http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/groups/opt_out" target="_blank" onmousedown="this.href='https://groups.google.com/groups/opt_out';return true;" onclick="this.href='https://groups.google.com/groups/opt_out';return true;"> https://groups.google.com/groups/opt_out.



--
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" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;"> http://wakened-cognition.blogspot.com/

--
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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users';return true;" onclick="this.href='http://groups.google.com/group/testng-users';return true;"> http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/groups/opt_out" target="_blank" onmousedown="this.href='https://groups.google.com/groups/opt_out';return true;" onclick="this.href='https://groups.google.com/groups/opt_out';return true;"> https://groups.google.com/groups/opt_out.

 

--
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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users';return true;" onclick="this.href='http://groups.google.com/group/testng-users';return true;"> http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/groups/opt_out" target="_blank" onmousedown="this.href='https://groups.google.com/groups/opt_out';return true;" onclick="this.href='https://groups.google.com/groups/opt_out';return true;"> https://groups.google.com/groups/opt_out.

--
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="8EYy1E1L-MEJ" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">testng-users...@googlegroups.com.
To post to this group, send email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="8EYy1E1L-MEJ" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;"> testn...@....
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users';return true;" onclick="this.href='http://groups.google.com/group/testng-users';return true;">http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/groups/opt_out" target="_blank" onmousedown="this.href='https://groups.google.com/groups/opt_out';return true;" onclick="this.href='https://groups.google.com/groups/opt_out';return true;">https://groups.google.com/groups/opt_out.

--
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 http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: Data Provider -How to either change run time testName for each run or call @Test methods based on @Test(data provider) received value.

QA Lead
In reply to this post by QA Lead
Hi Giannis,,

I am still facing problem in reporting just because of testName issue,

On Wednesday, February 5, 2014 10:29:37 AM UTC+5:30, QA Lead wrote:
Hi Giannis,

Thanks for the answer. I called it from @Test (DataProvider="xyz") but getting same result and expected result is not coming. I am expecting result like
[TestClass name=class selenium.bu.ReadSuite]   ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
           
                                          

where in actual I want, report should look like
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.browse()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]           


On Tuesday, February 4, 2014 8:10:56 PM UTC+5:30, John Papadakis wrote:
You can call it inside the listener or inside your dataProvider. It always returns the currentTestResult from Reporter class which is thread local variable (for multiple threads.)


2014-02-04 QA Lead <[hidden email]>:

Hi Giannis,

Thanks for your answer !
Should I call this reflection method in listner which I have created or how to call it ?


On Tuesday, February 4, 2014 1:57:56 PM UTC+5:30, John Papadakis wrote:
You can use reflection to set the name of the method in results.

public void SetResultTestName(String methodName) {

try 
{
ITestResult result=Reporter.getCurrentTestResult();
BaseTestMethod bm = (BaseTestMethod)result.getMethod();
Field f = bm.getClass().getSuperclass().getDeclaredField("m_methodName");
f.setAccessible(true);
f.set(bm,methodName);        

}
catch (Exception ex) {
System.out.println("ex" + ex.getMessage());
}}

Giannis


2014-02-03 Alexander Poulikakos <alexander....@ericsson.com>:

Hi

 

A POJO (Plain Old Java Object) is just a simple java class. For example this is a POJO:

 

public class MyPojo {

    private String a;

 

    public MyPojo(String a) {

        this.a = a;

    }

    public String getA() {

        return a;

    }

    @Override

    public String toString() {

        return a;

    }

}

 

 

You can have your DataProvider return POJO’s, and your @Test methods can take POJO’s as arguments.

 

/Alex

 

 

From: [hidden email] [mailto:testng...@googlegroups.com] On Behalf Of QA Lead
Sent: den 3 februari 2014 16:01
To: [hidden email]


Subject: Re: [testng-users] Data Provider -How to either change run time testName for each run or call @Test methods based on @Test(data provider) received value.

 

Hi Alex,

 Even this wiki does not contain much info about POJO.

On Monday, February 3, 2014 3:28:46 PM UTC+5:30, drapostolos wrote:

See wiki about POJO: <a href="http://en.wikipedia.org/wiki/Plain_Old_Java_Object" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FPlain_Old_Java_Object\46sa\75D\46sntz\0751\46usg\75AFQjCNFYKc3_17ZH6X3vfpUU6AzEsxGTYQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FPlain_Old_Java_Object\46sa\75D\46sntz\0751\46usg\75AFQjCNFYKc3_17ZH6X3vfpUU6AzEsxGTYQ';return true;">http://en.wikipedia.org/wiki/Plain_Old_Java_Object

 

/Alex

 

From: [hidden email] [mailto:testng...@googlegroups.com] On Behalf Of QA Lead
Sent: den 3 februari 2014 10:53
To: [hidden email]
Subject: Re: [testng-users] Data Provider -How to either change run time testName for each run or call @Test methods based on @Test(data provider) received value.

 

Hi Krishnan,

  Thanks for the solution which you have mentioned.
  Can you provide me little help about POJO as I never used this one.

On Monday, February 3, 2014 12:20:55 PM UTC+5:30, Krishnan wrote:

Sanjeev

Please have your DataProvider accept a POJO [ Plain Old Java Object] as a parameter and have it implement a custom toString() method which gives out the output as you need.


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" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;"> http://wakened-cognition.blogspot.com/

 

On Sat, Feb 1, 2014 at 10:56 AM, QA Lead <[hidden email]> wrote:

Hi Krishnan,

Thanks for reply but it seems your blog is not going to provide solution for this scenario. Please have a look at my actual sample output
PASSED TESTS -null
Class Method Time
(ms)
Status
[TestClass name=class selenium.bu.ReadSuite]   ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                           3147 PASSED
[TestClass name=class selenium.bu.ReadSuite]    ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                               154 PASSED
[TestClass name=class selenium.bu.ReadSuite]   ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                                  79 PASSED
[TestClass name=class selenium.bu.ReadSuite]   ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                                      1 PASSED

where in actual I want, report should look like
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.browse()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]           3147 PASSED
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.checkToolTip()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]    154 PASSED
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.clear()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]                 79 PASSED
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.clearAll()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]               1 PASSED

On Friday, January 31, 2014 2:11:25 PM UTC+5:30, Krishnan wrote:

You can refer to my blog post : <a href="http://rationaleemotions.wordpress.com/2013/07/31/pretty-printing-with-testng/" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Frationaleemotions.wordpress.com%2F2013%2F07%2F31%2Fpretty-printing-with-testng%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNGItBWrwaEbg-_De8ubg-wyA4oIQA';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Frationaleemotions.wordpress.com%2F2013%2F07%2F31%2Fpretty-printing-with-testng%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNGItBWrwaEbg-_De8ubg-wyA4oIQA';return true;">http://rationaleemotions.wordpress.com/2013/07/31/pretty-printing-with-testng/ and see if that helps you get started. 

On Friday, January 31, 2014, QA Lead <[hidden email]> wrote:

Hi,



Using @DataProvider(name="runMode"), I am able get runMode and then using @DataProvider(name=testCases") I am able to read each tests from one or more sheets along with corresponding value from data sheet (used @DataProvider(name="runMode") data-provider). But my @Test(Data-Provider="testCases") gives same name for each run. Let us say it run 50 times then it will show like below

ReadSuite.testDataPr
ovi(java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String)

for each run. I want it should give 50 names based on keyword.

--
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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users';return true;" onclick="this.href='http://groups.google.com/group/testng-users';return true;"> http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/groups/opt_out" target="_blank" onmousedown="this.href='https://groups.google.com/groups/opt_out';return true;" onclick="this.href='https://groups.google.com/groups/opt_out';return true;"> https://groups.google.com/groups/opt_out.



--
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" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;"> http://wakened-cognition.blogspot.com/

--
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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users';return true;" onclick="this.href='http://groups.google.com/group/testng-users';return true;"> http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/groups/opt_out" target="_blank" onmousedown="this.href='https://groups.google.com/groups/opt_out';return true;" onclick="this.href='https://groups.google.com/groups/opt_out';return true;"> https://groups.google.com/groups/opt_out.

 

--
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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users';return true;" onclick="this.href='http://groups.google.com/group/testng-users';return true;"> http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/groups/opt_out" target="_blank" onmousedown="this.href='https://groups.google.com/groups/opt_out';return true;" onclick="this.href='https://groups.google.com/groups/opt_out';return true;"> https://groups.google.com/groups/opt_out.

--
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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users';return true;" onclick="this.href='http://groups.google.com/group/testng-users';return true;">http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/groups/opt_out" target="_blank" onmousedown="this.href='https://groups.google.com/groups/opt_out';return true;" onclick="this.href='https://groups.google.com/groups/opt_out';return true;">https://groups.google.com/groups/opt_out.

--
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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users';return true;" onclick="this.href='http://groups.google.com/group/testng-users';return true;">http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/groups/opt_out" target="_blank" onmousedown="this.href='https://groups.google.com/groups/opt_out';return true;" onclick="this.href='https://groups.google.com/groups/opt_out';return true;">https://groups.google.com/groups/opt_out.

--
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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users';return true;" onclick="this.href='http://groups.google.com/group/testng-users';return true;">http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/groups/opt_out" target="_blank" onmousedown="this.href='https://groups.google.com/groups/opt_out';return true;" onclick="this.href='https://groups.google.com/groups/opt_out';return true;">https://groups.google.com/groups/opt_out.

--
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 http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: Data Provider -How to either change run time testName for each run or call @Test methods based on @Test(data provider) received value.

Giannis Papadakis
You can call the method inside your @Test and feed it from dataprovider for the name of the test in report.


2014-02-05 QA Lead <[hidden email]>:
Hi Giannis,,

I am still facing problem in reporting just because of testName issue,


On Wednesday, February 5, 2014 10:29:37 AM UTC+5:30, QA Lead wrote:
Hi Giannis,

Thanks for the answer. I called it from @Test (DataProvider="xyz") but getting same result and expected result is not coming. I am expecting result like
[TestClass name=class selenium.bu.ReadSuite]   ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
           
                                          

where in actual I want, report should look like
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.browse()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]           


On Tuesday, February 4, 2014 8:10:56 PM UTC+5:30, John Papadakis wrote:
You can call it inside the listener or inside your dataProvider. It always returns the currentTestResult from Reporter class which is thread local variable (for multiple threads.)


2014-02-04 QA Lead <[hidden email]>:

Hi Giannis,

Thanks for your answer !
Should I call this reflection method in listner which I have created or how to call it ?


On Tuesday, February 4, 2014 1:57:56 PM UTC+5:30, John Papadakis wrote:
You can use reflection to set the name of the method in results.

public void SetResultTestName(String methodName) {

try 
{
ITestResult result=Reporter.getCurrentTestResult();
BaseTestMethod bm = (BaseTestMethod)result.getMethod();
Field f = bm.getClass().getSuperclass().getDeclaredField("m_methodName");
f.setAccessible(true);
f.set(bm,methodName);        

}
catch (Exception ex) {
System.out.println("ex" + ex.getMessage());
}}

Giannis


2014-02-03 Alexander Poulikakos <alexander....@ericsson.com>:

Hi

 

A POJO (Plain Old Java Object) is just a simple java class. For example this is a POJO:

 

public class MyPojo {

    private String a;

 

    public MyPojo(String a) {

        this.a = a;

    }

    public String getA() {

        return a;

    }

    @Override

    public String toString() {

        return a;

    }

}

 

 

You can have your DataProvider return POJO’s, and your @Test methods can take POJO’s as arguments.

 

/Alex

 

 

From: [hidden email] [mailto:testng...@googlegroups.com] On Behalf Of QA Lead
Sent: den 3 februari 2014 16:01
To: [hidden email]


Subject: Re: [testng-users] Data Provider -How to either change run time testName for each run or call @Test methods based on @Test(data provider) received value.

 

Hi Alex,

 Even this wiki does not contain much info about POJO.

On Monday, February 3, 2014 3:28:46 PM UTC+5:30, drapostolos wrote:

See wiki about POJO: http://en.wikipedia.org/wiki/Plain_Old_Java_Object

 

/Alex

 

From: [hidden email] [mailto:testng...@googlegroups.com] On Behalf Of QA Lead
Sent: den 3 februari 2014 10:53
To: [hidden email]
Subject: Re: [testng-users] Data Provider -How to either change run time testName for each run or call @Test methods based on @Test(data provider) received value.

 

Hi Krishnan,

  Thanks for the solution which you have mentioned.
  Can you provide me little help about POJO as I never used this one.

On Monday, February 3, 2014 12:20:55 PM UTC+5:30, Krishnan wrote:

Sanjeev

Please have your DataProvider accept a POJO [ Plain Old Java Object] as a parameter and have it implement a custom toString() method which gives out the output as you need.


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/

 

On Sat, Feb 1, 2014 at 10:56 AM, QA Lead <[hidden email]> wrote:

Hi Krishnan,

Thanks for reply but it seems your blog is not going to provide solution for this scenario. Please have a look at my actual sample output
PASSED TESTS -null
Class Method Time
(ms)
Status
[TestClass name=class selenium.bu.ReadSuite]   ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                           3147 PASSED
[TestClass name=class selenium.bu.ReadSuite]    ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                               154 PASSED
[TestClass name=class selenium.bu.ReadSuite]   ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                                  79 PASSED
[TestClass name=class selenium.bu.ReadSuite]   ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                                      1 PASSED

where in actual I want, report should look like
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.browse()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]           3147 PASSED
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.checkToolTip()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]    154 PASSED
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.clear()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]                 79 PASSED
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.clearAll()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]               1 PASSED

On Friday, January 31, 2014 2:11:25 PM UTC+5:30, Krishnan wrote:

You can refer to my blog post : http://rationaleemotions.wordpress.com/2013/07/31/pretty-printing-with-testng/ and see if that helps you get started. 

On Friday, January 31, 2014, QA Lead <[hidden email]> wrote:

Hi,



Using @DataProvider(name="runMode"), I am able get runMode and then using @DataProvider(name=testCases") I am able to read each tests from one or more sheets along with corresponding value from data sheet (used @DataProvider(name="runMode") data-provider). But my @Test(Data-Provider="testCases") gives same name for each run. Let us say it run 50 times then it will show like below

ReadSuite.testDataPr
ovi(java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String)

for each run. I want it should give 50 names based on keyword.

--
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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/groups/opt_out.



--
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/

--
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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/groups/opt_out.

 

--
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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/groups/opt_out.

--
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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/groups/opt_out.

--
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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/groups/opt_out.

--
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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/groups/opt_out.

--
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 http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/groups/opt_out.

--
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 http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: Data Provider -How to either change run time testName for each run or call @Test methods based on @Test(data provider) received value.

QA Lead
Hi John,
I already called it from @Test(DataProvider="xyz") and do not understand about feeding. Did you suggest feeding the function "SetResultTestName" ?
public void testDataProvi(String s1,String s2,String s3,String s4,String s5,String s6,String s7) throws Exception
    {  
        SetResultTestName(s2);
         .....
     }
public void SetResultTestName(String methodName)
    {
        try
        {
        ITestResult myResult=Reporter.getCurrentTestResult();
        BaseTestMethod bm = (BaseTestMethod)myResult.getMethod();
        Field f = bm.getClass().getSuperclass().getDeclaredField("m_methodName");
        f.setAccessible(true);
        f.set(bm,methodName);  
        }
        catch (Exception ex) {
        System.out.println("ex" + ex.getMessage());
        }}

On Wednesday, February 5, 2014 8:03:54 PM UTC+5:30, John Papadakis wrote:
You can call the method inside your @Test and feed it from dataprovider for the name of the test in report.


2014-02-05 QA Lead <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="wZBn5TDXRt4J" onmousedown="this.href='javascript:';return true;" onclick="this.href='javascript:';return true;">sanjee...@...>:
Hi Giannis,,

I am still facing problem in reporting just because of testName issue,


On Wednesday, February 5, 2014 10:29:37 AM UTC+5:30, QA Lead wrote:
Hi Giannis,

Thanks for the answer. I called it from @Test (DataProvider="xyz") but getting same result and expected result is not coming. I am expecting result like
[TestClass name=class selenium.bu.ReadSuite]   ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
           
                                          

where in actual I want, report should look like
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.browse()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]           


On Tuesday, February 4, 2014 8:10:56 PM UTC+5:30, John Papadakis wrote:
You can call it inside the listener or inside your dataProvider. It always returns the currentTestResult from Reporter class which is thread local variable (for multiple threads.)


2014-02-04 QA Lead <[hidden email]>:

Hi Giannis,

Thanks for your answer !
Should I call this reflection method in listner which I have created or how to call it ?


On Tuesday, February 4, 2014 1:57:56 PM UTC+5:30, John Papadakis wrote:
You can use reflection to set the name of the method in results.

public void SetResultTestName(String methodName) {

try 
{
ITestResult result=Reporter.getCurrentTestResult();
BaseTestMethod bm = (BaseTestMethod)result.getMethod();
Field f = bm.getClass().getSuperclass().getDeclaredField("m_methodName");
f.setAccessible(true);
f.set(bm,methodName);        

}
catch (Exception ex) {
System.out.println("ex" + ex.getMessage());
}}

Giannis


2014-02-03 Alexander Poulikakos <alexander....@ericsson.com>:

Hi

 

A POJO (Plain Old Java Object) is just a simple java class. For example this is a POJO:

 

public class MyPojo {

    private String a;

 

    public MyPojo(String a) {

        this.a = a;

    }

    public String getA() {

        return a;

    }

    @Override

    public String toString() {

        return a;

    }

}

 

 

You can have your DataProvider return POJO’s, and your @Test methods can take POJO’s as arguments.

 

/Alex

 

 

From: [hidden email] [mailto:testng...@googlegroups.com] On Behalf Of QA Lead
Sent: den 3 februari 2014 16:01
To: [hidden email]


Subject: Re: [testng-users] Data Provider -How to either change run time testName for each run or call @Test methods based on @Test(data provider) received value.

 

Hi Alex,

 Even this wiki does not contain much info about POJO.

On Monday, February 3, 2014 3:28:46 PM UTC+5:30, drapostolos wrote:

See wiki about POJO: <a href="http://en.wikipedia.org/wiki/Plain_Old_Java_Object" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FPlain_Old_Java_Object\46sa\75D\46sntz\0751\46usg\75AFQjCNFYKc3_17ZH6X3vfpUU6AzEsxGTYQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FPlain_Old_Java_Object\46sa\75D\46sntz\0751\46usg\75AFQjCNFYKc3_17ZH6X3vfpUU6AzEsxGTYQ';return true;">http://en.wikipedia.org/wiki/Plain_Old_Java_Object

 

/Alex

 

From: [hidden email] [mailto:testng...@googlegroups.com] On Behalf Of QA Lead
Sent: den 3 februari 2014 10:53
To: [hidden email]
Subject: Re: [testng-users] Data Provider -How to either change run time testName for each run or call @Test methods based on @Test(data provider) received value.

 

Hi Krishnan,

  Thanks for the solution which you have mentioned.
  Can you provide me little help about POJO as I never used this one.

On Monday, February 3, 2014 12:20:55 PM UTC+5:30, Krishnan wrote:

Sanjeev

Please have your DataProvider accept a POJO [ Plain Old Java Object] as a parameter and have it implement a custom toString() method which gives out the output as you need.


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" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;"> http://wakened-cognition.blogspot.com/

 

On Sat, Feb 1, 2014 at 10:56 AM, QA Lead <[hidden email]> wrote:

Hi Krishnan,

Thanks for reply but it seems your blog is not going to provide solution for this scenario. Please have a look at my actual sample output
PASSED TESTS -null
Class Method Time
(ms)
Status
[TestClass name=class selenium.bu.ReadSuite]   ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                           3147 PASSED
[TestClass name=class selenium.bu.ReadSuite]    ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                               154 PASSED
[TestClass name=class selenium.bu.ReadSuite]   ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                                  79 PASSED
[TestClass name=class selenium.bu.ReadSuite]   ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                                      1 PASSED

where in actual I want, report should look like
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.browse()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]           3147 PASSED
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.checkToolTip()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]    154 PASSED
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.clear()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]                 79 PASSED
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.clearAll()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]               1 PASSED

On Friday, January 31, 2014 2:11:25 PM UTC+5:30, Krishnan wrote:

You can refer to my blog post : <a href="http://rationaleemotions.wordpress.com/2013/07/31/pretty-printing-with-testng/" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Frationaleemotions.wordpress.com%2F2013%2F07%2F31%2Fpretty-printing-with-testng%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNGItBWrwaEbg-_De8ubg-wyA4oIQA';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Frationaleemotions.wordpress.com%2F2013%2F07%2F31%2Fpretty-printing-with-testng%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNGItBWrwaEbg-_De8ubg-wyA4oIQA';return true;">http://rationaleemotions.wordpress.com/2013/07/31/pretty-printing-with-testng/ and see if that helps you get started. 

On Friday, January 31, 2014, QA Lead <[hidden email]> wrote:

Hi,



Using @DataProvider(name="runMode"), I am able get runMode and then using @DataProvider(name=testCases") I am able to read each tests from one or more sheets along with corresponding value from data sheet (used @DataProvider(name="runMode") data-provider). But my @Test(Data-Provider="testCases") gives same name for each run. Let us say it run 50 times then it will show like below

ReadSuite.testDataPr
ovi(java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String)

for each run. I want it should give 50 names based on keyword.

--
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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users';return true;" onclick="this.href='http://groups.google.com/group/testng-users';return true;"> http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/groups/opt_out" target="_blank" onmousedown="this.href='https://groups.google.com/groups/opt_out';return true;" onclick="this.href='https://groups.google.com/groups/opt_out';return true;"> https://groups.google.com/groups/opt_out.



--
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" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;"> http://wakened-cognition.blogspot.com/

--
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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users';return true;" onclick="this.href='http://groups.google.com/group/testng-users';return true;"> http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/groups/opt_out" target="_blank" onmousedown="this.href='https://groups.google.com/groups/opt_out';return true;" onclick="this.href='https://groups.google.com/groups/opt_out';return true;"> https://groups.google.com/groups/opt_out.

 

--
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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users';return true;" onclick="this.href='http://groups.google.com/group/testng-users';return true;"> http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/groups/opt_out" target="_blank" onmousedown="this.href='https://groups.google.com/groups/opt_out';return true;" onclick="this.href='https://groups.google.com/groups/opt_out';return true;"> https://groups.google.com/groups/opt_out.

--
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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users';return true;" onclick="this.href='http://groups.google.com/group/testng-users';return true;">http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/groups/opt_out" target="_blank" onmousedown="this.href='https://groups.google.com/groups/opt_out';return true;" onclick="this.href='https://groups.google.com/groups/opt_out';return true;">https://groups.google.com/groups/opt_out.

--
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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users';return true;" onclick="this.href='http://groups.google.com/group/testng-users';return true;">http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/groups/opt_out" target="_blank" onmousedown="this.href='https://groups.google.com/groups/opt_out';return true;" onclick="this.href='https://groups.google.com/groups/opt_out';return true;">https://groups.google.com/groups/opt_out.

--
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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users';return true;" onclick="this.href='http://groups.google.com/group/testng-users';return true;">http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/groups/opt_out" target="_blank" onmousedown="this.href='https://groups.google.com/groups/opt_out';return true;" onclick="this.href='https://groups.google.com/groups/opt_out';return true;">https://groups.google.com/groups/opt_out.

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

--
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 http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: Data Provider -How to either change run time testName for each run or call @Test methods based on @Test(data provider) received value.

QA Lead
Does we haney solution regarding this issue ?

On Wednesday, February 5, 2014 8:25:32 PM UTC+5:30, QA Lead wrote:
Hi John,
I already called it from @Test(DataProvider="xyz") and do not understand about feeding. Did you suggest feeding the function "SetResultTestName" ?
public void testDataProvi(String s1,String s2,String s3,String s4,String s5,String s6,String s7) throws Exception
    {  
        SetResultTestName(s2);
         .....
     }
public void SetResultTestName(String methodName)
    {
        try
        {
        ITestResult myResult=Reporter.getCurrentTestResult();
        BaseTestMethod bm = (BaseTestMethod)myResult.getMethod();
        Field f = bm.getClass().getSuperclass().getDeclaredField("m_methodName");
        f.setAccessible(true);
        f.set(bm,methodName);  
        }
        catch (Exception ex) {
        System.out.println("ex" + ex.getMessage());
        }}

On Wednesday, February 5, 2014 8:03:54 PM UTC+5:30, John Papadakis wrote:
You can call the method inside your @Test and feed it from dataprovider for the name of the test in report.


2014-02-05 QA Lead <[hidden email]>:
Hi Giannis,,

I am still facing problem in reporting just because of testName issue,


On Wednesday, February 5, 2014 10:29:37 AM UTC+5:30, QA Lead wrote:
Hi Giannis,

Thanks for the answer. I called it from @Test (DataProvider="xyz") but getting same result and expected result is not coming. I am expecting result like
[TestClass name=class selenium.bu.ReadSuite]   ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
           
                                          

where in actual I want, report should look like
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.browse()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]           


On Tuesday, February 4, 2014 8:10:56 PM UTC+5:30, John Papadakis wrote:
You can call it inside the listener or inside your dataProvider. It always returns the currentTestResult from Reporter class which is thread local variable (for multiple threads.)


2014-02-04 QA Lead <[hidden email]>:

Hi Giannis,

Thanks for your answer !
Should I call this reflection method in listner which I have created or how to call it ?


On Tuesday, February 4, 2014 1:57:56 PM UTC+5:30, John Papadakis wrote:
You can use reflection to set the name of the method in results.

public void SetResultTestName(String methodName) {

try 
{
ITestResult result=Reporter.getCurrentTestResult();
BaseTestMethod bm = (BaseTestMethod)result.getMethod();
Field f = bm.getClass().getSuperclass().getDeclaredField("m_methodName");
f.setAccessible(true);
f.set(bm,methodName);        

}
catch (Exception ex) {
System.out.println("ex" + ex.getMessage());
}}

Giannis


2014-02-03 Alexander Poulikakos <alexander....@ericsson.com>:

Hi

 

A POJO (Plain Old Java Object) is just a simple java class. For example this is a POJO:

 

public class MyPojo {

    private String a;

 

    public MyPojo(String a) {

        this.a = a;

    }

    public String getA() {

        return a;

    }

    @Override

    public String toString() {

        return a;

    }

}

 

 

You can have your DataProvider return POJO’s, and your @Test methods can take POJO’s as arguments.

 

/Alex

 

 

From: [hidden email] [mailto:testng...@googlegroups.com] On Behalf Of QA Lead
Sent: den 3 februari 2014 16:01
To: [hidden email]


Subject: Re: [testng-users] Data Provider -How to either change run time testName for each run or call @Test methods based on @Test(data provider) received value.

 

Hi Alex,

 Even this wiki does not contain much info about POJO.

On Monday, February 3, 2014 3:28:46 PM UTC+5:30, drapostolos wrote:

See wiki about POJO: <a href="http://en.wikipedia.org/wiki/Plain_Old_Java_Object" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FPlain_Old_Java_Object\46sa\75D\46sntz\0751\46usg\75AFQjCNFYKc3_17ZH6X3vfpUU6AzEsxGTYQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FPlain_Old_Java_Object\46sa\75D\46sntz\0751\46usg\75AFQjCNFYKc3_17ZH6X3vfpUU6AzEsxGTYQ';return true;">http://en.wikipedia.org/wiki/Plain_Old_Java_Object

 

/Alex

 

From: [hidden email] [mailto:testng...@googlegroups.com] On Behalf Of QA Lead
Sent: den 3 februari 2014 10:53
To: [hidden email]
Subject: Re: [testng-users] Data Provider -How to either change run time testName for each run or call @Test methods based on @Test(data provider) received value.

 

Hi Krishnan,

  Thanks for the solution which you have mentioned.
  Can you provide me little help about POJO as I never used this one.

On Monday, February 3, 2014 12:20:55 PM UTC+5:30, Krishnan wrote:

Sanjeev

Please have your DataProvider accept a POJO [ Plain Old Java Object] as a parameter and have it implement a custom toString() method which gives out the output as you need.


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" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;"> http://wakened-cognition.blogspot.com/

 

On Sat, Feb 1, 2014 at 10:56 AM, QA Lead <[hidden email]> wrote:

Hi Krishnan,

Thanks for reply but it seems your blog is not going to provide solution for this scenario. Please have a look at my actual sample output
PASSED TESTS -null
Class Method Time
(ms)
Status
[TestClass name=class selenium.bu.ReadSuite]   ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                           3147 PASSED
[TestClass name=class selenium.bu.ReadSuite]    ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                               154 PASSED
[TestClass name=class selenium.bu.ReadSuite]   ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                                  79 PASSED
[TestClass name=class selenium.bu.ReadSuite]   ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                                      1 PASSED

where in actual I want, report should look like
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.browse()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]           3147 PASSED
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.checkToolTip()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]    154 PASSED
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.clear()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]                 79 PASSED
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.clearAll()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]               1 PASSED

On Friday, January 31, 2014 2:11:25 PM UTC+5:30, Krishnan wrote:

You can refer to my blog post : <a href="http://rationaleemotions.wordpress.com/2013/07/31/pretty-printing-with-testng/" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Frationaleemotions.wordpress.com%2F2013%2F07%2F31%2Fpretty-printing-with-testng%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNGItBWrwaEbg-_De8ubg-wyA4oIQA';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Frationaleemotions.wordpress.com%2F2013%2F07%2F31%2Fpretty-printing-with-testng%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNGItBWrwaEbg-_De8ubg-wyA4oIQA';return true;">http://rationaleemotions.wordpress.com/2013/07/31/pretty-printing-with-testng/ and see if that helps you get started. 

On Friday, January 31, 2014, QA Lead <[hidden email]> wrote:

Hi,



Using @DataProvider(name="runMode"), I am able get runMode and then using @DataProvider(name=testCases") I am able to read each tests from one or more sheets along with corresponding value from data sheet (used @DataProvider(name="runMode") data-provider). But my @Test(Data-Provider="testCases") gives same name for each run. Let us say it run 50 times then it will show like below

ReadSuite.testDataPr
ovi(java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String)

for each run. I want it should give 50 names based on keyword.

--
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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users';return true;" onclick="this.href='http://groups.google.com/group/testng-users';return true;"> http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/groups/opt_out" target="_blank" onmousedown="this.href='https://groups.google.com/groups/opt_out';return true;" onclick="this.href='https://groups.google.com/groups/opt_out';return true;"> https://groups.google.com/groups/opt_out.



--
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" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;"> http://wakened-cognition.blogspot.com/

--
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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users';return true;" onclick="this.href='http://groups.google.com/group/testng-users';return true;"> http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/groups/opt_out" target="_blank" onmousedown="this.href='https://groups.google.com/groups/opt_out';return true;" onclick="this.href='https://groups.google.com/groups/opt_out';return true;"> https://groups.google.com/groups/opt_out.

 

--
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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users';return true;" onclick="this.href='http://groups.google.com/group/testng-users';return true;"> http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/groups/opt_out" target="_blank" onmousedown="this.href='https://groups.google.com/groups/opt_out';return true;" onclick="this.href='https://groups.google.com/groups/opt_out';return true;"> https://groups.google.com/groups/opt_out.

--
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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users';return true;" onclick="this.href='http://groups.google.com/group/testng-users';return true;">http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/groups/opt_out" target="_blank" onmousedown="this.href='https://groups.google.com/groups/opt_out';return true;" onclick="this.href='https://groups.google.com/groups/opt_out';return true;">https://groups.google.com/groups/opt_out.

--
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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users';return true;" onclick="this.href='http://groups.google.com/group/testng-users';return true;">http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/groups/opt_out" target="_blank" onmousedown="this.href='https://groups.google.com/groups/opt_out';return true;" onclick="this.href='https://groups.google.com/groups/opt_out';return true;">https://groups.google.com/groups/opt_out.

--
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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users';return true;" onclick="this.href='http://groups.google.com/group/testng-users';return true;">http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/groups/opt_out" target="_blank" onmousedown="this.href='https://groups.google.com/groups/opt_out';return true;" onclick="this.href='https://groups.google.com/groups/opt_out';return true;">https://groups.google.com/groups/opt_out.

--
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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users';return true;" onclick="this.href='http://groups.google.com/group/testng-users';return true;">http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/groups/opt_out" target="_blank" onmousedown="this.href='https://groups.google.com/groups/opt_out';return true;" onclick="this.href='https://groups.google.com/groups/opt_out';return true;">https://groups.google.com/groups/opt_out.

--
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 http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: Data Provider -How to either change run time testName for each run or call @Test methods based on @Test(data provider) received value.

QA Lead
Hi John,

  Sorry for typo error :(
   do we have any other remarks or solution ?

On Thursday, February 6, 2014 1:32:58 PM UTC+5:30, QA Lead wrote:
Does we haney solution regarding this issue ?

On Wednesday, February 5, 2014 8:25:32 PM UTC+5:30, QA Lead wrote:
Hi John,
I already called it from @Test(DataProvider="xyz") and do not understand about feeding. Did you suggest feeding the function "SetResultTestName" ?
public void testDataProvi(String s1,String s2,String s3,String s4,String s5,String s6,String s7) throws Exception
    {  
        SetResultTestName(s2);
         .....
     }
public void SetResultTestName(String methodName)
    {
        try
        {
        ITestResult myResult=Reporter.getCurrentTestResult();
        BaseTestMethod bm = (BaseTestMethod)myResult.getMethod();
        Field f = bm.getClass().getSuperclass().getDeclaredField("m_methodName");
        f.setAccessible(true);
        f.set(bm,methodName);  
        }
        catch (Exception ex) {
        System.out.println("ex" + ex.getMessage());
        }}

On Wednesday, February 5, 2014 8:03:54 PM UTC+5:30, John Papadakis wrote:
You can call the method inside your @Test and feed it from dataprovider for the name of the test in report.


2014-02-05 QA Lead <[hidden email]>:
Hi Giannis,,

I am still facing problem in reporting just because of testName issue,


On Wednesday, February 5, 2014 10:29:37 AM UTC+5:30, QA Lead wrote:
Hi Giannis,

Thanks for the answer. I called it from @Test (DataProvider="xyz") but getting same result and expected result is not coming. I am expecting result like
[TestClass name=class selenium.bu.ReadSuite]   ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
           
                                          

where in actual I want, report should look like
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.browse()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]           


On Tuesday, February 4, 2014 8:10:56 PM UTC+5:30, John Papadakis wrote:
You can call it inside the listener or inside your dataProvider. It always returns the currentTestResult from Reporter class which is thread local variable (for multiple threads.)


2014-02-04 QA Lead <[hidden email]>:

Hi Giannis,

Thanks for your answer !
Should I call this reflection method in listner which I have created or how to call it ?


On Tuesday, February 4, 2014 1:57:56 PM UTC+5:30, John Papadakis wrote:
You can use reflection to set the name of the method in results.

public void SetResultTestName(String methodName) {

try 
{
ITestResult result=Reporter.getCurrentTestResult();
BaseTestMethod bm = (BaseTestMethod)result.getMethod();
Field f = bm.getClass().getSuperclass().getDeclaredField("m_methodName");
f.setAccessible(true);
f.set(bm,methodName);        

}
catch (Exception ex) {
System.out.println("ex" + ex.getMessage());
}}

Giannis


2014-02-03 Alexander Poulikakos <alexander....@ericsson.com>:

Hi

 

A POJO (Plain Old Java Object) is just a simple java class. For example this is a POJO:

 

public class MyPojo {

    private String a;

 

    public MyPojo(String a) {

        this.a = a;

    }

    public String getA() {

        return a;

    }

    @Override

    public String toString() {

        return a;

    }

}

 

 

You can have your DataProvider return POJO’s, and your @Test methods can take POJO’s as arguments.

 

/Alex

 

 

From: [hidden email] [mailto:testng...@googlegroups.com] On Behalf Of QA Lead
Sent: den 3 februari 2014 16:01
To: [hidden email]


Subject: Re: [testng-users] Data Provider -How to either change run time testName for each run or call @Test methods based on @Test(data provider) received value.

 

Hi Alex,

 Even this wiki does not contain much info about POJO.

On Monday, February 3, 2014 3:28:46 PM UTC+5:30, drapostolos wrote:

See wiki about POJO: <a href="http://en.wikipedia.org/wiki/Plain_Old_Java_Object" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FPlain_Old_Java_Object\46sa\75D\46sntz\0751\46usg\75AFQjCNFYKc3_17ZH6X3vfpUU6AzEsxGTYQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FPlain_Old_Java_Object\46sa\75D\46sntz\0751\46usg\75AFQjCNFYKc3_17ZH6X3vfpUU6AzEsxGTYQ';return true;">http://en.wikipedia.org/wiki/Plain_Old_Java_Object

 

/Alex

 

From: [hidden email] [mailto:testng...@googlegroups.com] On Behalf Of QA Lead
Sent: den 3 februari 2014 10:53
To: [hidden email]
Subject: Re: [testng-users] Data Provider -How to either change run time testName for each run or call @Test methods based on @Test(data provider) received value.

 

Hi Krishnan,

  Thanks for the solution which you have mentioned.
  Can you provide me little help about POJO as I never used this one.

On Monday, February 3, 2014 12:20:55 PM UTC+5:30, Krishnan wrote:

Sanjeev

Please have your DataProvider accept a POJO [ Plain Old Java Object] as a parameter and have it implement a custom toString() method which gives out the output as you need.


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" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;"> http://wakened-cognition.blogspot.com/

 

On Sat, Feb 1, 2014 at 10:56 AM, QA Lead <[hidden email]> wrote:

Hi Krishnan,

Thanks for reply but it seems your blog is not going to provide solution for this scenario. Please have a look at my actual sample output
PASSED TESTS -null
Class Method Time
(ms)
Status
[TestClass name=class selenium.bu.ReadSuite]   ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                           3147 PASSED
[TestClass name=class selenium.bu.ReadSuite]    ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                               154 PASSED
[TestClass name=class selenium.bu.ReadSuite]   ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                                  79 PASSED
[TestClass name=class selenium.bu.ReadSuite]   ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                                      1 PASSED

where in actual I want, report should look like
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.browse()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]           3147 PASSED
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.checkToolTip()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]    154 PASSED
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.clear()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]                 79 PASSED
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.clearAll()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]               1 PASSED

On Friday, January 31, 2014 2:11:25 PM UTC+5:30, Krishnan wrote:

You can refer to my blog post : <a href="http://rationaleemotions.wordpress.com/2013/07/31/pretty-printing-with-testng/" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Frationaleemotions.wordpress.com%2F2013%2F07%2F31%2Fpretty-printing-with-testng%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNGItBWrwaEbg-_De8ubg-wyA4oIQA';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Frationaleemotions.wordpress.com%2F2013%2F07%2F31%2Fpretty-printing-with-testng%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNGItBWrwaEbg-_De8ubg-wyA4oIQA';return true;">http://rationaleemotions.wordpress.com/2013/07/31/pretty-printing-with-testng/ and see if that helps you get started. 

On Friday, January 31, 2014, QA Lead <[hidden email]> wrote:

Hi,



Using @DataProvider(name="runMode"), I am able get runMode and then using @DataProvider(name=testCases") I am able to read each tests from one or more sheets along with corresponding value from data sheet (used @DataProvider(name="runMode") data-provider). But my @Test(Data-Provider="testCases") gives same name for each run. Let us say it run 50 times then it will show like below

ReadSuite.testDataPr
ovi(java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String)

for each run. I want it should give 50 names based on keyword.

--
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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users';return true;" onclick="this.href='http://groups.google.com/group/testng-users';return true;"> http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/groups/opt_out" target="_blank" onmousedown="this.href='https://groups.google.com/groups/opt_out';return true;" onclick="this.href='https://groups.google.com/groups/opt_out';return true;"> https://groups.google.com/groups/opt_out.



--
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" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;"> http://wakened-cognition.blogspot.com/

--
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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users';return true;" onclick="this.href='http://groups.google.com/group/testng-users';return true;"> http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/groups/opt_out" target="_blank" onmousedown="this.href='https://groups.google.com/groups/opt_out';return true;" onclick="this.href='https://groups.google.com/groups/opt_out';return true;"> https://groups.google.com/groups/opt_out.

 

--
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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users';return true;" onclick="this.href='http://groups.google.com/group/testng-users';return true;"> http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/groups/opt_out" target="_blank" onmousedown="this.href='https://groups.google.com/groups/opt_out';return true;" onclick="this.href='https://groups.google.com/groups/opt_out';return true;"> https://groups.google.com/groups/opt_out.

--
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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users';return true;" onclick="this.href='http://groups.google.com/group/testng-users';return true;">http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/groups/opt_out" target="_blank" onmousedown="this.href='https://groups.google.com/groups/opt_out';return true;" onclick="this.href='https://groups.google.com/groups/opt_out';return true;">https://groups.google.com/groups/opt_out.

--
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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users';return true;" onclick="this.href='http://groups.google.com/group/testng-users';return true;">http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/groups/opt_out" target="_blank" onmousedown="this.href='https://groups.google.com/groups/opt_out';return true;" onclick="this.href='https://groups.google.com/groups/opt_out';return true;">https://groups.google.com/groups/opt_out.

--
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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users';return true;" onclick="this.href='http://groups.google.com/group/testng-users';return true;">http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/groups/opt_out" target="_blank" onmousedown="this.href='https://groups.google.com/groups/opt_out';return true;" onclick="this.href='https://groups.google.com/groups/opt_out';return true;">https://groups.google.com/groups/opt_out.

--
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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users';return true;" onclick="this.href='http://groups.google.com/group/testng-users';return true;">http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/groups/opt_out" target="_blank" onmousedown="this.href='https://groups.google.com/groups/opt_out';return true;" onclick="this.href='https://groups.google.com/groups/opt_out';return true;">https://groups.google.com/groups/opt_out.

--
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 http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/groups/opt_out.
Reply | Threaded
Open this post in threaded view
|

Re: Data Provider -How to either change run time testName for each run or call @Test methods based on @Test(data provider) received value.

QA Lead
In reply to this post by QA Lead
Hi
Any new update on it ?

On Wednesday, February 5, 2014 10:29:37 AM UTC+5:30, QA Lead wrote:
Hi Giannis,

Thanks for the answer. I called it from @Test (DataProvider="xyz") but getting same result and expected result is not coming. I am expecting result like
[TestClass name=class selenium.bu.ReadSuite]   ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
           
                                          

where in actual I want, report should look like
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.browse()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]           


On Tuesday, February 4, 2014 8:10:56 PM UTC+5:30, John Papadakis wrote:
You can call it inside the listener or inside your dataProvider. It always returns the currentTestResult from Reporter class which is thread local variable (for multiple threads.)


2014-02-04 QA Lead <[hidden email]>:

Hi Giannis,

Thanks for your answer !
Should I call this reflection method in listner which I have created or how to call it ?


On Tuesday, February 4, 2014 1:57:56 PM UTC+5:30, John Papadakis wrote:
You can use reflection to set the name of the method in results.

public void SetResultTestName(String methodName) {

try 
{
ITestResult result=Reporter.getCurrentTestResult();
BaseTestMethod bm = (BaseTestMethod)result.getMethod();
Field f = bm.getClass().getSuperclass().getDeclaredField("m_methodName");
f.setAccessible(true);
f.set(bm,methodName);        

}
catch (Exception ex) {
System.out.println("ex" + ex.getMessage());
}}

Giannis


2014-02-03 Alexander Poulikakos <alexander....@ericsson.com>:

Hi

 

A POJO (Plain Old Java Object) is just a simple java class. For example this is a POJO:

 

public class MyPojo {

    private String a;

 

    public MyPojo(String a) {

        this.a = a;

    }

    public String getA() {

        return a;

    }

    @Override

    public String toString() {

        return a;

    }

}

 

 

You can have your DataProvider return POJO’s, and your @Test methods can take POJO’s as arguments.

 

/Alex

 

 

From: [hidden email] [mailto:testng...@googlegroups.com] On Behalf Of QA Lead
Sent: den 3 februari 2014 16:01
To: [hidden email]


Subject: Re: [testng-users] Data Provider -How to either change run time testName for each run or call @Test methods based on @Test(data provider) received value.

 

Hi Alex,

 Even this wiki does not contain much info about POJO.

On Monday, February 3, 2014 3:28:46 PM UTC+5:30, drapostolos wrote:

See wiki about POJO: <a href="http://en.wikipedia.org/wiki/Plain_Old_Java_Object" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FPlain_Old_Java_Object\46sa\75D\46sntz\0751\46usg\75AFQjCNFYKc3_17ZH6X3vfpUU6AzEsxGTYQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FPlain_Old_Java_Object\46sa\75D\46sntz\0751\46usg\75AFQjCNFYKc3_17ZH6X3vfpUU6AzEsxGTYQ';return true;">http://en.wikipedia.org/wiki/Plain_Old_Java_Object

 

/Alex

 

From: [hidden email] [mailto:testng...@googlegroups.com] On Behalf Of QA Lead
Sent: den 3 februari 2014 10:53
To: [hidden email]
Subject: Re: [testng-users] Data Provider -How to either change run time testName for each run or call @Test methods based on @Test(data provider) received value.

 

Hi Krishnan,

  Thanks for the solution which you have mentioned.
  Can you provide me little help about POJO as I never used this one.

On Monday, February 3, 2014 12:20:55 PM UTC+5:30, Krishnan wrote:

Sanjeev

Please have your DataProvider accept a POJO [ Plain Old Java Object] as a parameter and have it implement a custom toString() method which gives out the output as you need.


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" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;"> http://wakened-cognition.blogspot.com/

 

On Sat, Feb 1, 2014 at 10:56 AM, QA Lead <[hidden email]> wrote:

Hi Krishnan,

Thanks for reply but it seems your blog is not going to provide solution for this scenario. Please have a look at my actual sample output
PASSED TESTS -null
Class Method Time
(ms)
Status
[TestClass name=class selenium.bu.ReadSuite]   ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                           3147 PASSED
[TestClass name=class selenium.bu.ReadSuite]    ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                               154 PASSED
[TestClass name=class selenium.bu.ReadSuite]   ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                                  79 PASSED
[TestClass name=class selenium.bu.ReadSuite]   ReadSuite.testDataProvi(java.lang.String,
                                                                         java.lang.String, java.lang.String, java.lang.String,
                                                                         java.lang.String, java.lang.String,java.lang.String)                
                                                                         [pri:0,instance:selenium.bu.ReadSuite@24dfb3be]
                                                      1 PASSED

where in actual I want, report should look like
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.browse()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]           3147 PASSED
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.checkToolTip()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]    154 PASSED
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.clear()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]                 79 PASSED
[TestClass name=class selenium.bu.ReadSuite]      ReadSuite.clearAll()[pri:0,instance:selenium.bu.ReadSuite@24dfb3be]               1 PASSED

On Friday, January 31, 2014 2:11:25 PM UTC+5:30, Krishnan wrote:

You can refer to my blog post : <a href="http://rationaleemotions.wordpress.com/2013/07/31/pretty-printing-with-testng/" target="_blank" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Frationaleemotions.wordpress.com%2F2013%2F07%2F31%2Fpretty-printing-with-testng%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNGItBWrwaEbg-_De8ubg-wyA4oIQA';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Frationaleemotions.wordpress.com%2F2013%2F07%2F31%2Fpretty-printing-with-testng%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNGItBWrwaEbg-_De8ubg-wyA4oIQA';return true;">http://rationaleemotions.wordpress.com/2013/07/31/pretty-printing-with-testng/ and see if that helps you get started. 

On Friday, January 31, 2014, QA Lead <[hidden email]> wrote:

Hi,



Using @DataProvider(name="runMode"), I am able get runMode and then using @DataProvider(name=testCases") I am able to read each tests from one or more sheets along with corresponding value from data sheet (used @DataProvider(name="runMode") data-provider). But my @Test(Data-Provider="testCases") gives same name for each run. Let us say it run 50 times then it will show like below

ReadSuite.testDataPr
ovi(java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String,
java.lang.String)

for each run. I want it should give 50 names based on keyword.

--
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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users';return true;" onclick="this.href='http://groups.google.com/group/testng-users';return true;"> http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/groups/opt_out" target="_blank" onmousedown="this.href='https://groups.google.com/groups/opt_out';return true;" onclick="this.href='https://groups.google.com/groups/opt_out';return true;"> https://groups.google.com/groups/opt_out.



--
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" onmousedown="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;" onclick="this.href='http://www.google.com/url?q\75http%3A%2F%2Fwakened-cognition.blogspot.com%2F\46sa\75D\46sntz\0751\46usg\75AFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ';return true;"> http://wakened-cognition.blogspot.com/

--
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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users';return true;" onclick="this.href='http://groups.google.com/group/testng-users';return true;"> http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/groups/opt_out" target="_blank" onmousedown="this.href='https://groups.google.com/groups/opt_out';return true;" onclick="this.href='https://groups.google.com/groups/opt_out';return true;"> https://groups.google.com/groups/opt_out.

 

--
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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users';return true;" onclick="this.href='http://groups.google.com/group/testng-users';return true;"> http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/groups/opt_out" target="_blank" onmousedown="this.href='https://groups.google.com/groups/opt_out';return true;" onclick="this.href='https://groups.google.com/groups/opt_out';return true;"> https://groups.google.com/groups/opt_out.

--
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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users';return true;" onclick="this.href='http://groups.google.com/group/testng-users';return true;">http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/groups/opt_out" target="_blank" onmousedown="this.href='https://groups.google.com/groups/opt_out';return true;" onclick="this.href='https://groups.google.com/groups/opt_out';return true;">https://groups.google.com/groups/opt_out.

--
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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users';return true;" onclick="this.href='http://groups.google.com/group/testng-users';return true;">http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/groups/opt_out" target="_blank" onmousedown="this.href='https://groups.google.com/groups/opt_out';return true;" onclick="this.href='https://groups.google.com/groups/opt_out';return true;">https://groups.google.com/groups/opt_out.

--
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 testng-users...@googlegroups.com.
To post to this group, send email to [hidden email].
Visit this group at <a href="http://groups.google.com/group/testng-users" target="_blank" onmousedown="this.href='http://groups.google.com/group/testng-users';return true;" onclick="this.href='http://groups.google.com/group/testng-users';return true;">http://groups.google.com/group/testng-users.
For more options, visit <a href="https://groups.google.com/groups/opt_out" target="_blank" onmousedown="this.href='https://groups.google.com/groups/opt_out';return true;" onclick="this.href='https://groups.google.com/groups/opt_out';return true;">https://groups.google.com/groups/opt_out.

--
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 http://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/groups/opt_out.
12