Learn-Make BDD Automation Tests using Cucumber, Selenium, Java
Some useful links to advance your learning:
- Cucumber 10 Minute Tutorial
- Selenium WebDriver
- Very nice blog about BDD Testing >>
Getting up and running for your dev-env is as easy as counting 1 to 4 :-)
-
Make sure you have installed Java 8 version 8, Maven version 3.3.1 or higher.
-
Clone this repo and verify compile
git clone https://github.com/CapgeminiNorway/learnmake-cucumber-selenium cd path/to/learnmake-cucumber-selenium mvn clean compile
-
Run all tests and enjoy automation
mvn clean test -DisLocal=true -DisHeadless=false
to see test results are generated, just open this
learnmake-cucumber-selenium/target/cucumber/index.html
in your browseroptional params:
- when running inside Jenkins environment, you must append
-DGITHUB_TOKEN=...public_access_token...
- if you want to forcefully use custom webdrivers (e.g. specific versions), then just append:
-Dwebdriver.gecko.driver=wdm_local/geckodriver -Dwebdriver.chrome.driver=wdm_local/chromedriver
- when running inside Jenkins environment, you must append
-
Run inside Intellij IDEA
Import as standard Maven project.
Then, set 'Cucumber java' defaults of this project as:- Main class:
cucumber.api.cli.Main
- Glue:
learnmake.automation.stepdefs
- feature folder path: point to folder where feature files are
- VM options: (copy the same ones from mvn example )
p.s. Intellij has a bug with Cucumber, here's a workaround
If you remove--plugin org.jetbrains.plugins.cucumber.java.run.CucumberJvm2SMFormatter
from program arguments in the run configuration it will work again. You'll have to do this until InteliJ fixes their plugin. - Main class:
Please contribute with comments, pull-requests, etc.