有没有人有报告门户集成与空手道 0.9.5.RC5 一起工作?



我正在尝试使Reportportal集成与空手道版本0.9.5.RC5一起使用。我可以将结果推送到报告门户;但是,报告上的步骤不按顺序排列,即使在使用适当的缺陷类型标记以前的故障后,ReportPortal也无法执行准确的自动分析。有没有人与空手道版本 0.9.5.RC5 集成工作报告门户?

空手道版本中经常发生的不兼容更改。

报告门户团队期望遵循任何稳定版本。

但是贡献者将其更新为 0.9.5RC5 https://github.com/karthikbits/reportportal-karate

使用此类与报表门户进行交互: https://github.com/reportportal/agent-java-karate/blob/a84d3bef617f0f7bf479de57a29477b4b84792ae/src/main/java/com/epam/RPReporter.java

在那次提交中,开发人员更改了空手道跑步者,但我认为这是矫枉过正,您可以使用空手道的钩子并注入您的跑步者。您也可以遵循该方法,但可能需要很少的更改。

以下是我的看法。您可能需要根据需要对其进行调整。请注意 beforeAll(( 和 afterAll(( 注释了 startLaunch(( 和 finishLaunch((,这是由于我自己的代码,因为我在不同的 Runner 中执行了几个不同的启动。您可能希望取消注释这些内容。

在与该 RPReporter 类的钩子就位后,您将能够轻松自定义它。

请注意,我还没有玩过加特林,可能想向 perfEvent 方法添加一些内容,以从指标中排除与报表门户的集成。

要将钩子添加到您的 Runner 中,只需使用 Runner API 的 .hook(( 方法即可。

public class RPExecutionHook implements ExecutionHook {
private RPReporter rpReporter;
public RPExecutionHook2(RPReporter rpReporter) {
this.rpReporter = rpReporter;
}

@Override
public boolean beforeScenario(Scenario scenario, ScenarioContext context) {
return true; // make sure you keep this true or it breaks the Karate logic for Scenario Outline
}
@Override
public void afterScenario(ScenarioResult result, ScenarioContext context) {
}
@Override
public boolean beforeFeature(Feature feature, ExecutionContext context) {
log.debug("Starting new feature: " + feature.getName());
this.rpReporter.startFeature(context.result);
return true;
}
@Override
public void afterFeature(FeatureResult result, ExecutionContext context) {
log.debug("Finishing feature: " + result.getFeature().getName());
this.rpReporter.finishFeature(context.result);
}
@Override
public void beforeAll(Results results) {
//this.rpReporter.startLaunch();
}
@Override
public void afterAll(Results results) {
//this.rpReporter.finishLaunch();
}
@Override
public boolean beforeStep(Step step, ScenarioContext context) {
return true;
}
@Override
public void afterStep(StepResult result, ScenarioContext context) {
}
@Override
public String getPerfEventName(HttpRequestBuilder req, ScenarioContext context) {
return null;
}
@Override
public void reportPerfEvent(PerfEvent event) {
}
}

看看空手道Maven Gradle项目

最新更新