私はJenkins freestyle job
を使用して自動テストを行っています。私の仕事では、毎日午前8時に、windows実行可能なバッチTestNG.bat
ファイルを実行し、定義されたすべての受信者にfailure - any
とsuccess - any
の通知を送信します。私は約15のテストケースを持っており、それらのすべてが合格しています。次のようにTestNGのemailable-report.html
結果は以下のとおりです。すべてのテストが合格ですが、Jenkinsビルドに失敗します
<!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>
私はジェンキン内のすべてのコンフィギュレーションをクロスチェック。
`Console Output
Started by timer Building in workspace F:\Automation\MovingWalls No emails were triggered. [MovingWalls] $ cmd /c call F:\Automation\Drivers\apache-tomcat-7.0.82\temp\jenkins7993468679509933908.bat
F:\Automation\MovingWalls>TestNG.bat
F:\Automation\MovingWalls>set projectLocation=F:\Automation\MovingWalls
F:\Automation\MovingWalls>cd F:\Automation\MovingWalls
F:\Automation\MovingWalls>set classpath=F:\Automation\MovingWalls\bin;F:\Automation\MovingWalls\lib*
F:\Automation\MovingWalls>java org.testng.TestNG F:\Automation\MovingWalls\testng.xml ... ... TestNG 6.11 by Cédric Beust ([email protected]) ...
Starting ChromeDriver 2.32.498550 (9dec58e66c31bcc53a9ce3c7226f0c1c5810906a) on port 27334 Only local connections are allowed. Nov 08, 2017 4:27:05 PM org.openqa.selenium.remote.ProtocolHandshake createSession INFO: Detected dialect: OSS
===== PASSED: MI_Demo
Tests run: 15, Failures: 0, Skips: 0
=============================================== Suite Total tests run: 15, Failures: 0, Skips: 0
Exception in thread "main" java.lang.Error: Unresolved compilation problems:
The operator - is undefined for the argument type(s)
String, void Syntax error, insert ")" to complete MethodInvocation
Syntax error, insert ")" to complete MethodInvocation
Syntax error, insert ";" to complete BlockStatements
Syntax error on token "text", delete this token css cannot be resolved to a variable
Syntax error on token "">"", delete this token at com.easy.TestNGCustomReportListener.startHtml(TestNGCustomReportListener.java:535)
at com.easy.TestNGCustomReportListener.generateReport(TestNGCustomReportListener.java:57)
at org.testng.TestNG.generateReports(TestNG.java:1192) 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>pause Press any key to continue . . . Build step 'Execute Windows batch command' marked build as failure TestNG Reports Processing: START Looking for TestNG results report in workspace using pattern: **/testng-results.xml Saving reports... Processing 'C:\Users\MWn0v2014.jenkins\jobs\MwProducts\builds\68\testng\testng-results.xml' TestNG Reports Processing: FINISH Sending e-mails to: [email protected]
Email was triggered for:
Failure - Any Sending email for trigger: Failure - Any
Sending email to: [email protected]
Finished: FAILURE`
は親切に私のコードには、構文エラーがないことに注意してください:予想通りすべてはまだ私のビルドが失敗し、私はこのレポートのたびに取得しています、です。間違っていることを理解するのを助けてください。