我使用Cucumber进行Java实现,并在 Jenkins 上运行我的测试套件后,我得到了 Java堆空间错误。我试图为进程提高内存但仍然出错。我还试图为确保火灾和故障安全的maven插件提高内存,但由于在测试/集成阶段没有发生问题,我仍然无法工作。
当编译并生成JSON报告时,有时也会在运行测试时发生。关于它的任何线索?
错误跟踪是:
[CucumberReportPublisher] Compiling Cucumber Html Reports ...
[CucumberReportPublisher] copying all json files from slave: /apps/hudson/workspace/cbs-billing-web-nightly1/trunk/cbs-billing-web-qa-test/target/cucumberReport to master reports directory: /apps/hudson/jobs/cbs-billing-web-nightly1/builds/2014-05-15_02-01-24/cucumber-html-reports
[CucumberReportPublisher] Found the following number of json files: 1
[CucumberReportPublisher] 0. Found a json file: cucumber.json
[CucumberReportPublisher] Generating HTML reports
FATAL: Java heap space
java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Arrays.java:2882)
at java.lang.AbstractStringBuilder.expandCapacity(AbstractStringBuilder.java:100)
at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:390)
at java.lang.StringBuffer.append(StringBuffer.java:224)
at java.lang.StringBuffer.append(StringBuffer.java:284)
at java.util.regex.Matcher.appendReplacement(Matcher.java:746)
at java.util.regex.Matcher.replaceAll(Matcher.java:813)
at java.lang.String.replaceAll(String.java:2189)
at net.masterthought.cucumber.util.Util.U2U(Util.java:107)
at net.masterthought.cucumber.ReportParser.parseJsonResults(ReportParser.java:30)
at net.masterthought.cucumber.ReportParser.(ReportParser.java:18)
at net.masterthought.cucumber.ReportBuilder.(ReportBuilder.java:65)
at net.masterthought.jenkins.CucumberReportPublisher.perform(CucumberReportPublisher.java:97)
at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:20)
at hudson.model.AbstractBuild$AbstractBuildExecution.perform(AbstractBuild.java:804)
at hudson.model.AbstractBuild$AbstractBuildExecution.performAllBuildSteps(AbstractBuild.java:776)
at hudson.maven.MavenModuleSetBuild$MavenModuleSetBuildExecution.post2(MavenModuleSetBuild.java:1030)
at hudson.model.AbstractBuild$AbstractBuildExecution.post(AbstractBuild.java:725)
at hudson.model.Run.execute(Run.java:1695)
at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:519)
at hudson.model.ResourceController.execute(ResourceController.java:88)
at hudson.model.Executor.run(Executor.java:231)
答案 0 :(得分:0)
当您使用Scenario
对象在黄瓜HTML报告中嵌入自己的文本时,我经常会看到这种情况。我曾经使用scenario.write(myObject.toString())
在我的黄瓜报告中嵌入了整个JSON对象,这导致Cucumber Jenkins插件因你提到的Java堆空间错误而崩溃。在我将这些写入限制在报告之后,一切都开始正常工作。