The Agile Way

The Agile Way

Share this post

The Agile Way
The Agile Way
#37: Reliable Client Booking Test
Selenium Training Workbook

#37: Reliable Client Booking Test

A complete, easy to read and maintain test script.

Courtney Zhan's avatar
Courtney Zhan
May 09, 2024
∙ Paid
1

Share this post

The Agile Way
The Agile Way
#37: Reliable Client Booking Test
Share

This is an enhancement exercise of the previous two exercises, to create a production-quality automated test script for this core business scenario for WhenWise.

Learning Objectives

  • The concept of dynamic test data
    When a manual tester performs “Clicking on tomorrow’s date”, a dynamic test data, they can choose it without thinking. In test automation, we have to ‘think’ as ‘robots’,
    - Get today’s date
    - Get tomorrow’s date
    - Get the specific format of tomorrow’s date as required

  • Review
    - Using text() in XPath
    - Refactoring

  • Naming of Modal Page Class

Test Design

The steps are the same as before, mainly two enhancement tasks.

  1. Don’t use hard-coded tomorrow’s day, make it dynamic.
    It is common that we focus on getting test steps working at the first go, with some rough edges to be refine later. But be sure to do that after you get first successful run, which meant the core test steps are fine only.

    However, there are many other factors, such as “Will this test run OK again?”, “Will this test run next week?”, “It is relatively immune to common changes”, … , etc. Make a habit to stabilise and refine the test scripts immediately. For example, the hard-coded date in the previous exercises means the test script works for that day only. Make it dynamic.

    Check out the article, Working Automated Test ≠ Good Reliable Test.

  2. Refactoring
    For longer test script, it is even more important to refactor as you go. This will help keep your mind clear and debugging test scripts easier.
    The most common refactoring is “Extract to Page Function”.

Tasks

Task 1. Get a dynamic date for booking, e.g. tomorrow

Thanks to the brilliant ActiveSupport library in Ruby, generating a dynamic date is easy.

Keep reading with a 7-day free trial

Subscribe to The Agile Way to keep reading this post and get 7 days of free access to the full post archives.

Already a paid subscriber? Sign in
© 2025 Zhimin Zhan
Privacy ∙ Terms ∙ Collection notice
Start writingGet the app
Substack is the home for great culture

Share