1

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 may 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).

Not sure if this is still the case that I have to attach to process.

Does anyone know the process for debugging UWP unit tests.

The Process without attach to 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 on both. And it does not stop at breakpoint.

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

Anyone have any ideas?

thanks

Haydn
  • 293
  • 1
  • 2
  • 13

1 Answers1

0

In Visual Studio 2017 Community debugging UWP Test Apps is just the same as debugging any other unit test: Open your Test Explorer (Test->Windows->Test Explorer), right click on the unit test you want to debug and click on Debug Selected Tests. Also described somewhere in this article (though for Visual Studio 2015, but seems to be the same for Visual Studio 2017).

If your unit test does not show up, you can click on Run All in the Test Explorer, which will first build your solution and then discover and run all tests.

Simon
  • 165
  • 1
  • 8