3

I have a bunch of scenarios written in my feature file that have Assertions in them. If the First scenario fails an assertion, Specflow skips all the scenarios that follow after it. I would like for all my scenarios to continue to run even if one them fails just like in NUnit. I am using SpecRun as the test provider, I could not find anything on the SpecFlow website that would help me. Could it be that I am missing something in my App.config file?

The following is my App.config file:

<?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>
AKN
  • 163
  • 1
  • 10

1 Answers1

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.

AKN
  • 163
  • 1
  • 10
  • 1
    In addition, you can copy Default.srprofile into your project. Check the [Official SpecFlow documentation](https://docs.specflow.org/projects/specflow-runner/en/latest/Profile/Profiles.html). That works for me – David López Oct 28 '21 at 23:36