Quantcast
Channel: Active questions tagged selenium - Stack Overflow
Viewing all articles
Browse latest Browse all 99409

TestNg [TestNG] No tests found. Nothing was run error is thrown on DataProvider annotation

$
0
0

Below is the test code written, Can anybody help me on this,

I am trying to fetch the test data from an excel file using getExcelData function which collects the data in ArrayList object, and below one in the testclass where i am executing the code.

public class roughTest {

public WebDriver driver;


@BeforeMethod
public void setUp() {

    System.setProperty("webdriver.chrome.driver", "D:\\geckodriver.exe");
    WebDriver driver = new FirefoxDriver();     
    driver.manage().window().maximize();
    driver.manage().deleteAllCookies();

    driver.get("TEST URL LINK");
}




@Test(dataProvider="getData")
public void form(String firstname,String lastname,String date,String continent) {


    driver.findElement(By.name("firstname")).clear();
    driver.findElement(By.name("firstname")).sendKeys(firstname);

    driver.findElement(By.name("lastname")).clear();
    driver.findElement(By.name("lastname")).sendKeys(lastname);

    driver.findElement(By.xpath("(.//input[@type='text'])[4]")).clear();
    driver.findElement(By.xpath("(.//input[@type='text'])[4]")).sendKeys(date);

    Select s = new Select(driver.findElement(By.name("continents")));       
    s.selectByVisibleText(continent);


    System.out.println("Value entered successfully");


}



@DataProvider
public Iterator<Object[]> getData() {

    ArrayList<Object[]> testData = getDataFromExcel.getExcelData();
    return testData.iterator();


}




@AfterMethod
public void tearDown() {

    driver.quit();

}

}


Viewing all articles
Browse latest Browse all 99409

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>