testng自帶的report樣式不美觀,可以使用testng的一個plugin reportng來生成報告,具體的做法如下
使用intellij idea創建一個maven項目,在項目的pom.xml文件中引入reportng的dependency,具體如下:
4.0.0 TestNGProj TestNGProj 1.0-SNAPSHOT org.testng testng 6.8.21 org.uncommons reportng 1.1.4 test org.testng testng com.google.inject guice 3.0 test org.apache.maven.plugins maven-resources-plugin 2.5 org.apache.maven.plugins maven-surefire-plugin 2.12 src/main/java/testng.xml
測試生成的報告
運行項目中的testng.xml文件,執行成功後,生成的報告地址位於項目的此目錄下:test-output/html/index.html
例如:file:///Users/Vicky/Documents/vicky/TestNGProj/test-output/html/index.html。
生成的報告樣式: