https://dzone.com/articles/spock-data-driven-testing
http://aruizca.com/integrated-vs-functional-testing-how-to-test-rest-apis-in-grails-using-spock/
@Unroll def '#wc should return getlasterror document #commandDocument'() { expect: wc.asDocument() == commandDocument; where: wc | commandDocument WriteConcern.UNACKNOWLEDGED | ['getlasterror': 0] WriteConcern.ACKNOWLEDGED | ['getlasterror': 1] WriteConcern.REPLICA_ACKNOWLEDGED | ['getlasterror': 1, 'w': 2] WriteConcern.JOURNALED | ['getlasterror': 1, 'j': true] WriteConcern.FSYNCED | ['getlasterror': 1, 'fsync': true] new WriteConcern('majority') | ['getlasterror': 1, 'w': 'majority'] new WriteConcern(1, 100) | ['getlasterror': 1, 'wtimeout': 100] }all the lines under where: get run, regardless of whether the test before it passes or fails. This basically is seven different tests, but takes up the same space as one.
@Unroll def 'should generate index name #indexName for #index'() { expect: index.getName() == indexName; where: index | indexName new Index('x') | 'x_1' new Index('x', OrderBy.ASC) | 'x_1' new Index('x', OrderBy.DESC) | 'x_-1' new Index(new Index.GeoKey('x')) | 'x_2d' new Index(new Index.OrderedKey('x', OrderBy.ASC), new Index.OrderedKey('y', OrderBy.ASC), new Index.OrderedKey('a', OrderBy.ASC)) | 'x_1_y_1_a_1' new Index(new Index.GeoKey('x'), new Index.OrderedKey('y', OrderBy.DESC)) | 'x_2d_y_-1' }http://hamletdarcy.blogspot.com.es/2009/05/new-power-assertions-in-groovy.html
http://aruizca.com/integrated-vs-functional-testing-how-to-test-rest-apis-in-grails-using-spock/