Extracting keywords of test cases from excel file but getting following exception(.NoClassDefFoundError). Please help. | Selenium Training|Java|WebDriver|TestNG|Frameworks|Videos
10% July Month Discount Avail now

Selenium Training Forum

Extracting keywords of test cases from excel file but getting following exception(.NoClassDefFoundError). Please help.

S
sandeep.ratnakar Post on 02/06/2019

package testscript;

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("------------------");
}
}


}
}

______________________________________________________________________

Error stack trace

______________________________________________________________________

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

S

Instructor

Support Team Reply on 03/06/2019

Which Module are you referring to?

Additionally, share your project in a compressed ZIP file.

S
sandeep.ratnakar Reply on 06/06/2019

I am refering to module 22. Please look into practice.java in the zip file.

S

Instructor

Support Team Reply on 12/06/2019

Please share all the dependent files as well (Jars and Other dependent Files)

S
sandeep.ratnakar Reply on 23/06/2019

Added jars in a seprate folder. Tried a lot of things but stuck badly in extracting data from excel file. Please guide.

S
sandeep.ratnakar Reply on 23/06/2019

Also, I have used jar files provided by you.

S

Instructor

Support Team Reply on 24/06/2019

Did you try debugging the code?