我试着为我的词写一个蛋糕剧本。我刚吃蛋糕。作为这个脚本的一部分,我想要执行MSpec测试。
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);
});我假设它会像MSBuild那样提供控制台输出,因为它没有返回值。见API
正如您可能预期的,没有控制台输出,这意味着我不知道测试的结果是什么。
我怎样才能把这个结果报告给我的线人呢?
发布于 2019-01-07 20:04:25
使用MSpec(string,MSpecSettings)重载将允许您设置什么样的报表、它的名称以及使用MSpecSettings类放置它的位置。
MSpec("../src/Progresso.ERP.BusniessLogic.Tests/bin/" + configurationIntoTests,
new MSpecSettings {
ReportName = "Progresso.ERP.BusniessLogic.Tests",
HtmlReport = true,
OutputDirectory = "./build"
});更新
在学习示例代码时,我注意到在配置之前缺少一个/。
var configurationIntoTests = configuration + "/*.Tests.dll";应该是
var configurationIntoTests = "/" + configuration + "/*.Tests.dll";否则,bin/Debug/变成binDebug,测试全局程序集将找不到任何程序集,甚至不会执行MSPec。
https://stackoverflow.com/questions/54074663
复制相似问题