Build/Test Issues

Netstandard test helper project cannot reference xunit.extensibility.core

Started by tiesmaster on 1,948 views

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:
[list=1]
  • Create new unit test project
  • Add test helpers netstandard project, and reference that from the unit test project
  • 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.
    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.

    Edited

    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 ;)
    tiesmaster 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 :)

    Edited

    Post a reply

    Log in to reply.