-
Notifications
You must be signed in to change notification settings - Fork 249
How to stop OpenCover if some test cases in unit test fail. #168
Comments
OpenCover will continue to run until the process it is 'profiling' stops/exits so it is up to the process itself to know when to stop and or abort early due to test error. You didn't mention what test runner you are using so... If you are using nunit-console then you can use its I don't know of such a switch for MsTest. |
I am using MsTest. It seems impossible to stop OpenCover when some test cases fail running in MsTest. |
You could possibly wrap mstest in another process that could terminate mstest when it fails (i.e. process the mstest output as it happens) but OpenCover would not be able to do that for you. |
I don't want terminate MsTest. I mean after running all unit test in MsTest , if there is any failed test case, Open Cover won't export coverage report. |
I am confused are you you saying that if you get a failed test from mstest that |
I mean I do not want opencover to generate a report in this case. |
Why - if you don't want it just delete it |
It's just my process. I think it is not a big problem. Just delete it if it's not necessary. |
no worries - I hope you enjoy using OpenCover |
Hi there. I just stumbled over the same issue - I run OpenCover with MSTest as its target as part of a Jenkins build process. I would like to execute all tests AND generate the report, BUT after that the build job should be aborted and marked as failed (which happens when opencover exits with a non-zero code). Is such a configuration possible? |
How are you running OpenCover? If using the |
@sawilde, thank you for the very quick response! I call opencover from the command line, using the "Execute Windows Batch Script" Jenkins build step. How can I find out whether at least one test failed using the Exec task (or the command line?) |
I don't know much about Jenkins but you can use |
Very good, thank you! |
When I integrate OpenCover in Jenkin, I want to break build process if there are some test cases in unit test fail.
So is there any way to stop open cover immediately if some test cases fail ? I don't want output report in this case.
The text was updated successfully, but these errors were encountered: