是否可以根据结果再次运行相同的 specflow 测试? [英] Is it possible to run same specflow test again based on outcome?

查看:24
本文介绍了是否可以根据结果再次运行相同的 specflow 测试?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是 Specflow、Visual Studio 2015 和 Nunit.如果测试无法再次运行,我需要.我有

I'm using Specflow, Visual studio 2015 and Nunit. I need if a test fails to run it once again. I have

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

如何重新开始上次测试?

How do I start the last test again?

推荐答案

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

In NUnit there is the RetryAttribute (https://github.com/nunit/docs/wiki/Retry-Attribute) for that. It looks like that the SpecFlow.Retry plugin is using that (https://www.nuget.org/packages/SpecFlow.Retry/). This plugin is a 3rd party plugin and I did not used it yet. So no guarantee that this works as you want.

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

As alternative you could use the SpecFlow+Runner (http://www.specflow.org/plus/). This specialized runner has the option to rerun your failed test. (http://www.specflow.org/plus/documentation/SpecFlowPlus-Runner-Profiles/#Execution - retryFor/retryCount config value).

完全披露:我是 SpecFlow 和 SpecFlow+ 的开发者之一.

Full disclosure: I am one of the developers of SpecFlow and SpecFlow+.

这篇关于是否可以根据结果再次运行相同的 specflow 测试?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆