4. Challenges in Web
Automation
Dynamic nature of web pages
Ever changing Javascript world and cross
browser support
Simulating real user experience
Writing automation test at a low level (E.g >
click , select )
Robust handling of environment and response
slowness
Developer centric test cases
5.
6. BDD Vs TDD
BDD : $(count)should-be(5)
TDD assertEquals(count 5)
7. Tools we are proposing
»Selenium 2.0 (Webdriver) ˃ Advanced browser testing
API
»Thucydides >automation framework designed to make it
easier to write automated acceptance tests using
Selenium 2.
» Jenkins (Or Any other CI Tool) ˃ To support continuous
integration approach
8. Webdriver/Selenium 2.*
»Webdriver is an Advanced API to interact
with browser
» Clean API enables to write robust
Automation Solution
» Browsers Supported – Firefox, IE, Chrome,
Safari, HTMLUnit, Iphone, Android ( Default
browsers for Mobile Phones)
» Supports various programming languages –
Java, C#, Python, etc
» Java is supported out of the box
9.
10. Thucydides
By default, Thucydides supports a simple directory-based convention for organizing your requirements. The standard structure uses
three levels: capabilities, features and stories.
+ src
+ test
+ resources
+ stories
+ grow_potatoes
+ grow_organic_potatoes
[a capability]
[a feature]
- plant_organic_potatoes.story [a story]
- dig_up_organic_potatoes.story [another story]
+ grow_sweet_potatoes
[another feature]
...
If you prefer another hierarchy, you can use the thucydides.capability.types system property to override the default convention.
11. Defining Thucydides Page Objects
Page Objects are a way of isolating the implementation details of a web page inside a class, exposing only business-focused
methods related to that page
Example :public class LoginPage extends PageObject {
public LoginPage(WebDriver driver) {
super(driver);
}
@FindBy(id = "username")
private WebElement userName;
@FindBy(css = "button.button")
private WebElement loginButton;
public void inputForm(String username, String password) {
}
public void submitForm() {
}
public void logOut() {
}
public String getResultValue(String value){;
}
}
12.
13. Stories
Narrative:
In order to configure on the THM DashBoard
As an Admin
I want to be able to login to the Dashboar
Scenario: Logging in as Admin
Given I am on Login Page
When I input 'admin' and 'alfresco' as Username And
Password
Then I Click Login Button
Then I should see 'logout'
14. Defining the Test Steps
public class LoginSteps extends ScenarioSteps {
LoginPage loginPage;
@Step
public void enters() {
loginPage.navigateTo(getDriver());
}
@Step
public void provides_credentials(String username, String password) {
loginPage.inputForm(username, password);
}
@Step
public void click_button() {
}
@Step
public void LogOut(){
15. Step Class
public class LoginTest {
@Steps
LoginSteps login;
@Given("I am on Login Page")
@Alias("the admin is not logged in")
@Then("I am on Login Page")
public void givenIAmOnLoginPage() {
login.enters();
}
@When("I input '$username' and '$password' as Username And Passoword")
public void whenIInputUsernameAndPasswordAsUsernameAndPassoword(String username, String password) {
login.provides_credentials(username, password);
}
@Then("I Click Login Button")
public void thenIClickLoginButton() {
login.click_button();
}
16. Jenkin Set Up
Jenkins is an open source application which provides continuous
integration services for software development.
Jenkins focuses on the following two jobs:
1. Building/testing software projects continuously,
2. Monitoring executions of externally-run jobs
Command to run test cases :mvn clean install -Dstory.timeout.in.secs=30000