none
[UWP] Debugging Unit Tests RRS feed

  • Question

  • Hi everyone

    I am using MSTest in a UWP Test App. I am trying to debug unit tests. I would like to set a breakpoint in them and step through them.

    I am using Visual Studio 2017 Community Edition.

    I watched an old Channel 9 video on unit tests, but it did not give me enough information. I know UWP apps run in a sandbox and that's why you have to attach to process. I have tried this but if the tests are not running it does not show up in the list. If the app is running then the test app does show up in the attach to process dialog, but is greyed out (unselectable).

    Does anyone know the process for debugging UWP unit tests.

    thanks



    Monday, April 10, 2017 11:53 AM

Answers

  • Hi All

    Got the answer on Stack Exchange. I have to right click the unit test in test explorer and select Debug Selected Tests

    then it works

    thanks

    • Marked as answer by hypodyne1 Sunday, April 16, 2017 8:51 AM
    Sunday, April 16, 2017 8:51 AM

All replies

  • Oh I just found this thread..

    Cannot debug unit tests for universal app (VS 2015)

    I will try that tomorrow. Did not show up in google results. Anyone else noticed that google results are pretty bad for UWP apps?.


    Monday, April 10, 2017 12:00 PM
  • Process:

    I created a default UWP app and UWP test app, add a reference to the main project from the test project, add some code in the default unit test, set a break point and run all tests. The build is set to Debug x86. And it does not stop at breakpoint.

    Tried devenc /resetuserprofile I think it was. something like that. Has no effect.

    Tried adding a few properties in the project file like the "Cannot debug unit tests for universal app" forum post suggests. Has no effect.

    Anyone have any ideas?

    Monday, April 10, 2017 9:31 PM
  • Hi friend, 

    I saw this thread you mentioned, where the op solved by changing the following setting: 

    setting

    <EnableDotNetNativeCompatibleProfile>false</EnableDotNetNativeCompatibleProfile>

    and

    <UseDotNetNativeToolchain>false</UseDotNetNativeToolchain>

    and after deleting

    <EnableCoreRuntime>false</EnableCoreRuntime>

    <UapDefaultAssetScale>100</UapDefaultAssetScale>

    Then, does the above work in you end?

    Best regards, 

    Fletch


    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.


    • Edited by Fletch Zhou Wednesday, April 12, 2017 8:26 AM
    Wednesday, April 12, 2017 8:26 AM
  • Hi All

    Got the answer on Stack Exchange. I have to right click the unit test in test explorer and select Debug Selected Tests

    then it works

    thanks

    • Marked as answer by hypodyne1 Sunday, April 16, 2017 8:51 AM
    Sunday, April 16, 2017 8:51 AM