Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OpenCover doesn't fail the build if tests fail #1101

Closed
MarkusAmshove opened this issue Jul 22, 2016 · 6 comments
Closed

OpenCover doesn't fail the build if tests fail #1101

MarkusAmshove opened this issue Jul 22, 2016 · 6 comments

Comments

@MarkusAmshove
Copy link

MarkusAmshove commented Jul 22, 2016

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.

@gep13
Copy link
Member

gep13 commented Jul 22, 2016

@MarkusAmshove I don't see anything in the repo that you link to. Have you pushed the source?

@MarkusAmshove
Copy link
Author

Oops, sorry @gep13

I just pushed it ;)

@gep13
Copy link
Member

gep13 commented Jul 22, 2016

@MarkusAmshove try setting this property in your NUnit3Settings class:

http://cakebuild.net/api/cake.common.tools.nunit/7bd0c6da/14279c2d

As per here:

OpenCover/opencover#168

@gep13
Copy link
Member

gep13 commented Jul 22, 2016

Also, you might want to look at this setting:

http://cakebuild.net/api/cake.common.tools.opencover/48327845/d90cdd53

@MarkusAmshove
Copy link
Author

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 👍

@gep13
Copy link
Member

gep13 commented 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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants