New TestNG Eclipse feature: "stop button"

109 views
Skip to first unread message

Cédric Beust ♔

unread,
Jan 6, 2011, 12:48:01 PM1/6/11
to testng...@googlegroups.com
Hi everyone,

The latest Eclipse plug-in has a new feature that some of you requested: a way to stop a test run in progress.

stop-button.png

Right now, this button will kill the test process right away. The downside of this approach is that you won't have any result file, so I'm wondering if a more gentle behavior wouldn't be more appropriate, such as marking all the tests from the moment where that button is pressed as "skipped". The problem with this approach is that the test run won't stop right away and also that the test results, while present, might not be terribly useful if most of these tests are marked as skipped.

Try it and let me know what you think.

--
Cédric


stop-button.png

Felipe Knorr Kuhn

unread,
Jan 6, 2011, 12:57:47 PM1/6/11
to testng...@googlegroups.com
Hi Cédric,

When I want to kill the TestNG process, I usually hit the Stop button on the Console tab.

If people want to wait until the current test is running, wouldn't it be better to have a pause button instead?

I think marking the tests are "skipped" have a different effect in this case, you are intentionally not running them instead of having them skipped for some "automated" reason, so "Not Run" sounds more reasonable than "Skipped".

FK

2011/1/6 Cédric Beust ♔ <ced...@beust.com>
--
You received this message because you are subscribed to the Google Groups "testng-users" group.
To post to this group, send email to testng...@googlegroups.com.
To unsubscribe from this group, send email to testng-users...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/testng-users?hl=en.

stop-button.png

Uma Senthil

unread,
Nov 10, 2016, 5:29:28 PM11/10/16
to testng-users
Hello All,
            I have question somewhat related to this question.

If I use stop button to kill the TestNG process in eclipse (shown in the other emails attachment), the test suite gets killed immediately without calling Teardown method(the selenium browser which I opened for this test suite in Setup method is still open.).

I tried using the TestNG annotations like @AfterMethod, @AfterTest, @AfterSuite for the Teardown method. None of these annotations help to reach the Teardown code.

I read in TestNG website that if I use listeners, then I can make testNG process to hit the Teardown method when OnTestSuccess, OnTestFailure, OnTestSkipped...

But I don't think the listeners will help, as the testNG results shows all the test cases that are run so far as passed and NO test is shown as skipped.

I don't think try and catch will help as no exceptions are thrown when I hit the eclipse STOP button.

Please advice.

Thank you,
Uma

⇜Krishnan Mahadevan⇝

unread,
Nov 11, 2016, 1:03:16 AM11/11/16
to testng...@googlegroups.com
Uma,
Here's my take on this.

In general, if you would like to have any last minute cleanup activities to be done, right before the JVM exits (be it gracefully or via a crash), you could perhaps try adding that functionality via a ShutdownHook

So even though the plugin might perhaps posses this feature (I haven't tried eclipse for a long time, so I am a bit rusty on that front), how would you be able to deal with this sort of an abort from the command line or via the RED stop button on a Jenkins job ? 

I dont remember seeing the TestNG API (the core functionality that the eclipse TestNG plugin also falls back to using) which specifically deals with this sort of clean-ups.

That perhaps is why you didn't see any of the things that you tried, help you out [ Using configuration annotations (or) using listeners (or) attempting to use try..catch ]

If you really would like to have a clean up invoked at all the times (especially when the JVM exits), then you might want to judiciously wire-in such clean up activities through a ShutdownHook.

PS : I have read some articles which also say that a ShutdownHook is actually not a very way of handling cleanup and should be really used sparsely. Read more here.

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/

To unsubscribe from this group and stop receiving emails from it, send an email to testng-users+unsubscribe@googlegroups.com.

To post to this group, send email to testng...@googlegroups.com.

XuQing Tan

unread,
Nov 19, 2016, 9:49:53 AM11/19/16
to testng-users
from the eclipse plugin side, I think we might be able to implement a two-phases stop button, which means first click just send a gentle shut down signal, so that the application still have time to do some final cleanup. if people don't want to wait the 2nd click will force kill the process.
what do you think?
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