Geeks With Blogs
Mark Pearl

 

Today I had an issue with Jenkins where I wanted it to perform a set of tasks, but not worry about the exit code of any of the tasks…. In my instance I was using Jenkins to run DotCover to check the code coverage of a solution and then run a custom application to make sure the coverage was sufficient….The challenge I was facing that for DotCover to generate coverage statistics, it would need to run NUnit. If a test in NUnit failed for some reason, regardless of the the total coverage of the tests Jenkins would fail the job.

In my scenario, I wanted Jenkins to ignore whether the tests passed or failed and just examine the code coverage as I had other jobs doing this and wanted this job in Jenkins to be focused on one item. After some time I finally came up with a configuration that worked.

We were executing the tasks through a windows batch command, to suppress the exit code of nunit, I added an exit command to the end of the batch file and set manually overrode the exit code… This worked, life goes on.

So, using EXIT /B 0 was the solution

Test Config [Jenkins] - Dashboard [Jenkins]_2011-12-15_14-00-10

Posted on Thursday, December 15, 2011 2:29 PM Misc , Useful Tools | Back to top


Comments on this post: Getting Jenkins to ignore the exit code if failure

# re: Getting Jenkins to ignore the exit code if failure
Requesting Gravatar...
I'm doing the same scenario. Thanks !
Left by granadaCoder on Apr 28, 2016 5:29 PM

# re: Getting Jenkins to ignore the exit code if failure
Requesting Gravatar...
Note. for me, I had to put in two lines (press enter after the first line)

Example below. There is a hard-return after "nologo"


"C:\Program Files (x86)\Microsoft Visual Studio 11.0\Common7\IDE\MSTest.exe" /resultsfile:"%WORKSPACE%\MyTestResults.trx" /testcontainer:"%WORKSPACE%\bin\Debug\My.Services.Tests.dll" /nologo
EXIT /B 0
Left by granadaCoder on Apr 28, 2016 7:34 PM

Your comment:
 (will show your gravatar)


Copyright © MarkPearl | Powered by: GeeksWithBlogs.net