This tutorial uses JBehave 3.x and Selenium 2.x to test Etsy.com (an live online shopping site).
This will run the build and (after a minute or so) Firefox will open and test the etsy.com website:
mvn clean integration-test -Dspring.profiles.active=localWebDriver
You should see Firefox (installed on your system) flicker as it tests Etsy.com
This will run a single story (one contained in a etsy_cart.story file):
mvn clean install -DstoryFilter=etsy_cart -Dspring.profiles.active=localWebDriver
This will run a suite based on the meta filters in the three story files:
mvn clean install -Dmeta.filter="+color red" -Dspring.profiles.active=localWebDriver
In directory target/jbehave/view, a page named 'reports.html' has been generated, which you open that in any browser to the stories that have run and their execution status.
This project counts with several WebDriver implementations to run over diferent architectures
To run the tests locally run with -Dspring.profiles.active=localWebDriver To run the test on SauceLabs add the following -Dspring.profiles.active=sauceWebDriver -DSAUCE_USERNAME= -DSAUCE_ACCESS_KEY= To run against your own grid configuration
There should be a row for each story. The story reports are clickable to via links on the right-most column.
The tutorial aims to provide a fully-functional project that you can use to model you own project:
- src/main/java/org/jbehave/tutorials/etsy/EtsyDotComStories.java is the entry-point that JBehave uses to run the stories.
- src/main/stories contains the stories run by JBehave via EtsyDotComStories.java.
- src/main/java/org/jbehave/tutorials/etsy/steps/HousekeepingSteps.java contains the steps does housekeeping chores, such as emptying cart between scenarios.
- src/main/java/org/jbehave/tutorials/etsy/steps/EtsyDotComSteps.java contains the steps mapped to the textual steps.
- src/main/java/org/jbehave/tutorials/etsy/pages contains the Groovy page-objects used by steps to abstract in a more manageable and maintainable way the interaction with the web pages via Selenium WebDriver.
- src/main/resources/etsy-steps.xml contains the Spring configuration for composition the steps