Git Product home page Git Product logo

kaspresso's Introduction

Kaspresso

Kaspresso is a UiTest framework based on Espresso, UIAutomator and Kakao and assisting to write right and no-pain ui tests.

Capabilities

Stability

Kaspresso provides a mechanism to handle a flakiness of Espresso.

Flakiness in ui tests is when one test passes 50 times but brakes at 51 attempt without any understandable reason. Unfortunately, it's a disease of all ui-tests libraries.

Readability

We like a syntax to write ui-tests providing by Kakao. Just compare:

Espresso:

@Test
fun testFirstFeature() {
    onView(withId(R.id.toFirstFeature))
        .check(ViewAssertions.matches(
               ViewMatchers.withEffectiveVisibility(
                       ViewMatchers.Visibility.VISIBLE)))
    onView(withId(R.id.toFirstFeature)).perform(click())
}

Kakao:

@Test
fun testFirstFeature() {
    mainScreen {
        toFirstFeatureButton {
            isVisible()
            click()
        }
    }
}

But we went even further and made Kakao syntax wider and correlated with the test-case you are writing the test on.

Attention on the code below:

@Test
fun shouldPassOnNoInternetScanTest() =
    beforeTest {
        activityTestRule.launchActivity(null)
        // some things with the state
    }.afterTest {
        // some things with the state
    }.run {
        step("Open Simple Screen") {
            MainScreen {
                nextButton {
                    isVisible()
                    click()
                }
            }
        }

        step("Click button_1 and check button_2") {
            SimpleScreen {
                button1 {
                    click()
                }
                button2 {
                    isVisible()
                }
            }
        }

        step("Click button_2 and check edit") {
            SimpleScreen {
                button2 {
                    click()
                }
                edit {
                    attempt(timeoutMs = 7000) { isVisible() }
                    hasText(R.string.text_edit_text)
                }
            }
        }

        step("Check all possibilities of edit") {
            scenario(
                CheckEditScenario()
            )
        }
    }

Flexibility

We have introduced a mechanism of interceptors giving an ability to catch all actions going to Espresso.

Thanks to this mechanism, the developer can add additional custom actions at each action of Espresso (a logging, a screenshoting), handle results of actions of Espresso and re-run failed actions (flaky tests handling), for example, and do other interesting things.

Part of interceptors was introduced in Kakao version 2.1, another part of interceptors was introduced in Kaspresso.

Ability to call Adb commands

Espresso or UiAutomator doesn't allow to call adb commands inside a test. That's why we have written special AdbServer repository fixing mentioned problem.

In Kaspresso, the developer can call adb and cmd commands by AdbServer class.

Ability to work with Android System

There are a lot of useful classes in Kaspresso to work with Android System.

Examples of such work: 1. push files, 2. enable/disable network, 3. permissions' giving, 4. emulate phone calls, 5. make screenshots, 6. and other.

Feature's screenshoting

Sometimes when developing new features, there is a need to check if the application works properly in all supported languages. Kaspresso offers a possibility make feature's screenshots fast and automatically.

Configurability

The developer can tune any part of Kaspresso thanks to Kaspresso.Builder.

The philosophy

Kaspresso proposes such very important things for ui-tests as the set of rules on how to write ui-tests.

Wiki

For all information check Kaspresso wiki

Integration

To use AdbServer device library, include the jcenter repository to your root build.gradle file (if it does not exist already):

allprojects {
    repositories {
        jcenter()
    }
}

And then add dependency to your module build.gradle:

implementation 'com.kaspersky.android-components:kaspresso:1.0.1'

If you are still using old Android Support libraries, use the <version>-support artifact:

implementation 'com.kaspersky.android-components:kaspresso:1.0.1-support'

Support

Russian support in telegram - t.me/kaspresso

Contribution Policy

Kaspresso is an open source project, and depends on its users to improve it. We are more than happy to find you interested in taking the project forward.
Kindly refer to the Contribution Guidelines for detailed information.

License

Kaspresso is open source and available under the Apache License, Version 2.0.

kaspresso's People

Contributors

matzuk avatar eakurnikov avatar antipovandrey avatar ruslanmingaliev avatar v1sar avatar xanderblinov avatar pstrelchenko avatar klbot avatar priomino avatar avesha avatar mrsoftwaredeveloper avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.