// START SNIPPET after-evaluate
allprojects {
    afterEvaluate { project ->
        if (project.hasTests) {
            println "Adding test task to $project"
            project.task('test') << {
                println "Running tests for $project"
            }
        }
    }
}
// END SNIPPET after-evaluate

allprojects {
    hasTests = false
}
