2014-06-27 64 views
2

我有一堆场景写在我的功能文件中,其中有断言。如果第一个场景的断言失败,则Specflow将跳过其后的所有场景。我希望所有场景都能继续运行,即使其中一个失败,就像在NUnit中一样。我使用SpecRun作为测试提供者,在SpecFlow网站上找不到任何可以帮助我的东西。难道是我在App.config文件中丢失了一些东西?SpecFlow跳过方案,如果它之前失败断言

以下是我App.config文件:一些失败的测试后

<?xml version="1.0" encoding="utf-8"?> 
<configuration> 
    <configSections> 
    <section name="specFlow" type="TechTalk.SpecFlow.Configuration.ConfigurationSectionHandler, TechTalk.SpecFlow" /> 
    </configSections> 
    <specFlow> 
    <!-- For additional details on SpecFlow configuration options see http://go.specflow.org/doc-config --> 
    <unitTestProvider name="SpecRun" /> 
    <!-- setting flag to continue on first assert error --> 
    <runtime stopAtFirstError="false" /> 
    <plugins> 
     <add name="SpecRun" /> 
    </plugins> 
    </specFlow> 
</configuration> 

回答

6

SpecRun实际停止执行。此限制可以在.srprofile(EX:Default.srprofile)中用以下行指定。

<Execution retryFor="None" stopAfterFailures="0" testThreadCount="1" testSchedulingMode="Sequential" /> 

retryFor =“None”将告诉SpecRun不会在重试失败时不重试测试。

stopAfterFailures =“0”会告诉Specrun在任何故障后不会停止并继续。