Extracting keywords of test cases from excel file but getting following exception(.NoClassDefFoundError). Please help.
import java.io.FileInputStream; import java.io.IOException; import java.util.Properties;
import org.junit.Before; import org.junit.Test; import org.openqa.selenium.WebDriver;
import datatable.Xls_Reader;
public class delete { public static Properties CONFIG; public static Properties OR; public static Properties APPTEXT; public static Xls_Reader controller; public static Xls_Reader testData;
public static String currentTest; public static String keyword;
@Before public void initialize() throws IOException{ // load the property fIles // load the config prop CONFIG = new Properties(); FileInputStream fs = new FileInputStream(System.getProperty("user.dir")+"\\src\\config\\config.properties"); CONFIG.load(fs); // LOAD OR OR = new Properties(); fs = new FileInputStream(System.getProperty("user.dir")+"\\src\\config\\OR.properties"); OR.load(fs); // app text prop load APPTEXT = new Properties(); fs = new FileInputStream(System.getProperty("user.dir")+"\\src\\config\\app_text.properties"); APPTEXT.load(fs); // intialize datatable controller= new Xls_Reader(System.getProperty("user.dir")+"\\src\\config\\Controller.xlsx"); testData = new Xls_Reader(System.getProperty("user.dir")+"\\src\\config\\TestData.xlsx"); } @Test public void testApp() { for(int tcid=2; tcid<=controller.getRowCount("Suite1"); tcid++) { currentTest=controller.getCellData("Suite1", "TCID", tcid); if(controller.getCellData("Suite1", "Runmode", tcid).equals("Y")) { for(int tsid =2;tsid<=controller.getRowCount("currentTest"); tcid++) { keyword=controller.getCellData("currentTest", "Keyword", tsid); System.out.println(keyword); } System.out.println("------------------"); } } } }
______________________________________________________________________
java.lang.NoClassDefFoundError: org/junit/platform/commons/util/Preconditions at org.junit.platform.launcher.core.LauncherFactory.create(LauncherFactory.java:83) at org.junit.platform.launcher.core.LauncherFactory.create(LauncherFactory.java:67) at org.eclipse.jdt.internal.junit5.runner.JUnit5TestLoader.<init>(JUnit5TestLoader.java:34) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490) at java.base/java.lang.Class.newInstance(Class.java:584) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.createRawTestLoader(RemoteTestRunner.java:370) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.createLoader(RemoteTestRunner.java:365) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.defaultInit(RemoteTestRunner.java:309) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.init(RemoteTestRunner.java:224) at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:208) Caused by: java.lang.ClassNotFoundException: org.junit.platform.commons.util.Preconditions at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583) at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521) ... 13 more
Which Module are you referring to?
Additionally, share your project in a compressed ZIP file.
I am refering to module 22. Please look into practice.java in the zip file.
Please share all the dependent files as well (Jars and Other dependent Files)
Added jars in a seprate folder. Tried a lot of things but stuck badly in extracting data from excel file. Please guide.
Also, I have used jar files provided by you.
Did you try debugging the code?
We offer online selenium and UFT/QTP training. The course is very comprehensive and covers every aspect of automation testing with UFT/QTP and selenium. All types of frameworks are covered in depth - data driven framework, hybrid framework, page object model with a live project
© 2020 Whizdom Trainings. All rights Reserved - Powered by Whizdom Trainings