Skip to content

Commit

Permalink
Merge pull request #5873 from psiinon/sequence/report1
Browse files Browse the repository at this point in the history
Sequence: Support for JSON reports
  • Loading branch information
kingthorin authored Nov 5, 2024
2 parents 2689265 + f25203c commit a4c7183
Show file tree
Hide file tree
Showing 14 changed files with 733 additions and 15 deletions.
1 change: 1 addition & 0 deletions addOns/reports/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## Unreleased
### Added
- Stats counter to the main toolbar button (Issue 8375).
- Sequence data to JSON reports.

### Changed
- Update automation job help.
Expand Down
1 change: 1 addition & 0 deletions addOns/reports/reports.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ dependencies {
exclude(group = "org.apache.logging.log4j")
}

testImplementation(project(":addOns:sequence"))
testImplementation(project(":testutils"))
testImplementation(libs.log4j.core)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"desc": "[(${helper.legacyEscapeParagraph(alert.description, true)})]",
"instances":[ [#th:block th:each="instance, instState: ${instances}"][#th:block th:if="${! instState.first}"],[/th:block]
{
"id": "[(${instance.alertId})]",
"uri": "[(${helper.legacyEscapeText(instance.uri, true)})]",
"method": "[(${helper.legacyEscapeText(instance.method, true)})]",
"param": "[(${helper.legacyEscapeTextAlertParam(instance, true)})]",
Expand Down Expand Up @@ -48,6 +49,37 @@
}[#th:block th:if="${! alertState.last}"],[/th:block][/th:block]
]
}[/th:block]
]
][#th:block th:if="${reportData.reportObjects.get('seqAScanData') != null}"],
"sequences":[[#th:block th:each="seq, seqState: ${reportData.reportObjects.get('seqAScanData').seqData}"][#th:block th:if="${! seqState.first}"],[/th:block]
{
"name": "[(${seq.sequenceName})]",
"steps": [[#th:block th:each="step, stepState: ${seq.steps}"][#th:block th:if="${! stepState.first}"],[/th:block]
{
"step": "[(${step.step})]",
"pass": "[(${step.pass})]",
"resultDetails": "[(${step.result})]",
"alertIds": [[(${step.alertIds})]],
"original":
{
"uri": "[(${helper.legacyEscapeText(step.originalMsg.requestHeader.uri, true)})]",
"method": "[(${helper.legacyEscapeText(step.originalMsg.requestHeader.method, true)})]",
"request-header": "[(${helper.legacyEscapeText(step.originalMsg.requestHeader, true)})]",
"request-body": "[(${helper.legacyEscapeText(step.originalMsg.requestBody, true)})]",
"response-header": "[(${helper.legacyEscapeText(step.originalMsg.responseHeader, true)})]",
"response-body": "[(${helper.legacyEscapeText(step.originalMsg.responseBody, true)})]"
},
"replay":
{
"uri": "[(${helper.legacyEscapeText(step.replayMsg.requestHeader.uri, true)})]",
"method": "[(${helper.legacyEscapeText(step.replayMsg.requestHeader.method, true)})]",
"request-header": "[(${helper.legacyEscapeText(step.replayMsg.requestHeader, true)})]",
"request-body": "[(${helper.legacyEscapeText(step.replayMsg.requestBody, true)})]",
"response-header": "[(${helper.legacyEscapeText(step.replayMsg.responseHeader, true)})]",
"response-body": "[(${helper.legacyEscapeText(step.replayMsg.responseBody, true)})]"
}
}[/th:block]
]
}[/th:block]
][/th:block]
}

Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"desc": "[(${helper.legacyEscapeParagraph(alert.description, true)})]",
"instances":[ [#th:block th:each="instance, instState: ${instances}"][#th:block th:if="${! instState.first}"],[/th:block]
{
"id": "[(${instance.alertId})]",
"uri": "[(${helper.legacyEscapeText(instance.uri, true)})]",
"method": "[(${helper.legacyEscapeText(instance.method, true)})]",
"param": "[(${helper.legacyEscapeTextAlertParam(instance, true)})]",
Expand All @@ -38,5 +39,29 @@
}[#th:block th:if="${! alertState.last}"],[/th:block][/th:block]
]
}[/th:block]
]
][#th:block th:if="${reportData.reportObjects.get('seqAScanData') != null}"],
"sequences":[[#th:block th:each="seq, seqState: ${reportData.reportObjects.get('seqAScanData').seqData}"][#th:block th:if="${! seqState.first}"],[/th:block]
{
"name": "[(${seq.sequenceName})]",
"steps": [[#th:block th:each="step, stepState: ${seq.steps}"][#th:block th:if="${! stepState.first}"],[/th:block]
{
"step": "[(${step.step})]",
"pass": "[(${step.pass})]",
"resultDetails": "[(${step.result})]",
"alertIds": [[(${step.alertIds})]],
"original":
{
"uri": "[(${helper.legacyEscapeText(step.originalMsg.requestHeader.uri, true)})]",
"method": "[(${helper.legacyEscapeText(step.originalMsg.requestHeader.method, true)})]"
},
"replay":
{
"uri": "[(${helper.legacyEscapeText(step.replayMsg.requestHeader.uri, true)})]",
"method": "[(${helper.legacyEscapeText(step.replayMsg.requestHeader.method, true)})]"
}
}[/th:block]
]
}[/th:block]
][/th:block]

}
Loading

0 comments on commit a4c7183

Please sign in to comment.