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

[Feature] Support standard xunit tests #6

Closed
ChristopherHaws opened this issue May 1, 2017 · 9 comments
Closed

[Feature] Support standard xunit tests #6

ChristopherHaws opened this issue May 1, 2017 · 9 comments

Comments

@ChristopherHaws
Copy link
Contributor

Add support for having a standard xUnit test in the same project as a SpecFlow test. Currently, since we are using a custom TestFramework, standard xUnit tests get filtered out. We will need to modify SpecFlowTestDiscoverer to support this, probably by inheriting XunitTestFrameworkDiscoverer or by creating a wrapper that calls into both types.

@instecjason
Copy link

instecjason commented Sep 21, 2017

Wow. I just encountered this problem. Had the Adapter working perfectly and planned to convert all my tests to Specflow over time... but my old tests are no longer recognized or running. If I get some free time, I might try to cobble something together.

@gasparnagy
Copy link
Owner

@ChristopherHaws @instecjason this makes sense. i did it, see commit 210f7ff

@instecjason
Copy link

This looks great. Any plans to publish an updated Nuget package for this?

@gasparnagy
Copy link
Owner

@instecjason the NuGet package is updated now. https://www.nuget.org/packages/SpecFlow.xUnitAdapter/1.1.0

@instecjason
Copy link

@gasparnagy , thanks for the update. Unfortunately, I am including your Nuget package in my own library and when I got to package up my library I get:

C:\Users\jzp\.nuget\packages\specflow.xunitadapter\1.1.0\build\net45\SpecFlow.xUnitAdapter.targets(14,9): error MSB4062: The "SpecFlow.xUnitAdapter.Build.SpecFlowSourceMapAppender" task could not be loaded from the assembly C:\Users\jzp\.nuget\packages\specflow.xunitadapter\1.1.0\build\net45\SpecFlow.xUnitAdapter.Build.dll. Could not load type 'Microsoft.Build.Utilities.AppDomainIsolatedTask' from assembly 'Microsoft.Build.Utilities.Core, Version=15.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask. [C:\Users\jzp\Source\Repos\smLibTest\smLibTest\src\Instec.StrawberryMoon.Tests\Instec.StrawberryMoon.Tests.csproj]

I'm not sure why the 1.0.0 version worked great and this one does not.

@gasparnagy
Copy link
Owner

@instecjason the msbuild task has been introduced in this version. Could you please let me know the .net version of the project you use? If you could make a mini repro project that would be the best.

Workaround: you can comment out the include statement for this target file from your project. The target and the msbuild task is responsible to handle the new SpecFlowFature and SpecFlowEmbeddedResource compile actions keeping the source reference. But temporarily using the normal Content and Embedded Resource actions will also work.

@ChristopherHaws
Copy link
Contributor Author

Note that using Content and Embedded Resource actions will cause Visual Studio to be unable to navigate to the feature file when double clicking the test as the sourcemaps will not be in-lined.

@gasparnagy
Copy link
Owner

@ChristopherHaws thx for the clarification.

@instecjason It only works as a workaround, because v1.0.0 was not supporting this feature either... so you don't get that benefit until we fix the MsBuild error.

@instecjason
Copy link

@gasparnagy , I was not able to verify the workaround since we only use Nuget packages for our downstream libraries projects. I had to roll back to 1.0.0 for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants