views:

41

answers:

2

I use scripting for this:

"%ProgramFiles%\Microsoft Visual Studio 9.0\Common7\IDE\TF.exe" get $/DmlOnDemmand /recursive /force /noprompt

And I build solution .sln

call %msBuildDir%\msbuild %solutionName% /t:Rebuild /p:Configuration=%buildType%

Now, I would like execute all Unit Tests and check all is OK.

How can I execute unit tests of .csproj projects of a solution from the command line using a build tool like MSBuild?

+1  A: 

Have you tried using MSTest.exe?

found possible dupe

http://stackoverflow.com/questions/3930445/how-to-run-unit-testing-tests-from-command-line

and related

http://stackoverflow.com/questions/3961633/how-to-run-all-tests-in-my-solution-using-command-line-mstest-exe

and in that question there is a neat utility called Gallio Echo that seems like a awesome option to check out.

but if you want to just use MSTest.exe this should just about cover how to use it

http://msdn.microsoft.com/en-us/library/ms182486.aspx

Terrance
any sample code of scripting using MSTest.exe?
alhambraeidos
Did that answer your question?
Terrance
A: 

I inserted a Test-Project in the Solution.

Every build a library the test depends on is changed the solution updates the Test-Project. The Test is automaticaly run after each "Test-Project" change with the Post-Build option.

The result from the Test is directly shown in the buildlog.

Marco Wagner