TFS Build 2015 not publishing test results

Deadly 提交于 2019-12-07 22:06:44

问题


UPDATE (I have restructured this question with a new and basic solution and build as the same problem exists there)

I'm using the new build system in Tfs 2015 and I'm using Update 1. I have noticed that on the build summary screen, no test results or Code Coverage results are submitted:

I have a test step which runs and contains results and I have a .trx and a .coverage file but the test step log contains the warning:

##[warning]Failed to publish test results: The value for the Build.Id property is not within the permissible values for it.

The Build is very basic, it contains 2 steps and Code Coverage is Enabled on the test step:

Here is the build def as retrieved by the TEST REST API:

    {  
   "build":[  
      {  
         "enabled":true,
         "continueOnError":false,
         "alwaysRun":false,
         "displayName":"Build solution $/IsdDev/SQTestBuild/Main/TestBuildSystem.sln",
         "task":{  
            "id":"71a9a2d3-a98a-4caa-96ab-affca411ecda",
            "versionSpec":"*"
         },
         "inputs":{  
            "solution":"$/IsdDev/SQTestBuild/Main/TestBuildSystem.sln",
            "msbuildArgs":"",
            "platform":"$(BuildPlatform)",
            "configuration":"$(BuildConfiguration)",
            "clean":"false",
            "restoreNugetPackages":"true",
            "vsVersion":"14.0",
            "msbuildArchitecture":"x86",
            "logProjectEvents":"true"
         }
      },
      {  
         "enabled":true,
         "continueOnError":false,
         "alwaysRun":false,
         "displayName":"Test Assemblies **\\$(BuildConfiguration)\\*test*.dll;-:**\\obj\\**",
         "task":{  
            "id":"ef087383-ee5e-42c7-9a53-ab56c98420f9",
            "versionSpec":"*"
         },
         "inputs":{  
            "testAssembly":"**\\$(BuildConfiguration)\\*test*.dll;-:**\\obj\\**",
            "testFiltercriteria":"",
            "platform":"$(BuildPlatform)",
            "configuration":"$(BuildConfiguration)",
            "runSettingsFile":"",
            "overrideTestrunParameters":"",
            "codeCoverageEnabled":"true",
            "vsTestVersion":"14.0",
            "pathtoCustomTestAdapters":"",
            "otherConsoleOptions":""
         }
      }
   ],
   "options":[  
      {  
         "enabled":false,
         "definition":{  
            "id":"7c555368-ca64-4199-add6-9ebaf0b0137d"
         },
         "inputs":{  
            "multipliers":"[]",
            "parallel":"false",
            "continueOnError":"true"
         }
      }
   ],
   "variables":{  
      "BuildConfiguration":{  
         "value":"debug",
         "allowOverride":true
      },
      "BuildPlatform":{  
         "value":"any cpu",
         "allowOverride":true
      }
   },
   "retentionRules":[  
      {  
         "branches":[  
            "+refs/heads/*"
         ],
         "artifacts":[  
            "build.SourceLabel"
         ],
         "daysToKeep":10,
         "deleteBuildRecord":true,
         "deleteTestResults":true
      }
   ],
   "_links":{  
      "self":{  
         "href":"http://removed/343974ee-60a8-40ee-a103-37fa5db37c41/_apis/build/Definitions/71"
      },
      "web":{  
         "href":"http://removed/_permalink/_build/index?collectionId=808a695f-85b6-49db-a2df-ca4aaf8bbb9f&projectId=343974ee-60a8-40ee-a103-37fa5db37c41&definitionId=71"
      }
   },
   "buildNumberFormat":"$(date:yyyyMMdd)$(rev:.r)",
   "createdDate":"2015-11-19T07:43:27.977Z",
   "jobAuthorizationScope":"projectCollection",
   "jobTimeoutInMinutes":60,
   "repository":{  
      "properties":{  
         "labelSources":"0",
         "labelSourcesFormat":"$(build.buildNumber)",
         "tfvcMapping":"{\"mappings\":[{\"serverPath\":\"$/IsdDev\",\"mappingType\":\"map\",\"localPath\":\"\\\\\"},{\"serverPath\":\"$/IsdDev/Drops\",\"mappingType\":\"cloak\",\"localPath\":\"\"}]}"
      },
      "id":"$/",
      "type":"TfsVersionControl",
      "name":"IsdDev",
      "url":"http://removed/",
      "defaultBranch":"$/IsdDev",
      "rootFolder":"$/IsdDev",
      "clean":"undefined",
      "checkoutSubmodules":false
   },
   "quality":"definition",
   "authoredBy":{  
      "id":"7d24caba-6c09-4b78-8ff1-2404e0b0ec64",
      "displayName":"Rod Hall",
      "uniqueName":"ISD-NR\\Rod.Hall",
      "url":"http://removed/_apis/Identities/7d24caba-6c09-4b78-8ff1-2404e0b0ec64",
      "imageUrl":"http://removed/_api/_common/identityImage?id=7d24caba-6c09-4b78-8ff1-2404e0b0ec64"
   },
   "queue":{  
      "pool":{  
         "id":2,
         "name":"Back Office Pool"
      },
      "id":2,
      "name":"Back Office Pool"
   },
   "uri":"vstfs:///Build/Definition/71",
   "type":"build",
   "revision":1,
   "id":71,
   "name":"SQ Test",
   "url":"http://removed/343974ee-60a8-40ee-a103-37fa5db37c41/_apis/build/Definitions/71",
   "project":{  
      "id":"343974ee-60a8-40ee-a103-37fa5db37c41",
      "name":"IsdDev",
      "url":"http://removed/_apis/projects/343974ee-60a8-40ee-a103-37fa5db37c41",
      "state":"wellFormed",
      "revision":7
   }
}

What is the Build.Id that the warning refers to, how can I view it and set it?

This could even be a problem with TFS 2015 Update 1...

UPDATE I'm not sure if it matters but when I go to the Build section of the TFS Admin Console it appears to not be configured:

I have my application tier on 1 server and then I have 3 Agent Pools each with 3 Agents. There are 3 build servers each of which have 1 agent from each pool installed for a total of 9 agents. I set these up using PowerShell and I downloaded the agent from the TFS page. My builds still work Ok, it's just this tests publishing


回答1:


Check the attached vNext build configuration, with which I can get the Test result and Code coverage. Make sure you have specified the solution in Visual Studio Build and select Code Coverage Enabled in Visual Studio Test.




回答2:


Credit to Jesse Houwing for helping me on this one. I had to detach and reattach the Team Project Collection using the TFS Admin Console on the App Server. It seems there is an issue with Update 1 (or perhaps one of the Release Candidates).

For those with the same problem, it will obviously take TFS offline but it took less than 5 minutes.




回答3:


I had a similar issue yesterday: Visual Studio Test using Test Agent step was failing with the "The value for the Build.Id property is not within the permissible values for it" error message when it was trying to execute Coded UI tests on the remote test machine. Detaching project collection and re-attaching it back fixed the issue.



来源:https://stackoverflow.com/questions/33752784/tfs-build-2015-not-publishing-test-results

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!