Re: [testng-users] Replacement for IExecutorFactory in TestNG 7.9.0+

66 views
Skip to first unread message

Krishnan Mahadevan

unread,
Jan 24, 2024, 10:55:09 PMJan 24
to testng...@googlegroups.com
Aleksandr,

Thank you so much for calling out this use case.
The rationale behind TestNG deprecating IExecutorFactory was that we wanted to move away from using any customised thread pool executor (I am referring to the built in ones) and instead move towards using whatever is already available within the JDK.

Now that we know that you have a specific use case, wherein you would like to wire in your own ThreadPoolExecutor, we can look at that.

Can you please help file an issue on the issue tracker with all the required details [ including how you are currently altering the thread pool size dynamically via the IExecutorFactory implementation ] so that we can keep all of those in mind when we introduce a standardised way of doing this in the next upcoming release ?

The reason behind me asking you to log this issue is to facilitate the following:

  • You get notified as and when any updates happen on that issue. That way it’s easier to be notified.
  • In-case there is a need to get any more additional context from you, its easier to do that.
  • We can keep all the discussion related to this ask in one place than wading through mailing lists.

Also, if you have any other interesting needs that you would like to see TestNG support, please do call them out in this Github discussion: https://github.com/testng-team/testng/discussions/3037 


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 24-Jan-2024, at 11:43 PM, 'Aleksandr Postnov' via testng-users <testng...@googlegroups.com> wrote:

Hi folks,

We are currently using IExecutorFactory, but it is deprecated in the latest version. I wonder what we could use instead for our case.

Context: We want to run E2E tests that use heavy resources like devices. A Test Suite Run can take 20-30 minutes in total. During the run, 1-2-3 devices can stop working. In this case, we need to adjust the number of currently running threads.

What we do is: We need to dynamically adjust TestNG's thread pool size during a test run so that the thread count is in line with the number of available emulators/simulators. Increasing and decreasing the number of threads is supported by Java's ThreadPoolExecutor (via methods setCorePoolSize() and setMaximumPoolSize()), so the only thing we actually need is references to ThreadPoolExecutors.

To get the reference, we introduced a class that implements IExecutorFactory and stores references to created Executors. This class is then passed to TestNG via the -threadPoolFactoryClass parameter.

This scheme is working fine, but some parts of it were deprecated, and it looks like they may be removed at some point.

So the question is: how do we achieve the above in the new versions of TestNG?

Thanks!


--
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/072247cd-240b-4159-986d-2886edc22953n%40googlegroups.com.

Reply all
Reply to author
Forward
0 new messages