Example UI tests for the Citi Bike web application.
Automated UI tests are written in Kotlin (script), with Selenium for browser interaction.
Proof of concept for using the scripting capabilities of Kotlin to write test scripts (.kts files). Attempting a lighter weight, more agile approach to an area of the technical stack where Java is the most commonly used language 😝
# on Mac OS, use Homebrew to install Kotlin
$ brew install kotlin
$ kotlinc -script TestRunner.main.kts
The tests are defined in CitiBike.kts. The tests interact with the Citi Bike web application.
Each relevant page of the web application is represented by a class which implements methods of interacting with and retrieving information from the page. These classes are an instance of the Page Object Model design pattern.
TestRunner.main.kts contains a minimal test runner using JUnitCore.
By giving a Kotlin file the extension ".main.kts", when you run the file, the special extension will trigger Kotlin's experimental scripting functionality. The experimental functionality includes the special annotation "@file:DependsOn" to specify external dependencies, and "@file:Import" to specify internal dependencies.
Specifying the dependencies at the top of the script saves some work that would otherwise be done with a project build tool and its many associated scripts / configurations. Looking at you, Gradle 🐘 🙄