Skip to content

Kotlin test automation framework for Selenium/Appium

License

Notifications You must be signed in to change notification settings

QAutomatron/kaper

Repository files navigation

Kaper Build Status Download

Test automation framework for Selenium/Appium written in Kotlin

Basics

Base structure is: Test - Steps - Elements

All step classes should be inherited from Step()

All steps in test should be init by lazy {}: private val mySteps by lazy { MySteps() }

First call to any step in test will invoke WebDriver or AppiumDriver creation. One Driver per thread

Every element in steps should be wrapped in kEl(By)

Could use TestNG listener KListener

Could use AspectJ step logger com.qautomatron.kaper.core.listener.StepLogger

Installation (Gradle)

  1. Add repository to your project:
repositories {
    mavenCentral()
    jcenter()

    maven {
        url  "https://dl.bintray.com/qautomatron/kaper"
    }
}
  1. Add dependency:
dependencies {
    compile 'com.qautomatron:kaper:0.0.16'
}

How to use

  1. Create step classes inherited from Steps()
  2. Add some elements to you new step class:
    private val btnYes = kEl(ai("Yes")) // ai is alias for AccessibilityId
    private val popup = kEl(ai("SomePopup"))
  1. Add some methods to interact with elements:
    fun tapYes() {
        btnYes.click()
    }
  1. Or Add asserts:
    fun popupShouldBePresent() {
        assertTrue("Popup should be visible",
            popup.waitForVisibility())
    }
  1. Write test:
class SampleTest {

    private val mySteps by lazy { MySteps() }

    fun example_test() {

        // Tap Yes
        mySteps.tapYes()

        // Check Popup visible
        mySteps.popupShouldBePresent()
    }
}

Contributing

Will add info

Authors

License

This project is licensed under the Apache 2.0 License - see the LICENSE file for details

Acknowledgments

  • Inspired by: