{"id":315,"date":"2019-10-16T14:13:10","date_gmt":"2019-10-16T14:13:10","guid":{"rendered":"http:\/\/yer.ac\/blog\/?p=315"},"modified":"2020-04-22T07:40:23","modified_gmt":"2020-04-22T07:40:23","slug":"ensuring-dotnet-test-trx-coverage-files-end-up-in-sonarqube","status":"publish","type":"post","link":"https:\/\/yer.ac\/blog\/2019\/10\/16\/ensuring-dotnet-test-trx-coverage-files-end-up-in-sonarqube\/","title":{"rendered":"Ensuring &#8220;dotnet test&#8221; TRX &#038; Coverage files end up in SonarQube"},"content":{"rendered":"\n<p style=\"text-align:center\"><em>Do feel free to provide any comments\/feedback to <\/em><a href=\"https:\/\/twitter.com\/therichcarey\"><em>@TheRichCarey<\/em><\/a><em> on Twitter<\/em><\/p>\n\n\n\n<p>I have written <a href=\"http:\/\/yer.ac\/blog\/2019\/03\/19\/my-attempt-at-using-sonarqube-for-static-code-analysis\/\">before <\/a>about using SonarQube to do static analysis, but one issue I never came back to was ensuring that code coverage files generated via a build pipeline end up being picked up by the Sonar Scanner to assess code coverage.<\/p>\n\n\n\n<p>Note that the following I am actually using the &#8216;dotnet test&#8217; build step, rather than the &#8216;Vs Test&#8217; one. Do let me know if you find a nice work around for the VS Test variant, as I couldn&#8217;t get it to drop coverage files!<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">The issue<\/h2>\n\n\n\n<p>The issue is that:<\/p>\n\n\n\n<ul class=\"wp-block-list\"><li>When using VSTest, TRX files are deleted automatically if using version 2+ of the VS Test task as per this <a href=\"https:\/\/stackoverflow.com\/questions\/50082797\/vsts-visual-studio-test-task-deletes-trx-file-after-publish\">stack overflow post<\/a>.<\/li><li>When I switched back to &#8216;dotnet test&#8217; the same thing appeared to be happening.<\/li><li>.coverage files are not output by default<\/li><li>TRX and Coverage files are placed in a temporary folder of the build agent rather than the executing agents working directory.<\/li><li><strong>Even though SonarQube could detect the tests, it would still register as 0.0% code coverage!<\/strong><\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">Getting &#8216;dotnet test&#8217; to collect coverage<\/h2>\n\n\n\n<p>The first step was to get the &#8216;dotnet test&#8217; build step to collect the code coverage, and not just dump TRX files.<\/p>\n\n\n\n<p>To do this, go to the &#8220;Arguments&#8221; field of the dotnet test build step and append <code>--collect \"Code Coverage\"<\/code>, as well as ensuring that &#8220;Publish test results and code coverage&#8221; is enabled.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"370\" height=\"117\" data-attachment-id=\"324\" data-permalink=\"https:\/\/yer.ac\/blog\/2019\/10\/16\/ensuring-dotnet-test-trx-coverage-files-end-up-in-sonarqube\/image-3-5\/\" data-orig-file=\"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/10\/image-3.png?fit=370%2C117&amp;ssl=1\" data-orig-size=\"370,117\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"image-3\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/10\/image-3.png?fit=370%2C117&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/10\/image-3.png?resize=370%2C117\" alt=\"\" class=\"wp-image-324\" srcset=\"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/10\/image-3.png?w=370&amp;ssl=1 370w, https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/10\/image-3.png?resize=300%2C95&amp;ssl=1 300w\" sizes=\"auto, (max-width: 370px) 100vw, 370px\" \/><\/figure><\/div>\n\n\n\n<h2 class=\"wp-block-heading\">Ensure generated files are copied to the working directory<\/h2>\n\n\n\n<p>As the coverage files will end up in the \/tmp folder of the build agent, SonarQube will not be able to scan them. <\/p>\n\n\n\n<p>We will need to add a new build step  of &#8220;<em>copy files<\/em>&#8221; with the correct filter set to get the <code>.trx<\/code>and <code>.coverage<\/code> files from the default temporary directory on the build agent, to the test results folder of the workspace. To do this we need to add the &#8220;Copy Files&#8221; task into the build and place it after the test task. The source folder for the copy will be <code>$(Agent.HomeDirectory)\\_work\\_temp<\/code> and the target folder will be <code>$(Common.TestResultsDirectory)<\/code> &#8211; The contents can remain as ** but feel free to filter if required. Example below.<\/p>\n\n\n\n<div class=\"wp-block-image\"><figure class=\"aligncenter\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"372\" height=\"460\" data-attachment-id=\"317\" data-permalink=\"https:\/\/yer.ac\/blog\/2019\/10\/16\/ensuring-dotnet-test-trx-coverage-files-end-up-in-sonarqube\/image-24\/\" data-orig-file=\"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/10\/image.png?fit=372%2C460&amp;ssl=1\" data-orig-size=\"372,460\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"image\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/10\/image.png?fit=372%2C460&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/10\/image.png?resize=372%2C460\" alt=\"\" class=\"wp-image-317\" srcset=\"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/10\/image.png?w=372&amp;ssl=1 372w, https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/10\/image.png?resize=243%2C300&amp;ssl=1 243w\" sizes=\"auto, (max-width: 372px) 100vw, 372px\" \/><\/figure><\/div>\n\n\n\n<p>If we run a build now, we should now see files in the TestResults folder of the build agent&#8217;s working directory.<\/p>\n\n\n\n<p>I didn&#8217;t have to make any changes to the configuration within SonarQube as it should just pick up the coverage files. If I follow the above I get the following (Lets just ignore the fact the number is low \ud83d\ude09)<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"589\" height=\"153\" data-attachment-id=\"321\" data-permalink=\"https:\/\/yer.ac\/blog\/2019\/10\/16\/ensuring-dotnet-test-trx-coverage-files-end-up-in-sonarqube\/image-1-4\/\" data-orig-file=\"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/10\/image-1.png?fit=589%2C153&amp;ssl=1\" data-orig-size=\"589,153\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"image-1\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/10\/image-1.png?fit=589%2C153&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/10\/image-1.png?resize=589%2C153\" alt=\"\" class=\"wp-image-321\" srcset=\"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/10\/image-1.png?w=589&amp;ssl=1 589w, https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/10\/image-1.png?resize=300%2C78&amp;ssl=1 300w\" sizes=\"auto, (max-width: 589px) 100vw, 589px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">CSPROJ Changes to test projects<\/h2>\n\n\n\n<p>One thing I did notice in the console when attempting to fix this code coverage issue was that I got a lot of warnings like:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">SonarQube.Integration.targets: warning : <strong>The project does not have a valid ProjectGuid<\/strong>. Analysis results for this project will not be uploaded to SonarQube. <\/pre>\n\n\n\n<p>As all my projects were .net core or .net standard the CSPROJ files do not contain a &lt;ProjectGuid&gt; tag by default. As also suggested in this <a href=\"https:\/\/stackoverflow.com\/questions\/56814444\/azure-devops-issue-with-sonar-cloud-code-coverage\">stack overflow answer <\/a>, I added a GUID to my test project file. I am not 100% if this is required, but it stopped warnings appearing in my console and does no harm.<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"876\" height=\"144\" data-attachment-id=\"326\" data-permalink=\"https:\/\/yer.ac\/blog\/2019\/10\/16\/ensuring-dotnet-test-trx-coverage-files-end-up-in-sonarqube\/image-4-4\/\" data-orig-file=\"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/10\/image-4.png?fit=876%2C144&amp;ssl=1\" data-orig-size=\"876,144\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"image-4\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/10\/image-4.png?fit=700%2C115&amp;ssl=1\" src=\"https:\/\/i1.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/10\/image-4.png?fit=700%2C115\" alt=\"\" class=\"wp-image-326\" srcset=\"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/10\/image-4.png?w=876&amp;ssl=1 876w, https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/10\/image-4.png?resize=300%2C49&amp;ssl=1 300w, https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/10\/image-4.png?resize=768%2C126&amp;ssl=1 768w, https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/10\/image-4.png?resize=700%2C115&amp;ssl=1 700w\" sizes=\"auto, (max-width: 876px) 100vw, 876px\" \/><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Bonus<\/h2>\n\n\n\n<p>If you have multiple builds to update and you are using Azure Devops, you can take advantage of &#8220;Task Groups&#8221;. This allows you to create a single build step which in turn executes a series of other build steps. Using the steps above, you can create a new Task Group to create a single build step to run the test script and make sure the files are copied to the correct location for analysis.  For example I have the single build step below:<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img loading=\"lazy\" decoding=\"async\" width=\"1011\" height=\"566\" data-attachment-id=\"328\" data-permalink=\"https:\/\/yer.ac\/blog\/2019\/10\/16\/ensuring-dotnet-test-trx-coverage-files-end-up-in-sonarqube\/image-5-3\/\" data-orig-file=\"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/10\/image-5.png?fit=1011%2C566&amp;ssl=1\" data-orig-size=\"1011,566\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"image-5\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/10\/image-5.png?fit=700%2C392&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/10\/image-5.png?fit=700%2C392\" alt=\"\" class=\"wp-image-328\" srcset=\"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/10\/image-5.png?w=1011&amp;ssl=1 1011w, https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/10\/image-5.png?resize=300%2C168&amp;ssl=1 300w, https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/10\/image-5.png?resize=768%2C430&amp;ssl=1 768w, https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/10\/image-5.png?resize=700%2C392&amp;ssl=1 700w\" sizes=\"auto, (max-width: 1000px) 100vw, 1000px\" \/><\/figure>\n\n\n\n<p>Which means I can then just call this single build step in all my builds<\/p>\n\n\n\n<figure class=\"wp-block-image\"><img data-recalc-dims=\"1\" loading=\"lazy\" decoding=\"async\" width=\"644\" height=\"174\" data-attachment-id=\"329\" data-permalink=\"https:\/\/yer.ac\/blog\/2019\/10\/16\/ensuring-dotnet-test-trx-coverage-files-end-up-in-sonarqube\/image-6-3\/\" data-orig-file=\"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/10\/image-6.png?fit=644%2C174&amp;ssl=1\" data-orig-size=\"644,174\" data-comments-opened=\"1\" data-image-meta=\"{&quot;aperture&quot;:&quot;0&quot;,&quot;credit&quot;:&quot;&quot;,&quot;camera&quot;:&quot;&quot;,&quot;caption&quot;:&quot;&quot;,&quot;created_timestamp&quot;:&quot;0&quot;,&quot;copyright&quot;:&quot;&quot;,&quot;focal_length&quot;:&quot;0&quot;,&quot;iso&quot;:&quot;0&quot;,&quot;shutter_speed&quot;:&quot;0&quot;,&quot;title&quot;:&quot;&quot;,&quot;orientation&quot;:&quot;0&quot;}\" data-image-title=\"image-6\" data-image-description=\"\" data-image-caption=\"\" data-large-file=\"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/10\/image-6.png?fit=644%2C174&amp;ssl=1\" src=\"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/10\/image-6.png?resize=644%2C174\" alt=\"\" class=\"wp-image-329\" srcset=\"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/10\/image-6.png?w=644&amp;ssl=1 644w, https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/10\/image-6.png?resize=300%2C81&amp;ssl=1 300w\" sizes=\"auto, (max-width: 644px) 100vw, 644px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>I have written before about using SonarQube to do static analysis, but one issue I never came back to was ensuring that code coverage files generated via a build pipeline end up being picked up by the Sonar Scanner to assess code coverage. Note that the following I am actually using the &#8216;dotnet test&#8217; build &hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[7,11],"tags":[2,9,3],"class_list":["post-315","post","type-post","status-publish","format-standard","hentry","category-devops","category-testing","tag-devops","tag-sonarqube","tag-testing"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Ensuring &quot;dotnet test&quot; TRX &amp; Coverage files end up in SonarQube -<\/title>\n<meta name=\"description\" content=\"Fixing the 0% code coverage issue in SonarQube when using dotnet test in Azure Devops\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/yer.ac\/blog\/2019\/10\/16\/ensuring-dotnet-test-trx-coverage-files-end-up-in-sonarqube\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Ensuring &quot;dotnet test&quot; TRX &amp; Coverage files end up in SonarQube -\" \/>\n<meta property=\"og:description\" content=\"Fixing the 0% code coverage issue in SonarQube when using dotnet test in Azure Devops\" \/>\n<meta property=\"og:url\" content=\"https:\/\/yer.ac\/blog\/2019\/10\/16\/ensuring-dotnet-test-trx-coverage-files-end-up-in-sonarqube\/\" \/>\n<meta property=\"og:site_name\" content=\"yer.ac | Adventures of a developer, and other things.\" \/>\n<meta property=\"article:published_time\" content=\"2019-10-16T14:13:10+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2020-04-22T07:40:23+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/yer.ac\/blog\/wp-content\/uploads\/2019\/10\/image-3.png\" \/>\n<meta name=\"author\" content=\"yer.ac\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"yer.ac\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/yer.ac\\\/blog\\\/2019\\\/10\\\/16\\\/ensuring-dotnet-test-trx-coverage-files-end-up-in-sonarqube\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/yer.ac\\\/blog\\\/2019\\\/10\\\/16\\\/ensuring-dotnet-test-trx-coverage-files-end-up-in-sonarqube\\\/\"},\"author\":{\"name\":\"yer.ac\",\"@id\":\"https:\\\/\\\/yer.ac\\\/blog\\\/#\\\/schema\\\/person\\\/4638b9d868c7d3747bd3bb01fbc8153d\"},\"headline\":\"Ensuring &#8220;dotnet test&#8221; TRX &#038; Coverage files end up in SonarQube\",\"datePublished\":\"2019-10-16T14:13:10+00:00\",\"dateModified\":\"2020-04-22T07:40:23+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/yer.ac\\\/blog\\\/2019\\\/10\\\/16\\\/ensuring-dotnet-test-trx-coverage-files-end-up-in-sonarqube\\\/\"},\"wordCount\":610,\"commentCount\":9,\"publisher\":{\"@id\":\"https:\\\/\\\/yer.ac\\\/blog\\\/#\\\/schema\\\/person\\\/4638b9d868c7d3747bd3bb01fbc8153d\"},\"image\":{\"@id\":\"https:\\\/\\\/yer.ac\\\/blog\\\/2019\\\/10\\\/16\\\/ensuring-dotnet-test-trx-coverage-files-end-up-in-sonarqube\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/yer.ac\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/10\\\/image-3.png\",\"keywords\":[\"DevOps\",\"SonarQube\",\"Testing\"],\"articleSection\":[\"DevOps\",\"Testing\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/yer.ac\\\/blog\\\/2019\\\/10\\\/16\\\/ensuring-dotnet-test-trx-coverage-files-end-up-in-sonarqube\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/yer.ac\\\/blog\\\/2019\\\/10\\\/16\\\/ensuring-dotnet-test-trx-coverage-files-end-up-in-sonarqube\\\/\",\"url\":\"https:\\\/\\\/yer.ac\\\/blog\\\/2019\\\/10\\\/16\\\/ensuring-dotnet-test-trx-coverage-files-end-up-in-sonarqube\\\/\",\"name\":\"Ensuring \\\"dotnet test\\\" TRX & Coverage files end up in SonarQube -\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/yer.ac\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/yer.ac\\\/blog\\\/2019\\\/10\\\/16\\\/ensuring-dotnet-test-trx-coverage-files-end-up-in-sonarqube\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/yer.ac\\\/blog\\\/2019\\\/10\\\/16\\\/ensuring-dotnet-test-trx-coverage-files-end-up-in-sonarqube\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/yer.ac\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/10\\\/image-3.png\",\"datePublished\":\"2019-10-16T14:13:10+00:00\",\"dateModified\":\"2020-04-22T07:40:23+00:00\",\"description\":\"Fixing the 0% code coverage issue in SonarQube when using dotnet test in Azure Devops\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/yer.ac\\\/blog\\\/2019\\\/10\\\/16\\\/ensuring-dotnet-test-trx-coverage-files-end-up-in-sonarqube\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/yer.ac\\\/blog\\\/2019\\\/10\\\/16\\\/ensuring-dotnet-test-trx-coverage-files-end-up-in-sonarqube\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/yer.ac\\\/blog\\\/2019\\\/10\\\/16\\\/ensuring-dotnet-test-trx-coverage-files-end-up-in-sonarqube\\\/#primaryimage\",\"url\":\"https:\\\/\\\/i0.wp.com\\\/yer.ac\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/10\\\/image-3.png?fit=370%2C117&ssl=1\",\"contentUrl\":\"https:\\\/\\\/i0.wp.com\\\/yer.ac\\\/blog\\\/wp-content\\\/uploads\\\/2019\\\/10\\\/image-3.png?fit=370%2C117&ssl=1\",\"width\":370,\"height\":117},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/yer.ac\\\/blog\\\/2019\\\/10\\\/16\\\/ensuring-dotnet-test-trx-coverage-files-end-up-in-sonarqube\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/yer.ac\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Ensuring &#8220;dotnet test&#8221; TRX &#038; Coverage files end up in SonarQube\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/yer.ac\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/yer.ac\\\/blog\\\/\",\"name\":\"yer.ac | Adventures of a developer, and other things.\",\"description\":\"Blog to keep track of things I am upto\",\"publisher\":{\"@id\":\"https:\\\/\\\/yer.ac\\\/blog\\\/#\\\/schema\\\/person\\\/4638b9d868c7d3747bd3bb01fbc8153d\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/yer.ac\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/yer.ac\\\/blog\\\/#\\\/schema\\\/person\\\/4638b9d868c7d3747bd3bb01fbc8153d\",\"name\":\"yer.ac\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/67ed010c9cc7986d40647e061c6dcdb06d818776591c7e954055adb629621113?s=96&d=retro&r=pg\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/67ed010c9cc7986d40647e061c6dcdb06d818776591c7e954055adb629621113?s=96&d=retro&r=pg\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/67ed010c9cc7986d40647e061c6dcdb06d818776591c7e954055adb629621113?s=96&d=retro&r=pg\",\"caption\":\"yer.ac\"},\"logo\":{\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/67ed010c9cc7986d40647e061c6dcdb06d818776591c7e954055adb629621113?s=96&d=retro&r=pg\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Ensuring \"dotnet test\" TRX & Coverage files end up in SonarQube -","description":"Fixing the 0% code coverage issue in SonarQube when using dotnet test in Azure Devops","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/yer.ac\/blog\/2019\/10\/16\/ensuring-dotnet-test-trx-coverage-files-end-up-in-sonarqube\/","og_locale":"en_US","og_type":"article","og_title":"Ensuring \"dotnet test\" TRX & Coverage files end up in SonarQube -","og_description":"Fixing the 0% code coverage issue in SonarQube when using dotnet test in Azure Devops","og_url":"https:\/\/yer.ac\/blog\/2019\/10\/16\/ensuring-dotnet-test-trx-coverage-files-end-up-in-sonarqube\/","og_site_name":"yer.ac | Adventures of a developer, and other things.","article_published_time":"2019-10-16T14:13:10+00:00","article_modified_time":"2020-04-22T07:40:23+00:00","og_image":[{"url":"http:\/\/yer.ac\/blog\/wp-content\/uploads\/2019\/10\/image-3.png","type":"","width":"","height":""}],"author":"yer.ac","twitter_card":"summary_large_image","twitter_misc":{"Written by":"yer.ac","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/yer.ac\/blog\/2019\/10\/16\/ensuring-dotnet-test-trx-coverage-files-end-up-in-sonarqube\/#article","isPartOf":{"@id":"https:\/\/yer.ac\/blog\/2019\/10\/16\/ensuring-dotnet-test-trx-coverage-files-end-up-in-sonarqube\/"},"author":{"name":"yer.ac","@id":"https:\/\/yer.ac\/blog\/#\/schema\/person\/4638b9d868c7d3747bd3bb01fbc8153d"},"headline":"Ensuring &#8220;dotnet test&#8221; TRX &#038; Coverage files end up in SonarQube","datePublished":"2019-10-16T14:13:10+00:00","dateModified":"2020-04-22T07:40:23+00:00","mainEntityOfPage":{"@id":"https:\/\/yer.ac\/blog\/2019\/10\/16\/ensuring-dotnet-test-trx-coverage-files-end-up-in-sonarqube\/"},"wordCount":610,"commentCount":9,"publisher":{"@id":"https:\/\/yer.ac\/blog\/#\/schema\/person\/4638b9d868c7d3747bd3bb01fbc8153d"},"image":{"@id":"https:\/\/yer.ac\/blog\/2019\/10\/16\/ensuring-dotnet-test-trx-coverage-files-end-up-in-sonarqube\/#primaryimage"},"thumbnailUrl":"http:\/\/yer.ac\/blog\/wp-content\/uploads\/2019\/10\/image-3.png","keywords":["DevOps","SonarQube","Testing"],"articleSection":["DevOps","Testing"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/yer.ac\/blog\/2019\/10\/16\/ensuring-dotnet-test-trx-coverage-files-end-up-in-sonarqube\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/yer.ac\/blog\/2019\/10\/16\/ensuring-dotnet-test-trx-coverage-files-end-up-in-sonarqube\/","url":"https:\/\/yer.ac\/blog\/2019\/10\/16\/ensuring-dotnet-test-trx-coverage-files-end-up-in-sonarqube\/","name":"Ensuring \"dotnet test\" TRX & Coverage files end up in SonarQube -","isPartOf":{"@id":"https:\/\/yer.ac\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/yer.ac\/blog\/2019\/10\/16\/ensuring-dotnet-test-trx-coverage-files-end-up-in-sonarqube\/#primaryimage"},"image":{"@id":"https:\/\/yer.ac\/blog\/2019\/10\/16\/ensuring-dotnet-test-trx-coverage-files-end-up-in-sonarqube\/#primaryimage"},"thumbnailUrl":"http:\/\/yer.ac\/blog\/wp-content\/uploads\/2019\/10\/image-3.png","datePublished":"2019-10-16T14:13:10+00:00","dateModified":"2020-04-22T07:40:23+00:00","description":"Fixing the 0% code coverage issue in SonarQube when using dotnet test in Azure Devops","breadcrumb":{"@id":"https:\/\/yer.ac\/blog\/2019\/10\/16\/ensuring-dotnet-test-trx-coverage-files-end-up-in-sonarqube\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/yer.ac\/blog\/2019\/10\/16\/ensuring-dotnet-test-trx-coverage-files-end-up-in-sonarqube\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/yer.ac\/blog\/2019\/10\/16\/ensuring-dotnet-test-trx-coverage-files-end-up-in-sonarqube\/#primaryimage","url":"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/10\/image-3.png?fit=370%2C117&ssl=1","contentUrl":"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/10\/image-3.png?fit=370%2C117&ssl=1","width":370,"height":117},{"@type":"BreadcrumbList","@id":"https:\/\/yer.ac\/blog\/2019\/10\/16\/ensuring-dotnet-test-trx-coverage-files-end-up-in-sonarqube\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/yer.ac\/blog\/"},{"@type":"ListItem","position":2,"name":"Ensuring &#8220;dotnet test&#8221; TRX &#038; Coverage files end up in SonarQube"}]},{"@type":"WebSite","@id":"https:\/\/yer.ac\/blog\/#website","url":"https:\/\/yer.ac\/blog\/","name":"yer.ac | Adventures of a developer, and other things.","description":"Blog to keep track of things I am upto","publisher":{"@id":"https:\/\/yer.ac\/blog\/#\/schema\/person\/4638b9d868c7d3747bd3bb01fbc8153d"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/yer.ac\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/yer.ac\/blog\/#\/schema\/person\/4638b9d868c7d3747bd3bb01fbc8153d","name":"yer.ac","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/67ed010c9cc7986d40647e061c6dcdb06d818776591c7e954055adb629621113?s=96&d=retro&r=pg","url":"https:\/\/secure.gravatar.com\/avatar\/67ed010c9cc7986d40647e061c6dcdb06d818776591c7e954055adb629621113?s=96&d=retro&r=pg","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/67ed010c9cc7986d40647e061c6dcdb06d818776591c7e954055adb629621113?s=96&d=retro&r=pg","caption":"yer.ac"},"logo":{"@id":"https:\/\/secure.gravatar.com\/avatar\/67ed010c9cc7986d40647e061c6dcdb06d818776591c7e954055adb629621113?s=96&d=retro&r=pg"}}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/paP5IW-55","jetpack-related-posts":[{"id":514,"url":"https:\/\/yer.ac\/blog\/2021\/10\/06\/fixing-hostfxr-dll-could-not-be-found-within-windows-docker-container-net-installed-from-dotnet-install-ps1\/","url_meta":{"origin":315,"position":0},"title":"Fixing &#8220;hostfxr.dll could not be found&#8221; within Windows Docker container (.NET installed from dotnet-install.ps1)","author":"yer.ac","date":"October 6, 2021","format":false,"excerpt":"This is here mostly for my own reference for next time I need to fix this, but may be useful to someone else. Installing .NET (5, Core, etc.) via the Microsoft Supplied \"dotnet-install.ps1\"(https:\/\/docs.microsoft.com\/en-us\/dotnet\/core\/tools\/dotnet-install-script) installs the frameworks fine, but then running .net core code within that windows container would sometimes yield\u2026","rel":"","context":"In &quot;Docker&quot;","block_context":{"text":"Docker","link":"https:\/\/yer.ac\/blog\/category\/devops\/docker\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2021\/10\/image.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2021\/10\/image.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2021\/10\/image.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":333,"url":"https:\/\/yer.ac\/blog\/2019\/11\/06\/pragmatically-upgrading-net-framework-version-for-all-projects-with-powershell\/","url_meta":{"origin":315,"position":1},"title":"Pragmatically upgrading .net framework version for  all projects with PowerShell","author":"yer.ac","date":"November 6, 2019","format":false,"excerpt":"We had a situation where we needed to upgrade all the CSPROJ files in a solution to 4.8. The issue is that some of our solutions contain almost a hundred projects so a manual intervention would be prone to error. (plus we have multiple solutions to apply this against!) Whilst\u2026","rel":"","context":"In &quot;DevOps&quot;","block_context":{"text":"DevOps","link":"https:\/\/yer.ac\/blog\/category\/devops\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":599,"url":"https:\/\/yer.ac\/blog\/2026\/01\/23\/from-acceptance-criteria-to-playwright-tests-with-mcp\/","url_meta":{"origin":315,"position":2},"title":"From Acceptance Criteria to Playwright Tests with MCP","author":"yer.ac","date":"January 23, 2026","format":false,"excerpt":"Modern UI test tooling has quietly raised the bar for who can participate. Playwright is powerful, but it assumes comfort with TypeScript, selectors, repo structure, and terminal use. That gap often collapses testing back onto developers, creating pressure to almost validate their own work. This proof of concept explores using\u2026","rel":"","context":"In &quot;AI&quot;","block_context":{"text":"AI","link":"https:\/\/yer.ac\/blog\/category\/development\/ai\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2026\/01\/cover.png?fit=1200%2C800&ssl=1&resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2026\/01\/cover.png?fit=1200%2C800&ssl=1&resize=350%2C200 1x, https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2026\/01\/cover.png?fit=1200%2C800&ssl=1&resize=525%2C300 1.5x, https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2026\/01\/cover.png?fit=1200%2C800&ssl=1&resize=700%2C400 2x, https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2026\/01\/cover.png?fit=1200%2C800&ssl=1&resize=1050%2C600 3x"},"classes":[]},{"id":78,"url":"https:\/\/yer.ac\/blog\/2019\/04\/09\/debugging-es6-mocha-unit-tests-using-vs-code\/","url_meta":{"origin":315,"position":3},"title":"Debugging ES6 Mocha unit tests using VS Code","author":"yer.ac","date":"April 9, 2019","format":false,"excerpt":"The world of Mocha, VS Code and Node is still fairly new to me. Typically in the past all my JS unit tests have been debuggable in-browser using DevTools, but with Mocha this is not the case (As I am not deploying my spec files). I got Mocha to load\u2026","rel":"","context":"In &quot;Development&quot;","block_context":{"text":"Development","link":"https:\/\/yer.ac\/blog\/category\/development\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/04\/image-1.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/04\/image-1.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/04\/image-1.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/04\/image-1.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":303,"url":"https:\/\/yer.ac\/blog\/2019\/09\/05\/dotnet-pack-project-reference-and-nuget-dependency\/","url_meta":{"origin":315,"position":4},"title":"Include both Nuget Package References and project reference DLL using &#8220;dotnet pack&#8221; \ud83d\udce6","author":"yer.ac","date":"September 5, 2019","format":false,"excerpt":"Recently I have been trying to generate more Nuget packages for our dotnet core projects, utilizing the dotnet pack command. One issue I have been encountering is that the command was either referencing the required nuget packages, or the project reference DLLs, never both. The current problem. If you have\u2026","rel":"","context":"In &quot;Development&quot;","block_context":{"text":"Development","link":"https:\/\/yer.ac\/blog\/category\/development\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/09\/image-1.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/09\/image-1.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/09\/image-1.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":55,"url":"https:\/\/yer.ac\/blog\/2019\/03\/25\/recursive-folder-comparison-with-powershell\/","url_meta":{"origin":315,"position":5},"title":"Recursive folder comparison with PowerShell","author":"yer.ac","date":"March 25, 2019","format":false,"excerpt":"The Issue This post definitely isn't \"new\" or revolutionary, but I was quite surprised to find the Compare-object helper in PS, and I'm bound to forget in the future... As part of some recent roadmap work, we moved over to a new installer technology for some of our tooling. This\u2026","rel":"","context":"In &quot;DevOps&quot;","block_context":{"text":"DevOps","link":"https:\/\/yer.ac\/blog\/category\/devops\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/03\/image-11.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/03\/image-11.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/yer.ac\/blog\/wp-content\/uploads\/2019\/03\/image-11.png?resize=525%2C300 1.5x"},"classes":[]}],"_links":{"self":[{"href":"https:\/\/yer.ac\/blog\/wp-json\/wp\/v2\/posts\/315","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/yer.ac\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/yer.ac\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/yer.ac\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/yer.ac\/blog\/wp-json\/wp\/v2\/comments?post=315"}],"version-history":[{"count":7,"href":"https:\/\/yer.ac\/blog\/wp-json\/wp\/v2\/posts\/315\/revisions"}],"predecessor-version":[{"id":422,"href":"https:\/\/yer.ac\/blog\/wp-json\/wp\/v2\/posts\/315\/revisions\/422"}],"wp:attachment":[{"href":"https:\/\/yer.ac\/blog\/wp-json\/wp\/v2\/media?parent=315"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/yer.ac\/blog\/wp-json\/wp\/v2\/categories?post=315"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/yer.ac\/blog\/wp-json\/wp\/v2\/tags?post=315"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}