Visual Studio Test Result Compare Tool or Plugin?

Answered Visual Studio Test Result Compare Tool or Plugin?

  • miércoles, 27 de junio de 2012 16:52
     
     

    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.

Todas las respuestas

  • jueves, 28 de junio de 2012 5:39
     
     

    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

  • jueves, 28 de junio de 2012 18:10
     
     

    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".

  • viernes, 29 de junio de 2012 6:58
    Moderador
     
     Respondida

    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

    • Marcado como respuesta tferreira138 martes, 03 de julio de 2012 23:39
    •  
  • martes, 03 de julio de 2012 23:39
     
     
    Excellent idea Jack, I appreciate the post!