diff --git a/injitest/pom.xml b/injitest/pom.xml index 1ed5153c6..8f3eeafbf 100644 --- a/injitest/pom.xml +++ b/injitest/pom.xml @@ -141,12 +141,6 @@ java-client 9.0.0 - - - com.google.guava - guava - 32.1.3-jre - org.testng diff --git a/injitest/src/main/java/io/mosip/test/mob/inji/driver/TestRunner.java b/injitest/src/main/java/io/mosip/test/mob/inji/driver/TestRunner.java index 7cc5089a8..b7456e56e 100644 --- a/injitest/src/main/java/io/mosip/test/mob/inji/driver/TestRunner.java +++ b/injitest/src/main/java/io/mosip/test/mob/inji/driver/TestRunner.java @@ -1,48 +1,56 @@ package io.mosip.test.mob.inji.driver; + import java.io.File; import java.util.ArrayList; import java.util.List; + import org.testng.TestListenerAdapter; import org.testng.TestNG; + public class TestRunner { - public static String jarUrl = TestRunner.class.getProtectionDomain().getCodeSource().getLocation().getPath(); - - static TestListenerAdapter tla = new TestListenerAdapter(); - - public static void main(String[] args) throws Exception { - startTestRunner(); - } - - public static String getResourcePath() { - if (checkRunType().equalsIgnoreCase("JAR")) - return (new File(jarUrl)).getParentFile().getAbsolutePath().toString() + "/resources/"; - if (checkRunType().equalsIgnoreCase("IDE")) { - String path = System.getProperty("user.dir") + System.getProperty("path.config"); - if (path.contains("test-classes")) - path = path.replace("test-classes", "classes"); - return path; - } - return "Global Resource File Path Not Found"; - } - - public static String checkRunType() { - if (TestRunner.class.getResource("TestRunner.class").getPath().toString().contains(".jar")) - return "JAR"; - return "IDE"; - } - - public static void startTestRunner() { - File homeDir = null; - TestNG runner = new TestNG(); - List suitefiles = new ArrayList<>(); - String os = System.getProperty("os.name"); - homeDir = new File(System.getProperty("user.dir") + "/testng.xml"); - suitefiles.add(homeDir.getAbsolutePath()); - runner.setTestSuites(suitefiles); - System.getProperties().setProperty("testng.outpur.dir", "testng-report"); - runner.setOutputDirectory("testng-report"); - runner.run(); - } -} \ No newline at end of file + public static String jarUrl = TestRunner.class.getProtectionDomain().getCodeSource().getLocation().getPath(); + static TestListenerAdapter tla = new TestListenerAdapter(); + + + public static void main(String[] args) throws Exception { + startTestRunner(); + } + + public static String getResourcePath() { + if (checkRunType().equalsIgnoreCase("JAR")) { + return new File(jarUrl).getParentFile().getAbsolutePath().toString()+"/resources/"; + } else if (checkRunType().equalsIgnoreCase("IDE")) { + String path =System.getProperty("user.dir") + System.getProperty("path.config"); + + + if (path.contains("test-classes")) + path = path.replace("test-classes", "classes"); + return path; + } + return "Global Resource File Path Not Found"; + } + + public static String checkRunType() { + if (TestRunner.class.getResource("TestRunner.class").getPath().toString().contains(".jar")) + return "JAR"; + else + return "IDE"; + } + + + public static void startTestRunner() { + File homeDir = null; + TestNG runner = new TestNG(); + List suitefiles = new ArrayList<>(); + + homeDir = new File(System.getProperty("user.dir") + "/testng.xml"); + + suitefiles.add(homeDir.getAbsolutePath()); + + runner.setTestSuites(suitefiles); + System.getProperties().setProperty("testng.outpur.dir", "testng-report"); + runner.setOutputDirectory("testng-report"); + runner.run(); + }}