1

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!

William
  • 1,375
  • 12
  • 27
  • I'm assuming you're not using the default 2013 build template as it has a vstest runner activity for running unit tests (vstest being the replacement for mstest). Could you start simple and run a basic build using the default template and build up from there? If you're in the guts of the low level targets files just to run unit tests you've probably gone wrong somewhere – sburgess123 Feb 15 '15 at 09:43
  • I agree, but this place has a lot of customization in their build process that would affect down stream processes. I can get the build and all the customization working, its just not running tests. I will try to break down to just the tests and see. – William Feb 17 '15 at 14:56

2 Answers2

1

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.

Community
  • 1
  • 1
piter entity
  • 487
  • 4
  • 15
0

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

William
  • 1,375
  • 12
  • 27