---
name: compile-test
description: Compile, fill, export, and regression-test JasperReports reports with deterministic synthetic fixtures. Use when asked whether a JRXML report is actually validated, including when only XML well-formedness has been checked, or to build a report test pipeline. Distinguish XML parsing from engine compilation and output validation; do not invoke for unrelated application XML or for diagnosing an already failing report, which is debugging.
---
# Compile and test reports
## Establish the contract
Determine the exact engine and Java versions, expression language and dependencies, report and resource paths, parameter and data-source types, and requested output formats. Find existing Maven or Gradle tests first. Use the project's real compiler and runtime classpath, not an unrelated JasperReports version. Ask for measurable expectations such as text, exact totals, page count, spreadsheet types and no-data behavior.
## Pipeline
1. **Compile:** load the JRXML with the target engine and compile it, for example with `JasperCompileManager`. Report parse errors separately from expression compilation errors, and validate subreports, styles and optional modules too. Generic XML parsing is only a preliminary check: in the tested 7.1.1 runtime, a well-formed report that references an undeclared `$F{missing}` fails compilation with a message naming the field.
2. **Fill:** use `JasperFillManager` with the actual parameter and data contract. Create a fresh data source for each fill; in the tested 7.1.1 runtime, refilling with an already consumed collection data source produces an empty report without an error (see [data-sources](../data-sources/SKILL.md)). Use beans or maps for data-bearing reports and `JREmptyDataSource` only when its virtual-record semantics fit the report. Use fixed locales, timezones and dates.
3. **Inspect the print:** assert pages, expected text and business totals. Traverse frames when needed, because a report's text may not be a direct page child.
4. **Export:** run the required exporter with its matching extension modules and configuration, as described in [export](../export/SKILL.md). Check independently parsed output, not just file existence: PDF text and pages, XLSX cell values, types and sheets, HTML text and resources, or CSV values.
5. **Render:** inspect the output for long text, clipping, overlap, blank pages, fonts and page breaks. Structural output checks do not replace visual review.
## Focused cases
Cover ordinary data, empty input, nulls, long text and a page boundary, selecting only the cases relevant to the report change. Add a failing compile, contract or resource case to prove that the harness catches errors. Use fixed synthetic data and explicit assertions; do not snapshot binary PDF bytes, which contain timestamps and metadata.
Execute trusted templates only. Do not deserialize unknown compiled reports, connect production databases, install tools silently, or upload fixture output to a third-party service. Keep temporary and output paths bounded, and clean up resources and virtualizers in the application's established lifecycle.
## Deliver
List the tested report and version, commands, assertions, actual results and remaining visual or format gaps. Preserve exception causes and failed exit status. If tools or dependencies are unavailable, state the blocked stage and provide a reproducible command; never substitute a successful XML check for a successful engine test. Send a failure that needs root-cause analysis to [debug](../debug/SKILL.md).
## Sources
- [JasperReports API](https://jasperreports.sourceforge.net/api/index.html)
- [Official test and sample projects](https://github.com/Jaspersoft/jasperreports)
Verify all APIs and modules against the target release.
— ‹guest · 2026-11-29› —
این نسخه با نشانهگذاری اختصاصی حساب شما نمایش داده میشود. برای نصب سریع، به تب نصب و راهاندازی بروید.