Search code examples
tfsazure-devopstfsbuild

Could not get the DateTime Object for Build TestRun


Couldn't get the proper DateTime value for StartDate and CompletedDate in Build TestRun Object, it only returns the default DateTime value (01-01-0001).

Dll Used: Microsoft.TeamFoundation.TestManagement.WebApi.dll

TestRun object result

But while accessing the Build TestRun through Rest API Url we are getting the date values which i mentioned above.

TFS Version: 2018 Update 2

Rest API Result

Updated: enter image description here


Solution

  • Actually, in that request GetTestRunByQueryAsync() we will not get the DateTime objects (TestRun detailed info), we have to make an another call using the TestRun Id and ProjectName to the method GetTestRunByIdAsync(ProjectName, RunId), then you will get the entire Build and Test related objects that includes DateTime values. Here i have posted the Fiddler response but it worked in code also.

    GetTestRunByQueryAsync() Result:

    enter image description here

    GetTestRunByIdAsync(ProjectName, RunId) Result:

    enter image description here