locked
VS2010 Unit Test, Test Results Error Message field always blank RRS feed

  • Question

  • I add message strings to my Asserts, but they do not show up in Unit Test Test Results Error Message field.

    I catch Exceptions e and use Assert.Fail(e.message); and still message does not show up in Test Results Error Message field.

    I use Console.Writeline and Debug.Writeline and neither show up in Output.Debug window.

    How can I get Assert message to show up in Unit Test Test Results Error Message  field?

    No guidance or examples available.

    I am using Ordered Tests so that the tests run in the order that I specify.

    Sunday, November 11, 2012 3:58 PM

All replies

  • Hello DonBaechtel,

    Thank you for posting in the MSDN forum.

    If you are doing ordered test, then you can only get the Failed/Pass result in the Test Results window. To view detailed results of individual unit test, you need to click the View Test Results Details after run.

    I have tried the following unit test:

    [TestMethod]

    Public void Test1(){

    try{

    Assert.AreEqual(2,3);

    }

    catch(AssertFailedException e)

    {

    Assert.Fail(“ERROR MESSAGE”)

    }

    }

    After run alone, the “Assert.Fail failed” and “ERROR MESSAGE” display in the Test Result Error Message field. You can get the Assert message in the Test Result Error Message filed.

    But if you work with ordered test, you will not see the error message even in the detailed test result. I am afraid that you have to run individual unit test in order to see the Assert message in Error Message field.

    Best regards,


    Amanda Zhu [MSFT]
    MSDN Community Support | Feedback to us

    • Proposed as answer by Amanda Zhu Tuesday, November 13, 2012 9:15 AM
    • Marked as answer by Amanda Zhu Thursday, November 15, 2012 12:26 AM
    • Unmarked as answer by DonBaechtel Thursday, November 15, 2012 3:09 AM
    • Unproposed as answer by Amanda Zhu Thursday, November 15, 2012 4:14 AM
    Monday, November 12, 2012 7:50 AM
  • Hello DonBaechtel,

    I mark my reply as answer. If my suggestion can’t help you, you can come back and unmark it as answer. And then if possible you could let us know the result of the suggestion.

    Best regards,


    Amanda Zhu [MSFT]
    MSDN Community Support | Feedback to us

    Thursday, November 15, 2012 12:26 AM
  • I cannot run the tests individually. There are multiple tests to run and when I run them individually, they refuse to run in the order that I specify.

    The only way to get the tests in the order that I specify to to use ordered tests. But when I do that:

    • The Error Message is not displayed like it should.
    • I cannot see the results of the individual test runs as they are running.
    • I cannot easy navigate to the test code by clicking on the test name in the list, like the other does.

    This is a typical very losy Microsoft implementation. There is no reason why the test should not be run in the order that I specify WITHOUT going to the unnecessary complication of using ordered tests. Can't Microsoft execute from a list of test to run ??? !!!

    When I do go to all of the trouble of using ordered tests, I lose many features that the other method provides. What is up with that ??

    What is the logic to all of this unnecessary complication and frustration ??

    Thursday, November 15, 2012 3:18 AM
  • You did not provide a workable solution to my delemma.
    Thursday, November 15, 2012 3:19 AM
  • Hello DonBaechtel,

    Glad to receive your reply.

    As my previous reply, if you work with ordered test, you will not see the error message even in the detailed test result. When they are running, you can’t see the results of the individual test runs unless you see it in the detailed test result window after running.

    I think that all that you can’t see and do with using ordered test are like they should. It is desired for ordered test.

    Of cause you can add multiple unit tests in a Test List then run them with MSTest. But in that case they will not run in the order.

    If you want more features for ordered test result, you could submit this feature request:

    http://visualstudio.uservoice.com/forums/121579-visual-studio

    The Visual Studio product team is listening to user voice there. You can send your ideas/suggestions there and people can vote.

    Thanks for your understanding.

    Best regards,


    Amanda Zhu [MSFT]
    MSDN Community Support | Feedback to us

    • Marked as answer by Amanda Zhu Sunday, November 18, 2012 11:58 PM
    • Unmarked as answer by DonBaechtel Monday, November 19, 2012 12:04 AM
    • Proposed as answer by Fernando DeSantos Friday, November 30, 2012 5:47 PM
    Thursday, November 15, 2012 4:14 AM
  • This is not an acceptable solution.

    There is no reason why Visual Studio should behave so poorly.

    Monday, November 19, 2012 12:05 AM
  • Hello DonBaechtel,

    I think that the issue is related to product design. If you have hundreds of unit tests in an ordered test, when they fail, maybe too many error massages in Error Message field can cause confusion. So I am escalating this issue. There might be some time delay. Appreciate your patience.

    Thank you for your understanding.

    Best regards,


    Amanda Zhu [MSFT]
    MSDN Community Support | Feedback to us


    • Edited by Amanda Zhu Thursday, November 22, 2012 8:43 AM
    Monday, November 19, 2012 8:26 AM
  • I think that if there is more than one error message from a set of ordered tests, that if the test manager just displayed the first error message, that would be fine, especially if it flagged that there was more than 1 error. Usually you want to fix the first error, first ayway. Other error messages could be intercepted using other means.

    I still don't understand why VS can't execute a list of tests in the order that I specify, without resorting to using ordered tests. Why would you want to execute them automatically in any other order than the order that I specify? If this was done, the necessity and complication and issues with ordered tests just goes away.

    I think that if Microsoft considered what is happening, they could easily improve the situation dramatically and testers would be happier and more more in control of what happens without unnnecessary complication. It could be a win-win.

    Monday, November 19, 2012 2:21 PM
  • I don't see the error message for one failed test case (executed as single test) in the error message field in MTM. Please suggest.
    Wednesday, June 12, 2013 12:04 PM