ApprovalTests uses the following mechanisms to select a reporter. The first one that works is the reporter that is selected.
- Front-loaded Reporter
- Options
- UseReporter at the method level
- UseReporter at the class level
- UseReporter at the package level
flowchart
A[Package Level Defaults]-- If not enough ---B[Class Level UseReporter]-- then ---MethodLevel[Method Level]
MethodLevel-- Override for custom verify ---Options
MethodLevel-- Override for runtime environment---FrontLoadedReporter
At the package level set the default reporter that you like the most. See the Reporters documentation.
If everything in a particular class violates the default reporter you can override it using the UseReporter annotation. See the Reporters documentation.
If the specific method is violating the default reporter, override it, preferably using Options, or alternatively the UseReporter annotation. See the Reporters documentation.
If you make a custom verify() method that should use an alternative reporter, override it in the Options. See the Reporters documentation.
If you are in a situation where you need a different reporter based on the environment you are running in (for example, a CI machine, a continuous test runner, etc.) use a front-loaded reporter. This will override anything else that has been previously defined if the front-loaded reporter is valid for the environment.
- Read more about FrontLoadedReporters