ITest .getTestName() returns null if test is skipped

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

ITest .getTestName() returns null if test is skipped

agatheblues
Hello everyone,


I'm trying to generate a table report as follow:

| Test class name | Test method name | Custom test name | Test error message |

My test class implements ITest and has a getTestName method which returns a string that I define.

If one of the test is skipped (because of groups dependency for example), then the value returned by getTestName is null.

See the complete description of the issue here: https://stackoverflow.com/questions/49693956/itest-gettestname-returns-null-if-test-is-skipped-because-of-dependsongroups.


Anybody has an idea of how I can force getTestName to be evaluated even if the test is skipped ?

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: ITest .getTestName() returns null if test is skipped

Krishnan Mahadevan

I have answered your question on stackoverflow here: https://stackoverflow.com/a/49747320/679824

 

In a nutshell,

 

In TestNG 6.14.3, you will not see a null value but instead get the @Test annotated method’s name.

 

I have filed a bug on your behalf to ensure that for skipped methods if there’s an ITest implementation available, then it should be used at all times.

 

The bug is here: https://github.com/cbeust/testng/issues/1756

 

Thanks & Regards

Krishnan Mahadevan

 

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"

My Scribblings @ http://wakened-cognition.blogspot.com/

My Technical Scribbings @ http://rationaleemotions.wordpress.com/

From: <[hidden email]> on behalf of agatheblues <[hidden email]>
Reply-To: <[hidden email]>
Date: Monday, April 9, 2018 at 6:04 PM
To: testng-users <[hidden email]>
Subject: [testng-users] ITest .getTestName() returns null if test is skipped

 

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
[hidden email].
To post to this group, send email to
[hidden email].
Visit this group at
https://groups.google.com/group/testng-users.
For more options, visit
https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: ITest .getTestName() returns null if test is skipped

agatheblues
Thank you for your answer, and for filling the bug !

Agathe

On Tuesday, 10 April 2018 09:03:08 UTC+2, Krishnan Mahadevan wrote:

I have answered your question on stackoverflow here: <a href="https://stackoverflow.com/a/49747320/679824" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fstackoverflow.com%2Fa%2F49747320%2F679824\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEkzVjendmtX-gS9I3l0fHVhxaiuA&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fstackoverflow.com%2Fa%2F49747320%2F679824\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEkzVjendmtX-gS9I3l0fHVhxaiuA&#39;;return true;">https://stackoverflow.com/a/49747320/679824

 

In a nutshell,

 

In TestNG 6.14.3, you will not see a null value but instead get the @Test annotated method’s name.

 

I have filed a bug on your behalf to ensure that for skipped methods if there’s an ITest implementation available, then it should be used at all times.

 

The bug is here: <a href="https://github.com/cbeust/testng/issues/1756" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fcbeust%2Ftestng%2Fissues%2F1756\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGulYTsz3pDsYduT-e0dnP-afsRLg&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fgithub.com%2Fcbeust%2Ftestng%2Fissues%2F1756\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGulYTsz3pDsYduT-e0dnP-afsRLg&#39;;return true;">https://github.com/cbeust/testng/issues/1756

 

Thanks & Regards

Krishnan Mahadevan

 

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"

My Scribblings @ <a href="http://wakened-cognition.blogspot.com/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwakened-cognition.blogspot.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Fwakened-cognition.blogspot.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHzOdYJCASIDF_28vQtkp9gnKAYSQ&#39;;return true;">http://wakened-cognition.blogspot.com/

My Technical Scribbings @ <a href="http://rationaleemotions.wordpress.com/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Frationaleemotions.wordpress.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEcBOKyRn0lpL8LDbBuyAlKdwgXwQ&#39;;return true;" onclick="this.href=&#39;http://www.google.com/url?q\x3dhttp%3A%2F%2Frationaleemotions.wordpress.com%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEcBOKyRn0lpL8LDbBuyAlKdwgXwQ&#39;;return true;">http://rationaleemotions.wordpress.com/

From: <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="ViBd7AAFCQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">testng...@...> on behalf of agatheblues <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="ViBd7AAFCQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">lenclen...@...>
Reply-To: <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="ViBd7AAFCQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">testng...@...>
Date: Monday, April 9, 2018 at 6:04 PM
To: testng-users <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="ViBd7AAFCQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">testng...@...>
Subject: [testng-users] ITest .getTestName() returns null if test is skipped

 

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

--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.