/// <summary> /// Execution of the console parameter /// </summary> /// <param name="remainingArguments"></param> /// <returns></returns> public override int Run(string[] remainingArguments) { try { var conf = CreateDocumentConfig(); if (conf == null || conf.TestSpecSettings == null) { throw new ArgumentException(string.Format(Resources.ConfigurationFileMisconfigured, "TestSpecificationConfiguration")); } // One of the two options has to be chosen if (_workitems == null && _query == null) { ConsoleExtensionLogging.LogMessage(Resources.OptionsNullError, ConsoleExtensionLogging.LogLevel.Both); ConsoleExtensionLogging.LogMessage(Resources.OptionsNullErrorInstruction, ConsoleExtensionLogging.LogLevel.Console); SyncServiceTrace.D(Resources.OptionsNullError); return(CommandReturnCodeFail); } // It isn't allowed to choose both options simultaneously if (_workitems != null && _query != null) { ConsoleExtensionLogging.LogMessage(Resources.OptionsOverloadedError, ConsoleExtensionLogging.LogLevel.Both); SyncServiceTrace.D(Resources.OptionsOverloadedError); return(CommandReturnCodeFail); } if (_workitems != null) { var crm = new ConsoleExtensionHelper(new TestReportingProgressCancellationService(false)); crm.CreateTestSpecDocumentByQuery(conf, _workitems, "ByID"); } // Get work items by query else { var crm = new ConsoleExtensionHelper(new TestReportingProgressCancellationService(false)); crm.CreateTestSpecDocumentByQuery(conf, _query, "ByQuery"); } } catch (Exception e) { ConsoleExtensionLogging.LogMessage(e.Message, ConsoleExtensionLogging.LogLevel.Both); SyncServiceTrace.D(e.Message); return(CommandReturnCodeFail); } return(CommandReturnCodeSuccess); }
/// <summary> /// Return codes /// 0 Everything alright /// -1 Code from ManyConsole /// -2 An error occured during creation /// </summary> /// <param name="code"></param> private static void HandleReturnCode(int code) { switch (code) { case 0: ConsoleExtensionLogging.LogMessage(Resources.ReportCreationSuccessfull, ConsoleExtensionLogging.LogLevel.Both); Environment.Exit(0); break; case -2: ConsoleExtensionLogging.LogMessage(Resources.ReportCreationFailed, ConsoleExtensionLogging.LogLevel.Both); Environment.Exit(1); break; } }
/// <summary> /// Execution of the console parameter /// </summary> /// <param name="remainingArguments"></param> /// <returns></returns> public override int Run(string[] remainingArguments) { try { var conf = CreateDocumentConfig(); // One of the two options has to be chosen if (_workitems == null && _query == null) { ConsoleExtensionLogging.LogMessage(Resources.OptionsNullError, ConsoleExtensionLogging.LogLevel.Both); ConsoleExtensionLogging.LogMessage(Resources.OptionsNullErrorInstruction, ConsoleExtensionLogging.LogLevel.Console); SyncServiceTrace.D(Resources.OptionsNullError); return(CommandReturnCodeFail); } // It isn't allowed to choose both options simultaneously if (_workitems != null && _query != null) { ConsoleExtensionLogging.LogMessage(Resources.OptionsOverloadedError, ConsoleExtensionLogging.LogLevel.Both); SyncServiceTrace.D(Resources.OptionsOverloadedError); return(CommandReturnCodeFail); } var createDocumentModel = new ConsoleExtensionHelper(new TestReportingProgressCancellationService(false)); if (_workitems != null) { createDocumentModel.CreateWorkItemDocument(conf, _workitems, "ByID"); } else { createDocumentModel.CreateWorkItemDocument(conf, _query, "ByQuery"); } } catch (Exception e) { ConsoleExtensionLogging.LogMessage(e.Message, ConsoleExtensionLogging.LogLevel.Both); SyncServiceTrace.D(e.Message); return(CommandReturnCodeFail); } return(CommandReturnCodeSuccess); }
/// <summary> /// Execution of the console parameter /// </summary> /// <param name="remainingArguments"></param> /// <returns></returns> public override int Run(string[] remainingArguments) { try { var conf = CreateDocumentConfig(); // Check if all required test specification settings are given and valid if (conf == null || conf.TestResultSettings == null) { throw new ArgumentException(string.Format(Resources.ConfigurationFileMisconfigured, "TestResultConfiguration")); } var testResultSettings = conf.TestResultSettings; if (testResultSettings.TestPlan == null) { ConsoleExtensionLogging.LogMessage(Resources.TestSettingsTestPlanError, ConsoleExtensionLogging.LogLevel.Both); ConsoleExtensionLogging.LogMessage(Resources.TestSettingsErrorInstruction, ConsoleExtensionLogging.LogLevel.Console); SyncServiceTrace.D(Resources.TestSettingsTestPlanError); return(CommandReturnCodeFail); } if (testResultSettings.CreateDocumentStructure && testResultSettings.DocumentStructure == null) { ConsoleExtensionLogging.LogMessage(Resources.TestSettingsDocumentStructureError, ConsoleExtensionLogging.LogLevel.Both); SyncServiceTrace.D(Resources.TestSettingsDocumentStructureError); return(CommandReturnCodeFail); } DocumentStructureType structure; if (testResultSettings.CreateDocumentStructure && !Enum.TryParse(testResultSettings.DocumentStructure, out structure)) { ConsoleExtensionLogging.LogMessage(Resources.TestSettingsInvalidDocumentStructureError, ConsoleExtensionLogging.LogLevel.Both); SyncServiceTrace.D(Resources.TestSettingsInvalidDocumentStructureError); return(CommandReturnCodeFail); } if (testResultSettings.IncludeTestConfigurations && testResultSettings.TestConfigurationsPosition == null) { ConsoleExtensionLogging.LogMessage(Resources.TestSettingsConfigurationPositionError, ConsoleExtensionLogging.LogLevel.Both); SyncServiceTrace.D(Resources.TestSettingsConfigurationPositionError); return(CommandReturnCodeFail); } TestConfigurationPosition position; if (testResultSettings.IncludeTestConfigurations && !Enum.TryParse(testResultSettings.TestConfigurationsPosition, out position)) { ConsoleExtensionLogging.LogMessage(Resources.TestSettingsInvalidConfigurationPositionError, ConsoleExtensionLogging.LogLevel.Both); SyncServiceTrace.D(Resources.TestSettingsConfigurationPositionError); return(CommandReturnCodeFail); } if (testResultSettings.SortTestCasesBy == null) { ConsoleExtensionLogging.LogMessage(Resources.TestSettingsTestCasesSortError, ConsoleExtensionLogging.LogLevel.Both); SyncServiceTrace.D(Resources.TestSettingsConfigurationPositionError); return(CommandReturnCodeFail); } TestCaseSortType sort; if (testResultSettings.SortTestCasesBy == null && Enum.TryParse(testResultSettings.SortTestCasesBy, out sort)) { ConsoleExtensionLogging.LogMessage(Resources.TestSettingsInvalidTestCasesSortError, ConsoleExtensionLogging.LogLevel.Both); SyncServiceTrace.D(Resources.TestSettingsConfigurationPositionError); return(CommandReturnCodeFail); } var crm = new ConsoleExtensionHelper(new TestReportingProgressCancellationService(false)); crm.CreateTestResultDocument(conf); } catch (Exception e) { ConsoleExtensionLogging.LogMessage(e.Message, ConsoleExtensionLogging.LogLevel.Both); SyncServiceTrace.D(e.Message); return(CommandReturnCodeFail); } return(0); }