在没有 mstest.exe 的情况下运行 VSTS 测试
由于我不会详细说明的原因,我们所有的单元测试都使用 VSTS 测试框架。我现在想创建一个运行测试的 MSBuild 脚本,但由于各种原因我不想使用 mstest.exe(它速度较慢,需要到处安装 Visual Studio,我需要维护 testrunconfig 等)
我见过TestDriven.net 和 TeamCity 能够运行“NUnit 风格”的 VSTS 测试,而无需使用 mstest.exe。您知道有任何独立的命令行实用程序可以执行此操作吗?
From reasons I won't get into, all our unit tests are using the VSTS test framework. I now want to create an MSBuild script that runs the tests, but I don't want to use mstest.exe from various reasons (it's slower, requires Visual Studio installation everywhere, I need to maintain testrunconfig, etc.)
I've seen that TestDriven.net and TeamCity are able to run VSTS tests 'NUnit style', without using mstest.exe. Are you aware of any standalone command line utility that does this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
如果您使用可识别 MS 测试属性(TestClass 等)的特殊 NUnit 插件,则可以在 NUnit 中执行团队系统测试 (MSTest)。
Exact Magic Software 有一个开源“测试-适配器” 可以做到这一点。
更新:我已经针对 NUnit 2.5.2 重新设计了 Exact Magic 的 Msts NUnit 适配器。
You can execute Team System Tests (MSTest) in NUnit if you use a special NUnit Addin that recognizes the MS Test Attributes (TestClass, etc).
Exact Magic Software has an open-source "test-adapter" that can do this.
UPDATE: I've reworked Exact Magic's Msts NUnit Adapter for NUnit 2.5.2.
看起来 TeamCity 只是利用 Gallio 来运行 VS 测试。 Gallio 似乎有 msbuild 集成,听起来很完美,但仔细一看,它似乎需要像 MSTest 一样安装 VS,因为它似乎依赖于 MS exes:
话虽如此,听起来至少有一个人已经让它工作了:
Christoph De Baene - 不使用 Visual Studio 运行 MSTest< /a>
It seems like TeamCity is simply leveraging Gallio to run VS tests. Gallio appears to have msbuild integration and sounds perfect but after a closer look it seems that it would require a VS install just like MSTest as it appears to depend on MS exes:
That being said it sounds like at least one person has got it working:
Christoph De Baene - Running MSTest without Visual Studio
无需安装 Visual Studio 即可运行 MSTest。请参阅how-do-i-use-mstest-without-visual-studio 。
我这样做是为了可以将测试作为 CI 流程的一部分来运行。 (我的 CI 解决方案使用 CC.NET)。
我的情况和你类似,我想使用 TestDriven.NET 来获取代码覆盖率统计信息。但是,我遇到了问题。我的第一个问题是我使用
AssemblyInitialize
属性来初始化数据库连接。 NUnit 不支持这一点,因此大约一半的测试失败,而它们在 MSTest 下运行良好。因此,将测试从一种测试框架转换为另一种测试框架似乎存在缺陷。如果您意识到这一点,那么就继续吧,但最好尝试在一个测试框架上保持一致。
It is possible to run MSTests without installing Visual Studio. See how-do-i-use-mstest-without-visual-studio.
I did this so that I could run my tests as part of my CI process. (I am using CC.NET for my CI solution).
I am in a similar situation as you, in that I want to use TestDriven.NET to get code coverage stats. But, I am running into problems. My first problem is that I am using
AssemblyInitialize
attributes to initialize a database connection. This isn't supported by NUnit so about half of my tests fail whereas they run fine under MSTest.So, it seems that translating tests from one test framework to another has pitfalls. If you are aware of that, then go forth, but it might be better to try and keep consistent on one test framework.
我们使用 msbuild TestToolsTask 在巡航控制服务器。这不使用 MSTEST 可执行文件(您要求的条件),但确实使用各种 TFS 依赖项。
请注意,我们正在将测试从 NUnit 的 VSTS 测试框架中迁移出来,主要是因为我们可以为 NUnit 创建扩展来执行有用的任务。
We run VSTS tests using msbuild TestToolsTask on a Cruise Control server. This does not use the MSTEST executable -- the condition you ask for -- but does use a variety of TFS dependencies.
Note that we are migrating tests off of the VSTS test framework for NUnit, mostly because we can create extensions for NUnit to perform useful tasks.