Automation solution

624 views

Published on

Automation solutions using BDD, JBehave, Selenium, Maven.
Page object pattern.

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
624
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
23
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Automation solution

  1. 1. Automation solution for web apps Vadym Goncharenko, December 2013
  2. 2. Agenda: • • • • • • • 1. Introduction in JBehave 2. Behavior driven development 3. Selenium as a tool for automation testing 4. How to create new test scenario 5. The page objects pattern 6. Good and bad practices 7. Running test scenarios through maven
  3. 3. Introduction in JBehave • JBehave is a framework for Behaviour-Driven Development
  4. 4. Behavior driven development • Behavior-driven development is a software development process based on test-driven development (TDD)
  5. 5. Selenium • Selenium is a suite of tools to automate web browsers across many platforms. • Selenium IDE is a complete integrated development environment (IDE) for Selenium tests. • Selenium Remote Control (RC) is a server, written in Java, that accepts commands for the browser via HTTP. • Selenium WebDriver is the successor to Selenium RC.
  6. 6. Create new test • Write new test scenario on the Gherkin like: Scenario: “describes what should be passed” Given: “given something” When: “something happened” Then: “should be something” • Implementation for this scenario @Given ("given something") public void givenSomething() { } @When ("something happened") public void whenSomethingHappened() { } @Then ("should be something") public void thenShouldBeSomething() { }
  7. 7. The page objects pattern • More popular in test automation; • Page object is an object-oriented; • Serves as an interface to a page; Web page Java class Enhancing test maintenance; Reducing code duplication; Test cases
  8. 8. Good and bad practices public class GoogleLoginSteps { private Selenium selenium; public void googleLoginSteps() { selenium.open("google.com"); selenium.waitForPageToLoad("10000"); selenium.click("id=gb_70"); selenium.type("id=Email", "wrong@gmail.com"); selenium.type("id=Passwd", "wrong password"); selenium.click("id=signIn"); selenium.waitForPageToLoad("10000"); assertTrue(selenium.isElementPresent("errormsg_0_Passwd")); } }
  9. 9. Running test scenarios through maven Maven is a build automation tool used primarily for Java projects Basic concepts, examples: <dependency> <groupId>org.jbehave</groupId> <artifactId>jbehave-core</artifactId> <version>3.4</version> </dependency> <execution> <id>unpack-view-resources</id> <phase>process-resources</phase> <goals> <goal>unpack-view-resources</goal> </goals> </execution> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>2.3.2</version> <configuration> <compilerVersion>1.5</compilerVersion> </configuration> </plugin> mvn clean install
  10. 10. Questions ?

×