I am trying to make Reportportal integration work with Karate version 0.9.5.RC5. I am able to push the results to Reportportal; however, the steps on report are not in order and reportportal is not able to perform accurate Auto-Analysis even after marking previous failures with appropriate defect type. Does anyone have working ReportPortal integration with Karate version 0.9.5.RC5?
-
see if this thread helps: https://github.com/intuit/karate/issues/619 – Peter Thomas Feb 08 '20 at 00:36
3 Answers
To often non-compatible changes happening in karate version.
Team of reportportal expecting any stable version to follow.
But Contributors made it updated for 0.9.5RC5 https://github.com/karthikbits/reportportal-karate

- 410
- 3
- 10
-
no. we have only one `develop` branch in GitHub, I don't understand your confusion. – Peter Thomas Feb 11 '20 at 00:37
-
1update: we just released 0.9.5 final - https://github.com/intuit/karate/releases/tag/v0.9.5 – Peter Thomas Feb 25 '20 at 04:35
-
2Karate has released final stable version 0.9.5, do you have plans to update reportportal agent for Karate? – Prashant Patil Mar 31 '20 at 03:48
Use this class for interfacing with Report Portal: https://github.com/reportportal/agent-java-karate/blob/a84d3bef617f0f7bf479de57a29477b4b84792ae/src/main/java/com/epam/RPReporter.java
In that commit the developer changed the Karate Runner but I think that's overkill, you can use the hooks that Karate has and inject in your runner. You can also follow that approach but might need few changes.
Below is my take. You might need to tweak it to your needs. Note the beforeAll() and afterAll() that have the startLaunch() and finishLaunch() commented, that's due to my own code as I execute several different launches in different Runners. You'll probably want to uncomment those.
After you have the hook in place with that RPReporter class you'll be able to customize it easily.
Note that I have not played with gatling yet, might want to add something to the perfEvent methods to exclude the integration with Report Portal from your metrics.
To add the hook to your Runner just use the .hook() method of the Runner API.
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) {
}
}

- 108
- 1
- 8