SpecFlowOSS / SpecFlow

#1 .NET BDD Framework. SpecFlow automates your testing & works with your existing code. Find Bugs before they happen. Behavior Driven Development helps developers, testers, and business representatives to get a better understanding of their collaboration
https://www.specflow.org/
Other
2.24k stars 754 forks source link

SpecFlowNUnitExtension.cs prevents tests from appearing in TestExplorer #648

Closed AndyLPK247 closed 5 years ago

AndyLPK247 commented 8 years ago

Problem

I have a SpecFlow test project in Microsoft Windows Visual Studio 2015 Professional. It has one feature file and one C# source file with step definitions. The unit test provider is NUnit. I have the appropriate Visual Studio extensions installed, and I also have the SpecFlow and NUnit dependencies on the project through NuGet. Visual Studio automatically generates a file named SpecFlowNUnitExtension.cs in the project. However, this causes the SpecFlow tests to not appear in Test Explorer. If I delete SpecFlowNUnitExtension.cs or comment out its code, then the tests will appear in Test Explorer.

Visual Studio Extensions

`<?xml version="1.0" encoding="utf-8"?>

` ## App.config `
` ## With SpecFlowNUnitExtension.cs ![image](https://cloud.githubusercontent.com/assets/17988946/16153968/ce4ab044-3476-11e6-9a37-3365f3580be2.png) ## Without SpecFlowNUnitExtension.cs ![image](https://cloud.githubusercontent.com/assets/17988946/16154022/00d125de-3477-11e6-916b-2fde5d692873.png)
SabotageAndi commented 8 years ago

Could the SpecFlowNUnitExtension.cs have a problem with NUnit3?

AndyLPK247 commented 8 years ago

@SabotageAndi I don't know. I couldn't find anything in the documentation.

AndyLPK247 commented 8 years ago

I just tried using the NUnit3TestAdapter instead of the NUnitTestAdapter in my NuGet dependencies, but that did not work. The SpecFlowNUnitExtension.cs file would no longer compile because the NUnit.Core namespace could not be found. (This namespace is provided by NUnitTestAdapter.)

SabotageAndi commented 8 years ago

Ah, sorry, my comment should be a question to @gasparnagy, but somehow I forgot the mention. As we are currently working on fixing all NUnit3 stuff, this is one more on the list to look at.

I found this in the changelog an entry from 1.8.0.:

AndyLPK247 commented 8 years ago

Thanks, @SabotageAndi !

gasparnagy commented 8 years ago

@SabotageAndi @AndyLPK247 yes, that file was only needed for the AfterTestRun hook for unit test runners that do not create a separate AppDomain. Would be good if you could check if the AfterTestRun hook is executed without the file, but running the tests from 1) VS test window, 2) nunit console 3) nunit gui

ghost commented 7 years ago

Link to https://raw.github.com/techtalk/SpecFlow/master/Installer/NUnitNuGetPackage/SpecFlowNUnitExtension.cs

put 404. There is no such file in repo

evilC commented 6 years ago

I just followed the Welcome To Specflow guide, creating a brand new project, and it does not work.
Adding the Nunit reference adds the file SpecFlowNUnitExtension.cs which has unresolvable references.

YOU MUST DELETE THIS FILE for SpecFlow to work.
Kindly update your code and / or documentation, we just wasted a number of hours trying to work out how to solve the dependency.

Visual Studio 2015 in case it makes a difference.

Stephen-Mc commented 6 years ago

@EvilC: Thanks for the heads up. The page is outdated as you point out. I'd recommend you look at the Getting Started guide instead if you are new to SpecFlow.

Did you get taken to this page from the VS integration after installation, or from elsewhere? We will take a look at the links that are opened by the VS integration and update them. If you got to the page from elsewhere, let us know.

evilC commented 6 years ago

No, I have been using Specflow for a year or two, but due to some issues with MStest that we have only just discovered (It only supports ONE external assembly Step binding, when you try to add a 2nd, the tests fail to run in TFS as they cannot load the DLL) then we are now trying out various alternatives, so are creating various new projects from scratch using various versions of VS.
It has to be said, I have tried SpecFlow with VS2015, 2017, MSTest, Nunit, VSTest etc and in every single combination which I have tried there are constant crashes and other issues. Is there ANY version of SpecFlow where the VS integration is stable and does not crash or require constant restarting of VS?
Specifically, the two issues that drive me to distraction on a daily basis are:
Specflow routinely crashes if you use the mouse wheel after viewing a Diff or undoing changes.
Specflow fails to link step definitions from external assemblies (They stay purple) unless you change the regex and re-save, or reload VS. This is so ridiculous, seeing as you can debug and step into the code-behind, but hit F12 on the step definition and it cannot find it! AAAGH!

evilC commented 6 years ago

Oh and WRT the documentation... The old docs attempted to help you setting up one of two runners (MSTest and Nunit), both of which can be used for free.
The new documentation only attempts to help you through Specflow+, which is not free.
IMHO, this is a step backwards, not forwards.

SabotageAndi commented 6 years ago

@evilC Crashing on diff is a known issue. To fix that, it would need a big rewrite of the VS integration for what we currently don't have the workforce to do. It should only crash the one window. I think if you close all feature files and then open one, it should work again.

The intellisense and syntax highlighting from other assemblies is also heavy bugged. There are some issues here on Github with some workarounds to fix it temporary.

evilC commented 6 years ago

I already have an issue open for the syntax highlighting, do you have an ID for the diff crash issue?
My employer is willing to consider throwing some dev effort at properly fixing these issues (And of course feeding the fixes back to the community), but we are completely unfamiliar with what needs to be done, so if you could help us assess how much work would be involved, and what skills would be required, that would be great.

gasparnagy commented 6 years ago

@evilC I can try to help you setting up the things. Could you join the specflow dev gitter channel (https://gitter.im/gasparnagy/specflow-dev) to discuss how we could do that?

SabotageAndi commented 5 years ago

fixed with SpecFlow 3.

evilC commented 5 years ago

Many thanks guys, really looking forward to the new version!

lock[bot] commented 5 years ago

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.