machine.specifications icon indicating copy to clipboard operation
machine.specifications copied to clipboard

Support for running test on UWP runtime

Open ivanz opened this issue 8 years ago • 1 comments

MSpec 0.11 is .NET Standard 1.3+ compatible, which means one can happily add the NuGet package to a UWP project.

I ported "dotnet-test-mspec" to target UWP in a spike ( https://github.com/ivanz/dotnet-test-mspec/tree/uwp-support )- however when I run dotne test it appears UWP has a security model which is makes things a bit more complicated: https://xunit.github.io/docs/getting-started-uwp.html.

ivanz avatar Jul 30 '16 12:07 ivanz

Xunit has the "runner for devices" that can run tests on (for example) a Raspberry Pi running Windows 10 IoT Core (under UWP).

What I've been doing lately is putting all my testable code into a .NETStandard class library (which I can test directly) and then referencing that from my UWP code via NuGet. My tests are in a .NET Core class library and I use MSpec with NCrunch to run the tests, this works well for me.

However, where the problem comes is where you need to reference namespaces that are not available in NETStandard, such as the Windows.Devices namespace that is specific to IoT Core. I haven't found any way to reference that namespace outside of a UWP application or library, so any such code can only be tested running under UWP - so some sort of UWP test runner is probably going to be needed.

I wonder if, rather than hacking at the UWP security model, it might be better to approach it by having a UWP specific test runner and discovery engine that communicates with the actual test runner using some sort of RPC mechanism. I confess, I don't really have a goo d grasp of all the subtleties of UWP so this may be a crazy idea!

NameOfTheDragon avatar Aug 07 '17 13:08 NameOfTheDragon