Skip to content

Example UI Tests for Citi Bike web app using Selenium + Kotlin

License

Notifications You must be signed in to change notification settings

bgroJr/CitiBikeTest

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🗽 🚲 CitiBike UI Test Examples

Example UI tests for the Citi Bike web application.

Automated UI tests are written in Kotlin (script), with Selenium for browser interaction.

Purpose

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 😝

Setup

# on Mac OS, use Homebrew to install Kotlin
$ brew install kotlin

Run

$ kotlinc -script TestRunner.main.kts

Tests

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.

.main.kts

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 🐘 🙄

Releases

No releases published

Packages

No packages published

Languages