Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Groovy 斯波克;其中;带因变量_Groovy_Spock - Fatal编程技术网

Groovy 斯波克;其中;带因变量

Groovy 斯波克;其中;带因变量,groovy,spock,Groovy,Spock,我试图在斯波克做一些数据驱动测试 我有一个变量,它依赖于另一个变量:ie Services = ["tf1", "fr2"] Questions(service) = ["What is on {service} ?", "Switch to {service}"] 我希望我的测试能够检查所有可能的服务和问题组合(服务):总共4个测试 我试着写一个where:子句如下: where: service << SERVICES question <

我试图在斯波克做一些数据驱动测试

我有一个变量,它依赖于另一个变量:ie

Services = ["tf1", "fr2"]
Questions(service) = ["What is on {service} ?", "Switch to {service}"]
我希望我的测试能够检查所有可能的服务和问题组合(服务):总共4个测试

我试着写一个
where:
子句如下:

    where:
      service << SERVICES
      question << Questions(service)
其中:

服务您想要的是不可能的,所有变量必须具有相同的基数。对于每个
服务
条目,必须恰好有一个相应的
问题

你在评论中写的是正确的方法,你可以将它提取到一个助手方法
where:[服务,问题]这里是我现在做的,我发现很难阅读,所以不适合测试:where:[服务,问题]getQuestions(s)。收集{q->[s,q]}