<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Test on queil.net</title>
    <link>https://queil.net/tags/test/</link>
    <description>Recent content in Test on queil.net</description>
    <generator>Hugo</generator>
    <language>en-uk</language>
    <lastBuildDate>Thu, 24 Oct 2019 08:25:00 +0100</lastBuildDate>
    <atom:link href="https://queil.net/tags/test/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Dotnet Test and Jenkins</title>
      <link>https://queil.net/2019/10/dotnet-test-and-jenkins/</link>
      <pubDate>Thu, 24 Oct 2019 08:25:00 +0100</pubDate>
      <guid>https://queil.net/2019/10/dotnet-test-and-jenkins/</guid>
      <description>&lt;h2 id=&#34;problem&#34; class=&#34;anchor-link&#34;&gt;&lt;a href=&#34;#problem&#34;&gt;Problem&lt;span class=&#34;pilcrow&#34;&gt;&amp;nbsp;¶&lt;/span&gt;&lt;/a&gt;&lt;/h2&gt;&#xA;&lt;p&gt;How to get &lt;code&gt;dotnet test&lt;/code&gt; results collected by Jenkins?&lt;/p&gt;&#xA;&#xA;&lt;h2 id=&#34;solution&#34; class=&#34;anchor-link&#34;&gt;&lt;a href=&#34;#solution&#34;&gt;Solution&lt;span class=&#34;pilcrow&#34;&gt;&amp;nbsp;¶&lt;/span&gt;&lt;/a&gt;&lt;/h2&gt;&#xA;&lt;ol&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Make &lt;code&gt;dotnet test&lt;/code&gt; create logs:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-sh&#34; data-lang=&#34;sh&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;dotnet &lt;span class=&#34;nb&#34;&gt;test&lt;/span&gt; --logger trx&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;In console output you should now see messages like:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-txt&#34; data-lang=&#34;txt&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;Results File: ...\TestResults\a_long_file_name.trx&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;&#xA;&lt;li&gt;&#xA;&lt;p&gt;Make Jenkins collect the results:&lt;/p&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://wiki.jenkins.io/display/JENKINS/MSTest+Plugin&#34;&gt;MSTest&lt;/a&gt; is the plugin that can consume &lt;code&gt;trx&lt;/code&gt; files. Make sure it&amp;rsquo;s installed.&lt;/p&gt;&#xA;&lt;p&gt;Add this line to your &lt;code&gt;Jenkinsfile&lt;/code&gt; below your tests execution:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; class=&#34;chroma&#34;&gt;&lt;code class=&#34;language-groovy&#34; data-lang=&#34;groovy&#34;&gt;&lt;span class=&#34;line&#34;&gt;&lt;span class=&#34;cl&#34;&gt;&lt;span class=&#34;n&#34;&gt;mstest&lt;/span&gt; &lt;span class=&#34;nl&#34;&gt;testResultsFile:&lt;/span&gt;&lt;span class=&#34;s2&#34;&gt;&amp;#34;**/*.trx&amp;#34;&lt;/span&gt;&lt;span class=&#34;o&#34;&gt;,&lt;/span&gt; &lt;span class=&#34;nl&#34;&gt;keepLongStdio:&lt;/span&gt; &lt;span class=&#34;kc&#34;&gt;true&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;/li&gt;&#xA;&lt;/ol&gt;&#xA;&#xA;&lt;h1 id=&#34;notes&#34; class=&#34;anchor-link&#34;&gt;&lt;a href=&#34;#notes&#34;&gt;Notes&lt;span class=&#34;pilcrow&#34;&gt;&amp;nbsp;¶&lt;/span&gt;&lt;/a&gt;&lt;/h1&gt;&#xA;&lt;p&gt;You can run &lt;code&gt;dotnet test&lt;/code&gt; on the whole solution. It generates a &lt;code&gt;trx&lt;/code&gt; file per test project. The MSTest plugin collects all the files and creates an aggregated report accessible in Jenkins. This method is test-framework agnostic. I tested it with NUnit 3.&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
