After every automated test run I use the TFS rest API to update test results for a new test run to a test plan. First I create a new test run:
POST URL = http://<IP>:8080/tfs/DefaultCollection/_apis/test/runs?api-version=3.0
JSON = {'name':'run 1','build':{'id':1234},'buildPlatform':'x86','buildFlavor':'Release','plan':{'id':'4321'},configIds:[1111,2222],'startedDate':'08-07-2020 11:00:00Z','isAutomated':'true','comment':'automated test run 1','pointIds':[7777,8888,9999]}
I then update the results for each test ran in the test plan:
PATCH URL = http://<IP>:8080/tfs/DefaultCollection/_apis/test/runs/2323/results?api-version=3.0
JSON = [{'outcome':'Passed','state':'Completed','testPoint':{'id':7777},'comment':'test comment','automated':true,'automatedTestName':'Test1.sikuli','testCaseTitle':'Test1','testCase':{'id':7676},'id':7677,'priority':'2','buildReference':{'id':1234},'configuration':{'id':1111,'name':'Windows 10'},'computerName':'Desktop PC','completedDate':'08-07-2020 11:10:00Z','createdDate':'08-07-2020 11:00:00Z','startedDate':'08-07-2020 11:00:00Z','durationInMs':'600000'}]
However, when I view the test run result on TFS Web, the 'Tested build' is 'not available' and the 'Configuration' does not match the configuration specified in the JSON.
Additionally, when I list the most recent test runs, the 'Build Number' column does have the build number used, but when I view the summary of a test run the 'Tested build' is 'not available'.
Does anyone know what I am doing wrong with my JSON payloads and whether what I am trying to do with the rest APIs is possible? Basically I want to specify for each test run of the test plan, the build that was tested for that test run, for each test case of the test run I want to specify the build tested and the configuration used (not all the test cases are run on the same Windows OS and so I would like to indicate via the configuration which Windows OS the test cases was run on)
Please do not fixate on Ids not correlating in the JSON payload, I have just put dummy values in, I was more interested in posting the JSON structure used. The JSON payloads work in the sense that I get test runs created and test results posted that I can see via TFS Web, but I cannot get the 'Configuration' field or the 'Tested build' field to change.