Skip to content

Recipes

Here are some recipes to use to achieve various goals in flank. For additional recipes or suggestions, please file an issue on Github.

Smartly shard tests in 120 second shards across a maximum of 50 shards.

This recipe will keep track of test durations automatically on firebase test lab and try to split up test runs in to 120 second shards up to maximum of 50 shards.

fladle {
    maxTestShards = 50
    shardTime = 120
    smartFlankGcsPath = "gs://fladle-results/smart-flank/JUnitReport.xml"
}
fladle {
    maxTestShards.set(50)
    shardTime.set(120)
    smartFlankGcsPath.set("gs://fladle-results/smart-flank/JUnitReport.xml")
}

Run different tests on different devices with different Gradle tasks.

./gradlew runFlankPerfTests will execute the performance tests against a Nexus5 ./gradlew runFlankRegresssionTests will execute the regressions tests against a Nexus5LowRes

fladle {
    configs {
        perfTests {
            devices.set([
                ["model" : "Nexus5", "version" : "28"], 
                ["model" : "Nexus6", "version" : "28"]
            ])
            testTargets.set([
                    "class com.sample.MyPerformanceTest"
            ])
        }
        regressionTests {
            devices.set([
                [ "model" : "Nexus5LowRes", "version" : "28"]
            ])
            testTargets.set([
                "class com.sample.MyRegressionTest"
            ])
        }
    }
}
fladle {
    configs {
        create("perfTests") {
            devices.set(listOf(
                mapOf("model" to "Nexus5", "version" to "28" ), 
                mapOf("model" to "Nexus5", "version" to "28")
            ))
            testTargets.set(listOf(
                "class com.sample.MyPerformanceTest"
            ))
        }
        create("regressionTests") {
            devices.set(listOf(
                mapOf("model" to "Nexus5LowRes", "version" to "28" )
            ))
            testTargets.set(listOf(
                "class com.sample.MyRegressionTest"
            ))
        }
    }
}

Always use the latest version of Flank

Use Gradle's dynamic version syntax to declare a dynamic version.

Warning

Dynamic versions lead to non-reproducible builds since Gradle will check for new versions periodically based on how long versions are cached.

flankVersion = "23.+"
flankVersion.set("23.+")