How to Integrate .NET Projects with Jenkins

https://www.swtestacademy.com/jenkins-dotnet-integration/

8) Unit Tests and Test Coverage Settings

Download and extract OpenCover under “C:\Tools” folder.

Also, generate latest OpenCovertoCoberturaConverter.exe under “C:\Tools\Cobertura\”.

Install latest version of NUnit.

And finally, add an “Execute Windows batch command” step and write a command as follows according to your project. For targettargs, set your Unit Test’s dll file.

      Note: There is a problem to publish Nunit 3 test results with latest NUnit Jenkins plugin. Thus, I changed NUnit 3 format to NUnit 2 format by adding “format=nunit2” in below script.

Below script, automatically run all of your unit tests and create TestResults.xml file under workspace also it runs test coverage and creates Coverage.xml under workspace folder.

      Script:

               “C:\Tools\opencover\OpenCover.Console.exe” -register:user -target:”C:\Program Files (x86)\NUnit.org\nunit-console\nunit3-console.exe” -targetargs:”C:\JenkinsProjects\{YOUR PROJECT         PATH}\bin\Debug\KariyerNet.Business.ECommerce.UnitTests.dll –result=TestResult.xml;format=nunit2″ -filter:+

                 [*]* -output:Coverage.xml

作者:Chuck Lu    GitHub    
posted @   ChuckLu  阅读(270)  评论(0编辑  收藏  举报
编辑推荐:
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
· 浏览器原生「磁吸」效果!Anchor Positioning 锚点定位神器解析
· 没有源码,如何修改代码逻辑?
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
历史上的今天:
2016-03-14 Knowing When to Use Override and New Keywords (C# Programming Guide)
2016-03-14 Versioning with the Override and New Keywords (C# Programming Guide)
2016-03-14 Polymorphism (C# Programming Guide)
2015-03-14 2-Medium下的MultipleCommandAssembly
2015-03-14 如何获取supersocket的源代码
2015-03-14 supersocket中quickstart文件夹下的MultipleCommandAssembly的配置文件分析
点击右上角即可分享
微信分享提示