1 package vid.automation.test;
3 import org.testng.TestNG;
4 import org.apache.log4j.Logger;
5 import org.apache.log4j.PropertyConfigurator;
7 import java.io.IOException;
8 import java.util.ArrayList;
10 import java.util.concurrent.atomic.AtomicBoolean;
13 * Created by itzikliderman on 21/06/2017.
15 public class StartTest {
16 public static boolean debug = false;
18 public static AtomicBoolean loggerInitialized = new AtomicBoolean(false);
20 protected static Logger logger = null;
22 public static void main (String[] args) throws IOException {
23 String debugEnabled = System.getProperty("debug");
24 if (debugEnabled != null && debugEnabled.equalsIgnoreCase("true")) {
27 System.out.println("Debug mode is " + (debug ? "enabled" : "disabled"));
31 TestNG testng = new TestNG();
33 List<String> suites = new ArrayList<String>();
35 testng.setTestSuites(suites);
36 testng.setUseDefaultListeners(true);
37 testng.setOutputDirectory("target/");
43 logger = Logger.getLogger(StartTest.class.getName());
46 public static void enableLogger() {
48 if (false == loggerInitialized.get()) {
50 loggerInitialized.set(true);
52 String log4jPropsFile = System.getProperty("log4j.configuration");
53 // if (System.getProperty("os.name").contains("Windows")) {
54 String logProps = "src/main/resources/ci/conf/log4j.properties";
55 if (log4jPropsFile == null) {
56 System.setProperty("targetlog", "target/");
57 log4jPropsFile = logProps;
61 PropertyConfigurator.configureAndWatch(log4jPropsFile);