When using NCrunch, How Would Differences Reported From Verify.NUnit Be Approved?

123 Views Asked by At

Verify.NUnit version: 1.19.2

NCrunch version: 4.3.0.13 trial

Visual Studio 2019: 16.4.5

In this commit from the SimonCropp/Verify repo, both the command line and diff viewer functionality of the Verify library is disabled when NCrunch is detected. I understand that during the test executions that occur automatically as code is edited, we would not want the diff viewer to pop up. But I expected that when I manually ran the tests from NCrunch the diff viewer and clipboard functionality of would work. I am just trialing NCrunch right now to see if it would work for my team, so don't necessarily need a feature update for Verify.NUnit.

What would be the recommended workflow when a test failure from a Verify.NUnit assertion fails when using NCrunch?

Sample test:

using System.Threading.Tasks;
using NUnit.Framework;

namespace TestProject
{
    [TestFixture]
    public class MyTestClass
    {
        [Test]
        public async Task MyTest()
        {
            const string actual = @"This is a
a string
of text.";
            await VerifyNUnit.Verifier.Verify(actual);
        }
    }
}
2

There are 2 best solutions below

1
Benjamin Brandt On

I'm not sure if this is optimal, but what I've found so far is this process:

  1. Double-click test failure in NCrunch test list to go to the test
  2. Press the VS TestExplorer.RunAllTestsInContext hotkey (default Ctrl+R, T) to run the test under the cursor.
  3. The run from Test Explorer will allow the clipboard and diff viewer functionality of Verify.NUnit to execute allowing approval of the test results.

This requires both Test Explorer and NCrunch to be properly configured to run tests in VS, which may not be the case for all developers.

0
Simon On

this has been fixed in version 8.2.1 of Verify and version 4.5.0.3 of ncrunch. Sorry it took so long, but I was waiting for the new feature in ncrunch to enable this