Teacher instructions for the Selenium course
Preparations
Update the sample project with the versions with modern versions.
Create a new branch from master for the specific course so the code can be shared with the participants.
Clone it somewhere, projects/tsu/selenium-test-automation, and work on it there.
Introduction
Sample page: http://selenium.thinkcode.se/
Example - Selenium IDE
Record a Hello, world!
- Start Selenium IDE
- Note that it is in recording mode
- Browse to http://selenium.thinkcode.se
- Right click on the web page and
- Assert title
- Stop recording
- Replay
- Change the assert, remove world and
- Re-run
- See that it fails
- Fix it and re-run and see that it passes
- Save the test case
Record submission of a form
- Create a new test case
- Start recording
- Fill out the password form and assert the result
Open Idea with the example project in the right branch
Example - WebDriver
Export the code from Selenium IDE and import it in a test class
src/test/java/se/thinkcode/selenium/ExportedHelloWorldTest.java
- Format the code
- Remove the unused methods
- Notice the bug with an ending slash
- Run the test
Create a new test class
src/test/java/se/thinkcode/selenium/HelloWorldTest.java
Implement HelloWorld without page object
Source code: HelloWorldTest.java
Implement HelloWorld with page object
Source code:
HelloWorldTest.java
HelloWorldPage.java
Back to the presentation
Filling a form
Source code:
RequestNewPasswordTest.java
RequestPasswordPage.java
ConfirmPasswordSentPage.java
Back to the presentation
Check boxes
Source code:
SelectColorTest.java
SelectColorPage.java
SelectedColorPage.java
Back to the presentation
Radio buttons
Source code:
SelectBeverageTest.java
SelectBeveragePage.java
Back to the presentation
Drop down
Source code:
SelectCondimentTest.java
SelectCondimentPage.java
Back to the presentation
Data driven test
Source code:
RequestNewPasswordForLoopTest.java
RequestNewPasswordTest.java
Back to the presentation
Screenshot on failure
Source code:
FailingTest.java
ScreenShotRule.java
Back to the presentation
Slow response
Source code:
ExchangeRateTest.java
RequestExchangeRatePage.java
ExchangeRatePage.java
ResultPageException.java
Back to the presentation
Pop up
Source code:
NewPageTest.java
NewPage.java
AlertTest.java
AlertPage.java
Back to the presentation
Cross browser
Source code:
HelloWorldLocalTest.java
NOT
UP TO DATE HelloWorldSaucelabsTest.java
NOT
UP TO DATE HelloWorldPage.java
Executable specification
Source code:
ChangePassword.feature
RunCukesTest.java
PasswordSteps.java
PasswordHelper.java
RequestPage.java
ConfirmationPage.java