zl程序教程

您现在的位置是:首页 >  后端

当前栏目

How to Integrate .NET Projects with Jenkins

NetJenkins to with How Projects
2023-09-11 14:14:21 时间

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