/// <summary> /// This method contains the logic performed when the context menu is selected. /// </summary> /// <param name="objectToExecuteOn">TCObject on which the context menu task is performed.</param> /// <param name="taskContext">Task Context of the AddOn Task.</param> /// <returns>TCObject Instance</returns> public override TCObject Execute(TCObject objectToExecuteOn, TCAddOnTaskContext taskContext) { TCProject workspaceRoot = objectToExecuteOn as TCProject; //Opens the File Upload dialog. string filepath = taskContext.GetFilePath("Upload UFT Object archive"); //Instantiation of this object is mandatory. This class contains the necessary methods for migration. ToscaObjectDefinition toscaObjects = new ToscaObjectDefinition(); try { //Instantiates the MigrationTask class that contains the business logic of migration. MigrationTask migrationObjectImporter = new MigrationTask(toscaObjects, Engine.Html); //Entry point of MigrationTask class. migrationObjectImporter.ProcessArchive(filepath); //Calling this method is mandatory. It outputs the file containing the migrated object information. string outputFilePath = toscaObjects.FinishObjectDefinitionTask(); //Imports the output file from MigrationTask. workspaceRoot?.ImportExternalObjects(outputFilePath); //Cleans the migration metafiles. Directory.Delete(toscaObjects.MigrationFolderPath, true); } catch (Exception e) { //Pops-up the error message in case of any error in Migration. taskContext.ShowErrorMessage("Exception occured", e.Message); } return(null); }
/// <summary> /// Public Constructor /// </summary> /// <param name="toscaObjects">Definition Object</param> /// <param name="html">Engine Name</param> public MigrationTask(ToscaObjectDefinition toscaObjects, string html) { definition = toscaObjects; builder = new ToscaObjectBuilder(toscaObjects, html); }
/// <summary> /// Public Constructor /// </summary> /// <param name="definition">Definition Object</param> public ImportTask(ToscaObjectDefinition definition) { Definition = definition; //The 'Engine' parameter in ToscaObjectBuilder constructor is passed as null because we doen't need any specific engine for ManualTestCase. Builder = new VEBToscaObjectBuilder(Definition, null); }
//Derived class constructor public MigrationTask(ToscaObjectDefinition definition, string engine) : base(definition, engine) { }