Export run results as JSON
Use thejson reporter when you need a local, machine-readable report after a
run finishes.
1. Run with the JSON reporter
reports/checkout.momentic.json. Filenames derive from
--name, or from the project name when --name is omitted.
You can combine the JSON reporter with other reporters:
2. Read the report
reports/checkout.momentic.json
https://schemas.momentic.ai/momentic-json-report.schema.json.
Related
Custom outputs and JUnit reports
Declareoutputs in a test to capture environment variables or templated values
at the end of a run. These values are part of the run result. The current JUnit
reporter emits test metadata, timing, and status; it does not include custom
outputs as a testOutputs property.
1. Declare outputs
output-to-junit.test.yaml
2. Run with the JUnit reporter
3. Read the report
The report includes properties such as the testid, base_url, and run_url,
along with retry counts and timestamps. For example:
PLAN_OUTPUT is not included in this XML. If another tool needs custom outputs
in JUnit, add them in your own report-processing step.
Related
Push run results to New Relic
Thenewrelic reporter pushes run results to the
New Relic Event API.
The reporter sends each test run as a MomenticRun custom event and each run
group as a MomenticRunGroup summary event. Query both with New Relic Query
Language (NRQL).
1. Configure the reporter
Add areporting.newrelic block to momentic.config.yaml:
momentic.config.yaml
regiondefaults toUS. UseEUfor accounts in New Relic’s EU data center.licenseKeyis optional. If omitted, the reporter reads theNEW_RELIC_LICENSE_KEYenvironment variable. Use an ingest license key.attributesadds static tags (e.g.service,team) to every event, useful when multiple projects report into the same account.accountId,licenseKey, andattributesvalues all support${ENV_VAR}interpolation.
2. Run with the New Relic reporter
Pass--reporter newrelic to
momentic run:
--reporter multiple times to combine reporters:
3. Event reference
The reporter sendsMomenticRun once per executed test:
The reporter sends
MomenticRunGroup once per run group as a summary:
The reporter adds custom
attributes from the config to both event types.
4. Query in New Relic
Pass rate per test over the last day:Related
Self-host the result viewer
Momentic’s result viewer is a static JavaScript bundle that renders any Momentic run-result zip. You can host it yourself on any static host instead of uploading runs to the dashboard. You need somewhere to serve the bundle and somewhere to store the zipped run results. The example below uses AWS S3 for both, but any static host works. The zips need to be reachable over HTTP with CORS enabled.1. Host the static JavaScript bundle
Create a bundle-hosting bucket
Create a publicly readable bucket following the S3 static website documentation.Upload the run-viewer-static bundle
Upload the contents of the run-viewer-static directory from the Momentic npm
package. The current bundle is available on the
momentic npm page, or from your
project at node_modules/momentic/run-viewer-static.
The bucket should contain:
2. Host the run-result zips
Create a results bucket
The bucket needs to be reachable from wherever the bundle is hosted. For this example a publicly readable bucket works.Upload the test-results directory
CLI runs write to./test-results by default (override with
--output-dir). The directory contains:
metadata.json: metadata for the full run groupruns/<run_id>.zip: one zip per individual run
runs/*.zip to the results bucket.
Allow CORS from the viewer origin
Add a CORS policy that allowsGET and HEAD from the bundle-hosting bucket’s
URL (replace hosted-run-viewer with your bundle bucket name):
3. View a run
Navigate to the viewer’sindex.html with a zipUrl query parameter pointing
at the run zip: