Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Hi All,
- 1) This is my feature file
- Scenario Outline: Login to the application
- Given The application is launched
- When I enter the "<username>" and "<password>"
- And click on the login button
- Then I am logged into the application
- Examples:
- | username | password |
- | admin | admin |
- @Party
- Scenario Outline: Add new person or place
- Given The application is launched is with "<username>" and "<password>"
- When I click on Party button
- And I click on Add new Person Or Place
- And I select organization
- And I enter the partyname "<organizationName>" and "<correspondenceName>"
- And I enter the address "<Address>" and "<City>" and "<zipcode>"
- And I click on Done
- Then Verify the "<organizationName>" created
- Examples:
- | username | password | organizationName | correspondenceName | Address | City | zipcode |
- | admin | admin | orginsured | orginsured | 100 Main Rd | Bolivar | 65613 |
- Then
- 2) I have created a base class,
- public class BaseStepDefinition {
- WebDriver driver = new FirefoxDriver();
- }
- 3) I have 2 step definition class extending BaseStepDefinition class
- public class LoginFunctionality extends BaseStepDefinition {
- @Before
- public void launchbrowser() {
- WebDriver driver = new FirefoxDriver();
- String url = "SomeURL";
- driver.get(url);
- }
- @After public void closebrowser() {
- driver.findElement(By.id("id_LogOut")).click(); driver.close();
- }
- @Given("^The application is launched$")
- public void the_application_is_launched() throws Throwable {
- // Write code here that turns the phrase above into concrete actions
- // driver.get(url);
- String expectedtitle = "title";
- String actualtitle = driver.getTitle();
- Assert.assertEquals(actualtitle, expectedtitle);
- }
- @When("^I enter the "([^"]*)" and "([^"]*)"$")
- public void i_enter_the_and(String arg1, String arg2) throws Throwable {
- // Write code here that turns the phrase above into concrete actions
- WebElement username = driver.findElement(By.id("username"));
- username.sendKeys(arg1);
- WebElement password = driver.findElement(By.id("password"));
- password.sendKeys(arg2);
- }
- @Given("^The application is launched is with "([^"]*)" and "([^"]*)"$")
- public void login(String arg1, String arg2) throws Throwable {
- WebElement username = driver.findElement(By.id("username"));
- username.sendKeys(arg1);
- WebElement password = driver.findElement(By.id("password"));
- password.sendKeys(arg2);
- WebElement clicklogin = driver.findElement(By.xpath("//span[text()='Login']"));
- clicklogin.click();
- }
- @When("^I click on Party button$")
- public void i_click_on_Party_button() throws Throwable {
- driver.findElement(By.id("Party")).click();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement