Jump to content

cucumber with gherkins


Dimpy123

Recommended Posts

32 minutes ago, Dimpy123 said:

step defenation enduku use chestam, reusability ela  chestam...

That's what BDD is all about..You write a functional test case in the form of Gherkin stories..It's mainly used for automation testing..

Reusability ante parameters use chestharu..where you have the same step class for all the gherkin stories 

Link to comment
Share on other sites

23 minutes ago, ronitreddy said:

That's what BDD is all about..You write a functional test case in the form of Gherkin stories..It's mainly used for automation testing..

Reusability ante parameters use chestharu..where you have the same step class for all the gherkin stories 

for example login page undi, same script with different test data pass chestam kada, alantivi ela chestam

Link to comment
Share on other sites

Assuming that you know Java, I am giving you a code snippet for the Login Page & Login Steps

public class LoginPage 

@Autowired

Environment environment

private static final By LOGIN_USERNAME_INPUT = By.id("eusermanagement_login_logi_USER_ALIAS_id_input");

private static final By LOGIN_PASSWORD_INPUT = By.id("eusermanagement_login_logi_PASSWORD_id_input");

private static final By LOGIN_BUTTON = By.id("eusermanagement_login_logi_signin_id");

private static final By LOGIN_LINK = By.id("eusermanagement_logout_logo_logout_id");

private static final By LOGIN_DIALOG_OK = By.id("uicAlertBox_ok");

public void Login() throws Exception

driver.get(environment.getProperty("url");

Thread.sleep(5000);

driver.findElement(LOGIN_USERNAME_INPUT).sendKeys(environment.getProperty("username"));

driver.findElement(LOGIN_PASSWORD_INPUT).sendKeys(environment.getProperty("password"));

driver.findElement(LOGIN_BUTTON).click();

}

public void Logout() throws IOException, InterruptedException{

Thread.sleep(5000);

driver.findElement(LOGOUT_LINK).click();

driver.findElement(LOGOUT)DIALOG_OK).click();

}

}

Link to comment
Share on other sites

public class LoginSteps{

@Autowired

LoginPage loginpage;

@When("I login to X URL")

public void login() throws IOException {

loginPage.Login();

}

@When("I logout from X Website")

public void logout() throws IOException {

loginPage.Logout();

}

}

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...