2012-07-18 66 views
1

我在Eclipse中使用了帶有junit的selenium web驅動程序。請給我建議如何報告測試結果?在junit selenium webdriver中的報告

我儘量讓它在這樣的方式:

http://testerinyou.blogspot.com/2011/03/how-to-create-reports-using-junit.html?showComment=1342535781861#c6211334222001490686 

但gereration時出現錯誤:

Buildfile: E:\eclipse\WebDriver\build.xml 
build-subprojects: 
init: 
build-project: 
[echo] WebDriver: E:\eclipse\WebDriver\build.xml 
[javac] E:\eclipse\WebDriver\build.xml:43: warning: 'includeantruntime' was not set, defaulting to build.sysclasspath=last; set to false for repeatable builds 
build: 
Sector: 
[mkdir] Created dir: E:\eclipse\WebDriver\junit 
[junit] Running Sector 
[junit] Tests run: 1, Failures: 0, Errors: 1, Time elapsed: 0 sec 
[junit] Test Sector FAILED 
junitreport: 
[junitreport] Processing E:\eclipse\WebDriver\junit\TESTS-TestSuites.xml to E:\DOCUME~1\CONSUL~1\LOCALS~1\Temp\null255203125 
[junitreport] Loading stylesheet jar:file:/E:/eclipse/plugins/org.apache.ant_1.8.2.v20120109-1030/lib/ant-junit.jar!/org/apache/tools/ant/taskdefs /optional/junit/xsl/junit-frames.xsl 
[junitreport] : Error! The first argument to the non-static Java function 'replace' is not a valid object reference. 
[junitreport] : Error! Cannot convert data-type 'void' to 'reference'. 
[junitreport] : Fatal Error! Could not compile stylesheet 
[junitreport] Failed to process E:\eclipse\WebDriver\junit\TESTS-TestSuites.xml 

BUILD FAILED 
E:\eclipse\WebDriver\build.xml:135: Errors while applying transformations: Fatal error during transformation 

Total time: 4 seconds 

回答

0

我喜歡UnitTH生成測試報告。

您可以通過ant或maven啓動它

其他問題?

+1

你知道在哪裏可以找到有關UnitTH的maven集成的說明嗎?我已經搜索了這些,但他們不容易找到。 – Selena 2013-11-20 16:45:38

+0

最簡單的方法將是我猜的Maven螞蟻插件.. – 2013-11-21 06:40:22

3

Selenium WebDriver有不同的創建報告的可能性。 用戶開發了一個小型庫來創建帶有屏幕截圖等的HTML報告。 欲瞭解更多信息,請看這裏:https://github.com/vorburger/webdriver-reporting

此外,你可以使用另一個基於Selenium框架稱爲Thucydides。它生成非常漂亮的html報告並改進了Selenium WebDriver。您可以訪問官方網站獲取更多信息(www.thucydides.info)

您可以使用Ant或TestNG爲您的測試創建報告。 在這裏尋找更多的信息:http://selftechy.com/2011/06/29/selenium-use-ant-to-generate-html-reports

+0

你的圖書館真棒! – 2012-09-20 10:05:38