简体   繁体   English

从命令行运行单元测试

[英]Running unit tests from a command line

I'm working on a suite of application that interact with many websites and api's.我正在开发一套与许多网站和 api 交互的应用程序。 I have created unit tests that test this code.我已经创建了测试此代码的单元测试。

As it's beyond my control, I want to know as soon as sites / api's change and the code stops working so I can fix and would like to run the tests periodically against the assemblies running.由于它超出了我的控制范围,我想在站点/api 发生更改并且代码停止工作时立即知道,以便我可以修复并希望针对正在运行的程序集定期运行测试。 How can I run the tests outside of VS?如何在 VS 之外运行测试?

I'd like the option of testing on Linux mono too.我也想要在 Linux mono 上进行测试的选项。

You can use MsTest from the command line : 您可以使用MSTEST在命令行

Example: 例:

"C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\mstest" /testcontainer:C:\MyTestProject\bin\debug\MyTestProject.dll /resultsfile:C:\TestResults\results.trx

(Full list of command line switches on the link above) (以上链接上的命令行开关的完整列表)

This is set to Visual Studio 2015, for 2017 just make sure you have the right version number, I believe 15.0 设置为Visual Studio 2015,对于2017,只需确保您具有正确的版本号,我相信15.0

MSTest has been deprecated, you'll want to invoke VSTest from the command line MSTest 已被弃用,您需要从命令行调用 VSTest

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM