Facing some issues like *failled*, When I running 45+ Integration Test in Visual Studio Community 2017 RRS feed

  • Question

  • Hi,

    I have created 44 Integration tests in the 6 classes, when going to run one by one classes then it's passes. But I'm going to Run All then it's throwing error in the randomly test like test failed. Then after that When I'm going to run that class separately then it's passes.

    I'm not able to track these type of error.

    Could any one please suggest that how to do that.


    Monday, August 12, 2019 9:37 AM

All replies

  • Hi DevSingh_Dotnet,

    Welcome to MSDN forum.

    According to your description, this issue might be the intrinsic association of your tests that effects the order when tests run.

    As far as I know, unit tests usually run ordered by alphabetically. If there is any association between classes and methods, however, not run in correct order, might cause ‘later-test’ runs before ‘previous-test’ and fail to run.

    For example, if I have these two tests.

    VS 2017 will run LaterTest() first and run PreviousTest() second by default. But in PreviousTest() there does something that effect the LaterTest(), it means if not run PreviousTest() first the test will fail and not pass. Also, a static method or variable might also cause problem. So please check your tests to see whether they are independent, if not, you could try to change name of test method and ordered alphabetically, if possible, we recommend you to program tests to be independent to match the rule of Unit Testing – “Isolation”. Refer more from this link.

    If the tests are independent, could you please provide us with more information about error messages in Test->Windows->Test Explorer (like below) so that we could help you better. 

    Any feedback will be expected.

    Best Regards,


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com

    Tuesday, August 13, 2019 6:38 AM
  • Thanks Dylan Zhu-MSFT,

    Let me try with your suggestion.

    Wednesday, August 14, 2019 8:27 AM