Java tutorial
//package com.java2s; //License from project: Apache License public class Main { private static final String THREAD_NAME = "TestNG"; /** * @return true if the current thread was created by TestNG. */ public static boolean isTestNGThread() { return Thread.currentThread().getName().contains(THREAD_NAME); } }