如何使用命令行MSTest.exe在我的解决方案中运行所有测试?

编程入门 行业动态 更新时间:2024-10-24 07:32:59
本文介绍了如何使用命令行MSTest.exe在我的解决方案中运行所有测试?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

根据MSDN 此处并讨论了这里,我们可以使用 MSTest.exe 从命令行运行测试 - 这是甜美的,比在IDE中运行(尤其是慢,如果你正在一个像我这样的大解决方案)。

According to MSDN here and discussed here, we can use MSTest.exe to run tests from command line - which is sweet and faster than running within the IDE (especially slow if you are working on a big solution like me).

我的问题是如何使用 MSTest.exe 在我的解决方案中运行所有测试?该命令只有 / test 选项可过滤在 / container 选项。我只能想到调用这个命令N次,因为我可以在我的解决方案(!?)所有的N测试程序集。此外,运行后的结果是每个程序集的基础,所以不容易得到什么测试失败/

My question is how can I use MSTest.exe to run all tests in my solution? The command only have the /test option to filter the tests in one assembly specified in /container option. I only can think of calling this command N times given that I can have all the N test assembly in my solution (!?) Moreover, the results after run are per-assembly basics so that it's not easy to get what tests were failed/passed.

如果你知道更好的方法,请分享!谢谢!

If you know a better way, please share! Thank you!

推荐答案

我使用 testmetadata 它到我的.vsmdi文件。

I accomplished this using the testmetadata argument and pointing it to my .vsmdi file.

如解释此处。

例如:

mstest /testmetadata:mySolution.vsmdi

testmetadata 可能更脆弱(例如空白测试列表结合Ignore属性原因指定的转换无效)。 创建一个包含所有包含测试类的DLL的批处理可能是更可靠的替代方法。

However note that testmetadata can be more fragile (e.g. empty test lists combined with the Ignore attribute cause "Specified cast is not valid"). Creating a batch with all DLLs containing test classes could be more reliable alternative.

更多推荐

如何使用命令行MSTest.exe在我的解决方案中运行所有测试?

本文发布于:2023-11-14 19:18:07,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1588309.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:如何使用   命令行   解决方案   测试   MSTest

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!