From 0b4789105d7380b815e31bab06249e98d531b088 Mon Sep 17 00:00:00 2001 From: Anup Nehe Date: Wed, 25 Oct 2023 11:15:56 +0530 Subject: [PATCH 1/2] MOSIP-29934 Signed-off-by: Anup Nehe --- injitest/pom.xml | 9 +- .../test/mob/inji/driver/TestRunner.java | 86 +++++++++---------- 2 files changed, 47 insertions(+), 48 deletions(-) diff --git a/injitest/pom.xml b/injitest/pom.xml index ab97edd21..1ed5153c6 100644 --- a/injitest/pom.xml +++ b/injitest/pom.xml @@ -139,8 +139,15 @@ io.appium java-client - 8.5.0 + 9.0.0 + + + com.google.guava + guava + 32.1.3-jre + + org.testng 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 b7456e56e..7cc5089a8 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,56 +1,48 @@ 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/"; - } 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(); - }} + 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 From e2f4030989ee4266f86368477b7c3eed02c91e24 Mon Sep 17 00:00:00 2001 From: Anup Nehe Date: Wed, 25 Oct 2023 11:36:30 +0530 Subject: [PATCH 2/2] MOSIP-29934 Signed-off-by: Anup Nehe --- injitest/pom.xml | 6 -- .../test/mob/inji/driver/TestRunner.java | 86 ++++++++++--------- 2 files changed, 47 insertions(+), 45 deletions(-) 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(); + }}