Execute Unit Tests using MsBuild command line

53,968

Solution 1

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.

Solution 2

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.

Share:
53,968
Kiquenet
Author by

Kiquenet

Should "Hi", "Thanks" and taglines and salutations be removed from posts? http://meta.stackexchange.com/questions/2950/should-hi-thanks-and-taglines-and-salutations-be-removed-from-posts What have you tried? http://meta.stackexchange.com/questions/122986/is-it-ok-to-leave-what-have-you-tried-comments Asking http://stackoverflow.com/help/asking Answer http://meta.stackexchange.com/questions/8231/are-answers-that-just-contain-links-elsewhere-really-good-answers http://www.enriquepradosvaliente.com http://kiquenet.wordpress.com ◣◥◢◤◢◤◣◥◢◤◢◤◣◥◢◤ ◥◢◤◢◤◣◥◢◤◢◤◣◥◢◤◢ .NET developer and fan of continuous self-improvement and good patterns and practices. Stuff I am interested in: .NET technology stack in general, C#, Powershell and Javascript in particular as languages Test driven development, DI, IoC and mocking frameworks Data access with ORMs and SQL ASP.NET javascript, jQuery and related frontend frameworks Open source projects

Updated on May 07, 2020

Comments

  • Kiquenet
    Kiquenet about 4 years

    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?

  • Marco Kinski
    Marco Kinski over 8 years
    @Kiquenet You build the project as usual because of the "Post-Build" the test runs automaticaly