Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to execute tests from visual studio for netcoreapp3.1 project #1877

Closed
9 of 33 tasks
venkatrao-rgare opened this issue Feb 4, 2020 · 5 comments
Closed
9 of 33 tasks

Comments

@venkatrao-rgare
Copy link

venkatrao-rgare commented Feb 4, 2020

SpecFlow Version:

  • 3.1
  • 3.0
  • 2.4
  • 2.3
  • 2.2
  • 2.1
  • 2.0
  • 1.9

Used Test Runner

  • SpecFlow+Runner
  • MSTest
  • NUnit
  • Xunit

Version number:

Project Format of the SpecFlow project

  • 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
  • SpecFlowSingleFileGenerator custom tool

Visual Studio Version

  • VS 2019
  • VS 2017
  • VS 2015

Enable SpecFlowSingleFileGenerator Custom Tool option in Visual Studio extension settings

  • Enabled
  • Disabled

Are the latest Visual Studio updates installed?

  • Yes
  • No, I use Visual Studio version Version 16.4.2

.NET Framework:

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

Test Execution Method:

  • 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

csproj file

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <TargetFramework>netcoreapp3.1</TargetFramework>
    <ApplicationIcon />
    <StartupObject />
  </PropertyGroup>

  <ItemGroup>
    <SpecFlowObsoleteCodeBehindFiles Remove="Features\JustLaunch.feature.cs" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Include="Appium.WebDriver" Version="4.1.1" />
    <PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="3.1.1" />
    <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" />
    <PackageReference Include="Microsoft.TestPlatform" Version="16.4.0" />
    <PackageReference Include="NUnit" Version="3.12.0" />
    <PackageReference Include="Selenium.Support" Version="3.141.0" />
    <PackageReference Include="Selenium.WebDriver" Version="3.141.0" />
    <PackageReference Include="SpecFlow" Version="3.1.80" />
    <PackageReference Include="SpecFlow.Tools.MsBuild.Generation" Version="3.1.80" />
    <PackageReference Include="SpecRun.SpecFlow" Version="3.1.48" />
  </ItemGroup>

  <ItemGroup>
    <None Update="appsettings.json">
      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
    </None>
  </ItemGroup>

</Project>

Issue Description

Trying to execute a simple test from VSTest Explorer doesn't work.

Keep seeing this error message in the html report,

Execution framework error: TechTalk.SpecRun.Framework.SpecRunException: At least one test thread aborted. ---> System.ComponentModel.Win32Exception: The system cannot find the file specified. at TechTalk.SpecRun.Framework.TestThread.UnpackTestThreadExecutorInfoResult(IResult`1 testThreadExecutorInfoResult) at TechTalk.SpecRun.Framework.TestThread.InitializeTestThreadExecutor(IAssemblyReference testAssembly, ExecutionModelSettings executionModelSettings, String testTarget) at TechTalk.SpecRun.Framework.TestThread.GetThreadExecutor(IAssemblyReference testAssembly, ExecutionModelSettings executionModelSettings, String testTarget) at TechTalk.SpecRun.Framework.TestThread.GetThreadExecutorForTestItem(TestItem testItem) at TechTalk.SpecRun.Framework.TestThread.RunNonEmptyTestSuite(CancellationToken cancellationToken, TestThreadState testThreadState) at TechTalk.SpecRun.Framework.TestThread.Run(ITestExecutionManager executionManagerForRun, CancellationToken cancellationToken) at TechTalk.SpecRun.Framework.AsyncTestThreadRunner.RunSync(TestExecutionManager executionManager, CancellationToken cancellationToken) --- End of inner exception stack trace ---

Steps to Reproduce

@SabotageAndi
Copy link
Contributor

Could you create a small project to reproduce your issue? Thanks!

@venkatrao-rgare
Copy link
Author

venkatrao-rgare commented Feb 5, 2020

@SabotageAndi - https://github.com/venkatrao-rgare/specflow-vs2019, at this stage i am not sure if this is an issue with specflow or vs2019 or some setup in my machine. I am fairly new to specflow and visual studio. Please try this project and let me know if this works for you.

@SabotageAndi
Copy link
Contributor

@venkatrao-rgare I could reproduce your issue. Your project is fine.
For me, the problem was, that the test explorer was set to x86, but I don't have .NET Core for x86 installed. I only have x64 installed.
You can see this in the logfile. There is an entry like Executing test executor at 'C:\Program Files (x86)\dotnet\dotnet.exe' 'exec ' .....

After changing to x64, I was able to execute the tests successfully.
image

@venkatrao-rgare
Copy link
Author

@SabotageAndi - Thanks so much it worked for me too :)

@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 25, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants