Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Netstandard test helper project cannot reference xunit.extensibility.core
tiesmaster
#1 Posted : Wednesday, June 5, 2019 5:56:08 PM(UTC)
Rank: Newbie

Groups: Registered
Joined: 4/18/2019(UTC)
Posts: 5
Location: Netherlands

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
Hi,

Context
I have solution with many test projects, and a "test helpers" project. The test projects all target netcoreapp2.2, but the test helpers project is targetting netstandard2.0. This was working fine, but now I added the UseCultureAttribute from xunit.samples to the test helpers project, and that caused NCrunch to fail the build of the test helpers project, with a reference to the documentation, since I had to reference the xunit.extensibility.core NuGet package.

Steps to reproduce:

  1. Create new unit test project
  2. Add test helpers netstandard project, and reference that from the unit test project
  3. Reference xunit.extensibility.core NuGet package in the test helpers project


The reproduction can be found here: https://github.com/tiesmaster/ReproduceNCrunchBug

Expected result:
Building the test helpers project emits a NCrunch warning.

Actual result:
NCrunch fails the build of the test helpers project.


@remco
I hope this is enough to reproduce the bug. Let me know if you need more for this.
Remco
#2 Posted : Wednesday, June 5, 2019 10:44:17 PM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 5,758

Thanks: 745 times
Was thanked: 956 time(s) in 911 post(s)
Hi, thanks for sharing this.

In this situation, the correct response is to set the 'XUnit v2+ Enabled' configuration setting for the TestHelpers project to 'False'.

I'm revising the documentation to make this clearer.
1 user thanked Remco for this useful post.
tiesmaster on 6/11/2019(UTC)
tiesmaster
#3 Posted : Tuesday, June 11, 2019 9:00:52 AM(UTC)
Rank: Newbie

Groups: Registered
Joined: 4/18/2019(UTC)
Posts: 5
Location: Netherlands

Thanks: 1 times
Was thanked: 1 time(s) in 1 post(s)
Thanks! That did the trick. It's a pity I need to configure this project manually (and commit the ncrunch project file), but it gets the job done ;)
Remco
#4 Posted : Wednesday, June 12, 2019 12:06:13 AM(UTC)
Rank: NCrunch Developer

Groups: Administrators
Joined: 4/16/2011(UTC)
Posts: 5,758

Thanks: 745 times
Was thanked: 956 time(s) in 911 post(s)
tiesmaster;13576 wrote:
Thanks! That did the trick. It's a pity I need to configure this project manually (and commit the ncrunch project file), but it gets the job done ;)


Understood. My preference here would have been to automagically handle it (as we do with most things), but because of the nature of this problem, there just isn't a safe way for us to do this. When we encounter a netstandard project with references to test assemblies, it could for any one of a range of different reasons and we have no way to accurately guess which one. The focus has been on just trying to document the situation as well as possible so that people can make the right choice. You found a hole in the documentation, which has now been fixed. Thanks :)
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.

YAF | YAF © 2003-2011, Yet Another Forum.NET
This page was generated in 0.030 seconds.