RetryAnalyzer not working

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

RetryAnalyzer not working

Tony Chamberlain
I could not get this to work for me.  I did what several different sites suggested, but the analyzer was never called, nor tests repeated even though I caused deliberate failure:

public class RetryAnalyzer implements IRetryAnalyzer {

int counter = 0;

@Override
public boolean retry(ITestResult result) {
boolean res = false;
if (!result.isSuccess() && counter < 3) {
counter++;
res = true;
}
return res;
}
}

and

@Test(dataProvider = "dp",  retryAnalyzer = RetryAnalyzer.class)
public void testA(TestContext tContext) throws IOException {
genericTest("A", "83701");
}

The test usually passes.  I deliberately caused it to fail but it did not do a retry.  Am I missing something?  It did not even halt when I put a breakpoint at the first line of the analyzer (running with Eclipse).

===============================================
Default suite
Total tests run: 1, Failures: 1, Skips: 0
===============================================

--
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: RetryAnalyzer not working

Krishnan Mahadevan
Have you tried removing 

!result.isSuccess()

From your condition in the RetryAnalyzer ?



On Thu, Mar 22, 2018, 18:35 Tony Chamberlain <[hidden email]> wrote:
I could not get this to work for me.  I did what several different sites suggested, but the analyzer was never called, nor tests repeated even though I caused deliberate failure:

public class RetryAnalyzer implements IRetryAnalyzer {

int counter = 0;

@Override
public boolean retry(ITestResult result) {
boolean res = false;
if (!result.isSuccess() && counter < 3) {
counter++;
res = true;
}
return res;
}
}

and

@Test(dataProvider = "dp",  retryAnalyzer = RetryAnalyzer.class)
public void testA(TestContext tContext) throws IOException {
genericTest("A", "83701");
}

The test usually passes.  I deliberately caused it to fail but it did not do a retry.  Am I missing something?  It did not even halt when I put a breakpoint at the first line of the analyzer (running with Eclipse).

===============================================
Default suite
Total tests run: 1, Failures: 1, Skips: 0
===============================================

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

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/

--
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: RetryAnalyzer not working

Tony Chamberlain
In reply to this post by Tony Chamberlain
Yes, but it never gets that far.  When I move it to its own class then it works but it keeps retrying even though false is returned.  I think a page it inherits from does something I need to investigate.

On Thursday, March 22, 2018 at 8:05:32 AM UTC-5, Tony Chamberlain wrote:
I could not get this to work for me.  I did what several different sites suggested, but the analyzer was never called, nor tests repeated even though I caused deliberate failure:

public class RetryAnalyzer implements IRetryAnalyzer {

int counter = 0;

@Override
public boolean retry(ITestResult result) {
boolean res = false;
if (!result.isSuccess() && counter < 3) {
counter++;
res = true;
}
return res;
}
}

and

@Test(dataProvider = "dp",  retryAnalyzer = RetryAnalyzer.class)
public void testA(TestContext tContext) throws IOException {
genericTest("A", "83701");
}

The test usually passes.  I deliberately caused it to fail but it did not do a retry.  Am I missing something?  It did not even halt when I put a breakpoint at the first line of the analyzer (running with Eclipse).

===============================================
Default suite
Total tests run: 1, Failures: 1, Skips: 0
===============================================

--
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: RetryAnalyzer not working

Krishnan Mahadevan

Tony,

Can you please help share a standalone test which uses the retry analyzer and which can be used to reproduce the issue ?

 

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/

Reply-To: <[hidden email]>
Date: Thursday, March 22, 2018 at 8:16 PM
To: testng-users <[hidden email]>
Subject: [testng-users] Re: RetryAnalyzer not working

 

Yes, but it never gets that far.  When I move it to its own class then it works but it keeps retrying even though false is returned.  I think a page it inherits from does something I need to investigate.

On Thursday, March 22, 2018 at 8:05:32 AM UTC-5, Tony Chamberlain wrote:

I could not get this to work for me.  I did what several different sites suggested, but the analyzer was never called, nor tests repeated even though I caused deliberate failure:

 

           public class RetryAnalyzer implements IRetryAnalyzer {

 

                           int counter = 0;

 

                           @Override

                           public boolean retry(ITestResult result) {

                                           boolean res = false;

                                           if (!result.isSuccess() && counter < 3) {

                                                           counter++;

                                                           res = true;

                                           }

                                           return res;

                           }

           }

 

and

 

           @Test(dataProvider = "dp",  retryAnalyzer = RetryAnalyzer.class)

           public void testA(TestContext tContext) throws IOException {

                           genericTest("A", "83701");

           }

 

The test usually passes.  I deliberately caused it to fail but it did not do a retry.  Am I missing something?  It did not even halt when I put a breakpoint at the first line of the analyzer (running with Eclipse).

 

===============================================

Default suite

Total tests run: 1, Failures: 1, Skips: 0

===============================================

 

--
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: RetryAnalyzer not working

Tony Chamberlain
In reply to this post by Tony Chamberlain
I have to come up with one.  So let me do that.  However, now they don't think I should retry again and they think even if the proxy server fails I should mark it as a failure.

On Thursday, March 22, 2018 at 8:05:32 AM UTC-5, Tony Chamberlain wrote:
I could not get this to work for me.  I did what several different sites suggested, but the analyzer was never called, nor tests repeated even though I caused deliberate failure:

public class RetryAnalyzer implements IRetryAnalyzer {

int counter = 0;

@Override
public boolean retry(ITestResult result) {
boolean res = false;
if (!result.isSuccess() && counter < 3) {
counter++;
res = true;
}
return res;
}
}

and

@Test(dataProvider = "dp",  retryAnalyzer = RetryAnalyzer.class)
public void testA(TestContext tContext) throws IOException {
genericTest("A", "83701");
}

The test usually passes.  I deliberately caused it to fail but it did not do a retry.  Am I missing something?  It did not even halt when I put a breakpoint at the first line of the analyzer (running with Eclipse).

===============================================
Default suite
Total tests run: 1, Failures: 1, Skips: 0
===============================================

--
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: RetryAnalyzer not working

Tony Chamberlain
In reply to this post by Tony Chamberlain
this continued to retry

@Test(dataProvider = "dp", retryAnalyzer = SmokeRetryAnalyzer.class, groups = "glub")
public void testStandalone(TestContext tContext) throws IOException {
assert false : ("cause false");
}

/**
* Generates a test.
* @return
*/
@DataProvider
public Object[][] dp() {
return TestUtils.getTestData();
}

On Thursday, March 22, 2018 at 8:05:32 AM UTC-5, Tony Chamberlain wrote:
I could not get this to work for me.  I did what several different sites suggested, but the analyzer was never called, nor tests repeated even though I caused deliberate failure:

public class RetryAnalyzer implements IRetryAnalyzer {

int counter = 0;

@Override
public boolean retry(ITestResult result) {
boolean res = false;
if (!result.isSuccess() && counter < 3) {
counter++;
res = true;
}
return res;
}
}

and

@Test(dataProvider = "dp",  retryAnalyzer = RetryAnalyzer.class)
public void testA(TestContext tContext) throws IOException {
genericTest("A", "83701");
}

The test usually passes.  I deliberately caused it to fail but it did not do a retry.  Am I missing something?  It did not even halt when I put a breakpoint at the first line of the analyzer (running with Eclipse).

===============================================
Default suite
Total tests run: 1, Failures: 1, Skips: 0
===============================================

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