Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
724 views
in Technique[技术] by (71.8m points)

visual studio 2010 - How to run ALL tests in my solution using command line MSTest.exe?

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).

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!

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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

As explained here.

E.g.:

mstest /testmetadata:mySolution.vsmdi

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...