2

I have a *.webtest that I'm building as part of a TFS 2015 Release Definition. I'd like to run this test as part of the release.

I believe this requires mstest.exe however the mstest command is not recognized when running within the Command Line component, unlike other commands like dotnet publish.

Do I need to include the MSTest.exe executable within my test project or is there a more "out of the box" way to go about running webtests within a TFS 2015 Release Definition?

SB2055
  • 12,272
  • 32
  • 97
  • 202

1 Answers1

1

You can run WebTests through MSBuild tool, you can call MSBuild tool through PowerShell.

  1. Add PowerShell task

Code:

        param (    
        $tool = "C:\Program Files (x86)\Microsoft Visual Studio 14.0\Common7\IDE\MSTest.exe",   
         $path ,   
         $include = "*.webtest",   
         $results ,    
        $testsettings)
            $web_tests = get-ChildItem -Path $paths -Recurse -Include $include

foreach ($item in $web_tests)
     {   

     $args += "/TestContainer:$item "

    }

    & $tool $args /resultsfile:$Results /testsettings:$testsettings
  1. Add Publish Test Results task

More information, you can refer to this article: Running WebTests as part of a VSTS VNext Release pipeline

Andy Li-MSFT
  • 28,712
  • 2
  • 33
  • 55
  • Whoops - I commented on the wrong question. +1, Marking as accepted. Would you mind taking a look at this one? https://stackoverflow.com/questions/47705026/running-webtest-tests-results-in-webtest-is-not-a-valid-extension – SB2055 Dec 08 '17 at 02:54