When using the following Cake Script:
Task("Test-xUnit")
.WithCriteria(() => DirectoryExists(parameters.Paths.Directories.PublishedxUnitTests))
.Does(() =>
{
EnsureDirectoryExists(parameters.Paths.Directories.xUnitTestResults);
OpenCover(tool => {
tool.XUnit2(GetFiles(parameters.Paths.Directories.PublishedxUnitTests + "/**/*.Tests.dll"), new XUnit2Settings {
OutputDirectory = parameters.Paths.Directories.xUnitTestResults,
XmlReport = true,
NoAppDomain = true
});
},
parameters.Paths.Files.TestCoverageOutputFilePath,
new OpenCoverSettings()
.WithFilter(testCoverageFilter)
.ExcludeByAttribute(testCoverageExcludeByAttribute)
.ExcludeByFile(testCoverageExcludeByFile));
});
Even though there are some failing tests, the call to OpenCover doesn't fail with an exception as expected.
Is there a way to tell OpenCover to fail, if there are actually failing unit tests?