从命令行运行通用 Windows 单元测试 [英] Running Universal Windows unit tests from the command line

查看:35
本文介绍了从命令行运行通用 Windows 单元测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何从命令行运行通用 Windows (UWP) 单元测试项目?

How do you run Universal Windows (UWP) unit test projects from the command line?

我正在使用 MSTestFramework.

I am using the MSTestFramework.

推荐答案

简答:

vstest.console.exe /Platform:x64 AppPackagesUnitTestProject1_1.0.0.0_x64_Debug_TestUnitTestProject1_1.0.0.0_x64_Debug.appx

长答案:

  1. 通过选择 Universal/Unit Test App (Universal Windows) 模板创建项目:

  1. Create the project by selecting Universal / Unit Test App (Universal Windows) template:

在解决方案文件所在的文件夹中使用命令行构建它

Build it with command line using in the folder where the solution file is

msbuild/p:Platform=x64;Configuration=Debug

尝试在简短回答中运行上面的 vstest.console.exe 命令.它将失败,并给出以下错误消息:

Try running the vstest.console.exe command above, in the short answer. It will fail, giving the following error message:

error 0x800B0109: The root certificate of the signature in the app package or bundle must be trusted..
For more details look into Event Viewer under Applications and Services Logs -> Microsoft -> Windows -> AppXDeployment-Server -> Microsoft-Windows-AppXDeploymentServer/Operational.

  • 为了能够从命令行运行测试,您需要使用具有受信任根的证书,或者使 Visual Studio 生成的证书受信任.对于后者,从 windows 资源管理器中双击 UnitTestProject1_TemporaryKey.pfx 文件,并按照导入向导的默认步骤进行操作,但要更改以下两点:

  • To be able to run tests from command line, you need to use a certificate which has trusted root, or make the certificate that generated by visual studio trusted. For the latter, double click UnitTestProject1_TemporaryKey.pfx file from windows explorer, and follow the import wizard default steps, but change two things:

    • 将商店位置设置为本地机器:
    • 将证书放入受信任的根证书颁发机构存储:
    • 完成向导后应该会提示导入成功."

    这篇关于从命令行运行通用 Windows 单元测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

  • 查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆