Example UI tests for the AURDroid mobile application for Android.
Automated UI tests are written in Kotlin (script), with Appium for mobile app interaction.
Proof of concept for writing automated test scripts with the experimental scripting mode of the Kotlin runtime. Attempting to show the viability of a lighter weight workflow, and avoid Java 😝
# on Mac OS, use HomeBrew and NPM to install system dependencies
# ... and let's just assume you have the Android SDK installed already
$ brew install kotlin
$ brew install node
$ npm install -g appium@latest
$ kotlinc -script TestRunner.main.kts
The tests are defined in AURDroid.kts. The tests interact with the AURDroid mobile application.
Each screen of the mobile application is represented by a class which implements methods of interacting with and retrieving information from the screen: Home.kts, Results.kts, Package.kts These classes are the mobile version of the Page Object Model design pattern.
TestRunner.main.kts contains a minimal test runner using JUnitCore.
When you give a Kotlin file the .main.kts extension, Kotlin's experimental scripting extension will trigger for script execution. The experimental extension enables special annotations like @file:DependsOn to specify external project dependencies, and @file:Import to specify internal dependencies.
Putting these annotations at the top of a script file saves you some work and complexity that you're normally stuck with when you work with a JVM-based language. And I'm getting pretty tired of editing Gradle build scripts 🐘 😩