hello I am trying to run a test case in TestNG class where i can get reports and number test failed or passed test cases the below code works when ran in normal java class...
@Test
public void make() throws InterruptedException{
System.setProperty("webdriver.chrome.driver","C:\\Users\\sasy\\Desktop\\Akhil\\Selenium\\chromedriver.exe");
WebDriver driver=new ChromeDriver();
driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS);
System.setProperty("org.apache.commons.logging.Log","org.apache.commons.logging.impl.Jdk14Logger");
driver.get("http://198.57.218.124/CRFGLSPL/Private/login.aspx?ReturnUrl=%2fCRFGLSPL%2fPrivate%2fPatientOrganDamageIntermediateVisit.aspx%3fPatientID%3d2&PatientID=2");
driver.findElement(By.xpath("//*[@id='ctl00_ContentPlaceHolder1_txtEmail']")).sendKeys("[email protected]");
driver.findElement(By.xpath("//*[@id='ctl00_ContentPlaceHolder1_txtPassword']")).sendKeys("maryme");
driver.findElement(By.xpath("//*[@id='ctl00_ContentPlaceHolder1_btnLogin']")).click();
driver.findElement(By.xpath("//*[@id='ctl00_ContentPlaceHolder1_btnSubmit']")).click();
driver.findElement(By.xpath("//*[@id='ctl00_ContentPlaceHolder1_btnSubmit']")).click();
//WebElement ID418=driver.findElement(By.xpath("//*[@id='edit41']"));
//WebElement ID830=driver.findElement(By.xpath("//*[@id='edit40']"));
WebElement ID969=driver.findElement(By.xpath("//*[@id='edit37']"));
//WebElement ID472=driver.findElement(By.xpath("//*[@id='edit39']"));
Thread.sleep(3000);
ID969.click();
driver.quit();
}
when the above code is ran as TestNG Test i am given following error
FAILED: make java.lang.NoClassDefFoundError: com/google/common/base/Function at first.heha.make(heha.java:16)
The jar file having the class
com.google.common.base.Function
, which you most probably did not add to your classpath. Add Guava jar file to build pathCheck to make sure all the required selenium ,testNg libraries are in your build path