0

ApprovalTests DiffReporter is not popping up diff window after running the test if the test is failed. Below is my code.

[UseReporter(typeof(DiffReporter))]
[TestClass]
public class ProjectEmployeeJsonTests
{
    [TestMethod]
    public void ToCommand()
    {
        var source = new EmployeeJson
        {
            firstName = "ABC",
            lastName = "TestCarrier"
        };

        var destination = new EmployeeCommand();
        var mapper = GetMapper();
        mapper.Execute(source, destination);

        Approvals.Verify(
            JsonConvert.SerializeObject(
                destination,
                Formatting.Indented));
    }
}

It pops up the diff window for the same code on one of my colleague's machine. We are using the same version of Visual studio with same settings and both of us do not have any diff tools installed.

However, I am able to run the test in VS 2012 (diff window popped up) but not in VS2013.

Versions: ApprovalTests.dll: 3.0.0.0 Visual studio: 2012 Professional, 2013 Professional

Any help here would be highly appreciated. Thanks!

Deepak Ageeru
  • 69
  • 1
  • 6

2 Answers2

0

Can you run this and see what happens?

Approvals.SetCaller();
Assert.IsTrue(VisualStudioReporter.INSTANCE.IsWorkingInThisEnvironment("a.txt"));
llewellyn falco
  • 2,281
  • 16
  • 13
  • I ran the above lines of code, the test failed as "IsWorkingInThisEnvironment("a.txt")" was returning false. I performed some tests and here are some interesting points: 1) Opened VS2013 first and opened VS2012 later, diff window did not popup and Assert failed in both. 2) Closed VS2013 and ran the test in VS2012, the diff window popped up and Assert passed. 3) Opened VS2013 (VS2012 still opened), when I ran the test in VS2013, the diff window showed up in VS2012 and Assert in VS 2013 passed. – Deepak Ageeru Jul 25 '16 at 19:04
0

As per the documentation, applying the "DiffReporter" attribute will "Launch an instance of the best matching DiffReporter on your system".

Not sure why it did not detect the diff merge reporter that comes with visual studio and Sourcegear's diff merge installed on my machine.

Installing tortoise svn worked for me, it pops up the diff window in tortoise diff tool now.

Deepak Ageeru
  • 69
  • 1
  • 6