/selenium-examples

Tests which run using saucelabs and page objects. Based on Selenium Guide Book examples

Primary LanguageJava

selenium framework

Based on the book but expanded. Based on page object modelling

To run in Chrome - open Run > Edit Configurations In VM options, add -Dbrowser=chrome

For other browsers to execute on locally, download the driver and put it in the vendor folder of this project Then update the if/else statement in Base.java in the tests package then update VM options accordingly

SAUCELABS VM option: -Dhost=saucelabs or -Dhost=saucelabs-mobile (This is entered in the VM options currently for each test - need to set up a parameters file I think Local execution: -Dhost=localhost

The saucerest library has been added to the pom.xml so we can set a pass or fail in the saucelabs dashboard instead of just showing as "Finished"

Example saucelabs and sauce labs mobile parameter set to use (tested) -ea -Dhost=saucelabs -Dplatform="Windows 8.1" -Dbrowser="chrome" -DbrowserVersion=41 -ea -Dhost=saucelabs-mobile -Dplatform="android" -DplatformVersion="5.0" -ea -Dhost="saucelabs-mobile" -Dbuild="debug1" -Dplatform="Linux" -DplatformVersion="5.1" -Dbrowser="Android"

Note that click and tap check if the constant host is set to "saucelabs-mobile" or not and then either perform a click or a tap This means that click and tap can be used interchangeably

MAVEN SUREFIRE PLUGIN: Used to execute tests and execute in parallel - pom.xml updated as per Chapter 14 Run as Maven configuration with Surefire:test as the option with any command line parameters This can be run in Jenkins also Report is output to target/surefire folder, look for reports and index.html

TFS INTEGRATION: Requires ultimate version of intelliJ

DATA PROVISIONING: Basic example set up with a test in TestLogin Next step is to use apache poi to read all data and store it, then to access it via a loop in TestLogin. Check TOD0s

TEST REPORTS: http://maven.apache.org/surefire/maven-surefire-report-plugin/usage.html run configuration = site:site or just surefire-report:report

Categories set up using Maven surefire - Smoke & Deep categories can be applied to individual @Test or classes To run only a subset of tests, use -Dgroups=tests.groups.Smoke or -Dgroups=tests.groups.Deep otherwise all will be run as default (specified in the pom.xml) can also use -Dgroups=tests.groups.Shallow,test.groups.Deep

@Override annotation was added to the staring method in tests/Base.java (book does not have this but video walkthrough does and without it, saucelabs tests show as "unnamed job" and don't have a "pass" or "fail"