Jbehave selenium

865
-1

Published on

Published in: Technology
1 Comment
1 Like
Statistics
Notes
No Downloads
Views
Total Views
865
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
41
Comments
1
Likes
1
Embeds 0
No embeds

No notes for slide

Jbehave selenium

  1. 1. Solution for automated testing web apps Vadym Goncharenko, December 2013
  2. 2. Agenda: 1. Behavior driven development 2. Introduction to JBehave 3. Automated testing with Selenium 4. The page objects pattern 5. How to add new test scenario 6. Running test scenarios through maven 7. An example of best practice 8. Reporting JBehave results 9. Questions ?
  3. 3. Behavior driven development Behavior-driven development is a software development process based on test-driven development (TDD)
  4. 4. Introduction to JBehave JBehave is a framework for Behaviour-Driven Development
  5. 5. Automated testing with 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. The page objects pattern • More popular in test automation; • Page object is an object-oriented; • Serves as an interface to a page; Enhancing test maintenance; Reducing code duplication; Web page Java class Test cases
  7. 7. How to add new test scenario • 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() { }
  8. 8. 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 mvn install –Dtest=testname mvn install -DskipTests
  9. 9. An example of best practices • Each scenario must make sense and be able to be executed independently; • Stories may be dependent of each other. If so, they must declare their dependencies; • A scenario should consist of steps: "Given“, "When“, "Then"; • Steps of type "Given" and "When" should not perform a verification; • Steps of type "Then" should not perform actions; • Each scenario should not run longer than 3 minutes. • Step names should be written in business language terms.
  10. 10. Reporting Jbehave results
  11. 11. Questions ?
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×