Multiple test case execution with excel

I used for loop for reading all the rows.But i was unable to do.Can you please help me ?

I used following framework.

http://www.toolsqa.com/selenium-webdriver/data-driven-testing-excel-poi/

sarmila Train Asked on August 16, 2014 in Selenium WebDriver.
Add Comment
7 Answer(s)

How to execute multiple test data with the Single Test Case

Test Case File

 


 

 

Add this function in to the Excel utility file

 


 

Note : Above test might not work and not been executed and tested by me. I just tried to give you an example of what you have asked.
Please mark the answer as ANSWERED, if it resolve your query.

Best Regards,

Lakshay Sharma

 

xLov3rDns Professor Answered on August 16, 2014.
Add Comment

Hi Ankit,
Please find the below code and attached excel.

 

 

RE: I have multiple rows in excel.I need to pass all the row one by one.I am using your data driven testing framework.Can you please give me a sample code or some hints how to do?
sarmila Train Answered on August 16, 2014.
Add Comment

hi shramila

 

 

you can try this code and let me knw if it works

ankit ramola Vice Professor Answered on August 16, 2014.
Add Comment

Could you please tell me  how to store alert message for this url http://demo.cropin.in .By entering anything on username and password field,it will give a message “Invalid user”.I want to store this message and print it in a console? Please help me how to do?

sarmila Train Answered on August 18, 2014.
Add Comment

ankit ramola Vice Professor Answered on August 18, 2014.
Add Comment

Not working.Can you please try with given url ?

sarmila Train Answered on August 18, 2014.
Add Comment

try this
package testv;

import java.util.concurrent.TimeUnit;

import org.openqa.selenium.Alert;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;

public class testalert
{

WebDriver driver;
@BeforeTest
public void init()
{

driver= new FirefoxDriver();
driver.get(“http://demo.cropin.in/application/login/login.aspx”);
driver.manage().timeouts().implicitlyWait(30,TimeUnit.SECONDS);
}
@Test
public void testalert1() throws InterruptedException
{

driver.findElement(By.xpath(“//input[@id=’txtUserName’]”)).sendKeys(“fdssd”);
driver.findElement(By.xpath(“//input[@name=’txtPassword’]”)).sendKeys(“dsaasd”);
driver.findElement(By.name(“btnSignIn”)).click();
//    driver.manage().timeouts().pageLoadTimeout(50, TimeUnit.SECONDS);

Thread.sleep(10000);
Alert alert = driver.switchTo().alert();

String alerttext=    alert.getText();
System.out.println(alerttext);
alert.accept();

}
@AfterMethod
public void teardown()
{
driver.quit();
}

}

u can increse thread.sleep value and implicit wait depending on ur network speed

ankit ramola Vice Professor Answered on August 18, 2014.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.