AzureDevOps-CloneTestPlan
$organization = "your_organization_name" | |
$PAT = "your_PAT" | |
$project = "your_project_name" | |
$planId = "testplan_id_from" | |
$suiteId = "testsuite_id_from" | |
$cloneTo = "name_of_new_testplan" | |
$authorization = [Convert]::ToBase64String([System.Text.Encoding]::UTF8.GetBytes(":$PAT")) | |
$headers = New-Object "System.Collections.Generic.Dictionary[[String],[String]]" | |
$headers.Add("Accept-Charset", 'UTF-8') | |
$headers.Add('Content-Type','Application/Json') | |
$headers.Add('Authorization',"Basic $authorization") | |
$postParams=@" | |
{ | |
"destinationTestPlan": { | |
"name": "$cloneTo", | |
"Project": { | |
"Name": "$project" | |
} | |
}, | |
"options": { | |
"copyAncestorHierarchy": true, | |
"copyAllSuites": true | |
}, | |
"suiteIds": [ | |
$suiteId | |
] | |
} | |
"@ | |
$apiUrl = "https://dev.azure.com/$organization/$project/_apis/test/Plans/$planId/cloneoperation?api-version=5.0-preview.2" | |
Invoke-WebRequest -Uri $apiUrl -Method POST -Headers $headers -Body $postParams | Select-Object -Expand StatusDescription |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This comment has been minimized.
Script explained at https://thingsandcode.com/2019/04/19/clone-azure-devops-test-plans-with-powershell/