.net core - Jenkins integration for dotnet test -


i'm running unit test of dotnet core library using dotnet test. run test on jenkins slave this.

dotnet test test/turbine.domain.unittest -xml mstest-reports/turbine.domain.unittest.xml 

the test report looks this.

<?xml version="1.0" encoding="utf-8"?> <assemblies>   <assembly name="turbine.domain.unittest.dll" environment="64-bit .net (unknown version) [collection-per-class, parallel (8 threads)]" test-framework="xunit.net 2.1.0.3179" run-date="2017-04-07" run-time="13:34:31" total="31" passed="31" failed="0" skipped="0" time="0.170" errors="0">     <errors />     <collection total="3" passed="3" failed="0" skipped="0" name="test collection turbine.domain.tests.accumulatepositionstests" time="0.052">       <test name="turbine.domain.tests.accumulatepositionstests.canaccumulatepositionsbyportfolioindex" type="turbine.domain.tests.accumulatepositionstests" method="canaccumulatepositionsbyportfolioindex" time="0.0402475" result="pass" />       <test name="turbine.domain.tests.accumulatepositionstests.loteventstriggerpositioneventsimmediately" type="turbine.domain.tests.accumulatepositionstests" method="loteventstriggerpositioneventsimmediately" time="0.0102925" result="pass" />       <test name="turbine.domain.tests.accumulatepositionstests.canaccumulatepositionsbydefaultindex" type="turbine.domain.tests.accumulatepositionstests" method="canaccumulatepositionsbydefaultindex" time="0.0012357" result="pass" />     </collection>     <collection total="4" passed="4" failed="0" skipped="0" name="test collection turbine.domain.tests.queries.analyticssummarytests" time="0.087">       <test name="turbine.domain.tests.queries.analyticssummarytests.marketvaluehandlesnegativeamounts" type="turbine.domain.tests.queries.analyticssummarytests" method="marketvaluehandlesnegativeamounts" time="0.0826806" result="pass" />       <test name="turbine.domain.tests.queries.analyticssummarytests.canproducefirmsummaryfromsnapshot" type="turbine.domain.tests.queries.analyticssummarytests" method="canproducefirmsummaryfromsnapshot" time="0.0012097" result="pass" />       <test name="turbine.domain.tests.queries.analyticssummarytests.grossmarketvaluehandlesnegativeamounts" type="turbine.domain.tests.queries.analyticssummarytests" method="grossmarketvaluehandlesnegativeamounts" time="0.0020873" result="pass" />       <test name="turbine.domain.tests.queries.analyticssummarytests.firmsummaryproducesoutputonquote" type="turbine.domain.tests.queries.analyticssummarytests" method="firmsummaryproducesoutputonquote" time="0.0010767" result="pass" />     </collection> etc... 

i use archivexunit block in jenkins jobs dsl try , read in report.

archivexunit {   mstest {     pattern('**/mstest-reports/*.xml')   } } 

jenkins appears see report.

recording test results

[xunit] [info] - starting record. [xunit] [info] - processing mstest-version n/a (default) [xunit] [info] - [mstest-version n/a (default)] - 1 test report file(s) found pattern '**/mstest-reports/*.xml' relative '/home/jenkins/workspace/routing/turbine/build_turbine' testing framework 'mstest-version n/a (default)'. [xunit] [info] - check 'failed tests' threshold. [xunit] [info] - check 'skipped tests' threshold. [xunit] [info] - setting build status success [xunit] [info] - stopping recording. 

but isn't parsing , incorporating results in report. don't see test report on jenkins build dashboard.

any ideas?

so i'm using xunit , trx format works happily:

run tests:

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

however using gives me following issue:

 no test discoverer registered perform discovery of test cases. register test discoverer , try again. 

and copying xunit runner manually bin folder of test project fixes (yes hacky):

copy packages\xunit.runner.visualstudio.2.2.0\build\_common\*.dll test_dir\bin\release /y 

i add publish xunit tests step shown:

jenkins xunit reporter

tests reported correctly on project , build pages.


Comments

Popular posts from this blog

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -

c# - Update a combobox from a presenter (MVP) -

How to understand 2 main() functions after using uftrace to profile the C++ program? -