Retry failed dataprovider

30 views
Skip to first unread message

zaw...@gmail.com

unread,
Nov 2, 2022, 5:16:24 AM11/2/22
to testng-users
Hey! 
I am looking for some generic way of retrying failed data providers.
I use data providers to generate some data in the cloud. Sometimes, some HTTP calls fail, and I would need to retry this data creation - I don't care too much about them falling from time to time - it's not the purpose of my tests to check the HTTP calls results. 
I've checked IDataProviderListener, but the onDataProviderFailure method will anyway cause an exception to be thrown in org/testng/internal/Parameters.java:803
It would be nice to have a data provider method implementing e.g. IConfigurable so that it is possible to check if there is a throwable thrown from an execution of a dataprovider, and then implement some retry logic invoking failed dataprovider, just like I did it for configuration methods:

```public class RetryConfigurationMethodsListener implements IConfigurable, IHookable {

@Override
public void run(IConfigureCallBack callBack, ITestResult testResult) {
callBack.runConfigurationMethod(testResult);
if (testResult.getThrowable() != null) {
String className = testResult.getMethod().getTestClass().getName();
String methodName = testResult.getMethod().getMethodName();
System.out.println(String.format("Configuration method '%s#%s' failed. Retrying...", className, methodName));
for (int i = 0; i < 3; i++) {
sleep5s();
callBack.runConfigurationMethod(testResult);
if (testResult.getThrowable() == null) {
break;
} else {
System.out.println(String.format("Retry %d/%d of '%s#%s' method failed.", i + 1, 3, className, methodName));
}
}
}
}

}```

⇜Krishnan Mahadevan⇝

unread,
Nov 3, 2022, 12:51:14 AM11/3/22
to testng...@googlegroups.com
I have created a github issue on your behalf https://github.com/cbeust/testng/issues/2819
Please follow up on this there.

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.
To view this discussion on the web visit https://groups.google.com/d/msgid/testng-users/a1d46710-8778-4b58-b82a-f1cb2a60a660n%40googlegroups.com.

Velpula Ramu

unread,
Nov 5, 2022, 2:34:26 AM11/5/22
to testng...@googlegroups.com
Can we merge two projects' extent reports, in a single report  is it possible?

⇜Krishnan Mahadevan⇝

unread,
Nov 5, 2022, 2:36:45 AM11/5/22
to testng...@googlegroups.com
Please do not cross post and hijack threads. Instead I request you to please post your query as a new message on the forum by including all relevant details. That way its easier for anyone in the future to search through the user mailing list and get information.

With respect to extent reports, TestNG does not own/maintain it. I would suggest that you please post it on an extent reports specific forum.

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/

Reply all
Reply to author
Forward
0 new messages