question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

OpenCover doesn't fail the build if tests fail

See original GitHub issue

What You Are Seeing?

When I have a failing unittest, the OpenCover buildstep doesn’t fail the build. I could do a seperate test step before the coverage, but then I had to run the tests twice.

What is Expected?

I expect the build to fail, because the tests are failing.

What version of Cake are you using?

Version 0.14.0+Branch.main.Sha.295cea62406bf905d085d14a67e3656381b72707

Are you running on a 32 or 64 bit system?

64bit

What environment are you running on? Windows? Linux? Mac?

Windows 10

Are you running on a CI Server? If so, which one?

No

How Did You Get This To Happen? (Steps to Reproduce)

I created a repository to reproduce it:

https://github.com/MarkusAmshove/OpenCoverDoesntFail

The build is creating reports for the unit tests and the coverage, which can be viewed in:

.\build\reports\Tests\NUnit3.html

and

.\build\reports\Coverage\index.htm

Output Log

If I run build.ps1 I expect the following output:

.\build.ps1
$?

to yield False, but it gives True.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
MarkusAmshovecommented, Jul 22, 2016

The “StopOnError” didn’t do the trick, but sounds like a good default settings, because I had unittests with errors which also wouldn’t fail the build 😉

Setting the ReturnTargetCodeOffset to 0 did the trick.

I pushed the changes to the repository.

Is Cake able to set some setting defaults or does it just instantiate those classes? Those settings sounds like they should be a default.

Anyway, thanks for your help! I’m closing this as my original issue is resolved 👍

0reactions
gep13commented, Jul 22, 2016

@MarkusAmshove said… Is Cake able to set some setting defaults or does it just instantiate those classes? Those settings sounds like they should be a default.

Cake is just a Wrapper around the underlying tools, so we don’t add anything to them that aren’t there by default already. If you were manually running the tool, you would have add to add those flags as well.

@MarkusAmshove said… Anyway, thanks for your help! I’m closing this as my original issue is resolved 👍

Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

AppVeyor + OpenCover + xUnit - Build doesn't fail when ...
I created an AppVeyor Build Script that uses OpenCover and Coveralls.Net to run my xUnit tests and publish the code coverage to Coveralls.io....
Read more >
Cannot run OpenCover due to -register:user flag failing
I am trying to configure OpenCover for my project. I have the following PowerShell script to achieve this running as a post build...
Read more >
Teamcity opencover integration
Hi,We run our tests as part of the test phase of every build which ... with all test assemblies, failing the build if...
Read more >
Maven task does not fail when tests fail : r/azuredevops
I have built a pipeline that needs to run maven tests. For maven I use Maven@4 task as follows: - task: Maven@4 inputs:...
Read more >
Setting up code coverage with .Net, xUnit and TeamCity for ...
You can run the build and break it if tests fail. Do. Will run xUnit tests + code coverage in one dotnet test...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found