Shows insertion of values in test name. @Unroll
is required for this.
Last active
August 29, 2015 14:22
-
-
Save westonal/06284a438166f3e69d78 to your computer and use it in GitHub Desktop.
Groovy Spock Specification Tests
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import spock.lang.* | |
@Unroll | |
class ExampleSpockSpec extends Specification { | |
def "max of #a and #b is #c"() { | |
expect: | |
Math.max(a, b) == c | |
where: | |
a | b || c | |
1 | 2 || 2 | |
3 | 1 || 3 | |
2 | 2 || 2 | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<project> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>com.example</groupId> | |
<artifactId>SpockExample</artifactId> | |
<version>1</version> | |
<dependencies> | |
<dependency> | |
<groupId>org.spockframework</groupId> | |
<artifactId>spock-core</artifactId> | |
<version>1.0-groovy-2.4</version> | |
</dependency> | |
</dependencies> | |
</project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment