Star

Created With

linkReporters

REST-EZ has several built-in reporters, json, specs, html etc.

When you need a HTML report, you can invoke rest-ez with the --reporter option

Basic example:

1link$./node_modules/.bin/rest-ez --reporter html

Advanced example:

1link$./node_modules/.bin/rest-ez --reporter html,json --reporter-options jsonReportDir=reports,jsonReportName=json-report,htmlReportDir=reports,htmlReportName=html-report,logRequests



linkMultiple Formats

REST-EZ can generate reports in multiple formats.

When you need a HTML report and a JSON report too, you could do something like this

1link$./node_modules/.bin/rest-ez --reporter html,json

This way you can generate reports in multiple formats for the same run.



linkReporter Options

REST-EZ accepts an additonal command line option --reporter-options that you can use to customize how and where reports are generated and saved.

You must pass a comma separated list of key and value pairs to this option as k=v,k2=v2,...



linkjsonReportDir

Provide an existing directory path that is relative to REST-EZ node process's cwd. JSON report will be saved to this directory.

1link$./node_modules/.bin/rest-ez --reporter json --reporter-options jsonReportDir=test-reports

# Outputs to: test-reports/report.json



linkjsonReportName

Provide a name for the JSON report file. JSON report will be saved with this name.

1link$./node_modules/.bin/rest-ez --reporter json --reporter-options jsonReportName=test-report.json

# Outputs to: test-report.json



linkhtmlReportDir

Provide an existing directory path that is relative to REST-EZ node process's cwd. HTML report will be saved to this directory.

1link$./node_modules/.bin/rest-ez --reporter json --reporter-options htmlReportDir=reports,htmlReportName=test-report.json

# Outputs to: reports/test-report.json



linkhtmlReportName

Provide a name for the HTML report file. HTML report will be saved with this name.

1link$./node_modules/.bin/rest-ez --reporter json --reporter-options htmlReportDir=html-reports,htmlReportName=latest-report.json

# Outputs to: html-reports/latest-report.json



linklogRequests

Tells REST-EZ to log HTTP request & response details in reports for failed tests. Omit this if you don't want to log details.

Log all failed requests in an HTML report:

1link$./node_modules/.bin/rest-ez --reporter html --reporter-options logRequests

Log all failed requests in a JSON report:

1link$./node_modules/.bin/rest-ez --reporter json --reporter-options logRequests



linkCustom Reporters

You can write your own custom reporter.

See also: REST-EZ Built-In JSON Reporter

Reporters are JS constructors. When instantiated, a reporter receives the test launcher object along with program options.

linkRunning Custom Reporter

Using a node module by name:

1link$./node_modules/.bin/rest-ez --reporter html,custom-reporter-module-name

Using a path to a file:

1link$./node_modules/.bin/rest-ez --reporter html,/absolute/path/to/js/file

linkEvents

REST-EZ emits events on launcher object and suite object, So a custom reporter should listen to these events and implement reporting.

linkInterface

1linkclass Reporter {

2link

3link constructor(launcher, opts = {}) {

4link

5link }

6link

7link addSuite(suite) {

8link

9link }

10link

11link getSuite(location) {

12link

13link }

14link}



ReportersMultiple FormatsReporter OptionsjsonReportDirjsonReportNamehtmlReportDirhtmlReportNamelogRequestsCustom ReportersRunning Custom ReporterEventsInterface

Home

Getting Startedchevron_right
Basicschevron_right
Requestchevron_right

Request Basics Headers Cookies Query Parameters Path Parameters

Payload Bodychevron_right

File Uploads Auto-Retry Additional Options

Response Validationchevron_right

Overview

Assertionschevron_right

Status Code Headers & Cookies

Bodychevron_right
Hooks & JSchevron_right

Overview

Function Typeschevron_right
Suite-Level Hookschevron_right
Spec-Level Hookschevron_right
Contextchevron_right
DRY & Reusing Specschevron_right
Command Line Interface (CLI)chevron_right