Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

All possible permutations of parameters using Spock's Unroll

I have the following parameters for the same test:

  a  |  b  |  c
  1  |  2  |  3
 11  | 22  | 33

Spock provides the @Unroll annotation for tests similar to this (with this set of parameters you can run to same tests with the vectors [1, 2, 3] and [11, 22, 33]).

However, I need to run the same test for all the possible permutations (e.g [1, 2, 3], [1, 2, 33], [11, 2, 33] and etc, all the 8 combinations). How can I achieve it?

Thanks for any thoughts!

like image 896
Dmitry Senkovich Avatar asked Aug 10 '17 19:08

Dmitry Senkovich


1 Answers

You need

where:
[a, b, c] << [[1, 11], [2, 12], [3, 13]].combinations()
like image 131
tim_yates Avatar answered Nov 16 '22 01:11

tim_yates