Reputation: 2090
i tried to write a cake script for my ci. I'm new to cake. As part of this script I wanted to execute MSpec tests.
Task("Run-Tests")
.IsDependentOn("Build")
.Does(() => {
var configurationIntoTests = configuration + "/*.Tests.dll";
MSpec("../src/ERP.BusniessLogic.Tests/bin" + configurationIntoTests);
MSpec("../src/ERP.DapperDataAccess.Tests/bin" + configurationIntoTests);
MSpec("../src/ERP.DomainModel.Tests/bin" + configurationIntoTests);
MSpec("../src/ERP.Shared.Tests/bin" + configurationIntoTests);
MSpec("../src/ERP.Web.Tests/bin" + configurationIntoTests);
});
I assumed that it would give a console output as MSBuild does, since it has no return value. See API
As you may expect there is no console output, which means I don't know what the result of the tests is.
How can i get this result to report it to my ci?
Upvotes: 0
Views: 43
Reputation: 5010
Using the MSpec(string, MSpecSettings) overload will let you set what kind of report, it's name and where to put it using the MSpecSettings class.
MSpec("../src/Progresso.ERP.BusniessLogic.Tests/bin/" + configurationIntoTests,
new MSpecSettings {
ReportName = "Progresso.ERP.BusniessLogic.Tests",
HtmlReport = true,
OutputDirectory = "./build"
});
Update
Studying your example code I notice a /
is missing before configuration
var configurationIntoTests = configuration + "/*.Tests.dll";
should be
var configurationIntoTests = "/" + configuration + "/*.Tests.dll";
Otherwise i.e. bin/Debug/
becomes binDebug
and the test globber will not find any assemblies and MSPec won't even be executed.
Upvotes: 3