TestNG: Killing processes associated with a timeout test

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

TestNG: Killing processes associated with a timeout test

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

--
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: TestNG: Killing processes associated with a timed-out test

Ramakrishna Prasad


On Monday, September 25, 2017 at 12:47:56 PM UTC+5:30, Ramakrishna Prasad wrote:
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.

--
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: TestNG: Killing processes associated with a timeout test

Krishnan Mahadevan
In reply to this post by Ramakrishna Prasad

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/

 

From: <[hidden email]> on behalf of Ramakrishna Prasad <[hidden email]>
Reply-To: <[hidden email]>
Date: Monday, September 25, 2017 at 12:48 PM
To: testng-users <[hidden email]>
Subject: [testng-users] TestNG: Killing processes associated with a timeout test

 

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.

--
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 [hidden email].
To post to this group, send email to [hidden email].
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 [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/testng-users.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: TestNG: Killing processes associated with a timeout test

Todd Bradley-2
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.

On Mon, Sep 25, 2017 at 10:31 AM, Krishnan Mahadevan <[hidden email]> wrote:

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/

 

From: <[hidden email]> on behalf of Ramakrishna Prasad <[hidden email]>
Reply-To: <[hidden email]>
Date: Monday, September 25, 2017 at 12:48 PM
To: testng-users <[hidden email]>
Subject: [testng-users] TestNG: Killing processes associated with a timeout test

 

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.

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