Replies: 45 comments
-
Shared steps are migrated as part of the link migration: You would need to debug the code on your scenario to see why this is not working for you. |
Beta Was this translation helpful? Give feedback.
-
Hello, ive debugged the code and it seems like the tool dosnt find ReflectedWorkItemId in the target for shared steps : This returns NULL. Shared Steps is custom in Azure DevOps and I am not able to add ReflectedWorkItemId on it. So the solution here would be to make a custom Shared Steps Workitem to add ReflectedWorkItemId ? |
Beta Was this translation helpful? Give feedback.
-
Hmm, no. We will need to add additional logic to the find function so that we can find them. |
Beta Was this translation helpful? Give feedback.
-
Alright, I will inform my company. And wait for you (the smarter guys) to come up with a solution. |
Beta Was this translation helpful? Give feedback.
-
Unfortunately, there is no way to identify these easily without adding ReflectedWorkItemId which can be done on a local TFS. I currently have no solution. |
Beta Was this translation helpful? Give feedback.
-
We have added ReflectedWorkItemId in TFS. |
Beta Was this translation helpful? Give feedback.
-
Not sure if this will work for everyone. As this is basically high jacking an existing field to do the migration. |
Beta Was this translation helpful? Give feedback.
-
Are u saying u can maybe use fieldtofieldmultimapconfig to map your reflected workitem in shared steps to Microsoft.VSTS.Build.IntegrationBuild ? Then do a update to update the new target.reflectedworkitemId, which is now set to Microsoft.VSTS.Build.IntegrationBuild |
Beta Was this translation helpful? Give feedback.
-
Sorry, it was a bit of a mental dump.
I've also found it might not properly update the Share Steps in the Test Case on the initial import, but rerunning the same import again seems to fix it. |
Beta Was this translation helpful? Give feedback.
-
Awesome this seems to fix the issue. At the same time, by running it twice I fix my links to Test Plans / Suits. Thanks @WorkChris . Have a great week! |
Beta Was this translation helpful? Give feedback.
-
Thats an awesome work around @WorkChris , would you consider documenting it for us ans submitting a PR? |
Beta Was this translation helpful? Give feedback.
-
Ive been trying it out. It works, but if you use Microsoft.VSTS.Build.IntegrationBuild as a target reflectedworkitemID for test cases and shared steps. You will not get links to for example PBI, Bugs, Tasks etc IF they use a different target reflectedworkitemID (Custom.ReflectedWorkItemId). It seems like only the workitems with the same target.reflectedworkitemid can "communicate". Because of this, me and my team would not use this workaround. When we do not know the effects of using Microsoft.VSTS.Build.IntegrationBuild as a target.reflectedworkitemid for all workitems (Could be a problem with ID's when you start with builds) |
Beta Was this translation helpful? Give feedback.
-
@Kennyher if you migrate all work items using Microsoft.VSTS.Build.IntegrationBuild all links will work. This is also not ideal as projects are more than likely using it in their Bugs, etc. If you are already using the IntegrationBuild field in any work item, it causes the migration to crash. I am currently trying to find a better solution, as I know some projects at my work use shared steps and parameters extensively. I do have a theory that I need to test.
|
Beta Was this translation helpful? Give feedback.
-
I have now tested the above idea a couple of times and it looks like it works constantly. I changed the order to be:
All pretty seamless and hidden from a general users view. But can still be reviewed using a query. Would like some feedback from other people if they are willing to try. |
Beta Was this translation helpful? Give feedback.
-
@WorkChris @MrHinsh @Gordon-Beeming please spread the word... ask everyone to go upvote on this one: |
Beta Was this translation helpful? Give feedback.
-
@melvis137 After using @WorkChris 's patented Microsoft.VSTS.Build.IntegrationBuild field hijack to move the Shared Steps and Shared Parameters, I switch the target ReflectedWorkItemIDFieldName back to Custom.ReflectedWorkItemId before pushing the rest of the test artifacts. The only linkage in the Test Plans and Suites is with the Test Cases, not the other two WITs. Try that... |
Beta Was this translation helpful? Give feedback.
-
I'll try that. There are some issues with the Test Plan migrations. The simplest is that the count doesn't always reset. At one point I was at Test Case 72/48. But I think there's also something weird going on. I was having an analyst look at her test cases and the query based ones were fine but the requirements based ones were empty. Maybe that's what I need your steps to fix. |
Beta Was this translation helpful? Give feedback.
-
Haven't seen that one before, but I may not have come across any of those suite types yet. @MrHinsh - does the Test Plan processor support requirement based suites? |
Beta Was this translation helpful? Give feedback.
-
They're just the normal Test Plans, where you create it and add the Test Cases you want manually. I'd need her to explain it right, but they're created by selecting the Test Cases manually. |
Beta Was this translation helpful? Give feedback.
-
Ok. I tried the TestPlanAndSuiteMigrationConfig with Custom.ReflectedWorkItemId and got the following error:
|
Beta Was this translation helpful? Give feedback.
-
Possible that you didn't add the custom field to the target work item types? Needs to be present on Test Plan and Test Suite, not just Test Case. |
Beta Was this translation helpful? Give feedback.
-
Wow. I didn't think I could modify those! Maybe that's my malfunction. I am running through another test migration now so I will give that a try when I get to the Test Suites and Test Cases. Just to confirm, here is my "pseudo process":
Does that sound right? |
Beta Was this translation helpful? Give feedback.
-
I get this when I try to run the WorkItemUpdateConfig, no matter what I put in for ReflectedWorkItemIDFieldName: |
Beta Was this translation helpful? Give feedback.
-
That's the same sequence that I use. And you said WorkItemUpdateConfig, and not WorkItemMigrationConfig? Are you trying to set values, or migrate? And are you sure that you added TfsMigrationTool.ReflectedWorkItemId to all source WITs that you specified in the QueryBit? Check your schema against on the version of the tool. Starting to clutter the hijack thread on this, maybe you should take this over to StackOverflow. |
Beta Was this translation helpful? Give feedback.
-
And post your config over there |
Beta Was this translation helpful? Give feedback.
-
This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 10 days |
Beta Was this translation helpful? Give feedback.
-
Hi @WorkChris , My team is trying to migrate shared steps/parameters over but is getting the same issue of ReflectedWorkItemID not found, now we are trying to use your script to copy the RefelectedWorkItemID -> IntegrationBuild. But the script doesn't run. Can you please suggest on what else need to be added to run this script? |
Beta Was this translation helpful? Give feedback.
-
Might need to check that the json output is correct and matches what is required. Not sure if anything might have changed.
…________________________________
From: Yitasha ***@***.***>
Sent: Tuesday, May 31, 2022 12:26:12 PM
To: nkdAgility/azure-devops-migration-tools ***@***.***>
Cc: WorkChris ***@***.***>; Mention ***@***.***>
Subject: Re: [nkdAgility/azure-devops-migration-tools] Shared Steps in Test Cases (#518)
@melvis137<https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fmelvis137&data=05%7C01%7C%7Cc6e03b822e5f44b5007b08da42aceeaa%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637895607771525362%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=JOnlfUJIKmdQ7bS7%2Ftmn%2BnNAnr9AornOvnsWws024II%3D&reserved=0> in case your admin team allows PATs in the future
Not the best powershell script in the world, but it does enough to do the field update and can possibly be re-written into the scripting language of your choice.
It handles copying the test case fields Custom.ReflectedWorkItemID to Microsoft.VSTS.Build.IntegrationBuild and vice versa. (i was testing different migration patterns, however it can possibly be stripped out)
-Proxy $proxyUrl -ProxyUseDefaultCredentials can also be removed if proxy isn't an issue.
Function Update-Field {
Param ($body, $field, $testCase, $authToken)
switch ($field) {
"Custom.ReflectedWorkItemID" {
Write-Host "Updating $field"
$body = "[{$($body -f 'Custom.ReflectedWorkItemID',$testCase.fields.'Microsoft.VSTS.Build.IntegrationBuild')}]"
}
"Microsoft.VSTS.Build.IntegrationBuild" {
Write-Host "Updating $field"
$addTag = "{$('"op": "add","path": "/fields/System.Tags","value": "{0}"' -f $testCase.fields.'Microsoft.VSTS.Build.IntegrationBuild')}"
$body = "[{$($body -f 'Microsoft.VSTS.Build.IntegrationBuild',$testCase.fields.'Custom.ReflectedWorkItemID')},$addTag]"
}
}
Invoke-RestMethod -Proxy $proxyUrl -ProxyUseDefaultCredentials -Method Patch -Headers $authToken "$($testCase.url)?api-version=6.0" -Body $body -ContentType 'application/json-patch+json'
}
Function Update-TestCases {
Param ($targetSubcription, $targetProject, $logpath)
try {
$devOpsWI = '{0}/{1}/{1} Team/_apis/wit/wiql?api-version=5.1' -f $targetSubcription, $targetProject #$targetPrd.name, $targetPrd.name
$body = "{`"query`": `"Select * From WorkItems Where [System.TeamProject] = '$targetProject' AND [System.WorkItemType] = 'Test Case'`"}"
$_devOpsCases = (Invoke-RestMethod -Proxy $proxyUrl -ProxyUseDefaultCredentials -Method Post -Headers $authToken -Body $body $devOpsWI -ContentType 'application/json').Workitems
$count = 0
foreach ($devOpsCase in $_devOpsCases) {
Write-Host -ForegroundColor Yellow ('{0} - {1}' -f $devOpsCase.id, $devOpsCase.url)
Add-Content -Path $logpath -Value ('{0} - {1}' -f $devOpsCase.id, $devOpsCase.url)
$testCase = (Invoke-RestMethod -Proxy $proxyUrl -ProxyUseDefaultCredentials -Method Get -Headers $authToken ($devOpsCase.url))
$intBuild = $testCase.fields.'Microsoft.VSTS.Build.IntegrationBuild' -ilike "https*"
$CustRef = $testCase.fields.'Custom.ReflectedWorkItemID' -ilike "https*"
$body = '"op": "add","path": "/fields/{0}","value": "{1}"'
if ($intBuild -and $CustRef) {
if ($testCase.fields.'Microsoft.VSTS.Build.IntegrationBuild' -eq $testCase.fields.'Custom.ReflectedWorkItemID') {
Write-Host "Mapping Urls Match"
Add-Content -Path $logpath -Value "Mapping Urls Match"
}
}
elseif (!$CustRef -and $intBuild) {
Update-Field -body $body -field "Custom.ReflectedWorkItemID" -testCase $testCase -authToken $authToken
Add-Content -Path $logpath -Value "Updated Custom.ReflectedWorkItemID"
}
elseif ($CustRef -and !$intBuild) {
Update-Field -body $body -field "Microsoft.VSTS.Build.IntegrationBuild" -testCase $testCase -authToken $authToken
Add-Content -Path $logpath -Value "Updated Microsoft.VSTS.Build.IntegrationBuild"
}
Write-Host -ForegroundColor Green "$count/$($_devOpsCases.Count)"
$count ++
}
}
Catch {
Write-Host -ForegroundColor Yellow "Issue Found"
}
}
$PAT = ""
$global:proxyUrl = ""
$global:authToken = $([Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(("{0}:{1}" -f "", $PAT))))
$global:authToken = @{Authorization = ("Basic {0}" -f $authToken) }
Update-TestCases -targetSubcription $wiFile.Target.Collection -targetProject $wiFile.Target.Project -logpath .\Output\UpdateFields.logs
Hi @WorkChris<https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FWorkChris&data=05%7C01%7C%7Cc6e03b822e5f44b5007b08da42aceeaa%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637895607771525362%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=OeVgID9jEu6t1dr9rdb2sh8u9aMx3AfqR1NrkAwjbyI%3D&reserved=0> ,
My team is trying to migrate shared steps/parameters over but is getting the same issue of ReflectedWorkItemID not found, now we are trying to use your script to copy the RefelectedWorkItemID -> IntegrationBuild.
But the script doesn't run.
I have added PAT token to the variable $PAT
I have removed the -Proxy $proxyUrl -ProxyUseDefaultCredentials
Can you please suggest on what else need to be added to run this script?
—
Reply to this email directly, view it on GitHub<https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FnkdAgility%2Fazure-devops-migration-tools%2Fissues%2F518%23issuecomment-1141603565&data=05%7C01%7C%7Cc6e03b822e5f44b5007b08da42aceeaa%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637895607771525362%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=xNPqv45L4wSNlvUGXOcccxwTtpPoPwaBvSahqW4bmMo%3D&reserved=0>, or unsubscribe<https://nam12.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAN44TJB7G6UML72AAM7ZUXLVMV2EJANCNFSM4PI2HLHQ&data=05%7C01%7C%7Cc6e03b822e5f44b5007b08da42aceeaa%7C84df9e7fe9f640afb435aaaaaaaaaaaa%7C1%7C0%7C637895607771525362%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=Xe5uDiLekVEnO19YDDplz3c4qeloE5u1UasdJ5ZW69s%3D&reserved=0>.
You are receiving this because you were mentioned.Message ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
Problem [10:54:10 WRN] ValidatingRequiredField: Shared Steps does not contain Custom.ReflectedWorkItemId I am a rookie trying to complete these steps to mitigate:
Problem is that I apparently not am able to complete step 1 to mitigate, this is my WIQLQueryBit: Questions:
|
Beta Was this translation helpful? Give feedback.
-
Hello. Can someone please quickly summarize the workaround for this issue? |
Beta Was this translation helpful? Give feedback.
-
Hello, I have seen quite a lot of issues regarding the Shared Step in Test Cases not being migrated from TFS to DevOps.
Do you have a solution for this problem yet?
To clarify : I am able to migrate test cases and shared steps. But the shared step inside the test case does not migrate over.
Have a nice day!
Beta Was this translation helpful? Give feedback.
All reactions