Skip to content

Commit

Permalink
hacky solution for #2290
Browse files Browse the repository at this point in the history
  • Loading branch information
ptrthomas committed Mar 31, 2023
1 parent acca863 commit 46c4eee
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ public ScenarioRuntime(FeatureRuntime featureRuntime, Scenario scenario) {
}
result = new ScenarioResult(scenario);
if (featureRuntime.setupResult != null) {
// TODO improve this and simplify report rendering code in report/karate-feature.html
StepResult sr = result.addFakeStepResult("@setup", null);
List<FeatureResult> list = new ArrayList(1);
FeatureResult fr = new FeatureResult(featureRuntime.featureCall.feature);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
<span>ms:</span>&nbsp;<span th:text="Math.round(scenario.durationMillis)"></span>
</div>
</div>
<div th:if="scenario.stepResults.length > 0 && scenario.stepResults[0].step.background" class="step-row">
<div th:if="(scenario.stepResults.length > 0 && scenario.stepResults[0].step.background) || (scenario.stepResults.length > 1 && scenario.stepResults[1].step.background)" class="step-row">
<div class="step-container" th:id="scenario.refId + 'bg'">
<div class="step-ref bg-step">&gt;&gt;</div>
<div class="step-cell passed">Background:</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ window.onload = function () {
if (!parentIds[parent.id]) return
const link = document.createElement('a')
link.dataset.stepId = parent.id
link.href = 'javascript:void()'
link.href = 'javascript:void(0)'
parent.parentNode.insertBefore(link, parent)
link.appendChild(parent)
})
Expand Down
12 changes: 11 additions & 1 deletion karate-core/src/test/java/com/intuit/karate/report/test.feature
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,14 @@ Examples:

Scenario: calling feature in loop
* def data = [{ name: 'one' }, { name: 'two' }]
* call read('called-loop.feature') data
* call read('called-loop.feature') data

@setup
Scenario:
* def data = [{a: 1}, {a: 2}]

Scenario Outline:
* print __row

Examples:
| karate.setup().data |
5 changes: 5 additions & 0 deletions karate-demo/src/test/java/demo/DemoRunner.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,10 @@ void testEncodingParallel() {
DemoTestParallel.generateReport(results.getReportDir());
assertTrue(results.getFailCount() == 0, results.getErrorMessages());
}

@Karate.Test
Karate testOutline() {
return Karate.run("classpath:demo/outline/setup-outline.feature");
}

}
16 changes: 16 additions & 0 deletions karate-demo/src/test/java/demo/outline/setup-outline.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Feature:

Background:
* print 'in background'

@setup
Scenario:
* def data = [{a: 1}, {a: 2}]

Scenario Outline:
* print __row

Examples:
| karate.setup().data |


0 comments on commit 46c4eee

Please sign in to comment.