Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix regressions in the JSON report #1499

Merged
merged 5 commits into from
Apr 28, 2023
Merged

Fix regressions in the JSON report #1499

merged 5 commits into from
Apr 28, 2023

Conversation

rdeltour
Copy link
Member

No description provided.

`CheckingReport`. `XmlReportImpl`, and `XmpReportImpl` are all used to produce a formatted report to a file or output stream.

This commit unifies their constructor API to receive a `PrintWriter` instance. Previously, only the latter two did, while `CheckingReport` was constructed with a path to the report file.
The report used for tests (`TestReport`) can now generate a formatted report.

- a new `setReportingFormat(String)` method is used to set the generated report format (can be "JSON", "XML", "XMP", or defaulting to a silent report)
- the `initialize()` method (Report API) is used to instantiate a delegate formatting report
- the `generate()` method (Report API) is used to finalize the formatted report delegate
- a new  `getOutput()` method is used to retrieve a String containing the formatted report

This formatting functionality is exposed as a cucumber step implemented in `TestConfiguration` and called with (in this example, for a JSON report):

```
   Given the reporting format is set to JSON
```
Add the following Cucumber steps:

- `Then the JSON report is valid`
- `Then JSON at {string} contains {int} items`
- `Then JSON at {string} has no null values`
- `Then JSON at {string} is not null`
- `Then JSON at {string} is {string}`

JSON values or arrays are inspected using expressions based on a JSON path DSL,
and asserted with the [json-path-assert](https://github.com/json-path/JsonPath) library.
This was caused by a regression after the refactoring of the parsing of the container structure and package documents.

This commit adds a new feature file to write tests for the JSON report.

The first test scenarios check basic assertions:
- JSON is well-formed
- the items array has the correct number of items (no items duplication)
- the checksum field

Fix #1475, Fix #1490
@rdeltour rdeltour added this to the Next maintenance release milestone Apr 28, 2023
@rdeltour rdeltour self-assigned this Apr 28, 2023
@rdeltour rdeltour merged commit b2c5d8c into main Apr 28, 2023
@rdeltour rdeltour deleted the fix/json-report branch April 28, 2023 15:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

items listed twice in JSON report Incorrect "item" JSON output for epubcheck 5.0.0
1 participant