Test automation project follows most modern approach to framework design and is based on the following tools/concepts:
Selenium
(most feature-rich, stable and fast browser driver)Java 8
Cucumber for Java 8
(with dependency injection)Multi-layered
test framework structurePageObject
patternMaven profiles
Cucumber is the industry standard for designing BDD-based frameworks and allows the code of tests to be easily-readable, maintainable and expandable. Cucumber scenarios are also the best when it comes to understanding of how functionality works and tested.
Cucumber is also an extremely potent and flexible tool when used just as a test framework and allows to achieve the following:
- Easy
grouping
of scenarios intosets
(with combinations of Cucumbertags
) - Execution of global
setUp/tearDown
code as well asfine-tuned before/after
scenario code for the specific scenarios State (context) sharing
between steps (withdependency injection
)- Powerful built-in reporting capabilities
- Make sure that
JDK 8+
is installed (I use Oracle JDK 8 on macOS) - Make sure that Maven is installed (if not run
brew install maven
on macOS or download the archive from Apache) Chrome
and/orFirefox
are installed
IMPORTANT This solution supports running tests against Chrome
and Firefox
on macOS
and Linux
and
automatically
selects necessary driver - you don't need to download chromedriver
or geckodriver
.
- to run web tests against the
default
browser(Chrome
innormal/GUI
mode):
mvn test
- OR to run web tests against the
default
browser(Chrome
innormal/GUI
mode) and generate Maven site report:
mvn test site
- to run web tests against the
Chrome
browser innormal/GUI
mode :
mvn clean test -P chrome
- to run web tests against the
Chrome
browser inheadless
mode :
mvn clean test -P chrome_headless
- to run web tests against the
Firefox
browser innormal/GUI
mode :
mvn clean test -P firefox
- to run web tests against the
Firefox
browser inheadless
mode :
mvn clean test -P firefox_headless
NOTE - in order to generate Maven site HTML report
please add site
goal to the command (after test
goal and
before -P
parameter).
IMPORTANT - Due to the lack of time cross-browser testing was only performed on macOS
(not on Linux
) -
tests passed in all browser configurations
During
the test execution a detailed information about the current Cucumber scenarios will be displayed in the console.
After
each test run the following reports
will be generated
Cucumber XML
(JUnit),Cucumber JSON
andCucumber HTML
reports can be found in target/reports folder (Cucumber HTML
report contains embeddedscreenshots
of the page in case if there were failures).Maven Surefire HTML
report can be found in target/site folder (requiressite
goal to be specified).Maven Surefire XML
andTXT
reports can be found in target/surefire-reports folder