我正在使用Gallio / MbUnit框架进行网络测试,测试从Jenkins开始。我已经安装了Gallio / MbUnit插件并发布了xml报告。我正在尝试找到一种在“测试结果”部分中显示测试日志或控制台消息的方法,以便团队可以轻松读取故障,而不是挖掘任何失败的测试运行的“控制台输出”。
当我使用Icarus从我的本地机器运行这些Gallio / MbUnit测试时,一切都非常好的格式化,但与Jenkins没那么多。我想继续使用它并改进我们显示错误的方式。建议?
对于测试失败:
Failed
...MainMenuTests.AcctClaimsItems
Failing for the past 4 builds (Since Failed#128 )
Took 47 sec.
add description
Error Message
Expected value to be false.Actual Value : d:\Jenkins\jobs\...\workspace\WebTesting\Base\Helpers.cs:line 90d:\Jenkins\jobs\...\workspace\WebTesting\TigerEye\Tests\MainMenuTests.cs:line 329true
Stacktrace
at WebTesting.Base.Helpers.Click(IWebDriver driver, IWebElement element) in
从原始控制台输出:
Start time: 4:21 PM
Initializing the runtime and loading plugins.
Verifying test files.
Initializing the test runner.
Running the tests.
[failed] Test WebTesting/MainMenuTests/AcctClaimsItems
Expected value to be false.
Found System.Web Exception after click to url
.../Accounting/FETReport.aspx
Actual Value : true
at WebTesting.Base.Click(IWebDriver driver, IWebElement element) in d:\Jenkins\jobs\...\workspace\WebTesting\Base\StaticHelpers.cs:line 90 at WebTesting...\Tests.MainMenuTests.AcctClaimsItems() in d:\Jenkins\jobs\...\workspace\WebTesting\TigerEye\Tests\MainMenuTests.cs:line 329
代码:
if (driver.PageSource.Contains("System.Web - Exception"))
{
TestLog.Write("Found exception on page {0}", driver.Url);
TestLog.Write(driver.PageSource.ToString());
Console.Write("Found exception on page {0}", driver.Url);
Console.Write(driver.PageSource.ToString());
Assert.IsFalse(driver.PageSource.Contains("System.Web - Exception"), "Found System.Web Exception after click to url {0}",driver.Url);
}
答案 0 :(得分:0)
您可以使用常规控制台解析插件添加帖子构建步骤https://wiki.jenkins-ci.org/display/JENKINS/Log+Parser+Plugin