|
|
|
|
|
by frederikb
4511 days ago
|
|
An interesting alternative to this is Spock [1], a specification framework for Java and Groovy with a nice Groovy DSL. Check out the new reference documentation [2] or try out some specifications using the web console [3]. It has a great syntax for data driven and interaction based syntax. Data driven example: class Math extends Specification {
def "maximum of two numbers"(int a, int b, int c) {
expect:
Math.max(a, b) == c
where:
a | b | c
1 | 3 | 3
7 | 4 | 4
0 | 0 | 0
}
}
[1] https://code.google.com/p/spock/[2] http://docs.spockframework.org/en/latest/ [3] http://meetspock.appspot.com/ |
|
With DSL's in groovy it always looks like the provided syntax is trying to code around Groovy's syntactic limitations, e.g. having to use the bar | in the example