Skip to content

Latest commit

 

History

History
108 lines (72 loc) · 3.4 KB

Reporters.md

File metadata and controls

108 lines (72 loc) · 3.4 KB

Reporters

Contents

Using Reporters

For an introduction on how to use reporters check out getting started with reporters

Supported Diff Tools

ApprovalTests Diff Reporters use DiffEngine which supports the following diff tools

Custom Diff Tool

Custom Diff Tools can be added via DiffEngine. See: https://github.com/SimonCropp/Verify/blob/master/docs/diff-tool.custom.md

Making Custom Reporters

Extend IApprovalFailureReporter. For example a file can be launched on failure:

namespace ApprovalTests.Reporters;

public class FileLauncherReporter : IApprovalFailureReporter
{
    public static readonly FileLauncherReporter INSTANCE = new();

    public void Report(string approved, string received)
    {
        QuietReporter.DisplayCommandLineApproval(approved, received);
        Process.Start(received);
    }
}

snippet source | anchor

Joining Reporters

These classes help you combine reporters to make more powerful combinations

  • FirstWorkingReporter - launch the first report for this system, only 1
  • MultiReporter - launch ALL reporters

Choosing a DiffTool preference

See How to customize the order of DiffTools in your Reporter

Auto-Approving Reporters

These reporters create a commandline move file to approve the results and place it on your clipboard when a test fails.

  • ClipboardReporter - This test only
  • AllFailingTestsClipboardReporter - All tests (this might make a long command line)

Continuous Integration

ApprovalTests will not launch anything if you are running on a CI machine.

Currently, we support:

TfsReporter.INSTANCE,
TfsVnextReporter.INSTANCE,
TeamCityReporter.INSTANCE,
JenkinsReporter.INSTANCE,
BambooReporter.INSTANCE,
NCrunchReporter.INSTANCE,
MyGetReporter.INSTANCE,
GoContinuousDeliveryReporter.INSTANCE,
AppVeyorReporter.INSTANCE

snippet source | anchor

You can add to this by configuring the FrontLoadedReporter Annotation.


Back to User Guide