Test Methods with @alwaysRun = true must be included in testng-failed.xml even though the method has passed

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

Test Methods with @alwaysRun = true must be included in testng-failed.xml even though the method has passed

Sivagami Sreenivasan
I have two classes


class A
{
             @BeforeClass
              public void abc()
              {
                           .............
              }

             @Test(alwaysRun = true)
            public void def()
            {
                           ------------------------
             }
}

and some other class with 
class B
{
             @Test
             public void xyz()
             {
                             SoftAssert sa = new SoftAssert();
                             sa.fail();
                             sa.assertAll();
        }
}



testng xml contains 

<test name="a">
<classes>
<class name="A"/>
</classes>
</test>
<test name="b">
<classes>
<class name="b" >
</class>
</classes>
</test>


then the failed testng-failed xml contains

<test name="afailed)">
<classes>
      <class name="A">
        <methods>
          <include name="abc"/>
        </methods>
      </class>
</classes>
</test>
<test name="B(failed)">
<classes>
      <class name="B">
        <methods>
          <include name="xyz"/>
        </methods>
      </class>
</classes>
</test>


But the testng-failed xml should also contain def() function as it is surrounded with alwaysRun = true
like as follows 


<test name="afailed)">
<classes>
      <class name="A">
        <methods>
          <include name="abc"/>
         <include name="def"/>
        </methods>
      </class>
</classes>
</test>
<test name="B(failed)">
<classes>
      <class name="B">
        <methods>
          <include name="xyz"/>
        </methods>
      </class>
</classes>
</test>

--
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: Test Methods with @alwaysRun = true must be included in testng-failed.xml even though the method has passed

Krishnan Mahadevan
In your case, did the method def() [ which has alwaysRun=true ] fail ?
Also can you please help let us know what version of TestNG are you using ? Please ensure you are using TestNG 6.13.1 [ this is the latest released version as of today ]

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/

On Thu, Dec 21, 2017 at 4:07 PM, Sivagami Sreenivasan <[hidden email]> wrote:
I have two classes


class A
{
             @BeforeClass
              public void abc()
              {
                           .............
              }

             @Test(alwaysRun = true)
            public void def()
            {
                           ------------------------
             }
}

and some other class with 
class B
{
             @Test
             public void xyz()
             {
                             SoftAssert sa = new SoftAssert();
                             sa.fail();
                             sa.assertAll();
        }
}



testng xml contains 

<test name="a">
<classes>
<class name="A"/>
</classes>
</test>
<test name="b">
<classes>
<class name="b" >
</class>
</classes>
</test>


then the failed testng-failed xml contains

<test name="afailed)">
<classes>
      <class name="A">
        <methods>
          <include name="abc"/>
        </methods>
      </class>
</classes>
</test>
<test name="B(failed)">
<classes>
      <class name="B">
        <methods>
          <include name="xyz"/>
        </methods>
      </class>
</classes>
</test>


But the testng-failed xml should also contain def() function as it is surrounded with alwaysRun = true
like as follows 


<test name="afailed)">
<classes>
      <class name="A">
        <methods>
          <include name="abc"/>
         <include name="def"/>
        </methods>
      </class>
</classes>
</test>
<test name="B(failed)">
<classes>
      <class name="B">
        <methods>
          <include name="xyz"/>
        </methods>
      </class>
</classes>
</test>

--
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: Test Methods with @alwaysRun = true must be included in testng-failed.xml even though the method has passed

Sivagami Sreenivasan

In your case, did the method def() [ which has alwaysRun=true ] fail ?

No . But according to my application, it must run at all times . 

TestNG version I am using is 6.10


On Thursday, December 21, 2017 at 6:13:38 PM UTC+5:30, Krishnan Mahadevan wrote:
In your case, did the method def() [ which has alwaysRun=true ] fail ?
Also can you please help let us know what version of TestNG are you using ? Please ensure you are using TestNG 6.13.1 [ this is the latest released version as of today ]

Thanks & Regards
Krishnan Mahadevan

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

On Thu, Dec 21, 2017 at 4:07 PM, Sivagami Sreenivasan <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="DTW1QySnCwAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">siva069...@...> wrote:
I have two classes


class A
{
             @BeforeClass
              public void abc()
              {
                           .............
              }

             @Test(alwaysRun = true)
            public void def()
            {
                           ------------------------
             }
}

and some other class with 
class B
{
             @Test
             public void xyz()
             {
                             SoftAssert sa = new SoftAssert();
                             sa.fail();
                             sa.assertAll();
        }
}



testng xml contains 

<test name="a">
<classes>
<class name="A"/>
</classes>
</test>
<test name="b">
<classes>
<class name="b" >
</class>
</classes>
</test>


then the failed testng-failed xml contains

<test name="afailed)">
<classes>
      <class name="A">
        <methods>
          <include name="abc"/>
        </methods>
      </class>
</classes>
</test>
<test name="B(failed)">
<classes>
      <class name="B">
        <methods>
          <include name="xyz"/>
        </methods>
      </class>
</classes>
</test>


But the testng-failed xml should also contain def() function as it is surrounded with alwaysRun = true
like as follows 


<test name="afailed)">
<classes>
      <class name="A">
        <methods>
          <include name="abc"/>
         <include name="def"/>
        </methods>
      </class>
</classes>
</test>
<test name="B(failed)">
<classes>
      <class name="B">
        <methods>
          <include name="xyz"/>
        </methods>
      </class>
</classes>
</test>

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

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

Re: Test Methods with @alwaysRun = true must be included in testng-failed.xml even though the method has passed

Krishnan Mahadevan
I dont think the testng-failed.xml would include it as per your expectation. 

If it needs to be included, then your methods that failed should have dependency on def() [ via dependsOnMethods or dependsOnGroups attribute of the @Test annotation ]

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/

On Thu, Dec 21, 2017 at 6:17 PM, Sivagami Sreenivasan <[hidden email]> wrote:

In your case, did the method def() [ which has alwaysRun=true ] fail ?

No . But according to my application, it must run at all times . 

TestNG version I am using is 6.10


On Thursday, December 21, 2017 at 6:13:38 PM UTC+5:30, Krishnan Mahadevan wrote:
In your case, did the method def() [ which has alwaysRun=true ] fail ?
Also can you please help let us know what version of TestNG are you using ? Please ensure you are using TestNG 6.13.1 [ this is the latest released version as of today ]

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/

On Thu, Dec 21, 2017 at 4:07 PM, Sivagami Sreenivasan <[hidden email]> wrote:
I have two classes


class A
{
             @BeforeClass
              public void abc()
              {
                           .............
              }

             @Test(alwaysRun = true)
            public void def()
            {
                           ------------------------
             }
}

and some other class with 
class B
{
             @Test
             public void xyz()
             {
                             SoftAssert sa = new SoftAssert();
                             sa.fail();
                             sa.assertAll();
        }
}



testng xml contains 

<test name="a">
<classes>
<class name="A"/>
</classes>
</test>
<test name="b">
<classes>
<class name="b" >
</class>
</classes>
</test>


then the failed testng-failed xml contains

<test name="afailed)">
<classes>
      <class name="A">
        <methods>
          <include name="abc"/>
        </methods>
      </class>
</classes>
</test>
<test name="B(failed)">
<classes>
      <class name="B">
        <methods>
          <include name="xyz"/>
        </methods>
      </class>
</classes>
</test>


But the testng-failed xml should also contain def() function as it is surrounded with alwaysRun = true
like as follows 


<test name="afailed)">
<classes>
      <class name="A">
        <methods>
          <include name="abc"/>
         <include name="def"/>
        </methods>
      </class>
</classes>
</test>
<test name="B(failed)">
<classes>
      <class name="B">
        <methods>
          <include name="xyz"/>
        </methods>
      </class>
</classes>
</test>

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

--
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: Test Methods with @alwaysRun = true must be included in testng-failed.xml even though the method has passed

Sivagami Sreenivasan
Thank you for the response. 

The name always run implies that it must run even though something has failed, Isnt it.

So What is your suggestion for me in this . I need this part of the script to run even the script(def) doesnt fail  

cant use dependsOnMethods or dependsOnGroups as it is one of the primary condition. 

Cant put it in Before Class or Before Suits as This needs to be a test case 

Thanks 
Sivagami 
 


On Thursday, December 21, 2017 at 6:22:51 PM UTC+5:30, Krishnan Mahadevan wrote:
I dont think the testng-failed.xml would include it as per your expectation. 

If it needs to be included, then your methods that failed should have dependency on def() [ via dependsOnMethods or dependsOnGroups attribute of the @Test annotation ]

Thanks & Regards
Krishnan Mahadevan

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

On Thu, Dec 21, 2017 at 6:17 PM, Sivagami Sreenivasan <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="V8G_9KSnCwAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">siva069...@...> wrote:

In your case, did the method def() [ which has alwaysRun=true ] fail ?

No . But according to my application, it must run at all times . 

TestNG version I am using is 6.10


On Thursday, December 21, 2017 at 6:13:38 PM UTC+5:30, Krishnan Mahadevan wrote:
In your case, did the method def() [ which has alwaysRun=true ] fail ?
Also can you please help let us know what version of TestNG are you using ? Please ensure you are using TestNG 6.13.1 [ this is the latest released version as of today ]

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

On Thu, Dec 21, 2017 at 4:07 PM, Sivagami Sreenivasan <[hidden email]> wrote:
I have two classes


class A
{
             @BeforeClass
              public void abc()
              {
                           .............
              }

             @Test(alwaysRun = true)
            public void def()
            {
                           ------------------------
             }
}

and some other class with 
class B
{
             @Test
             public void xyz()
             {
                             SoftAssert sa = new SoftAssert();
                             sa.fail();
                             sa.assertAll();
        }
}



testng xml contains 

<test name="a">
<classes>
<class name="A"/>
</classes>
</test>
<test name="b">
<classes>
<class name="b" >
</class>
</classes>
</test>


then the failed testng-failed xml contains

<test name="afailed)">
<classes>
      <class name="A">
        <methods>
          <include name="abc"/>
        </methods>
      </class>
</classes>
</test>
<test name="B(failed)">
<classes>
      <class name="B">
        <methods>
          <include name="xyz"/>
        </methods>
      </class>
</classes>
</test>


But the testng-failed xml should also contain def() function as it is surrounded with alwaysRun = true
like as follows 


<test name="afailed)">
<classes>
      <class name="A">
        <methods>
          <include name="abc"/>
         <include name="def"/>
        </methods>
      </class>
</classes>
</test>
<test name="B(failed)">
<classes>
      <class name="B">
        <methods>
          <include name="xyz"/>
        </methods>
      </class>
</classes>
</test>

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

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

Re: Test Methods with @alwaysRun = true must be included in testng-failed.xml even though the method has passed

Krishnan Mahadevan
>>>> The name always run implies that it must run even though something has failed, Isnt it.

Not necessarily true. The attribute merely indicates that this method should always be run irrespective of how you are filtering @Test methods to be executed [ is applicable when you resort to running @Tests by group names ]

​>>>> So What is your suggestion for me in this . I need this part of the script to run even the script(def) doesnt fail  

​So you have a couple of options.

1. Move it out of an @Test method (because it looks like it really is not a test method but some sort of a conditional setup that needs to be done only for certain methods) and into a TestNG listener [ for e.g., an IInvokedMethodListener ] and within the listener have this get executed based on some custom annotation. So all methods that needs this special code snippet to be run, would add a custom annotation [ See here for an example https://www.mkyong.com/java/java-custom-annotations-example/ ]
and within this listener's beforeInvocation() you would look for the custom annotation and if found, you would run it.

The other option would basically be to have this part of a base class which implements IHookable interface. All your test methods would extend this base class and within the run() implementation of the base class [ run() method via IHookable interface ] you would add the same custom annotation logic that I mentioned above.​


Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/

On Thu, Dec 21, 2017 at 6:31 PM, Sivagami Sreenivasan <[hidden email]> wrote:
Thank you for the response. 

The name always run implies that it must run even though something has failed, Isnt it.

So What is your suggestion for me in this . I need this part of the script to run even the script(def) doesnt fail  

cant use dependsOnMethods or dependsOnGroups as it is one of the primary condition. 

Cant put it in Before Class or Before Suits as This needs to be a test case 

Thanks 
Sivagami 
 


On Thursday, December 21, 2017 at 6:22:51 PM UTC+5:30, Krishnan Mahadevan wrote:
I dont think the testng-failed.xml would include it as per your expectation. 

If it needs to be included, then your methods that failed should have dependency on def() [ via dependsOnMethods or dependsOnGroups attribute of the @Test annotation ]

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/

On Thu, Dec 21, 2017 at 6:17 PM, Sivagami Sreenivasan <[hidden email]> wrote:

In your case, did the method def() [ which has alwaysRun=true ] fail ?

No . But according to my application, it must run at all times . 

TestNG version I am using is 6.10


On Thursday, December 21, 2017 at 6:13:38 PM UTC+5:30, Krishnan Mahadevan wrote:
In your case, did the method def() [ which has alwaysRun=true ] fail ?
Also can you please help let us know what version of TestNG are you using ? Please ensure you are using TestNG 6.13.1 [ this is the latest released version as of today ]

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"
My Scribblings @ http://wakened-cognition.blogspot.com/
My Technical Scribbings @ http://rationaleemotions.wordpress.com/

On Thu, Dec 21, 2017 at 4:07 PM, Sivagami Sreenivasan <[hidden email]> wrote:
I have two classes


class A
{
             @BeforeClass
              public void abc()
              {
                           .............
              }

             @Test(alwaysRun = true)
            public void def()
            {
                           ------------------------
             }
}

and some other class with 
class B
{
             @Test
             public void xyz()
             {
                             SoftAssert sa = new SoftAssert();
                             sa.fail();
                             sa.assertAll();
        }
}



testng xml contains 

<test name="a">
<classes>
<class name="A"/>
</classes>
</test>
<test name="b">
<classes>
<class name="b" >
</class>
</classes>
</test>


then the failed testng-failed xml contains

<test name="afailed)">
<classes>
      <class name="A">
        <methods>
          <include name="abc"/>
        </methods>
      </class>
</classes>
</test>
<test name="B(failed)">
<classes>
      <class name="B">
        <methods>
          <include name="xyz"/>
        </methods>
      </class>
</classes>
</test>


But the testng-failed xml should also contain def() function as it is surrounded with alwaysRun = true
like as follows 


<test name="afailed)">
<classes>
      <class name="A">
        <methods>
          <include name="abc"/>
         <include name="def"/>
        </methods>
      </class>
</classes>
</test>
<test name="B(failed)">
<classes>
      <class name="B">
        <methods>
          <include name="xyz"/>
        </methods>
      </class>
</classes>
</test>

--
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]om.
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 testng-users...@googlegroups.com.
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.

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