Issue in TestPlansAndSuitesMigrationConfig of Azure DevOps Migration Tools

171 Views Asked by At

I have successfully migrated my Work Items including Test Cases using Azure DevOps Migration Tools

Now I am trying to migrate my TestPlans and TestSuites with TestPlansAndSuitesMigrationConfig

Here's my config file:

{
  "ChangeSetMappingFile": null,
  "Source": {
    "$type": "TfsTeamProjectConfig",
    "Collection": "https://dev.azure.com/sourceOrg/",
    "Project": "sourceProj",
    "ReflectedWorkItemIDFieldName": "Custom.ReflectedWorkItemId",
    "AllowCrossProjectLinking": false,
    "AuthenticationMode": "AccessToken",
    "PersonalAccessToken": "redacted",
    "PersonalAccessTokenVariableName": "",
    "LanguageMaps": {
      "AreaPath": "Area",
      "IterationPath": "Iteration"
    }
  },
  "Target": {
    "$type": "TfsTeamProjectConfig",
    "Collection": "https://dev.azure.com/targetOrg/",
    "Project": "targetProj",
    "ReflectedWorkItemIDFieldName": "Custom.ReflectedWorkItemId",
    "AllowCrossProjectLinking": false,
    "AuthenticationMode": "AccessToken",
    "PersonalAccessToken": "redacted",
    "PersonalAccessTokenVariableName": "",
    "LanguageMaps": {
      "AreaPath": "Area",
      "IterationPath": "Iteration"
    }
  },
  "FieldMaps": [],
  "GitRepoMapping": null,
  "LogLevel": "Verbose",
  "CommonEnrichersConfig": null,
  "Processors": [
    {
      "$type": "TestVariablesMigrationConfig",
      "Enabled": true
    },
    {
      "$type": "TestConfigurationsMigrationConfig",
      "Enabled": true
    },
    {
      "$type": "TestPlansAndSuitesMigrationConfig",
      "Enabled": true,
      "RemoveInvalidTestSuiteLinks": false,
      "TestPlanQueryBit": "",
      "UseCommonNodeStructureEnricherConfig": false,
      "NodeBasePaths": [],
      "AreaMaps": null,
      "IterationMaps": null,
      "FilterCompleted": false
    }
  ],
  "Version": "14.3",
  "workaroundForQuerySOAPBugEnabled": false,
  "WorkItemTypeDefinition": {
    "sourceWorkItemTypeName": "targetWorkItemTypeName"
  },
  "Endpoints": {}
}

When I run it, I get following error:

 == Plan[ 1/11] Suite[0/0] Cases[0/0]  - planid[153   ] | ApplyConfigurationsAndAssignTesters Master Test Plan (All Test Cases)
2023-11-29 11:28:45.172 +05:30 [FTL] Error while running TestPlansAndSuitesMigrationContext
System.InvalidOperationException: Sequence contains more than one element
   at System.Linq.Enumerable.SingleOrDefault[TSource](IEnumerable`1 source)
   at VstsSyncMigrator.Engine.TestPlansAndSuitesMigrationContext.FindTestPlan(TestManagementContext tmc, String name) in D:\a\1\s\src\VstsSyncMigrator.Core\Execution\MigrationContext\TestPlansAndSuitesMigrationContext.cs:line 627
   at VstsSyncMigrator.Engine.TestPlansAndSuitesMigrationContext.ProcessTestPlan(ITestPlan sourcePlan) in D:\a\1\s\src\VstsSyncMigrator.Core\Execution\MigrationContext\TestPlansAndSuitesMigrationContext.cs:line 916
   at VstsSyncMigrator.Engine.TestPlansAndSuitesMigrationContext.InternalExecute() in D:\a\1\s\src\VstsSyncMigrator.Core\Execution\MigrationContext\TestPlansAndSuitesMigrationContext.cs:line 128
   at MigrationTools._EngineV1.Processors.MigrationProcessorBase.Execute() in D:\a\1\s\src\MigrationTools\_EngineV1\Processors\MigrationProcessorBase.cs:line 47
2023-11-29 11:28:45.178 +05:30 [ERR] TestPlansAndSuitesMigrationContext The Processor MigrationEngine entered the failed state...stopping run

I am not able to understand what is the issue. What am I missing here?

2

There are 2 best solutions below

0
On

With your json file, I confirm test plan, suites, configurations..etc is successfully migrated to the target project. But if I run the same migration command again, i can produce the same error with you.

The error could be caused by the same named test plans, test suites are already in the target project. Please check on target project, delete them and if any test plan, suites are same, then try again.

enter image description here

0
On

Unfortunately, because of the way that the APIs work, there is no way to uniquely identify each test case on the source to find it on the target... so we use the title as the primary key.

This error occurs when the Source has two Test Plans that have the same title. If you change the titles in the source so that they are unique, this should resolve your issue.