我正在使用Jenkins freestyle job
进行自动化测试。我的工作每天早上8:00运行一个Windows可执行批处理TestNG.bat
文件,并向所有已定义的收件人发送failure - any
和success - any
的通知。我有大约15个测试用例,所有测试用例都通过了。 TestNG emailable-report.html
结果如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>TestNG Report</title><style type="text/css">table {margin-bottom:10px;border-collapse:collapse;empty-cells:show}th,td {border:1px solid #009;padding:.25em .5em}th {vertical-align:bottom}td {vertical-align:top}table a {font-weight:bold}.stripe td {background-color: #E6EBF9}.num {text-align:right}.passedodd td {background-color: #3F3}.passedeven td {background-color: #0A0}.skippedodd td {background-color: #DDD}.skippedeven td {background-color: #CCC}.failedodd td,.attn {background-color: #F33}.failedeven td,.stripe .attn {background-color: #D00}.stacktrace {white-space:pre;font-family:monospace}.totop {font-size:85%;text-align:center;border-bottom:2px solid #000}</style></head><body><table><tr><th>Test</th><th># Passed</th><th># Skipped</th><th># Failed</th><th>Time (ms)</th><th>Included Groups</th><th>Excluded Groups</th></tr><tr><th colspan="7">Suite</th></tr><tr><td><a href="#t0">Test</a></td><td class="num">15</td><td class="num">0</td><td class="num">0</td><td class="num">81,918</td><td></td><td></td></tr></table><table id='summary'><thead><tr><th>Class</th><th>Method</th><th>Start</th><th>Time (ms)</th></tr></thead><tbody><tr><th colspan="4">Suite</th></tr></tbody><tbody id="t0"><tr><th colspan="4">Test — passed</th></tr><tr class="passedeven"><td rowspan="15">Products.MwSites</td><td><a href="#m0">AtLife</a></td><td rowspan="1">1510129675216</td><td rowspan="1">7467</td></tr><tr class="passedeven"><td><a href="#m1">EyeballTracker_Website</a></td><td rowspan="1">1510129700349</td><td rowspan="1">4039</td></tr><tr class="passedeven"><td><a href="#m2">MA_Content_demo</a></td><td rowspan="1">1510129672462</td><td rowspan="1">2754</td></tr><tr class="passedeven"><td><a href="#m3">MA_DSP_Demo</a></td><td rowspan="1">1510129667310</td><td rowspan="1">1302</td></tr><tr class="passedeven"><td><a href="#m4">MA_DSP_test</a></td><td rowspan="1">1510129668612</td><td rowspan="1">3849</td></tr><tr class="passedeven"><td><a href="#m5">MI_Demo</a></td><td rowspan="1">1510129625516</td><td rowspan="1">4068</td></tr><tr class="passedeven"><td><a href="#m6">MI_Test</a></td><td rowspan="1">1510129629585</td><td rowspan="1">9981</td></tr><tr class="passedeven"><td><a href="#m7">MovingAudiences_Asia_Website</a></td><td rowspan="1">1510129697106</td><td rowspan="1">3243</td></tr><tr class="passedeven"><td><a href="#m8">MovingWalls_Website</a></td><td rowspan="1">1510129682683</td><td rowspan="1">14423</td></tr><tr class="passedeven"><td><a href="#m9">PlanningTool_demo</a></td><td rowspan="1">1510129644583</td><td rowspan="1">3678</td></tr><tr class="passedeven"><td><a href="#m10">PlanningTool_live</a></td><td rowspan="1">1510129639567</td><td rowspan="1">5016</td></tr><tr class="passedeven"><td><a href="#m11">PlanningTool_test</a></td><td rowspan="1">1510129648261</td><td rowspan="1">10931</td></tr><tr class="passedeven"><td><a href="#m12">SellerSide_demo</a></td><td rowspan="1">1510129660664</td><td rowspan="1">1103</td></tr><tr class="passedeven"><td><a href="#m13">SellerSide_live</a></td><td rowspan="1">1510129659192</td><td rowspan="1">1472</td></tr><tr class="passedeven"><td><a href="#m14">SellerSide_test</a></td><td rowspan="1">1510129661768</td><td rowspan="1">5542</td></tr></tbody></table><h2>Test</h2><h3 id="m0">Products.MwSites#AtLife</h3><table class="result"></table><p class="totop"><a href="#summary">back to summary</a></p><h3 id="m1">Products.MwSites#EyeballTracker_Website</h3><table class="result"></table><p class="totop"><a href="#summary">back to summary</a></p><h3 id="m2">Products.MwSites#MA_Content_demo</h3><table class="result"></table><p class="totop"><a href="#summary">back to summary</a></p><h3 id="m3">Products.MwSites#MA_DSP_Demo</h3><table class="result"></table><p class="totop"><a href="#summary">back to summary</a></p><h3 id="m4">Products.MwSites#MA_DSP_test</h3><table class="result"></table><p class="totop"><a href="#summary">back to summary</a></p><h3 id="m5">Products.MwSites#MI_Demo</h3><table class="result"></table><p class="totop"><a href="#summary">back to summary</a></p><h3 id="m6">Products.MwSites#MI_Test</h3><table class="result"></table><p class="totop"><a href="#summary">back to summary</a></p><h3 id="m7">Products.MwSites#MovingAudiences_Asia_Website</h3><table class="result"></table><p class="totop"><a href="#summary">back to summary</a></p><h3 id="m8">Products.MwSites#MovingWalls_Website</h3><table class="result"></table><p class="totop"><a href="#summary">back to summary</a></p><h3 id="m9">Products.MwSites#PlanningTool_demo</h3><table class="result"></table><p class="totop"><a href="#summary">back to summary</a></p><h3 id="m10">Products.MwSites#PlanningTool_live</h3><table class="result"></table><p class="totop"><a href="#summary">back to summary</a></p><h3 id="m11">Products.MwSites#PlanningTool_test</h3><table class="result"></table><p class="totop"><a href="#summary">back to summary</a></p><h3 id="m12">Products.MwSites#SellerSide_demo</h3><table class="result"></table><p class="totop"><a href="#summary">back to summary</a></p><h3 id="m13">Products.MwSites#SellerSide_live</h3><table class="result"></table><p class="totop"><a href="#summary">back to summary</a></p><h3 id="m14">Products.MwSites#SellerSide_test</h3><table class="result"></table><p class="totop"><a href="#summary">back to summary</a></p></body></html>
我交叉检查了Jenkin中的所有配置。一切都如预期,仍然我的构建失败,我每次都收到这份报告:
`控制台输出
由计时器启动在工作区中构建F:\ Automation \ MovingWalls No. 电子邮件被触发。 [MovingWalls] $ cmd / c电话 F:\自动化\驱动\ Apache的Tomcat的7.0.82 \ TEMP \ jenkins7993468679509933908.bat
F:\自动化\ MovingWalls&GT; TestNG.bat
F:\自动化\ MovingWalls&gt;设置 projectLocation = F:\ Automation \ MovingWalls
F:\ Automation \ MovingWalls&gt; cd F:\ Automation \ MovingWalls
F:\自动化\ MovingWalls&gt;设置 类路径= F:\自动化\ MovingWalls \ BIN; F:\自动化\ MovingWalls \ lib中*
F:\ Automation \ MovingWalls&gt; java org.testng.TestNG F:\ Automation \ MovingWalls \ testng.xml ......Cédric的TestNG 6.11 Beust(cedric@beust.com)......
启动ChromeDriver 2.32.498550 (9dec58e66c31bcc53a9ce3c7226f0c1c5810906a)在27334港口 允许连接。 2017年11月8日下午4:27:05 org.openqa.selenium.remote.ProtocolHandshake createSession INFO: 检测方言:OSS
=====已通过:MI_Demo
测试运行:15,失败:0,跳过:0
===============================================套件总测试运行:15,失败:0,跳过:0
线程“main”中的异常java.lang.Error:未解决的编译问题:
操作符 - 未定义参数类型
String,void语法错误,插入“)”以完成MethodInvocation
语法错误,插入“)”以完成MethodInvocation
语法错误,插入“;”完成BlockStatements
令牌“text”上的语法错误,删除此令牌css无法解析为变量
令牌“”&gt;“”上的语法错误,请在com.easy.TestNGCustomReportListener.startHtml(TestNGCustomReportListener.java:535)中删除此令牌
at com.easy.TestNGCustomReportListener.generateReport(TestNGCustomReportListener.java:57)
at org.testng.TestNG.generateReports(TestNG.java:1192)at at org.testng.TestNG.run(TestNG.java:1120)at org.testng.TestNG.privateMain(TestNG.java:1442)at org.testng.TestNG.main(TestNG.java:1411)
F:\ Automation \ MovingWalls&gt;暂停按任意键继续。 。 。建立 步骤'执行Windows批处理命令'将构建标记为失败TestNG 报告处理:开始寻找TestNG结果报告 使用模式的工作空间:** / testng-results.xml保存报告... 处理 'C:\用户\ MWn0v2014.jenkins \作业\ MwProducts \构建\ 68 \ TestNG的\ TestNG的-results.xml' TestNG报告处理:完成发送电子邮件至:anil@movingwalls.com
触发了电子邮件:
失败 - 任何发送触发器的电子邮件:失败 - 任何
发送电子邮件至:anil@movingwalls.com
完成:失败。
请注意,我的代码中没有语法错误。请帮我理解出了什么问题。
答案 0 :(得分:1)
您的测试用例不包含任何错误。它是testNG.xml中的监听器,它引发了堆栈跟踪。调试 TestNGCustomReportListener 类方法 generateReport 。