gpt4 book ai didi

java - 编译 HTML 报告时出现 Cucumber 错误

转载 作者:太空宇宙 更新时间:2023-11-04 14:51:51 25 4
gpt4 key购买 nike

我使用 Cucumber 进行 Java 实现,在 Jenkins 上运行我的测试套件后,我收到 Java 堆空间错误。我尝试增加该进程的内存,但仍然出现错误。我还尝试提高surefire 和failsafe 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)

最佳答案

当您使用 Scenario 对象将自己的文本嵌入到 Cucumber HTML 报告中时,我通常会看到这种情况发生。我曾经使用 scenario.write(myObject.toString()) 在我的 Cucumber 报告中嵌入整个 JSON 对象,这导致 Cucumber Jenkins 插件因您提到的 Java 堆空间错误而崩溃。在我限制对报告的此类写入后,一切开始正常工作。

关于java - 编译 HTML 报告时出现 Cucumber 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23672842/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com