Jenkins integration for dotnet test

后端 未结 3 1628
南笙
南笙 2020-12-31 11:32

I\'m running a unit test of a dotnet core library using dotnet test. I run the test on my Jenkins slave like this.

dotnet test test/Turbine.Domain.UnitTest -         


        
3条回答
  •  时光取名叫无心
    2020-12-31 12:26

    So I'm using xUnit and the trx format which works happily:

    Run Tests:

    dotnet test test_dir\test_project.csproj --logger "trx;LogFileName=results\unit_tests.xml"
    

    However using this gives me the following issue:

    No test discoverer is registered to perform discovery of test cases.
    Register a test discoverer and try again.
    

    And so copying the xunit runner manually to the bin folder of the test project fixes this (yes this is hacky):

    copy packages\xunit.runner.visualstudio.2.2.0\build\_common\*.dll test_dir\bin\Release /Y
    

    I then add a Publish xUnit tests step as shown:

    Tests then get reported correctly on the project and build pages.

提交回复
热议问题