Skip to content

Commit

Permalink
Merge pull request #42 from iantmoore/report-fixes
Browse files Browse the repository at this point in the history
escape glossary data, corrected screenshot path
  • Loading branch information
iantmoore committed Feb 22, 2017
2 parents 0080fa8 + 05ece0c commit 5ea2995
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 13 deletions.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ Requirements
* Made the report builder more robust when there are no tests run
* Modified the Substeps exceptions to limit the stack trace
* Improved error message when no tests are run
* escaped < and > in the glossary data
* Corrected the path to the screenshot images to be relative so that they work when served off a server and locally.

1.0.5
-----
Expand Down
8 changes: 6 additions & 2 deletions core/src/main/scala/org/substeps/report/ReportBuilder.scala
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,11 @@ class ReportBuilder extends IReportBuilder with ReportFrameTemplate with UsageTr

val glossaryElements =
data.map(sid => sid.expressions.map(sd => {
GlossaryElement(sd.section, sd.expression, sid.className, sd.regex, sd.example, sd.description, sd.parameterNames, sd.parameterClassNames)

val escapedExpression =
sd.expression.replaceAll("\\$$", "").replaceAll("<", "&lt;").replaceAll(">", "&gt;")

GlossaryElement(sd.section, escapedExpression, sid.className, sd.regex, sd.example, sd.description, sd.parameterNames, sd.parameterClassNames)
})).flatten

glossaryElements
Expand Down Expand Up @@ -748,7 +752,7 @@ class ReportBuilder extends IReportBuilder with ReportFrameTemplate with UsageTr
nodeDetail.exceptionMessage.map(s => writer.append(s""""emessage":"${StringEscapeUtils.escapeEcmaScript(s)}",""") )


nodeDetail.screenshot.map(s => writer.append(s"""screenshot:"${dataDir + s}",""") )
nodeDetail.screenshot.map(s => writer.append(s"""screenshot:"data${s}",""") )
nodeDetail.stackTrace.map(s => writer.append(s"""stacktrace:[${s.mkString("\"", "\",\n\"", "\"")}],"""))

writer.append(s""""children":[""")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -846,17 +846,6 @@ public void testExecutionNodeTreeBuildingWithScenarioName() {
Assert.assertThat(rootNode.getChildren().get(0).getChildren().size(), is(1));
}

private static final Logger log = LoggerFactory.getLogger(ExecutionNodeRunnerTest.class);


@Test
public void testNoTestRunException(){

Throwable e = new NoTestsRunException();

log.debug("an exception: ", e);
}

}


0 comments on commit 5ea2995

Please sign in to comment.