Specflow: System.InvalidOperationException : Result collection has not been started after all steps were passed

Created on 10 Jan 2020  Â·  12Comments  Â·  Source: SpecFlowOSS/SpecFlow


Result collection has not been started after all steps were passed

SpecFlow Version:

  • [x] 3.1
  • [ ] 3.0
  • [ ] 2.4
  • [ ] 2.3
  • [ ] 2.2
  • [ ] 2.1
  • [ ] 2.0
  • [ ] 1.9
    Current version 3.1.74

Used Test Runner

  • [ ] SpecFlow+Runner
  • [ ] MSTest
  • [x] NUnit
  • [ ] Xunit


Version number:

Project Format of the SpecFlow project

  • [x] Classic project format using packages.config
  • [ ] Classic project format using <PackageReference> tags
  • [ ] Sdk-style project format

.feature.cs files are generated using

  • [ ] SpecFlow.Tools.MsBuild.Generation NuGet package
  • [x] SpecFlowSingleFileGenerator custom tool

Visual Studio Version

  • [x] VS 2019
  • [ ] VS 2017
  • [ ] VS 2015

Enable SpecFlowSingleFileGenerator Custom Tool option in Visual Studio extension settings

  • [x] Enabled
  • [ ] Disabled

Are the latest Visual Studio updates installed?

  • [x] Yes
  • [ ] No, I use Visual Studio version <Major>.<Minor>.<Patch>

.NET Framework:

  • [ ] >= .NET 4.5
  • [ ] before .NET 4.5
  • [ ] .NET Core 2.0
  • [ ] .NET Core 2.1
  • [ ] .NET Core 2.2
  • [x] .NET Core 3.0

Test Execution Method:

  • [x] Visual Studio Test Explorer
  • [ ] TFS/VSTS/Azure DevOps – Task – PLEASE SPECIFY THE NAME OF THE TASK
  • [ ] Command line – PLEASE SPECIFY THE FULL COMMAND LINE

<SpecFlow> Section in app.config or content of specflow.json


Repro Project

Issue Description


Result collection has not been started after all steps were passed.

Steps to Reproduce


1 . Run some scenario

  1. Check result
    Message:
    System.InvalidOperationException : Result collection has not been started.
    Stack Trace:
    TestRunResultCollector.CollectTestResultForScenario(ScenarioInfo scenarioInfo, TestResult testResult)
    TestExecutionEngine.OnAfterLastStep()
    TestRunner.CollectScenarioErrors()
    ValueCaptureMobileApiFeature.ScenarioCleanup()
    In test output or during debug I cannot see any Test Error, also I can see that a TestError=null and Execution status="OK", but after that I have got exception
Question msbuild

All 12 comments

Could you please create a project to reproduce the issue. Thanks!

Could you please create a project to reproduce the issue. Thanks!

Yes, I could. This is link for project with this issue
https://github.com/penknife/SpecflowIssue.git

I send you a PR (https://github.com/penknife/SpecflowIssue/pull/1) with the fix.

The problem was, that you were using the SingleFileGenerator wit SpecFlow 3.0. Normally it doesn't work anymore. No idea why it worked in your case.
But the problem was, that it was still generated code for SpecFlow 3.0. We changed the generation with 3.1. So generated code for 3.0 doesn't work for 3.1.

The PR add the SpecFlow.Tools.MSBuild.Generation package, which generates the code-behind files now when you compile your project.

see:

I send you a PR (penknife/SpecflowIssue#1) with the fix.

The problem was, that you were using the SingleFileGenerator wit SpecFlow 3.0. Normally it doesn't work anymore. No idea why it worked in your case.
But the problem was, that it was still generated code for SpecFlow 3.0. We changed the generation with 3.1. So generated code for 3.0 doesn't work for 3.1.

The PR add the SpecFlow.Tools.MSBuild.Generation package, which generates the code-behind files now when you compile your project.

see:

Oh thanks I will try to fix in my project)))

Should I do any extra steps after pulling your fix?

No. Why?

Thank you))) everything's works as expected

image
image
image

So, i think the issue is reproducible.

image

@ashwinkallembi could you please create a new issue and attach a repro project to it? We thought we fixed this issue, but it doesn't look like it.

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings