• Tech Travel Hub is your one stop, ultimate tour guide to all things tech, travel, visas and digital nomads
  • Home
  • Blog
    • Technology
      • General Tech
      • Blogging
      • Java
    • Lifestyle
      • General Lifestyle
    • Travel
    • Educational
    • Business
  • About
  • Contact
Menu
  • Home
  • Blog
    • Technology
      • General Tech
      • Blogging
      • Java
    • Lifestyle
      • General Lifestyle
    • Travel
    • Educational
    • Business
  • About
  • Contact
View Blog
May 9, 2023May 9, 2023

How to stop a Test Process If that Is Hanged or Went To Infinite loop

How to stop a Test Process If that Is Hanged or Went To Infinite loop

This is pretty common problem while going towards CDCI(Continuous Development and Continuous Integration) process that many testcases hang and freeze due to several issues . Improper scripting (waiting for an element for infinite time , infinite loop etc)are the real cause of those issues. It makes the machine busy and does not leave for next execution which are lined up for further execution. Ideally they should be handled by script itself. But when we try to implement CDCI over scripts which are there for years, we hardly get that covered via script.

Now if we look the way we trigger a UFT or selenium execution, we can see we start a AOM process that intern triggers the run. Well that is good but not full proof to avoid such exceptions.

Here is a small thought to improve the triggering mechanism..
Instead of directly triggering an AOM script or a batfile or an ant script what we can do, we start two thread instead. The first thread keeps checking if the execution is going beyond specified time,meanwhile the second thread (child one) starts the exeuction.
Once the second one,if over, it kills itself . And if, it can not end execution then it will be alive. The first thread gets activated and kills the second one and frees up the machine to accept other execution which are lined up..

public class kickStarter {
private static final long timeout=4*60*60*100;
//this is the timeout period , we can wait maximum of that hours to see if the
// execution is over
private static boolean flag=false;
public static void main(String[] args)
{
OtherThread oth=new OtherThread();
oth.start();
//starts the other thread which kicks off the execution
long timer=0;
do
try{
Thread.sleep(1);
timer++;
//below block checks if the executing thread which is executing run
// is over or not. If completed it should not be alive
if(!oth.isAlive())
{
flag=true;
break;
//we want to break it as the other thread executed successfully over the
//specified time
}
}
catch(Exception e)
{
}
while(timer=timeout)
{
oth.kill();
try {
Thread.sleep(1000);
} catch (InterruptedException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
flag=true;
}
if(flag)
{
//clear UFT or selenium
}
}

}

the child thread will look like:

public class OtherThread extends Thread implements Runnable {
private volatile boolean isRunning=true;
public void run()
{
while(isRunning)
{
try{
Thread.sleep(1);
//call your AOM or batchfile or ant file here
kill();
//kill should be called after control comes back from execution
}
catch(Exception e)
{

}
}
}
public void kill()
{
isRunning=false;
}


}

Post navigation

Previous post
Next post

Umer Umer

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts

  • Zoom Meeting Outfits: 4 Comfortable Yet Dressy Tops to Wear on Your Next Video Call
  • Zoom Clone: 6 Significant Benefits To Lure You In Launching
  • Your Shopify Store – Top 5 Essential Inventory Management Apps
  • All-inclusive You Need To Know About Skirting Beyond 2020
  • Yohuton Health and Fitness Smartwatch for Men Beyond 2020

Categories

  • Adventure
  • Agile Methodology
  • AI
  • All world Tour
  • Android Development
  • Ansible
  • App
  • App Development
  • Artificial Intelligence
  • AWS
  • Bitcoin
  • BlockChain
  • Blogging
  • Box Packing
  • Business
  • business
  • Business Communication
  • buying guide
  • C
  • car
  • Care
  • Certification
  • Certification
  • Chatbot
  • cinema
  • Cloud Tech
  • Companies
  • Content Marketing
  • Corporate
  • covid-19
  • crucible
  • Cryptocurrency
  • Database
  • DevOps
  • DevOps
  • Digital Marketing
  • Drawing
  • Dress
  • Earn Money Online
  • Educational
  • Employment
  • Entertainment
  • Exceptions In Java
  • Fashion
  • Festivals
  • Finance
  • Fitness
  • Food
  • Game
  • Gift ideas
  • Graphic Designers
  • Groovy
  • Health
  • Health
  • home
  • home improvement
  • HR
  • IllegalThreadStateException in Java
  • India Tour
  • Instagram
  • Ios
  • ISO
  • Java
  • Javascript
  • job
  • Kids Section
  • Kitchen
  • Law
  • Life Style
  • Lifestyle
  • Lifestyle Home Improvement
  • Magento
  • Main Stories
  • Management
  • Mattress
  • Motorable
  • Movie
  • nursing
  • Office Productivity
  • Pendrive
  • Perspective
  • Pet
  • Popular
  • Programming
  • Python
  • RDT
  • Relationships
  • Selenium
  • SEO
  • Skin
  • SOA
  • SOAPUI
  • Social Media
  • Social Media Marketing
  • Software
  • software development
  • Software Development Model
  • Software Engineering
  • Software Testing
  • Sports
  • Startup
  • T Robot
  • TDD
  • Tech
  • Tech News
  • Tech News
  • Technology
  • Tool
  • Tour Guide
  • Tour Guide
  • Travel
  • UFT
  • Uncategorized
  • USB Cable
  • VBscript
  • VPN
  • Web Development
  • WebHosting
  • WebServices
  • Wildlife
  • Wordpress
  • Yoga
  • Youtube

Tags

Instagram Instagram Marketing Marketing SEO Thoptv App

Categories

  • Tech
  • Travel
  • Visas
  • Digital Nomad
  • Tech
  • Travel
  • Visas
  • Digital Nomad

Publishing

If you would like to publish on our site, please email admin@techtravelhub.com

Quick Links

  • Home
  • Blog
    • Technology
      • General Tech
      • Blogging
      • Java
    • Lifestyle
      • General Lifestyle
    • Travel
    • Educational
    • Business
  • About
  • Contact
  • Home
  • Blog
    • Technology
      • General Tech
      • Blogging
      • Java
    • Lifestyle
      • General Lifestyle
    • Travel
    • Educational
    • Business
  • About
  • Contact

Contact

Tech Travel Hub LLC

Address:
8 The Green STE A
Dover
Delaware, 19901

Phone: +1 302 956 9948