Testscripts are skipped while running with TestNG | Selenium Forum
M
Posted on 10/10/2016
Hi Ashish,

I am trying to execute login test through xl data. I have given all required data.But my script is getting skipped.Need help on this

this is my code
package uploads;

import java.util.concurrent.TimeUnit;

import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
//import org.testng.annotations.BeforeTest;
import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;



public class login_xls {
WebDriver driver;

@Test(dataProvider="readxlsdata")
public void doLogin(String username,String password){


System.setProperty("webdriver.chrome.driver","C:\\Users\\sairam\\Desktop\\selenium\\chromedriver_win32\\chromedriver.exe");
driver = new ChromeDriver();
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(10,TimeUnit.SECONDS);
driver.get("http://gmail.com");
driver.findElement(By.xpath("//input[@id='email']")).sendKeys(username);
driver.findElement(By.xpath("//input[@id='email']")).sendKeys(Keys.ENTER);
driver.findElement(By.xpath("//input[@id='pass']")).sendKeys(password);
driver.findElement(By.xpath("//input[@id='pass]")).sendKeys(Keys.ENTER);
String loginurl=driver.getCurrentUrl();
if(loginurl.equals(driver.getCurrentUrl()))
System.out.println("Login successful");
}

@DataProvider
public Object[][]readxlsdata(){
Xls_Reader xls= new Xls_Reader("C:/Users/sairam/Desktop/login.xlsx");
int rows = xls.getRowCount("Sheet1");
int colms=xls.getColumnCount("Sheet1");
System.out.println("Number of Rows are " +rows);
System.out.println("number of colums are" +colms);
Object[][] data = new Object[rows-2][colms];
for(int i=2;i<=rows;i++){
for(int j=0;j<colms;j++){
data[i-2][j]=xls.getCellData("Sheet1", j, i);
}
}

return data;
}
}

Output:-
*******
[TestNG] Running:
C:\Users\sairam\AppData\Local\Temp\testng-eclipse--846178278\testng-customsuite.xml

[Utils] Attempting to create C:\Users\sairam\workspace\module15\test-output\Default suite\Default test.xml
[Utils] Directory C:\Users\sairam\workspace\module15\test-output\Default suite exists: true
SKIPPED: doLogin
java.lang.RuntimeException: java.lang.NoClassDefFoundError: org/apache/xmlbeans/XmlException
at org.testng.internal.MethodInvocationHelper.invokeMethodNoCheckedException(MethodInvocationHelper.java:45)
at org.testng.internal.MethodInvocationHelper.invokeDataProvider(MethodInvocationHelper.java:110)
at org.testng.internal.Parameters.handleParameters(Parameters.java:429)
at org.testng.internal.Invoker.handleParameters(Invoker.java:1240)
at org.testng.internal.Invoker.createParameters(Invoker.java:980)
at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1070)
at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:129)
at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:112)
at org.testng.TestRunner.privateRun(TestRunner.java:746)
at org.testng.TestRunner.run(TestRunner.java:600)
at org.testng.SuiteRunner.runTest(SuiteRunner.java:366)
at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:361)
at org.testng.SuiteRunner.privateRun(SuiteRunner.java:319)
at org.testng.SuiteRunner.run(SuiteRunner.java:268)
at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
at org.testng.TestNG.runSuitesSequentially(TestNG.java:1264)
at org.testng.TestNG.runSuitesLocally(TestNG.java:1189)
at org.testng.TestNG.runSuites(TestNG.java:1104)
at org.testng.TestNG.run(TestNG.java:1076)
at org.testng.remote.AbstractRemoteTestNG.run(AbstractRemoteTestNG.java:126)
at org.testng.remote.RemoteTestNG.initAndRun(RemoteTestNG.java:152)
at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:57)
Caused by: java.lang.NoClassDefFoundError: org/apache/xmlbeans/XmlException
at uploads.Xls_Reader.<init>(Xls_Reader.java:34)
at uploads.login_xls.readxlsdata(login_xls.java:38)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:100)
at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:51)
at org.testng.internal.MethodInvocationHelper.invokeMethodNoCheckedException(MethodInvocationHelper.java:41)
... 22 more
Caused by: java.lang.ClassNotFoundException: org.apache.xmlbeans.XmlException
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 31 more


===============================================
Default test
Tests run: 1, Failures: 0, Skips: 1
===============================================


===============================================
Default suite
Total tests run: 1, Failures: 0, Skips: 1
===============================================

[TestNG] Time taken by org.testng.reporters.XMLReporter@6e8dacdf: 11 ms
[TestNG] Time taken by org.testng.reporters.jq.Main@1d251891: 45 ms
[TestNG] Time taken by org.testng.reporters.EmailableReporter2@7f63425a: 9 ms
[Utils] Attempting to create C:\Users\sairam\workspace\module15\test-output\testng-failed.xml
[Utils] Directory C:\Users\sairam\workspace\module15\test-output exists: true
[Utils] Attempting to create C:\Users\sairam\workspace\module15\test-output\Default suite\testng-failed.xml
[Utils] Directory C:\Users\sairam\workspace\module15\test-output\Default suite exists: true
[TestNG] Time taken by [FailedReporter passed=0 failed=0 skipped=0]: 9 ms
[Utils] Attempting to create C:\Users\sairam\workspace\module15\test-output\old\Default suite\toc.html
[Utils] Directory C:\Users\sairam\workspace\module15\test-output\old\Default suite exists: true
[Utils] Attempting to create C:\Users\sairam\workspace\module15\test-output\old\Default suite\Default test.properties
[Utils] Directory C:\Users\sairam\workspace\module15\test-output\old\Default suite exists: true
[Utils] Attempting to create C:\Users\sairam\workspace\module15\test-output\old\Default suite\index.html
[Utils] Directory C:\Users\sairam\workspace\module15\test-output\old\Default suite exists: true
[Utils] Attempting to create C:\Users\sairam\workspace\module15\test-output\old\Default suite\main.html
[Utils] Directory C:\Users\sairam\workspace\module15\test-output\old\Default suite exists: true
[Utils] Attempting to create C:\Users\sairam\workspace\module15\test-output\old\Default suite\groups.html
[Utils] Directory C:\Users\sairam\workspace\module15\test-output\old\Default suite exists: true
[Utils] Attempting to create C:\Users\sairam\workspace\module15\test-output\old\Default suite\classes.html
[Utils] Directory C:\Users\sairam\workspace\module15\test-output\old\Default suite exists: true
[Utils] Attempting to create C:\Users\sairam\workspace\module15\test-output\old\Default suite\reporter-output.html
[Utils] Directory C:\Users\sairam\workspace\module15\test-output\old\Default suite exists: true
[Utils] Attempting to create C:\Users\sairam\workspace\module15\test-output\old\Default suite\methods-not-run.html
[Utils] Directory C:\Users\sairam\workspace\module15\test-output\old\Default suite exists: true
[Utils] Attempting to create C:\Users\sairam\workspace\module15\test-output\old\Default suite\testng.xml.html
[Utils] Directory C:\Users\sairam\workspace\module15\test-output\old\Default suite exists: true
[Utils] Attempting to create C:\Users\sairam\workspace\module15\test-output\old\index.html
[Utils] Directory C:\Users\sairam\workspace\module15\test-output\old exists: true
[TestNG] Time taken by org.testng.reporters.SuiteHTMLReporter@7c75222b: 49 ms
[Utils] Attempting to create C:\Users\sairam\workspace\module15\test-output\junitreports\TEST-uploads.login_xls.xml
[Utils] Directory C:\Users\sairam\workspace\module15\test-output\junitreports exists: true
[TestNG] Time taken by org.testng.reporters.JUnitReportReporter@511baa65: 8 ms

M
Replied on 10/10/2016

any update?


M
Replied on 12/10/2016

download this library xmlbeans-x.x.x.jar

http://xmlbeans.apache.org/