Sonja
Sonja

Reputation: 595

SpecFlow test not displayed in the test explorer

I have installed Visual studio 2015 on multiple PC and application that is using SpecFlow. The application is working normally on 1 pc because everything there was installed long time ago. However on the other PCs tests are not being displayed in the test explorer, and I need them in the test explorer. Please help

Upvotes: 7

Views: 13884

Answers (6)

Dmitry Karpenko
Dmitry Karpenko

Reputation: 592

In addition to the accepted answer:

What helped me is installing the NUnit3TestAdapter NuGet package:

NUnit3TestAdapter NuGet package

Upvotes: 0

Kaveh Naseri
Kaveh Naseri

Reputation: 1266

You just need to add these configurations in your .csproj file.

  1. Remove Microsoft.NET.Test.Sdk and replace it with Microsoft.TestPlatform.TestHost

  2. Add these two in PropertyGroup tag and rebuild the project

     <CopyLocalLockFileAssemblies>false</CopyLocalLockFileAssemblies>
     <GenerateRuntimeConfigDevFile>true</GenerateRuntimeConfigDevFile>
    

Upvotes: 0

Santhoshkumar Polu
Santhoshkumar Polu

Reputation: 11

if you have a file .srpofile in your solution, then adjust your gherkin steps according to file tags.# \in my case .srprofile is like below

<?xml version="1.0" encoding="utf-8"?>
<TestProfile xmlns="http://www.specflow.org/schemas/plus/TestProfile/1.5">
    <Settings projectName="project.test" projectId="{9A19103F-16F7-4668-BE54-9A1E7A4F7556}" outputFolder=".\Results" />
    <Execution stopAfterFailures="0" retryFor="None" testSchedulingMode="Sequential" />
    <Filter>@automated</Filter>
    <TestAssemblyPaths>
        <TestAssemblyPath>project.test.dll</TestAssemblyPath>
    </TestAssemblyPaths>
</TestProfile>

Upvotes: 0

Amishra
Amishra

Reputation: 41

For me, the test displayed after the Specflow MSTest was added from NuGet. enter image description here

Upvotes: 4

Sonja
Sonja

Reputation: 595

Thanks guys but I managed to fix my problem. The tests are displayed as soon as NUnit Test Adapter is installed:

Go to Tools->Extensions and updates ->Online->Visual Studio Gallery->Tools->Testing and select NUnit Test Adapter

Upvotes: 1

DerrickF
DerrickF

Reputation: 682

Tests are not displayed in the Test Explorer window when using SpecFlow+ Runner

I run into this all the time. There is a great section on the GitHub repo page for specflow that I keep bookmarked for when stuff like this comes up. Usually this one (deleting the cache file) fixes issues for me.

The Visual Studio Test Adapter cache may also get corrupted, causing tests to not be displayed. If this happens, try clearing your cache as follows:

  1. Close all Visual Studio instances
  2. Navigate to your %TEMP%\VisualStudioTestExplorerExtensions\ folder and delete any sub-folders related to SpecFlow/SpecRun.
  3. Reopen your solution and ensure that it builds.

https://github.com/techtalk/SpecFlow/wiki/Troubleshooting-Visual-Studio-Integration

Hope this helps

Upvotes: 1

Related Questions