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

查看:175
本文介绍了从命令行运行通用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 AppPackages\UnitTestProject1_1.0.0.0_x64_Debug_Test\UnitTestProject1_1.0.0.0_x64_Debug.appx

长答案:

  1. 通过选择通用/单元测试应用程序(通用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:

    • 将商店位置设置为本地计算机:
    • 将证书放入受信任的根证书颁发机构存储:
    • 完成向导应显示导入成功."
    • Set Store Location to local machine:
    • Place the certificate to Trusted Root Certification Authorities store:
    • Finishing the wizard should say "The import was successful."

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

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