TestNG: Killing processes associated with a timeout test

30 views
Skip to first unread message

Ramakrishna Prasad

unread,
Sep 25, 2017, 3:17:56 AM9/25/17
to testng-users
I want to kill all the processes associated with a test if its times out.  My Testng.xml file looks like this:

<suite name="OSProfiles_Adapters" thread-count="1">
          <parameter name="connectionFile" value="Connections/cloudera_cdh5u8"/>
          <parameter name="settingXmlPath" value="Resources/EnvironmentFiles/Env_OSProfiles_Adapters.xml"/>
          <parameter name="verifyXml" value="Resources/VerifyFiles/@{Version}/OSProfiles_Adapters_Verify.xml"/>
          <parameter name="onlyVerify" value="false"/>
          <parameter name="applicationPath" value="Applications/@{Version}/OSProfiles_Adapters.iar"/>
          <parameter name="database" value="OSProfiles_Adapters"/>
 
 <test name="m_FF_RS_Double_quotes_BlazeMode" time-out="5400000">
                    <parameter name="logFile" value="hadoopmslogs/${Domain_Name}/${NODENAME}/OSProfiles_Adapters/m_FF_RS_Double_quotes_BlazeMode.log"/>
                    <classes>
                              <class name="executems.main.RunMS"/>
                    </classes>
          </test>
  <test name="m_FF_RS_Double_quotes_BlazeMode2" time-out="5400000">
                    <parameter name="logFile" value="hadoopmslogs/${Domain_Name}/${NODENAME}/OSProfiles_Adapters/m_FF_RS_Double_quotes_BlazeMode2.log"/>
                    <classes>
                              <class name="executems.main.RunMS"/>
                    </classes>
          </test>
         
</suite>

Can someone suggest how can I achieve this? Each of my test invokes some java and shell processes. If the test timesout, I want TestNG to automatically kill these associated processes.
Currently what happens is it just timesout and moves ahead to the next Test. Thanks in advance.

Ramakrishna Prasad

unread,
Sep 25, 2017, 3:19:45 AM9/25/17
to testng-users

Krishnan Mahadevan

unread,
Sep 25, 2017, 12:31:42 PM9/25/17
to testng...@googlegroups.com

Can you please help add a bit more context around:

 

  • How do you start up your processes ?
  • How do you currently clean up your processes in the normal course of time ?
  • Can you please show us a code sample that would help us understand your use case ?

 

 

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 testng-users...@googlegroups.com.
To post to this group, send email to testng...@googlegroups.com.
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.

Todd Bradley

unread,
Sep 25, 2017, 12:55:20 PM9/25/17
to testng...@googlegroups.com
When the test hits the timeout, TestNG will interrupt the thread that the test is running in. But it doesn't know how to clean up what you are doing in that thread. I think you'll need to write your Java test case such that it correctly handles a thread interrupt. There's no way TestNG can do that for you, since it doesn't know what "java and shell processes" your test case has started.

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.
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 testng-users+unsubscribe@googlegroups.com.
Reply all
Reply to author
Forward
0 new messages