2013-07-19 48 views
0

我正在使用Gallio/MbUnit框架进行网络测试,测试从詹金斯启动。我已经安装了Gallio/MbUnit插件并发布了xml报告。我试图找到一种在“测试结果”部分中显示测试日志或控制台消息的方法,这样团队可以轻松读取故障,而不是陷入任何失败测试运行的“控制台输出”中。如何在Jenkins中显示mbunit/gallio TestLog或控制台输出?

当我使用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); 
} 

回答

相关问题