Cucumber -Scenario Outline
Feature: Access to the facebook application
Scenario Outline: Access to the facebook application
Given Login to the website with a url
Then Verify Facebook Login page is displayed
Then Enter the "<username>"
And input the "<password>"
Then please enter the "<firstname>" and "<lastname>" and "<newpassword>"
Examples:
| username | password | firstname | lastname | newpassword |
| sudheer | chittireddy | bindu | reddy | welcome |
| suresh | chittireddy | Sindu | reddy | welcome |
| sunil | chittireddy | Veronica | reddy | welcome |
| Dad | chittireddy | Mom | reddy | welcome |
| Muruga | chittireddy | Sunitha | reddy | welcome |
| sudheerreddy | chittireddy | binduVenkat | reddy | welcome |
Scenario Outline: Access to the facebook application
Given Login to the website with a url
Then Verify Facebook Login page is displayed
Then Enter the "<username>"
And input the "<password>"
Then please enter the "<firstname>" and "<lastname>" and "<newpassword>"
Examples:
| username | password | firstname | lastname | newpassword |
| sudheer | chittireddy | bindu | reddy | welcome |
| suresh | chittireddy | Sindu | reddy | welcome |
| sunil | chittireddy | Veronica | reddy | welcome |
| Dad | chittireddy | Mom | reddy | welcome |
| Muruga | chittireddy | Sunitha | reddy | welcome |
| sudheerreddy | chittireddy | binduVenkat | reddy | welcome |
StepDefination class
package StepDefination;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import cucumber.api.java.en.Given;
import cucumber.api.java.en.Then;
public class ScenarioOutlineExamples {
WebDriver driver=null;
@Given("^Login to the website with a url$")
public void login_to_the_website_with_a_url() {
System.setProperty("webdriver.chrome.driver", "C:\\Selenium-drivers\\chromedriver\\chromedriver.exe");
driver = new ChromeDriver();
}
@Then("^Verify Facebook Login page is displayed$")
public void verify_Facebook_Login_page_is_displayed() {
driver.get("http://ww.facebook.com");
}
@Then("^Enter the \"([^\"]*)\"$")
public void enter_the_sudheer(String username) {
driver.findElement(By.id("email")).sendKeys(username);
}
@Then("^input the \"([^\"]*)\"$")
public void enter_the_chittireddy(String password) {
driver.findElement(By.id("pass")).sendKeys(password);
}
@Then("^please enter the \"([^\"]*)\" and \"([^\"]*)\" and \"([^\"]*)\"$")
public void enter_the_sudheer_and_reddy_and_and_sudheer(String firstname, String lastname, String newpassword) {
driver.findElement(By.name("firstname")).sendKeys(firstname);
driver.findElement(By.name("lastname")).sendKeys(lastname);
driver.findElement(By.name("reg_passwd__")).sendKeys(newpassword);
}
}
--------
TestRunner
package Runner;
import org.junit.runner.RunWith;
import cucumber.api.CucumberOptions;
import cucumber.api.junit.Cucumber;
@RunWith(Cucumber.class)
@CucumberOptions(
features="C:\\Ecillipse-Java\\UnitedCumcumFreecrm\\src\\main\\java\\Features\\MapDataTableCRM.feature",
glue= "StepDefination",
plugin= {
"pretty", "html:test-output", "json:json_output/cucumber.json",
"junit:junit_output/cucumber.xml" },
dryRun=false,
strict=true,
monochrome=true)
public class ScenarioOutlineExampleSample {
}
//this is working with same
//have gace complete path in features
//rest all same..
///try with same then
//so i will be using this for all my execution ...then..
Comments
Post a Comment