gpt4 book ai didi

c# - 是否可以根据结果再次运行相同的 specflow 测试?

转载 作者:行者123 更新时间:2023-11-28 20:28:36 25 4
gpt4 key购买 nike

我正在使用 Specflow、Visual Studio 2015 和 Nunit。如果测试再次运行失败,我需要。我有

[AfterScenario]
public void AfterScenario1()
{
if (Test Failed and the counter is 1)
{
StartTheLastTestOnceAgain();
}
}

如何重新开始上次的测试?

最佳答案

在 NUnit 中有 RetryAttribute (https://github.com/nunit/docs/wiki/Retry-Attribute)。看起来 SpecFlow.Retry 插件正在使用它(https://www.nuget.org/packages/SpecFlow.Retry/)。这个插件是一个 3rd 方插件,我还没有使用它。所以不能保证这会如您所愿。

作为替代方案,您可以使用 SpecFlow+Runner ( http://www.specflow.org/plus/ )。这个专门的运行器可以选择重新运行失败的测试。 (http://www.specflow.org/plus/documentation/SpecFlowPlus-Runner-Profiles/#Execution - retryFor/retryCount 配置值)。


全面披露:我是 SpecFlow 和 SpecFlow+ 的开发者之一。

关于c# - 是否可以根据结果再次运行相同的 specflow 测试?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40735099/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com