Jenkins CI: 'NumberFormatException: empty String'

时间:2016-04-25 08:49:19

标签: jenkins nunit

We have a Jenkins installation and some projects which are tested by NUnit. This works fine and it writes an NUnit results XML file. Then we have a 'Publish NUnit test result report' post-build step. But since friday it produces this error:

Recording NUnit tests results
ERROR: Step ‘Publish NUnit test result report’ aborted due to exception: 
java.io.IOException: remote file operation failed: C:\Jenkins\workspace\xxx at hudson.remoting.Channel@205d5d5c:CIAgent: java.io.IOException: Failed to read C:\Jenkins\workspace\xxx\temporary-junit-reports\TEST-xxx_Tests.TestsWithRealServers.TestWithTwoLocals_1_2.xml
    at hudson.FilePath.act(FilePath.java:986)
    at hudson.FilePath.act(FilePath.java:968)
    at hudson.plugins.nunit.NUnitPublisher.getTestResult(NUnitPublisher.java:226)
    [...]

Caused by: java.io.IOException: Failed to read C:\Jenkins\workspace\xxx\temporary-junit-reports\TEST-xxx_Tests.TestsWithRealServers.TestWithTwoLocals_1_2.xml
    at hudson.tasks.junit.TestResult.parse(TestResult.java:306)
    at hudson.tasks.junit.TestResult.parsePossiblyEmpty(TestResult.java:244)
    at hudson.tasks.junit.TestResult.parse(TestResult.java:175)
    [...]
    ... 13 more
Caused by: java.lang.NumberFormatException: empty String
    at sun.misc.FloatingDecimal.readJavaFormatString(Unknown Source)
    at sun.misc.FloatingDecimal.parseFloat(Unknown Source)
    at java.lang.Float.parseFloat(Unknown Source)
    [...]
Archiving artifacts
Finished: FAILURE

The XML file is present in the working directory. I mentioned that the first line of this file looks like this:

<?xml version="1.0" encoding="UTF-8"?><testsuite errors="0" failures="0" name="xxx_Tests.TestsWithRealServers.TestWithTwoLocals" skipped="6" tests="6" time="">

So I guess it fails because the time attribe is empty.

Does anyone how I can fix this or why this error occurs? Thanks!

2 个答案:

答案 0 :(得分:1)

您最近是否将jenkins JUnit插件升级到1.12?此更新中有reported issue。您可以尝试降级回1.11。

答案 1 :(得分:0)

顺便说一句,Jenkins插件不支持Nunit 3 XML格式。詹金斯也有类似的问题。我曾经将Nunit 3结果格式转换为Nunit 2格式。

"C:\NUnit 3.5.0\nunit3-console.exe" /result:\MyApplication.xml;format=nunit2 "D:\Jenkins\workspace\MyApplication.Tests.dll"