[英]How to run UWP NUnit tests in with Visual Studio 2015?
This question is specifically about running Universal Windows Platform (UWP) unit tests written in C# for NUnit. 这个问题专门针对NUnit运行用C#编写的通用Windows平台(UWP)单元测试。
How can I discover and run these tests in Visual Studio? 如何在Visual Studio中发现并运行这些测试?
I could find no definitive articles on this on the web, which is really surprising. 我在网上找不到关于此的确切文章,这真的很令人惊讶。
I happened upon this asking if xUnit was still the only way to write tests. 我碰巧询问xUnit是否仍然是编写测试的唯一方法。 NUnit Wiki for Xamerin / UWP
针对Xamerin / UWP的NUnit Wiki
My current setup is 我目前的设置是
I added a new project in the Cross Platform section (where NUnit templates are installed as of this writing). 我在Cross Platform部分添加了一个新项目(在撰写本文时安装了NUnit模板)。 I added a template for UWP.
我为UWP添加了一个模板。 This is the
projects.json
that is created so you can probably just edit your xUnit one, but this is easier 这是创建的
projects.json
,因此您可以只编辑xUnit,但这更容易
{
"dependencies": {
"Microsoft.NETCore.UniversalWindowsPlatform": "5.0.0",
"NUnit": "3.0.1",
"nunit.xamarin": "3.0.1",
"Xamarin.Forms": "2.0.0.6490"
},
"frameworks": {
"uap10.0": {}
},
"runtimes": {
"win10-arm": {},
"win10-arm-aot": {},
"win10-x86": {},
"win10-x86-aot": {},
"win10-x64": {},
"win10-x64-aot": {}
}
}
From what i can tell this is more of a test runner than a test project. 据我所知,这更多的是测试运行器而不是测试项目。 Looks like both xUnit and NUnit both want you to create a PCL project with all your tests then reference it in this UI project and run your tests like that.
看起来xUnit和NUnit都希望您创建一个包含所有测试的PCL项目,然后在此UI项目中引用它并运行您的测试。 As of this writing I want to test if it does a shadow copy so you can run without a debugger and run your tests over and over again.
在撰写本文时,我想测试它是否进行了卷影复制,因此您可以在没有调试器的情况下运行并反复运行测试。 I hope it can, i'll report back later if it can.
我希望它可以,如果可以,我会稍后报告。 Hope this helps
希望这可以帮助
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.