Include spock testing support in the application

This requires pinning a specific minor version of Groovy since Spock requires a
specific package name for each major/minor release of Groovy
This commit is contained in:
R. Tyler Croy 2016-12-18 12:14:54 -08:00
parent 2822beb0f5
commit ab5d9b0b7e
No known key found for this signature in database
GPG Key ID: 1426C7DC3F51E16F
2 changed files with 27 additions and 6 deletions

View File

@ -29,14 +29,11 @@ repositories {
}
dependencies {
compile localGroovy()
compile 'org.codehaus.groovy:groovy-all:[2.4.7,2.5.0)'
compile "io.dropwizard:dropwizard-core:${dropwizardVersion}"
// Declare the dependency for your favourite test framework you want to use in your tests.
// TestNG is also supported by the Gradle Test task. Just change the
// testCompile dependency to testCompile 'org.testng:testng:6.8.1' and add
// 'test.useTestNG()' to your build script.
testCompile 'junit:junit:4.12'
testCompile "io.dropwizard:dropwizard-testing:${dropwizardVersion}"
testCompile 'org.spockframework:spock-core:1.0-groovy-2.4'
}
task generateExampleYaml {
@ -55,3 +52,13 @@ run {
args 'server', "${buildDir}/httpwizard.example.yml"
dependsOn generateExampleYaml
}
test {
testLogging {
/* we want more test failure information, see:
* <http://mrhaki.blogspot.com/2013/05/gradle-goodness-show-more-information.html>
*/
exceptionFormat = 'full'
events "passed", "skipped", "failed", "standardOut", "standardError"
}
}

View File

@ -0,0 +1,14 @@
package io.lasagna.httpwizard
import spock.lang.Specification
class HttpWizardSpec extends Specification {
def "ensure app can be instantiated"() {
when:
def app = new HttpWizard()
then:
app instanceof HttpWizard
}
}