Skip to content

Latest commit

 

History

History
118 lines (91 loc) · 5.46 KB

SubmitANewReporterToApprovalTests.md

File metadata and controls

118 lines (91 loc) · 5.46 KB

How to Submit a New Reporter to ApprovalTests

Contents

This guide is for figuring out how to make a more robust custom reporter, that you might want to submit back to us as a Pull Request.

For creating the ability to use a custom reporter that works on your machine, see How to Use A Custom Reporter

Adding a new Mac reporter

By way of an example, for supporting a new Reporter on macOS, the steps are:

  • Add a new APPROVAL_TESTS_MACROS_ENTRY value to the Mac namespace.
  • If you are adding a tool that is already supported on an existing platform, please try to be consistent with naming.

APPROVAL_TESTS_MACROS_ENTRY(
    ARAXIS_MERGE,
    DiffInfo("/Applications/Araxis Merge.app/Contents/Utilities/compare",
             Type::TEXT_AND_IMAGE))

snippet source | anchor

  • In the most common case, you will add a new implementation of GenericDiffReporter, that uses the APPROVAL_TESTS_MACROS_ENTRY you added in the first step.

class AraxisMergeReporter : public GenericDiffReporter
{
public:
    AraxisMergeReporter() : GenericDiffReporter(DiffPrograms::Mac::ARAXIS_MERGE())
    {
    }
};

snippet source | anchor

  • Scroll to the end of this file, and add an instance of the new reporter class to the MacDiffReporter
    • The reporters are searched in order, so more commonly-used or highly-featured ones should go nearer the start.
    • Paid-for ones should go before free ones.

new AraxisMergeReporter(),
new BeyondCompareReporter(),
new DiffMergeReporter(),
new KaleidoscopeReporter(),
new P4MergeReporter(),
new SublimeMergeReporter(),
new KDiff3Reporter(),
new TkDiffReporter(),
new VisualStudioCodeReporter()

snippet source | anchor

  • Add an instance of the new Reporter class

// Mac
std::make_shared<Mac::AraxisMergeReporter>(),
std::make_shared<Mac::BeyondCompareReporter>(),
std::make_shared<Mac::DiffMergeReporter>(),
std::make_shared<Mac::KaleidoscopeReporter>(),
std::make_shared<Mac::P4MergeReporter>(),
std::make_shared<Mac::SublimeMergeReporter>(),
std::make_shared<Mac::KDiff3Reporter>(),
std::make_shared<Mac::TkDiffReporter>(),
std::make_shared<Mac::VisualStudioCodeReporter>(),

snippet source | anchor

  • Run this test, review and accept the changes.

Adding a new Windows reporter

The steps are the same as above, except that in the second step, you will edit ApprovalTests/reporters/WindowsReporters.h.

Adding a new Linux reporter

The steps are the same as above, except that in the second step, you will edit ApprovalTests/reporters/LinuxReporters.h.


Back to User Guide