William
William

Reputation: 1395

TFS 2013 build doesn't run tests

Our build fails to run unit tests.

We upgraded our TFS 2010 to TFS 2013. I think the TFS2010 might have been an upgrade from eariler versions, not sure.

I've tracked down the failure to a TestToolsTask in the microsoft.teamfoundation.build.targets file.

  <TestToolsTask
            Condition=" '$(ProjectFileVersion)' != '2' and '$(IsDesktopBuild)'!='true' and '$(V8TestToolsTask)'!='true' and '@(LocalTestContainer)' != '' "
            ToolPath="$(TestToolsTaskToolPath)"
            TeamProject="$(TeamProject)"   
            BuildUri="$(BuildUri)"

            Publish="true"
            SearchPathRoot="$(OutDir)"
            PathToResultsFilesRoot="$(TestResultsRoot)"
            RunConfigFile="$(RunConfigFile)"
            TeamFoundationServerUrl="$(TeamFoundationServerUrl)"
            TestContainers="@(LocalTestContainer)"

            TestNames="$(TestNames)"

            ContinueOnError="$(ContinueOnTestError)" 
            Category="$(Category)" />

If I set it to publish (publish="true") it gets the following error.

 C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\MSTest.exe /nologo /usestderr /testSettings:"C:\Builds\18\XXX\XXX CI\Sources/Services/Local.testsettings" ................ /category:"Mock" /publish:"http://server:port/tfs/stuff" /noprompt /publishbuild:"vstfs:///Build/54258" /teamproject:"xxx" /platform:"Any CPU" /flavor:"Debug" 
  Invalid switch "/publish".
  Invalid switch "/publishbuild".
  Invalid switch "/teamproject".
  Invalid switch "/platform".
  Invalid switch "/flavor".
  For switch syntax, type "MSTest /help"

If I remove those switches (which i sorta did in the code above, and/or set the publish=false), it seems to run the tests because it loads all the test assemblies and takes a long time before reporting no test results. If I add any of those switches back in I get the bad switch error message.

TeamFoundationServerUrl="http://ncmtfs2010:8080/tfs/ncmcorporate" BuildUri="vstfs:///Build/Build/54259"
  C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\IDE\MSTest.exe /nologo /usestderr /testSettings:"C:\Builds\18\Enterprise\Chimera Trunk CI\Sources/Services/Local.testsettings" /testcontainer: ............ /category:"Mock" 

  Loading C:\Builds\18\Enterprise\Sources\Services\Local.testsettings...
  Loading C:\Builds\18\Enterprise\Binaries\Debug\DataTests.dll...
  Loading C:\Builds\18\Enterprise\Binaries\Debug\Library.Tests.dll...
  Loading C:\Builds\18\Enterprise\Binaries\Debug\Common.Tests.dll...
  Starting execution...
  No tests to execute.
  .............

Any Ideas, I'm lost???

Thanks!

Upvotes: 1

Views: 674

Answers (2)

piter entity
piter entity

Reputation: 527

According to this: Running MSTEST.exe /publish on a TeamBuild server, what are the prerequisites?

You need Team Explorer (or even Visual Studio) installed on your CI server to make MsTest.exe support additional switches like '/publish', '/teamproject' etc.

Upvotes: 1

William
William

Reputation: 1395

We finally copied the msbuild.exe from another build server and it all worked. The executable was the same size and version. Go figure.

Upvotes: 0

Related Questions