开发者

MS Build v4.0.30319 complains about mstest.exe "/category:" switch

I am trying to add th开发者_运维知识库e 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!


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:

>msbuid My.proj /p:mstestcat=cat1%26cat2

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,

<Exec
  Command="mstest.exe ... /category:$(mstestcat)"
  ...
  />
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜