Unit testing 在Spock测试中根据输入创建组合
在我的Spock测试中,这是我当前的where块Unit testing 在Spock测试中根据输入创建组合,unit-testing,groovy,spock,Unit Testing,Groovy,Spock,在我的Spock测试中,这是我当前的where块 where: [A,B,C] << [ ["A1","B1","C1"], ["A1","B1","C2"], ] 其中: [A,B,C]这里有一个解决方案: where: [A, B, C] << [[["A1","B1"]],["C1","C2"]].combinations()*.flatten() 其中: [A,B
where:
[A,B,C] <<
[
["A1","B1","C1"],
["A1","B1","C2"],
]
其中:
[A,B,C]这里有一个解决方案:
where:
[A, B, C] << [[["A1","B1"]],["C1","C2"]].combinations()*.flatten()
其中:
[A,B,C]你需要这样的东西:
where:
[A, B, C] << [
['a1', 'a2', 'a3'],
['b1', 'b3'],
['c1']
].combinations()
其中:
谢谢彼得,这正是我想要的。但我能说什么呢。在这个组合之后,在[A,B,C]处执行此操作。您可以使用+
添加两个表达式/集合,或者将[“C1”,“C2”]
更改为[“C1”,“C2”,“C3”,“C4”]
。可能是时候移动
where:
[A, B, C] << [
['a1', 'a2', 'a3'],
['b1', 'b3'],
['c1']
].combinations()