I got code coverage to work in the following configuration using VS2015:
- Create a portable class library (PCL) project.
- In the project properties, reconfigure the project to .NETStandard1.4 (see the official compatibility matrix for choosing option v1.4).
- Link to the PCL project from your UWP application.
- For a test project, use xUnit and the .NET Core class library, setting it up as described in xUnit docs .
If you can minimize the amount of code in a UWP application project (for example, using the MVVM template), most of your tests will be against PCL. Since code coverage works with the installed .NET Standard standard library, your numbers will be fairly accurate even if you cannot measure the scope of the UWP application project itself.
(Of course, this is more practical for new applications than existing applications, as this requires a specific design).
source share