Testng program skips execution.How to set it right? | Selenium Forum
M
Posted on 12/01/2016
Am trying to login to gmail via parameterization.Test skips execution.How do i make the test run..
Following is my code:
-----------------------------
package p1;

import org.testng.annotations.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.DataProvider;

public class Login_verifyy_gmail {
@Test(dataProvider = "dp")
public void f(String n, String s) {

WebDriver w=new FirefoxDriver();
w.get("http://www.gmail.com/");
//w.findElement(By.xpath("//input[@id='Email'] and [@type='email']")).sendKeys(keysToSend);
System.out.println("n"+n+"s"+s);

}

@DataProvider
public Object[][] dp() {
/* return new Object[][] {
new Object[] { 1, "a" },
new Object[] { 2, "b" },*/


Object[][] x=new Object[1][1];
Xls_Reader x1=new Xls_Reader("C:\\Users\\chaitra\\Pictures\\shopping_cart.xlsx");
for(int i=0;i<1;i++)
{
x[i][i]=x1.getCellData("Login","Login_name",2);
x[i][1]=x1.getCellData("Login","pwd",2);
System.out.println("loginName"+x[i][i]+"loginName"+x[i][1]);
}
return x;



};
}

M
Replied on 12/01/2016

[quote:22b5cw5j]Object[][] x = new Object[color=#FF0000:22b5cw5j][1][2][/color:22b5cw5j];
[/quote:22b5cw5j]

object should be more then one. it was giving me index out of bound error.


M
Replied on 13/01/2016

Am getting errors on using selenium packages in TestNG class.
How do i resolve this?

PLease refer snapshot:

Here is my code:
---------------------------
package p1;


import org.testng.annotations.Test;
import org.testng.annotations.DataProvider;

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

public class Login_verifyy_gmail {
@Test(dataProvider = "dp")
public void f(String n, String s) {

WebDriver w=new FirefoxDriver();
w.get("http://www.gmail.com/");
w.findElement(By.xpath("//input[@id='Email'] and [@type='email']")).sendKeys(n);
w.findElement(By.xpath("//*[@id='Passwd']")).sendKeys(s);
w.findElement(By.xpath("//*[@id='Passwd']")).sendKeys(Keys.ENTER);
System.out.println("n"+n+"s"+s);

}

@DataProvider
public Object[][] dp() {
/* return new Object[][] {
new Object[] { 1, "a" },
new Object[] { 2, "b" },*/


Object[][] x=new Object[1][2];
Xls_Reader x1=new Xls_Reader("C:\\Users\\chaitra\\Pictures\\shopping_cart.xlsx");
for(int i=0;i<1;i++)
{
x[i][i]=x1.getCellData("Login","Login_name",2);
x[i][1]=x1.getCellData("Login","pwd",2);
System.out.println("loginName"+x[i][i]+"loginName"+x[i][1]);
}
return x;



};
}

Responsive image

M
Replied on 13/01/2016

add all the selenium jar files to your eclipse project.