MS Build v4.0.30319 抱怨 mstest.exe“/category:”转变
我正在尝试添加运行属于特定类别的硒测试的能力。在我们的硒测试文件中,我添加了一个测试类别属性。由于我们进行了自动化测试,因此我们使用 msbuild.exe 来构建目标应用程序,然后使用带有类别开关的 mstest.exe 来运行测试。
每次我运行测试时,msbuild.exe 都会显示“MSBUILD:错误 MSB1001:未知开关。开关:/category:cat1&cat2”
msbuild 的版本是 4.0.30319。有什么想法/建议吗?
谢谢!
I am trying to add the ability to run selenium tests that belong to a particular category. In our selenium test files I added a test category attribute. Since we have automated testing we use msbuild.exe to build the target application and then use mstest.exe with the category switch to run the tests.
Every time I run the tests the msbuild.exe says "MSBUILD : error MSB1001: Unknown switch. Switch: /category:cat1&cat2"
The version of msbuild is 4.0.30319. Any ideas/suggestions?
Thanks!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
听起来您正在尝试将 mstest.exe 特定命令行参数之一传递给 msbuild.exe,对吗?不确定您期望它如何工作,msbuild.exe 不理解它们。大概您正在使用 msbuild 在 Exec 任务中调用 mstest,或者您是否通过其他方式执行测试?无论如何,/category:... 开关需要传递到对 mstest.exe 的调用中。您可以让您的 msbuild 脚本接受适当的 msbuild 参数并将其转换为 mstest 识别的参数,例如:
这会传入一个名为 $(mstestcat) 的新的有效 msbuild 属性。 %26 是 msbuild 转义 '&' 的方式特点。当您在 msbuild 中调用 mstest.exe 时,请执行以下操作:
It sounds like you are trying to pass one of the mstest.exe specific command line arguments to msbuild.exe, right? Not sure how you would expect this to work, msbuild.exe doesn't understand them. Presumably you are using msbuild to call to mstest in an Exec task, or are you getting the tests executed by some other means? Regardless, the /category:... switch needs to be passed into the call to mstest.exe. You can have your msbuild script accept a proper msbuild parameter and convert it to one recognized by mstest, for example:
This passes in a new valid msbuild property named $(mstestcat). The %26 is msbuild's way of escaping the '&' character. When you call mstest.exe inside msbuild, do something like this,