/// <summary> /// Migrates the Wse Module and all referencing XTestSteps. /// </summary> /// <param name="objectToExecuteOn">Only WSE XTestSteps and XModules which are present under this object will be migrated.</param> public void Migrate(TCObject objectToExecuteOn) { var wseTestSteps = CommonUtilities.GetFilteredWseTestSteps(objectToExecuteOn, wseModule.TestSteps); if (!wseTestSteps.Any()) { WseModuleParser wseParser = new WseModuleParser(); wseParser.Parse(wseModule); FolderStructureHandler folderStructureHandler = new FolderStructureHandler(); TCFolder apiModuleFolder = folderStructureHandler.CreateFolderForApiModules(wseModule); ApiModuleHandler.CreateApiModulePair(apiModuleFolder, wseModule.Name, wseParser); } else { foreach (var wseTestStep in wseTestSteps) { WseTestStepParser wseTestStepParser = new WseTestStepParser(); wseTestStepParser.Parse(wseTestStep, new XmlPayloadParser()); (ApiModule requestApiModule, ApiModule responseApiModule) = GetExistingOrCreateNewApiModulePair(objectToExecuteOn, wseTestStep, wseTestStepParser); WseTestStepMigrator wseTestStepMigrator = new WseTestStepMigrator(); wseTestStepMigrator.Migrate(objectToExecuteOn, requestApiModule, responseApiModule, new XmlPayloadParser(), new XmlPayloadSetterFactory(), wseTestStep); } } }
/// <summary> /// Migrates the Wse Module and all referencing XTestSteps. /// </summary> /// <param name="objectToExecuteOn">Only WSE XTestSteps and XModules which are present under this objectToExecuteOn object will be migrated.</param> public void Migrate(TCObject objectToExecuteOn) { foreach (var wseTestStep in CommonUtilities.GetFilteredWseTestSteps(objectToExecuteOn, WseModule.TestSteps) ) { try { FileLogger.Instance.Debug( $"Started migration for WSE TestStep : 'Name: {wseTestStep.Name}' NodePath:'{wseTestStep.NodePath}'"); var testStepParser = new WseTestStepParser(); testStepParser.Parse(wseTestStep, PayloadParser); (ApiModule requestApiModule, ApiModule responseApiModule) = GetExistingOrCreateNewApiModulePair(objectToExecuteOn, wseTestStep, testStepParser); WseTestStepMigrator wseTestStepMigrator = new WseTestStepMigrator(); wseTestStepMigrator.Migrate(objectToExecuteOn, requestApiModule, responseApiModule, PayloadParser, PayloadSetterFactory, wseTestStep ); FileLogger.Instance.Debug( $"Completed migration for WSE TestStep : 'Name: {wseTestStep.Name}' NodePath:'{wseTestStep.NodePath}'"); } catch (Exception e) { FileLogger.Instance.Error(e); } } }