【发布时间】:2018-06-08 20:24:53
【问题描述】:
我目前正在使用 Go 子测试并行运行多个测试。像这样的 -
func TestGroupedParallel(t *testing.T) {
for _, tc := range testCases {
tc := tc // capture range variable
t.Run(tc.Name, func(t *testing.T) {
t.Parallel()
if got := foo(tc.in); got != tc.out {
t.Errorf("got %v; want %v", got, tc.out)
}
...
})
}
}
当我使用超时标志时,它会终止所有并行运行的测试。有什么办法可以让每个子测试超时吗?谢谢!
【问题讨论】:
标签: unit-testing testing go