Browse Source

Copy all tests to a test directory under artifacts to prevent collecting coverage for multiple copies of the same assembly in multiple different areas. (Massively shrinks the coverage.xml file).

pull/755/head
Jeremy Koritzinsky 10 years ago
parent
commit
22b89ed897
  1. 36
      build.cake

36
build.cake

@ -95,6 +95,7 @@ var artifactsDir = (DirectoryPath)Directory("./artifacts");
var nugetRoot = artifactsDir.Combine("nuget"); var nugetRoot = artifactsDir.Combine("nuget");
var zipRoot = artifactsDir.Combine("zip"); var zipRoot = artifactsDir.Combine("zip");
var binRoot = artifactsDir.Combine("bin"); var binRoot = artifactsDir.Combine("bin");
var testsRoot = artifactsDir.Combine("tests");
var dirSuffix = configuration; var dirSuffix = configuration;
var dirSuffixSkia = (isPlatformAnyCPU ? "x86" : platform) + "/" + configuration; var dirSuffixSkia = (isPlatformAnyCPU ? "x86" : platform) + "/" + configuration;
@ -588,6 +589,7 @@ Task("Clean")
CleanDirectory(nugetRoot); CleanDirectory(nugetRoot);
CleanDirectory(zipRoot); CleanDirectory(zipRoot);
CleanDirectory(binRoot); CleanDirectory(binRoot);
CleanDirectory(testsRoot);
}); });
Task("Restore-NuGet-Packages") Task("Restore-NuGet-Packages")
@ -683,25 +685,25 @@ Task("Run-Unit-Tests")
xUnitSettings.NoAppDomain = !isRunningOnWindows; xUnitSettings.NoAppDomain = !isRunningOnWindows;
var openCoverOutput = artifactsDir.GetFilePath(new FilePath("./coverage.xml")); var openCoverOutput = artifactsDir.GetFilePath(new FilePath("./coverage.xml"));
var openCoverSettings = new OpenCoverSettings var openCoverSettings = new OpenCoverSettings()
{ .WithFilter("+[Avalonia.*]* -[*Test*]* -[ControlCatalog*]*")
ArgumentCustomization = openCoverArgs => openCoverArgs.AppendSwitch("-mergeoutput", "") .WithFilter("-[Avalonia.*]OmniXaml.* -[Avalonia.*]Glass.*")
} .WithFilter("-[Avalonia.HtmlRenderer]TheArtOfDev.HtmlRenderer.* +[Avalonia.HtmlRenderer]TheArtOfDev.HtmlRenderer.Avalonia.* -[Avalonia.ReactiveUI]*");
.WithFilter("+[Avalonia.*]* -[*Test*]*");;
foreach(var test in unitTests)
{
CopyDirectory(test.GetDirectory(), testsRoot);
}
foreach (var file in unitTests) if(isRunningOnWindows)
{ {
Information("Running test " + file.GetFilenameWithoutExtension()); OpenCover(context => {
if(isRunningOnWindows) context.XUnit2(unitTests.Select(test => testsRoot.GetFilePath(test).FullPath), xUnitSettings);
{ }, openCoverOutput, openCoverSettings);
OpenCover(context => { }
context.XUnit2(file.FullPath, xUnitSettings); else
}, openCoverOutput, openCoverSettings); {
} XUnit2(unitTests.Select(test => test.FullPath), xUnitSettings);
else
{
XUnit2(file.FullPath, xUnitSettings);
}
} }
}); });

Loading…
Cancel
Save