Retry BeforeTest operation using RetryAnalyzer.

104 views
Skip to first unread message

Aliasger Kiranawala

unread,
Jul 8, 2020, 7:57:24 AM7/8/20
to testng-users
Hello Team,

If there is any failure in Before (Test, Class, Suite) how to make them considered for Retry using Retry Analyzer?

⇜Krishnan Mahadevan⇝

unread,
Jul 8, 2020, 12:55:40 PM7/8/20
to testng...@googlegroups.com
To the best of my knowledge, configuration methods cannot be retried.

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 Scribblings @ https://rationaleemotions.com/


On Wed, Jul 8, 2020 at 5:27 PM Aliasger Kiranawala <alia...@locus.sh> wrote:
Hello Team,

If there is any failure in Before (Test, Class, Suite) how to make them considered for Retry using Retry Analyzer?

--
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 view this discussion on the web visit https://groups.google.com/d/msgid/testng-users/bd222ef4-131d-4ae4-a4c9-890284495fc2n%40googlegroups.com.

Aliasger Kiranawala

unread,
Jul 8, 2020, 1:33:50 PM7/8/20
to testng-users
Thanks Krishnan

⇜Krishnan Mahadevan⇝

unread,
Jul 10, 2020, 1:23:35 AM7/10/20
to testng...@googlegroups.com
I remember now...

I recently fixed a bug within IConfigurable interface so that configuration methods can be retried via an IConfigurable implementation.
The fix should be released as part of 7.2.0

After it gets released, you should be able to retry configuration methods that failed using an approach as shown in this unit test



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 Scribblings @ https://rationaleemotions.com/

Aliasger Kiranawala

unread,
Jul 10, 2020, 1:28:36 AM7/10/20
to testng-users
Thanks Krishnan, I will try your approach.

Aliasger Kiranawala

unread,
Jul 10, 2020, 6:10:35 AM7/10/20
to testng-users
Krishnan,

One more query, can we have some other conventions for those tests failed in first attempt and passed in second so that they dont appear under skipped column? This is causing a conflict when actual tests are getting skipped due to genuine reasons. 



Aliasger Kiranawala

unread,
Aug 3, 2020, 5:51:14 AM8/3/20
to testng-users
Hey Krishnan,

Saw your thread about release of 7.3.0 version. 
For this situation to take care do I still need to override IConfigurable method or TestNG will take care of it?

⇜Krishnan Mahadevan⇝

unread,
Aug 3, 2020, 10:21:12 AM8/3/20
to testng-users
You would need to build the retry logic within your IConfigurable implementation for the configuration to be retried. 


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 Scribblings @ https://rationaleemotions.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.

Aliasger Kiranawala

unread,
Oct 14, 2020, 5:59:00 AM10/14/20
to testng-users
Hey Krishnan,

I tried your suggestion and improvised a little bit. Created a RetryBaseTest which implements IConfigurable interface and overrides run method.
Test class extends this RetryBaseTest so that I dont have to override run method.
I am version 7.3 but seeing that @BeforeClass annotations not going for a retry in case of 5xx failures. Can you suggest something? I have not seen a retry happened due to some other issue either in recent days but it worked fine when I initially implemented it.

Thanks,
Aliasger

Krishnan Mahadevan

unread,
Oct 14, 2020, 12:37:18 PM10/14/20
to testng...@googlegroups.com

Can you share a sample project that can be used to reproduce the problem ?

 

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

Aliasger Kiranawala

unread,
Oct 15, 2020, 10:52:55 AM10/15/20
to testng-users
I afraid I cannot because the project is linked internally with multiple common items. 

As I explained you can try calling api throwing 5xx error in @BeforeTest and and using IConfigurable try retry. I am also not 100% sure because its working sometime.

⇜Krishnan Mahadevan⇝

unread,
Oct 18, 2020, 3:23:21 PM10/18/20
to testng-users
Without a sample, there's not much that I can do as well. I will side-step and let someone else help you out with your query.

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 Scribblings @ https://rationaleemotions.com/

Aliasger Kiranawala

unread,
Oct 19, 2020, 1:08:05 AM10/19/20
to testng...@googlegroups.com
Sorry Krishnan, I will see if I can prepare sample for it, Meanwhile If anyone faced this issue when config setup observe 5xx retry didn't happen then please suggest here.



--
Aliasger Kiranawala
Sr. SDET (Engineering Team)
+91-9980600523


Aliasger Kiranawala

unread,
Mar 9, 2021, 11:43:03 AM3/9/21
to testng-users
Hello Krishnan,

Using RetryAnalyzer to retry a test and if I have @BeforeTest and @AfterTest in a test class, if first attempt fails will @AfterTest will not execute?

⇜Krishnan Mahadevan⇝

unread,
Mar 11, 2021, 5:59:26 AM3/11/21
to testng-users
Can you please share a sample that shows what you are trying to do? That would add a bit more context in terms of your expectations.

In a nutshell: RetryAnalyser is meant to retry a test method alone. To the best of my knowledge its scope ends with this expectation.

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 Scribblings @ https://rationaleemotions.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.
Reply all
Reply to author
Forward
0 new messages