Skip to content

Commit

Permalink
escape intellij magic log strings #954
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas committed Nov 7, 2019
1 parent 7b0f3a2 commit 8f52b28
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public void afterStep(StepResult result, ScenarioContext context) {
public boolean beforeScenario(Scenario scenario, ScenarioContext context) {
if (intellij && context.callDepth == 0) {
Path absolutePath = scenario.getFeature().getResource().getPath().toAbsolutePath();
log(String.format(TEMPLATE_TEST_STARTED, getCurrentTime(), absolutePath + ":" + scenario.getLine(), scenario.getNameForReport()));
log(String.format(TEMPLATE_TEST_STARTED, getCurrentTime(), absolutePath + ":" + scenario.getLine(), escape(scenario.getNameForReport())));
// log(String.format(TEMPLATE_SCENARIO_STARTED, getCurrentTime()));
}
return true;
Expand All @@ -98,17 +98,17 @@ public void afterScenario(ScenarioResult result, ScenarioContext context) {
Scenario scenario = result.getScenario();
if (result.isFailed()) {
StringUtils.Pair error = details(result.getError());
log(String.format(TEMPLATE_TEST_FAILED, getCurrentTime(), escape(error.right), escape(error.left), scenario.getNameForReport(), ""));
log(String.format(TEMPLATE_TEST_FAILED, getCurrentTime(), escape(error.right), escape(error.left), escape(scenario.getNameForReport()), ""));
}
log(String.format(TEMPLATE_TEST_FINISHED, getCurrentTime(), result.getDurationNanos() / 1000000, scenario.getNameForReport()));
log(String.format(TEMPLATE_TEST_FINISHED, getCurrentTime(), result.getDurationNanos() / 1000000, escape(scenario.getNameForReport())));
}
}

@Override
public boolean beforeFeature(Feature feature, ExecutionContext context) {
if (intellij && context.callContext.callDepth == 0) {
Path absolutePath = feature.getResource().getPath().toAbsolutePath();
log(String.format(TEMPLATE_TEST_SUITE_STARTED, getCurrentTime(), absolutePath + ":" + feature.getLine(), feature.getNameForReport()));
log(String.format(TEMPLATE_TEST_SUITE_STARTED, getCurrentTime(), absolutePath + ":" + feature.getLine(), escape(feature.getNameForReport())));
}
return true;
}
Expand All @@ -119,7 +119,7 @@ public void afterFeature(FeatureResult result, ExecutionContext context) {
return;
}
if (intellij) {
log(String.format(TEMPLATE_TEST_SUITE_FINISHED, getCurrentTime(), result.getFeature().getNameForReport()));
log(String.format(TEMPLATE_TEST_SUITE_FINISHED, getCurrentTime(), escape(result.getFeature().getNameForReport())));
}
if (result.getScenarioCount() == 0) {
return;
Expand Down

0 comments on commit 8f52b28

Please sign in to comment.