Kiquenet
Kiquenet

Reputation: 15036

Execute Unit Tests using MsBuild command line

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?

Upvotes: 35

Views: 64809

Answers (2)

Mark Rowe
Mark Rowe

Reputation: 999

Look at VSTest.Console.EXE they added this for CodedUI tests. Seems to have more functionality. https://msdn.microsoft.com/en-us/library/jj155800.aspx in C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\CommonExtensions\Microsoft\TestWindow directory.

Upvotes: 12

Marco Kinski
Marco Kinski

Reputation: 342

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.

Upvotes: 3

Related Questions