Reporter: Manage test reporting

Description Usage Format Details See Also Examples

Description

The job of a reporter is to aggregate the results from files, tests, and expectations and display them in an informative way. Every testtthat function that runs multiple tests provides a reporter argument which you can use to override the default (which is selected by default_reporter()).

Usage

1

Format

An object of class R6ClassGenerator of length 24.

Details

You only need to use this Reporter object directly if you are creating a new reporter. Currently, creating new Reporters is undocumented, so if you want to create your own, you'll need to make sure that you're familiar with R6 and then need read the source code for a few.

See Also

Other reporters: CheckReporter, DebugReporter, FailReporter, ListReporter, LocationReporter, MinimalReporter, MultiReporter, ProgressReporter, RstudioReporter, SilentReporter, StopReporter, SummaryReporter, TapReporter, TeamcityReporter

Examples

1
2
3
4
5
6
7
8
path <- testthat_example("success")

# The default reporter - doesn't display well in examples because
# it's designed to work in an interactive console.
test_file(path)

# Override the default by supplying the name of a reporter
test_file(path, reporter = "minimal")

Example output

v |  OK F W S | Context

/ |   0       | success
v |   4   1 1 | success
--------------------------------------------------------------------------------
test-success.R:6: skip: you can skip tests if needed
This tests hasn't been written yet

test-success.R:10: warning: some tests have warnings
NaNs produced
--------------------------------------------------------------------------------

== Results =====================================================================
Duration: 0.2 s

OK:       4
Failed:   0
Warnings: 1
Skipped:  1
.SW...

testthat documentation built on Dec. 1, 2019, 5:06 p.m.