title: When using soft asserts in SpecFlow the test case in the extent report shows test as passed but should be failed
body: <p>I am working with a testing framework that uses BDD approach (SpecFlow), C# and ExtentReports for reporting.</p>
  <p>I'm using soft asserts for my steps to be able to continue executing. The issue is that the test case that is FAILING locally is marked as PASSED in extent reports. How can i set status for the step definition FAILED in order to see the test case is marked as FAILED in extent reports as well? Here is my SofAssert class:</p>
  <pre><code>public static class SoftAssert    {
  
  private static readonly ThreadLocal&lt;List&lt;string&gt;&gt; _assertionsMessages = new ThreadLocal&lt;List&lt;string&gt;&gt;();
          
  public static void Add(Action action)         {
        _assertionsMessages.Value ? ?=new List &lt; string &gt; ();
        try {
          action.Invoke();
        }
        catch(Exception exception) {
          _assertionsMessages.Value.Add(exception.Message);
          LogError(exception.Message);
        }
      }
      public static void AssertAll() {
    
        Logger.Info(&quot;-----------Test Finished-----------&quot;);
        if (_assertionsMessages.Value == null || _assertionsMessages.Value.Count == 0) return;
        var messages = new List &lt; string &gt; (_assertionsMessages.Value);
        _assertionsMessages.Value.Clear();
        throw new AssertionException(messages);
      }
  
  private static void LogError(string message)
          {
              Logger.Fatal(&quot;ERROR =&gt; !!!!!!&quot;);
              Logger.Fatal($&quot;         {message}&quot;);
              Logger.Fatal(&quot;         !!!!!!&quot;);
          }
      }
  </code></pre>
  <p>here is AssertionException :</p>
  <pre><code>public class AssertionException : NUnit.Framework.AssertionException
      {
          public AssertionException(List&lt;string&gt; assertsMessages) : base($&quot;\nAsserts fails:\n{GetFormattedLog(assertsMessages)}&quot;)
          {
  
          }
  
      private static string GetFormattedLog(List&lt;string&gt; assertsMessages)
      {
          var stringBuilder = new StringBuilder();
          assertsMessages.ForEach(message =&gt; stringBuilder.AppendLine(message));
          return stringBuilder.ToString();
      }
  }
  </code></pre>
  <p>And here is my hooks from BaseTest class:</p>
  <pre><code>[BeforeFeature]
          public static void BeforeFeature(FeatureContext featureContext)
          {
              _featureName = _extentReporter.CreateTest&lt;Feature&gt;(featureContext.FeatureInfo.Title);
          }
  
      [BeforeScenario]
  public void BeforeScenario()
  {
    _scenarioName = _featureName.CreateNode &lt; Scenario &gt; (_scenarioContext.ScenarioInfo.Title);
  }
  
  
      [AfterStep]
          public void InsertReportingSteps()
          {
              var stepType = _scenarioContext.StepContext.StepInfo.StepDefinitionType.ToString();
  
              if (_scenarioContext.TestError == null)
              {
                  switch (stepType)
                  {
                      case &quot;Given&quot;:
                          _scenarioName.CreateNode&lt;Given&gt;(_scenarioContext.StepContext.StepInfo.Text);
                          break;
                      case &quot;When&quot;:
                          _scenarioName.CreateNode&lt;When&gt;(_scenarioContext.StepContext.StepInfo.Text);
                          break;
                      case &quot;Then&quot;:
                          _scenarioName.CreateNode&lt;Then&gt;(_scenarioContext.StepContext.StepInfo.Text);
                          break;
                      case &quot;And&quot;:
                          _scenarioName.CreateNode&lt;And&gt;(_scenarioContext.StepContext.StepInfo.Text);
                          break;
                  }
              }
              else if (_scenarioContext.TestError != null)
              {                
                  switch (stepType)
                  {
                      case &quot;Given&quot;:
                          _scenarioName.CreateNode&lt;Given&gt;(_scenarioContext.StepContext.StepInfo.Text).Fail(_scenarioContext.TestError.Message);
    
                          break;
                      case &quot;When&quot;:
                          _scenarioName.CreateNode&lt;When&gt;(_scenarioContext.StepContext.StepInfo.Text).Fail(_scenarioContext.TestError.Message);
  
                          break;
                      case &quot;Then&quot;:
                          _scenarioName.CreateNode&lt;Then&gt;(_scenarioContext.StepContext.StepInfo.Text).Fail(_scenarioContext.TestError.Message);
                          break;
                      case &quot;And&quot;:
                          _scenarioName.CreateNode&lt;And&gt;(_scenarioContext.StepContext.StepInfo.Text).Fail(_scenarioContext.TestError.Message);
                          break;
                  }
              }
              else if (_scenarioContext.ScenarioExecutionStatus.ToString().Equals(&quot;StepDefinitionPending&quot;))
              {
                  switch (stepType)
                  {
                      case &quot;Given&quot;:
                          _scenarioName.CreateNode&lt;Given&gt;(_scenarioContext.StepContext.StepInfo.Text).Skip(&quot;Step Definition Pending&quot;);
                          break;
                      case &quot;When&quot;:
                          _scenarioName.CreateNode&lt;When&gt;(_scenarioContext.StepContext.StepInfo.Text).Skip(&quot;Step Definition Pending&quot;);
                          break;
                      case &quot;Then&quot;:
                          _scenarioName.CreateNode&lt;Then&gt;(_scenarioContext.StepContext.StepInfo.Text).Skip(&quot;Step Definition Pending&quot;);
                          break;
                      case &quot;And&quot;:
                          _scenarioName.CreateNode&lt;And&gt;(_scenarioContext.StepContext.StepInfo.Text).Skip(&quot;Step Definition Pending&quot;);
                          break;
                  }
              }
          }
  
  
  [AfterScenario]
          public static void TearDownReport()
          {
              try
              {
                  SoftAssert.AssertAll();
              }
              finally
              {
                  try
                  {
                      _extentReporter.Flush();
                      
                  }
                  catch (InvalidOperationException e)
                  {
                      //ignored
                  }
              }  
          }
  </code></pre>
  <p>the test is :</p>
  <pre><code>[When(@&quot;Get Alert&quot;)]
      public void WhenTheFirstNumberIsAdded()
      {
          var alert = _Client.GetAlert();
  // Making the test to FAIL. Checking status code equal to 400 
              SoftAssert.Add(() =&gt; alert.SuccessModel.StatusCode.Should().Be(400));  
          }
  </code></pre>