Fast

    RoboSpock tests are executed on the JVM. That means no DEXing or deployment time is wasted to execute your unit tests.

    Minimal

    RoboSpock glues several frameworks together and enables you to work with them directly.

    Batteries included

    Enjoy the support for Spock framework, Groovy language and RoboGuice

    Welcome

    RoboSpock combines two great test frameworks and lets you get the best of both - to run fast unit test written with Groovy on local JVM.

    It integrates well with Gradle build system and works with older Ant based projects.


    def "should display hello text"() {
        given:
        def textView = new TextView(RuntimeEnvironment.application)
    
        expect:
        textView.text == "Hello"
    }
                    

    Thanks to RoboSpock you can

    • Unit test Android code with Spock and Groovy
    • Write readable specifications
    • Execute tests fast on JVM
    • Mock your objects and test interactions
    • Specify behavior of Android SDK classes
    • Modify runtime dependencies configured with RoboGuice

    Installation

    For every build tools Android projects has it's clashes with IDE support. We've done our best to show you how to integrate your whole environment for both Ant and Gradle (New Build System).

    buildscript {
        repositories {
            jcenter()
        }
        dependencies {
            classpath 'com.android.tools.build:gradle:1.2.3'
            classpath 'org.codehaus.groovy:gradle-groovy-android-plugin:0.3.6'
        }
    }
    
    apply plugin: 'com.android.application'
    apply plugin: 'groovyx.grooid.groovy-android'
    
    repositories {
        mavenCentral()
    }
    
    dependencies {
        testCompile 'org.robospock:robospock:1.0.0'
    }
    

    Samples

    This section provides useful examples for integrating unit tests into diversed Android projects.

    Dagger

    Soon you will wind here sample project with Dagger DI integration.

    Need more?

    If you don't know how to test a code framgent please - we'll be happy to help.