3

我在我的功能文件中编写了一堆场景,其中包含断言。如果第一个场景的断言失败,Specflow 会跳过它之后的所有场景。我希望我的所有场景都能继续运行,即使它们像在 NUnit 中一样失败。我使用 SpecRun 作为测试提供者,我在 SpecFlow 网站上找不到任何可以帮助我的东西。可能是我的 App.config 文件中缺少某些内容吗?

以下是我的 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>
4

1 回答 1

11

SpecRun actually stops execution after a number of failing tests. This limit can be specified in the .srprofile (EX: Default.srprofile) with the following line.

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

retryFor = "None" will tell SpecRun not to retry a test if it fails an assertion.

stopAfterFailures = "0" will tell SpecRun not to stop after any failures and continue.

于 2014-07-02T14:14:07.010 回答