如何在maven输出中获得1行错误摘要?

时间:2016-09-03 21:41:32

标签: java maven selenium-webdriver

我想要与此问题相反:How do I turn off 1-line error reporting in Failsafe?,所以我做了相反的事情,因为它在那里解释,我把<trimStackTrace>true</trimStackTrace>放到了“maven-surefire-plugin”的<configuration>部分“但我仍然没有得到如下所述的”1行错误摘要“:The 1-line error summary,当我输入时我得到了这个输出:

mvn clean test

或使用以下内容生成html报告:

mvn surefire-report:report site -DgenerateReports=false -Dtest=TestWebPcQubitArV5

使用这两个命令,我会在每个失败的测试用例中获得这种级别的详细程度:

Running tv.qubit.suites.TestWebPcQubitCoV5
Tests run: 5, Failures: 0, Errors: 3, Skipped: 0, Time elapsed: 196.798 sec <<< FAILURE! - in tv.qubit.suites.TestWebPcQubitCoV5
testLandingPage(tv.qubit.suites.TestWebPcQubitCoV5)  Time elapsed: 40.344 sec  <<< ERROR!
org.openqa.selenium.NoSuchElementException: 
no such element: Unable to locate element: {"method":"link text","selector":"Comenzá tu mes gratis"}
  (Session info: chrome=53.0.2785.92)
  (Driver info: chromedriver=2.23.409687 (c46e862757edc04c06b1bd88724d15a5807b84d1),platform=Linux 4.7.2-1-ARCH x86_64) (WARNING: The server did not provide any stacktrace information)
Command duration or timeout: 30.06 seconds
For documentation on this error, please visit: http://seleniumhq.org/exceptions/no_such_element.html
Build info: version: 'unknown', revision: '31c43c8', time: '2016-08-02 21:57:56 -0700'
System info: host: 'arch', ip: '127.0.0.1', os.name: 'Linux', os.arch: 'amd64', os.version: '4.7.2-1-ARCH', java.version: '1.8.0_102'
Driver info: org.openqa.selenium.chrome.ChromeDriver
Capabilities [{applicationCacheEnabled=false, rotatable=false, mobileEmulationEnabled=false, networkConnectionEnabled=false, chrome={chromedriverVersion=2.23.409687 (c46e862757edc04c06b1bd88724d15a5807b84d1), userDataDir=/tmp/.org.chromium.Chromium.m22jAs}, takesHeapSnapshot=true, databaseEnabled=false, handlesAlerts=true, hasTouchScreen=false, version=53.0.2785.92, platform=LINUX, browserConnectionEnabled=false, nativeEvents=true, acceptSslCerts=true, locationContextEnabled=true, webStorageEnabled=true, browserName=chrome, takesScreenshot=true, javascriptEnabled=true, cssSelectorsEnabled=true}]
Session ID: 036114974517a8f9c7215f2e615ffb27
*** Element info: {Using=link text, value=Comenzá tu mes gratis}
    at tv.qubit.suites.TestWebPcQubitCoV5.testLandingPage(TestWebPcQubitCoV5.java:67)

当我想我得到类似文档的内容时说:

Failed tests:
  Test1.assertion1:59 Bending maths expected:<[123]> but was:<[312]>
  Test1.assertion2:64 True is false

Tests in error:
  Test1.nullPointerInLibrary:38 » NullPointer
  Test1.failInMethod:43->innerFailure:68 NullPointer Fail here
  Test1.failInLibInMethod:48 » NullPointer
  Test1.failInNestedLibInMethod:54->nestedLibFailure:72 » NullPointer
  Test2.test6281:33 Runtime FailHere

1 个答案:

答案 0 :(得分:0)

我的不好...... 1行输出显示在每个错误的完整轨迹下方。由于我是maven的初学者,我错误地认为输出只显示1行短暂错误,而不是一切...

以下是maven完整输出的以下部分:

Results :

Tests in error: 
tv.qubit.suites.TestWebPcQubitCoV5.testLandingPage(tv.qubit.suites.TestWebPcQubitCoV5)
  Run 1: TestWebPcQubitCoV5.testLandingPage:67 » NoSuchElement no such element: Unable ...
  Run 2: TestWebPcQubitCoV5.testLandingPage:67 » NoSuchElement no such element: Unable ...
  Run 3: TestWebPcQubitCoV5.testLandingPage:67 » NoSuchElement no such element: Unable ...