詹金斯 CI:'NumberFormatException: empty String'
Jenkins CI: 'NumberFormatException: empty String'
我们有一个 Jenkins 安装和一些由 NUnit 测试的项目。这工作正常,它写了一个 NUnit 结果 XML 文件。
然后我们有一个 'Publish NUnit test result report' post-构建步骤。但是自星期五以来它产生了这个错误:
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
XML 文件存在于工作目录中。我提到该文件的第一行如下所示:
<?xml version="1.0" encoding="UTF-8"?><testsuite errors="0" failures="0" name="xxx_Tests.TestsWithRealServers.TestWithTwoLocals" skipped="6" tests="6" time="">
所以我猜它失败了,因为时间属性是空的。
有人知道我该如何解决这个问题或者为什么会出现这个错误吗?
谢谢!
您最近是否将 jenkins JUnit 插件升级到 1.12?本次更新有一个reported issue。您可以尝试降级回 1.11。
顺便说一下,Jenkins 插件不支持 Nunit 3 XML 格式。我在 Jenkins 上也有类似的问题。我曾经将 Nunit 3 结果格式转换为 Nunit 2 格式。
"C:\NUnit 3.5.0\nunit3-console.exe" /result:\MyApplication.xml;format=nunit2 "D:\Jenkins\workspace\MyApplication.Tests.dll"
我们有一个 Jenkins 安装和一些由 NUnit 测试的项目。这工作正常,它写了一个 NUnit 结果 XML 文件。 然后我们有一个 'Publish NUnit test result report' post-构建步骤。但是自星期五以来它产生了这个错误:
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
XML 文件存在于工作目录中。我提到该文件的第一行如下所示:
<?xml version="1.0" encoding="UTF-8"?><testsuite errors="0" failures="0" name="xxx_Tests.TestsWithRealServers.TestWithTwoLocals" skipped="6" tests="6" time="">
所以我猜它失败了,因为时间属性是空的。
有人知道我该如何解决这个问题或者为什么会出现这个错误吗? 谢谢!
您最近是否将 jenkins JUnit 插件升级到 1.12?本次更新有一个reported issue。您可以尝试降级回 1.11。
顺便说一下,Jenkins 插件不支持 Nunit 3 XML 格式。我在 Jenkins 上也有类似的问题。我曾经将 Nunit 3 结果格式转换为 Nunit 2 格式。
"C:\NUnit 3.5.0\nunit3-console.exe" /result:\MyApplication.xml;format=nunit2 "D:\Jenkins\workspace\MyApplication.Tests.dll"