0

We've got a lot of test cases that require specific data to be in the environment but the environment is not properly populated a lot of times.

Right now we're failing those tests but I was thinking about running them and marking them as 'pending' instead if the data is not there, so then it's easy to just run those in isolation.

Is this somehow possible? How could I stop the execution of the cucumber test so that it's reported as pending (or any other status different to 'failed' or 'passed' could do if that exists).

Cheers!

4

2 回答 2

0

您可以只调用pending一个步骤定义来停止该场景的执行并将其标记为待处理。

于 2012-11-15T14:40:04.193 回答
0

我不太清楚你所说的“实时”是什么意思,但总的来说是的。创建一个新的自定义输出格式化程序,用于创建待处理测试的列表并重新运行它们。默认情况下可用的重新运行输出格式化程序几乎已经完成了您想要的操作。参见例如这里。它允许您重新运行失败的测试。

如果您查看重新运行格式化程序的源代码,它具有以下内容:

def step_name(keyword, step_match, status, source_indent, background, file_colon_line)
        @rerun = true if [:failed, :pending, :undefined].index(status)
end

只需创建您自己的自定义格式化程序,该格式化程序仅将带有 :pending 状态的测试标记为重新运行。您总是可以在测试中将某些内容标记为待处理,请参阅例如问题How do you mark a Cucumber Scenario as Pending

于 2012-11-15T12:54:51.020 回答