You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Report Portal测试执行完成后Launch仍显示处于进行中如何解决

问题解决方案

1. 优先排查版本兼容问题

你当前使用的@reportportal/agent-js-cucumber@5.0.1最低适配Cucumber 5.0.0版本,和你本地的Cucumber 4.1.0版本不兼容,这是Launch状态无法自动结束的核心原因,可选两种修复方案:

  • 降级Report Portal agent到适配Cucumber 4的版本:执行npm i @reportportal/agent-js-cucumber@4.2.2 -D,该版本完全兼容Cucumber 4.x + protractor-cucumber-framework 5.x的技术栈
  • 升级技术栈到高版本:将Cucumber升级到v6+,同步升级protractor-cucumber-framework到v8+,适配agent 5.x版本

2. 补全protractor.conf.js配置

仅配置format参数无法保证agent正确上报结束信号,需要新增配置项强制等待上报完成:

const ReportPortalCucumberFormatter = require('@reportportal/agent-js-cucumber');
const RPClient = require('@reportportal/client-javascript');

exports.config = {
  // 保留你原有seleniumAddress、specs、capabilities等全局配置不变
  cucumberOpts: {
    // 原有format配置不变,注意变量名和引入的formatter对应
    format: ['json:reports/results.json', 'progress', `${ReportPortalCucumberFormatter}:${tempFile.name}`],
    // 新增formatParams传入Report Portal客户端配置
    formatParams: {
      rpClient: new RPClient({
        token: '你的Report Portal账号令牌',
        endpoint: '你的Report Portal服务地址',
        project: '所属项目名',
        launch: '测试任务名称',
        attributes: [
          { key: '测试框架', value: 'protractor-cucumber' }
        ]
      })
    }
  },
  // 新增onComplete钩子,等待上报完成后再退出Protractor
  onComplete: async () => {
    const reporterInstance = ReportPortalCucumberFormatter.getReporter();
    if (reporterInstance) {
      await reporterInstance.exit();
    }
  }
}

3. 临时兜底方案

如果短期内无法调整版本和配置,可以在Report Portal服务端配置自动清理规则:超过2小时无新日志上报的Launch自动标记为结束,避免运行中状态长期残留。

内容的提问来源于stack exchange,提问作者Vivek Kumar

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.13 04:21:03