locked
Visual Studio Test Result Compare Tool or Plugin? RRS feed

  • Question

  • Is there any tool or plugin for Visual Studio 2010 to compare the difference of a Assert.AreEqual failed result?  I'm looking for a convenient way in VS to compare the Expected result vs. Actual result.

    Wednesday, June 27, 2012 4:52 PM

Answers

  • Thanks for Anuj’s help.

    Hi tferreira138,

    Thank you for posting in the MSDN forum.

    Open your test result in Test Results window, and I think you could get the error message like this:

    Assert.AreEqual failed. Expected:< My Test 123456>. Actual:< My Test 12345>.

    I'm looking for a compare tool to say, the different is "6".

    About your issue, I’m afraid that it couldn’t achieve it with VS tool in default now, but you could send this feature request: http://visualstudio.uservoice.com/forums/121579-visual-studio. The Visual Studio product team is listening to user voice there. Thanks for your understanding.

    In addition, since the unit test support the Console.WriteLine(), one idea is that we could write it like the following code. And then Output the value to the test result

    if (expected != actual)

                {

                    Compared the values and get the difference of the two values s

                   

                    System.Console.WriteLine("XX:{0}", s);

                    Assert.Fail();//make the result is failed

                }

    About how to compare the two values, if it is hard for you to write the code, you could post an issue in the develop forum like the C# forum. I think you would get useful information. Thanks for your understanding.

    Best Regards,


    Jack Zhai [MSFT]
    MSDN Community Support | Feedback to us

    • Marked as answer by tferreira138 Tuesday, July 3, 2012 11:39 PM
    Friday, June 29, 2012 6:58 AM

All replies

  • I am not sure if I get the question. You can use Assert.AreEqual to compare the Expected result vs. Actual result.

    Thanks,

    Anuj


    http://www.anujchaudhary.com

    Thursday, June 28, 2012 5:39 AM
  • HI Anu -

    Assert.AreEqual will tell you if they match or not; however, it doesn't tell you what the difference is between the two. 

    Example:

    String Expected = "My Test 123456."

    String Actual = "My Test 12345."

    Assert.AreEqual will tell you your test failed; however, it doesn't tell you why.  I'm looking for a compare tool to say, the different is "6".

    Thursday, June 28, 2012 6:10 PM
  • Thanks for Anuj’s help.

    Hi tferreira138,

    Thank you for posting in the MSDN forum.

    Open your test result in Test Results window, and I think you could get the error message like this:

    Assert.AreEqual failed. Expected:< My Test 123456>. Actual:< My Test 12345>.

    I'm looking for a compare tool to say, the different is "6".

    About your issue, I’m afraid that it couldn’t achieve it with VS tool in default now, but you could send this feature request: http://visualstudio.uservoice.com/forums/121579-visual-studio. The Visual Studio product team is listening to user voice there. Thanks for your understanding.

    In addition, since the unit test support the Console.WriteLine(), one idea is that we could write it like the following code. And then Output the value to the test result

    if (expected != actual)

                {

                    Compared the values and get the difference of the two values s

                   

                    System.Console.WriteLine("XX:{0}", s);

                    Assert.Fail();//make the result is failed

                }

    About how to compare the two values, if it is hard for you to write the code, you could post an issue in the develop forum like the C# forum. I think you would get useful information. Thanks for your understanding.

    Best Regards,


    Jack Zhai [MSFT]
    MSDN Community Support | Feedback to us

    • Marked as answer by tferreira138 Tuesday, July 3, 2012 11:39 PM
    Friday, June 29, 2012 6:58 AM
  • Excellent idea Jack, I appreciate the post!
    Tuesday, July 3, 2012 11:39 PM