Coder Social home page Coder Social logo

colibri's Introduction

Colibri

Colibri is an android library for autotesting UI.

Uses UiAutomator and Espresso.

Colibri

Gradle Dependency

Add it in your root build.gradle at the end of repositories:

allprojects {
	repositories {
		...
		maven { url "https://jitpack.io"}
	}
}

Add the dependency:

dependencies {
	androidTestImplementation 'com.github.kernel0x:colibri:1.0.0'
}

How to use

In androidTest create a class inheritable from ColibriTest or in already created class initialize class Colibri.

class SampleColibriTest : ColibriTest() {
    override fun getCondition(): Condition {
        return Condition.Builder()
                .randomInputText(arrayOf("borscht", "vodka", "bear"))
                .pause(Duration(500, TimeUnit.MILLISECONDS))
                .build()
    }

    override fun getStrategy(): Strategy {
        return Monkey()
    }

    @Test
    fun colibriTest() {
        launch()
    }
}

OR

class SampleColibriTest {

    @get:Rule
    var permissionRule = GrantPermissionRule.grant(android.Manifest.permission.WRITE_EXTERNAL_STORAGE, android.Manifest.permission.READ_EXTERNAL_STORAGE)

    @Test
    fun colibriTest() {
        Colibri.condition(Condition.Builder()
                .randomInputText(arrayOf("borscht", "vodka", "bear"))
                .pause(Duration(500, TimeUnit.MILLISECONDS)).build())
                .strategy(Monkey())
                .launch()
    }
}

Everything is simple. Now you can run the test!

How to works

Colibri runs throughout the app, analyzing UI elements on each screen.

You can set different testing strategies and conditions. All conditions are available in Condition.Builder()

You can create custom behavior that will be executed at each step (for example for authorization). Example:

.addCustomBehavior(CustomBehavior {
                    if (getCurrentActivity().localClassName.equals(LoginActivity::class.java.canonicalName)) {
                        try {
                            onView(withId(R.id.text_username)).perform(setTextInEditText("mylogin"))
                            onView(withId(R.id.text_password)).perform(setTextInEditText("qwerty"))
                            onView(withId(R.id.button_login)).perform(click())
                            Thread.sleep(Duration.FIVE_SECONDS.valueAsMs)
                        } catch (e: Exception) {}
                    }
                })

Features

  • condition configuration
  • different behavioral strategies
  • customization of behavior
  • logging and screenshots

Try it

Check out the sample project to try it yourself! ๐Ÿ˜‰

Releases

Checkout the Releases tab for all release info.

colibri's People

Contributors

kernel0x avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 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.