简体   繁体   English

在VS 2017中运行UWP单元测试

[英]Running UWP unit tests in VS 2017

For some reason Visual Studio 2017 does not recognize unit tests in Universal Windows Unit Test App projects. 由于某些原因,Visual Studio 2017无法识别通用Windows单元测试应用程序项目中的单元测试。

Steps to reproduce: 重现步骤:

  1. Create a new Unit Test App (Universal Windows) in VS 2017 在VS 2017中创建新的单元测试应用程序(通用Windows)
  2. Add Assert.IsTrue(true); 添加Assert.IsTrue(true); to the unit test created 到创建的单元测试
  3. Click on Test -> Run -> All Tests 单击测试->运行->所有测试

Expected: unit test discovered and run successfully. 预期:发现单元测试并成功运行。

Actual: no tests found. 实际:未找到测试。

Output Tests produces absolutely no output. 输出测试绝对不会产生任何输出。

Comment if there is a log file containing some more info and I'll add it. 评论是否有包含更多信息的日志文件,我将其添加。

EDIT: So it turns out they don't work in 2015 either . 编辑:因此,事实证明他们也不会在2015年工作 I have ReSharper in 2015 which is able to run them. 我在2015年ReSharper的,它能够运行它们。 But why can't the VS runner run them? 但是为什么VS跑步者不能运行它们?

By sheer dumb luck (or just desperation), I went to my Test project and Deployed it (right click on project-> Deploy). 由于运气愚蠢(或者只是绝望),我去了我的Test项目并部署了它(右键单击project-> Deploy)。 That made the tests appear and now they run. 这使得测试出现,现在它们可以运行。

This now works in Visual Studio 2017 (version 15.4.5 currently). 现在可以在Visual Studio 2017中使用(当前版本15.4.5)。

After building the solution, the tests appear right away. 构建解决方案后,将立即显示测试。 Deploying the test project may have also worked in the older versions. 在旧版本中,部署测试项目也可能有效。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 单元测试未在vs 2017中运行 - Unit Test not running in vs 2017 VS 2017 15.7.1 - “旧”单元测试无法运行 - VS 2017 15.7.1 - “old” unit tests not runnable 由于Windows操作系统不同,VS2017(vstest.console.exe)运行单元测试失败 - Running Unit Tests fails with VS2017 (vstest.console.exe) because the Windows OS is different VS2017运行调试选定的测试无法打开调试器 - VS2017 running debug selected tests does not open the debugger 在VS2015中的调试中运行单元测试时出现DisconnectedContext错误 - DisconnectedContext error when running Unit Tests in debug in VS2015 如何查看VS2017中的单元测试结果? - How can I see the results of my Unit Tests in VS2017? 我是否必须将经过测试的源文件添加到 VS2017 中的单元测试项目中? - Do I have to add tested source files to unit tests' project in VS2017? 在VS2017中,是否有一种方法可以一次将所有失败的单元测试的名称复制到剪贴板? - In VS2017, is there a way to copy the names of all the failed unit tests to the clipboard at one time? 没有发现要运行的测试 - 在调试/运行单元测试用例时 - Visual Studio 2017 15.5.1 - No tests found to run - while debugging/running Unit test cases -- Visual studio 2017 15.5.1 VS2017中的单元测试 - Unit testing in VS2017
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM