public SpecFlowConfiguration(ConfigSource configSource, ContainerRegistrationCollection customDependencies, ContainerRegistrationCollection generatorCustomDependencies, CultureInfo featureLanguage, CultureInfo bindingCulture, string unitTestProvider, bool stopAtFirstError, MissingOrPendingStepsOutcome missingOrPendingStepsOutcome, bool traceSuccessfulSteps, bool traceTimings, TimeSpan minTracedDuration, StepDefinitionSkeletonStyle stepDefinitionSkeletonStyle, List <string> additionalStepAssemblies, List <PluginDescriptor> pluginDescriptors, bool allowDebugGeneratedFiles, bool allowRowTests, bool markFeaturesParallelizable, string[] skipParallelizableMarkerForTags, ObsoleteBehavior obsoleteBehavior) { ConfigSource = configSource; CustomDependencies = customDependencies; GeneratorCustomDependencies = generatorCustomDependencies; FeatureLanguage = featureLanguage; BindingCulture = bindingCulture; UnitTestProvider = unitTestProvider; StopAtFirstError = stopAtFirstError; MissingOrPendingStepsOutcome = missingOrPendingStepsOutcome; TraceSuccessfulSteps = traceSuccessfulSteps; TraceTimings = traceTimings; MinTracedDuration = minTracedDuration; StepDefinitionSkeletonStyle = stepDefinitionSkeletonStyle; AdditionalStepAssemblies = additionalStepAssemblies; Plugins = pluginDescriptors; AllowDebugGeneratedFiles = allowDebugGeneratedFiles; AllowRowTests = allowRowTests; MarkFeaturesParallelizable = markFeaturesParallelizable; SkipParallelizableMarkerForTags = skipParallelizableMarkerForTags; ObsoleteBehavior = obsoleteBehavior; }
public SpecFlowConfiguration(ConfigSource configSource, ContainerRegistrationCollection customDependencies, ContainerRegistrationCollection generatorCustomDependencies, CultureInfo featureLanguage, CultureInfo bindingCulture, bool stopAtFirstError, MissingOrPendingStepsOutcome missingOrPendingStepsOutcome, bool traceSuccessfulSteps, bool traceTimings, TimeSpan minTracedDuration, StepDefinitionSkeletonStyle stepDefinitionSkeletonStyle, List <string> additionalStepAssemblies, bool allowDebugGeneratedFiles, bool allowRowTests, string[] addNonParallelizableMarkerForTags, ObsoleteBehavior obsoleteBehavior, CucumberMessagesConfiguration cucumberMessagesConfiguration) { CucumberMessagesConfiguration = cucumberMessagesConfiguration; ConfigSource = configSource; CustomDependencies = customDependencies; GeneratorCustomDependencies = generatorCustomDependencies; FeatureLanguage = featureLanguage; BindingCulture = bindingCulture; StopAtFirstError = stopAtFirstError; MissingOrPendingStepsOutcome = missingOrPendingStepsOutcome; TraceSuccessfulSteps = traceSuccessfulSteps; TraceTimings = traceTimings; MinTracedDuration = minTracedDuration; StepDefinitionSkeletonStyle = stepDefinitionSkeletonStyle; AdditionalStepAssemblies = additionalStepAssemblies; AllowDebugGeneratedFiles = allowDebugGeneratedFiles; AllowRowTests = allowRowTests; AddNonParallelizableMarkerForTags = addNonParallelizableMarkerForTags; ObsoleteBehavior = obsoleteBehavior; }
public SpecFlowConfiguration LoadJson(SpecFlowConfiguration specFlowConfiguration, string jsonContent) { if (String.IsNullOrWhiteSpace(jsonContent)) { throw new ArgumentNullException(nameof(jsonContent)); } var jsonConfig = JsonSerializer.Deserialize <JsonConfig>(jsonContent); ContainerRegistrationCollection containerRegistrationCollection = specFlowConfiguration.CustomDependencies; ContainerRegistrationCollection generatorContainerRegistrationCollection = specFlowConfiguration.GeneratorCustomDependencies; CultureInfo featureLanguage = specFlowConfiguration.FeatureLanguage; CultureInfo bindingCulture = specFlowConfiguration.BindingCulture; bool stopAtFirstError = specFlowConfiguration.StopAtFirstError; MissingOrPendingStepsOutcome missingOrPendingStepsOutcome = specFlowConfiguration.MissingOrPendingStepsOutcome; bool traceSuccessfulSteps = specFlowConfiguration.TraceSuccessfulSteps; bool traceTimings = specFlowConfiguration.TraceTimings; TimeSpan minTracedDuration = specFlowConfiguration.MinTracedDuration; StepDefinitionSkeletonStyle stepDefinitionSkeletonStyle = specFlowConfiguration.StepDefinitionSkeletonStyle; List <string> additionalStepAssemblies = specFlowConfiguration.AdditionalStepAssemblies; bool allowRowTests = specFlowConfiguration.AllowRowTests; bool allowDebugGeneratedFiles = specFlowConfiguration.AllowDebugGeneratedFiles; bool markFeaturesParallelizable = specFlowConfiguration.MarkFeaturesParallelizable; string[] skipParallelizableMarkerForTags = specFlowConfiguration.SkipParallelizableMarkerForTags; ObsoleteBehavior obsoleteBehavior = specFlowConfiguration.ObsoleteBehavior; if (jsonConfig.Language != null) { if (jsonConfig.Language.Feature.IsNotNullOrWhiteSpace()) { featureLanguage = CultureInfo.GetCultureInfo(jsonConfig.Language.Feature); } } if (jsonConfig.BindingCulture != null) { if (jsonConfig.BindingCulture.Name.IsNotNullOrWhiteSpace()) { bindingCulture = CultureInfo.GetCultureInfo(jsonConfig.BindingCulture.Name); } } if (jsonConfig.Runtime != null) { missingOrPendingStepsOutcome = jsonConfig.Runtime.MissingOrPendingStepsOutcome; stopAtFirstError = jsonConfig.Runtime.StopAtFirstError; obsoleteBehavior = jsonConfig.Runtime.ObsoleteBehavior; if (jsonConfig.Runtime.Dependencies != null) { foreach (var runtimeDependency in jsonConfig.Runtime.Dependencies) { containerRegistrationCollection.Add(runtimeDependency.ImplementationType, runtimeDependency.InterfaceType); } } } if (jsonConfig.Generator != null) { allowDebugGeneratedFiles = jsonConfig.Generator.AllowDebugGeneratedFiles; allowRowTests = jsonConfig.Generator.AllowRowTests; markFeaturesParallelizable = jsonConfig.Generator.MarkFeaturesParallelizable; skipParallelizableMarkerForTags = jsonConfig.Generator.SkipParallelizableMarkerForTags?.ToArray(); } if (jsonConfig.Trace != null) { traceSuccessfulSteps = jsonConfig.Trace.TraceSuccessfulSteps; traceTimings = jsonConfig.Trace.TraceTimings; minTracedDuration = jsonConfig.Trace.MinTracedDuration; stepDefinitionSkeletonStyle = jsonConfig.Trace.StepDefinitionSkeletonStyle; } if (jsonConfig.StepAssemblies != null) { foreach (var stepAssemblyEntry in jsonConfig.StepAssemblies) { additionalStepAssemblies.Add(stepAssemblyEntry.Assembly); } } return(new SpecFlowConfiguration(ConfigSource.Json, containerRegistrationCollection, generatorContainerRegistrationCollection, featureLanguage, bindingCulture, stopAtFirstError, missingOrPendingStepsOutcome, traceSuccessfulSteps, traceTimings, minTracedDuration, stepDefinitionSkeletonStyle, additionalStepAssemblies, allowDebugGeneratedFiles, allowRowTests, markFeaturesParallelizable, skipParallelizableMarkerForTags, obsoleteBehavior)); }
public Configuration.SpecFlowConfiguration LoadAppConfig(Configuration.SpecFlowConfiguration specFlowConfiguration, ConfigurationSectionHandler configSection) { if (configSection == null) { throw new ArgumentNullException(nameof(configSection)); } ContainerRegistrationCollection runtimeContainerRegistrationCollection = specFlowConfiguration.CustomDependencies; ContainerRegistrationCollection generatorContainerRegistrationCollection = specFlowConfiguration.GeneratorCustomDependencies; CultureInfo featureLanguage = specFlowConfiguration.FeatureLanguage; CultureInfo bindingCulture = specFlowConfiguration.BindingCulture; string runtimeUnitTestProvider = specFlowConfiguration.UnitTestProvider; bool stopAtFirstError = specFlowConfiguration.StopAtFirstError; MissingOrPendingStepsOutcome missingOrPendingStepsOutcome = specFlowConfiguration.MissingOrPendingStepsOutcome; bool traceSuccessfulSteps = specFlowConfiguration.TraceSuccessfulSteps; bool traceTimings = specFlowConfiguration.TraceTimings; TimeSpan minTracedDuration = specFlowConfiguration.MinTracedDuration; StepDefinitionSkeletonStyle stepDefinitionSkeletonStyle = specFlowConfiguration.StepDefinitionSkeletonStyle; List <string> additionalStepAssemblies = specFlowConfiguration.AdditionalStepAssemblies; List <PluginDescriptor> pluginDescriptors = specFlowConfiguration.Plugins; ObsoleteBehavior obsoleteBehavior = specFlowConfiguration.ObsoleteBehavior; bool allowRowTests = specFlowConfiguration.AllowRowTests; bool allowDebugGeneratedFiles = specFlowConfiguration.AllowDebugGeneratedFiles; bool markFeaturesParallelizable = specFlowConfiguration.MarkFeaturesParallelizable; string[] skipParallelizableMarkerForTags = specFlowConfiguration.SkipParallelizableMarkerForTags; if (IsSpecified(configSection.Language)) { featureLanguage = CultureInfo.GetCultureInfo(configSection.Language.Feature); } if (IsSpecified(configSection.BindingCulture)) { bindingCulture = CultureInfo.GetCultureInfo(configSection.BindingCulture.Name); } if (IsSpecified(configSection.Runtime)) { stopAtFirstError = configSection.Runtime.StopAtFirstError; missingOrPendingStepsOutcome = configSection.Runtime.MissingOrPendingStepsOutcome; obsoleteBehavior = configSection.Runtime.ObsoleteBehavior; if (IsSpecified(configSection.Runtime.Dependencies)) { runtimeContainerRegistrationCollection = configSection.Runtime.Dependencies; } } if (IsSpecified((configSection.Generator))) { allowDebugGeneratedFiles = configSection.Generator.AllowDebugGeneratedFiles; allowRowTests = configSection.Generator.AllowRowTests; markFeaturesParallelizable = configSection.Generator.MarkFeaturesParallelizable; if (IsSpecified(configSection.Generator.SkipParallelizableMarkerForTags)) { skipParallelizableMarkerForTags = configSection.Generator.SkipParallelizableMarkerForTags.Select(i => i.Value).ToArray(); } if (IsSpecified(configSection.Generator.Dependencies)) { generatorContainerRegistrationCollection = configSection.Generator.Dependencies; } } if (IsSpecified(configSection.UnitTestProvider)) { if (!string.IsNullOrEmpty(configSection.UnitTestProvider.RuntimeProvider)) { //compatibility mode, we simulate a custom dependency runtimeUnitTestProvider = "custom"; runtimeContainerRegistrationCollection.Add(configSection.UnitTestProvider.RuntimeProvider, typeof(IUnitTestRuntimeProvider).AssemblyQualifiedName, runtimeUnitTestProvider); } else { runtimeUnitTestProvider = configSection.UnitTestProvider.Name; } } if (IsSpecified(configSection.Trace)) { if (!string.IsNullOrEmpty(configSection.Trace.Listener)) // backwards compatibility { runtimeContainerRegistrationCollection.Add(configSection.Trace.Listener, typeof(ITraceListener).AssemblyQualifiedName); } traceSuccessfulSteps = configSection.Trace.TraceSuccessfulSteps; traceTimings = configSection.Trace.TraceTimings; minTracedDuration = configSection.Trace.MinTracedDuration; stepDefinitionSkeletonStyle = configSection.Trace.StepDefinitionSkeletonStyle; } foreach (var element in configSection.StepAssemblies) { var assemblyName = ((StepAssemblyConfigElement)element).Assembly; additionalStepAssemblies.Add(assemblyName); } var pluginNames = pluginDescriptors.Select(m => m.Name).ToList(); foreach (PluginConfigElement plugin in configSection.Plugins) { var pluginDescriptor = plugin.ToPluginDescriptor(); if (pluginNames.Contains(pluginDescriptor.Name)) { continue; } pluginDescriptors.Add(pluginDescriptor); pluginNames.Add(plugin.Name); } return(new SpecFlowConfiguration(ConfigSource.AppConfig, runtimeContainerRegistrationCollection, generatorContainerRegistrationCollection, featureLanguage, bindingCulture, runtimeUnitTestProvider, stopAtFirstError, missingOrPendingStepsOutcome, traceSuccessfulSteps, traceTimings, minTracedDuration, stepDefinitionSkeletonStyle, additionalStepAssemblies, pluginDescriptors, allowDebugGeneratedFiles, allowRowTests, markFeaturesParallelizable, skipParallelizableMarkerForTags, obsoleteBehavior )); }
public Configuration.SpecFlowConfiguration LoadAppConfig(Configuration.SpecFlowConfiguration specFlowConfiguration, ConfigurationSectionHandler configSection) { if (configSection == null) { throw new ArgumentNullException(nameof(configSection)); } ContainerRegistrationCollection runtimeContainerRegistrationCollection = specFlowConfiguration.CustomDependencies; ContainerRegistrationCollection generatorContainerRegistrationCollection = specFlowConfiguration.GeneratorCustomDependencies; CultureInfo featureLanguage = specFlowConfiguration.FeatureLanguage; CultureInfo bindingCulture = specFlowConfiguration.BindingCulture; bool stopAtFirstError = specFlowConfiguration.StopAtFirstError; MissingOrPendingStepsOutcome missingOrPendingStepsOutcome = specFlowConfiguration.MissingOrPendingStepsOutcome; bool traceSuccessfulSteps = specFlowConfiguration.TraceSuccessfulSteps; bool traceTimings = specFlowConfiguration.TraceTimings; TimeSpan minTracedDuration = specFlowConfiguration.MinTracedDuration; StepDefinitionSkeletonStyle stepDefinitionSkeletonStyle = specFlowConfiguration.StepDefinitionSkeletonStyle; List <string> additionalStepAssemblies = specFlowConfiguration.AdditionalStepAssemblies; ObsoleteBehavior obsoleteBehavior = specFlowConfiguration.ObsoleteBehavior; bool allowRowTests = specFlowConfiguration.AllowRowTests; bool allowDebugGeneratedFiles = specFlowConfiguration.AllowDebugGeneratedFiles; bool markFeaturesParallelizable = specFlowConfiguration.MarkFeaturesParallelizable; string[] skipParallelizableMarkerForTags = specFlowConfiguration.SkipParallelizableMarkerForTags; CucumberMessagesConfiguration cucumberMessagesConfiguration = specFlowConfiguration.CucumberMessagesConfiguration; if (IsSpecified(configSection.Language)) { featureLanguage = CultureInfo.GetCultureInfo(configSection.Language.Feature); } if (IsSpecified(configSection.BindingCulture)) { bindingCulture = CultureInfo.GetCultureInfo(configSection.BindingCulture.Name); } if (IsSpecified(configSection.Runtime)) { stopAtFirstError = configSection.Runtime.StopAtFirstError; missingOrPendingStepsOutcome = configSection.Runtime.MissingOrPendingStepsOutcome; obsoleteBehavior = configSection.Runtime.ObsoleteBehavior; if (IsSpecified(configSection.Runtime.Dependencies)) { runtimeContainerRegistrationCollection = configSection.Runtime.Dependencies; } } if (IsSpecified((configSection.Generator))) { allowDebugGeneratedFiles = configSection.Generator.AllowDebugGeneratedFiles; allowRowTests = configSection.Generator.AllowRowTests; markFeaturesParallelizable = configSection.Generator.MarkFeaturesParallelizable; if (IsSpecified(configSection.Generator.SkipParallelizableMarkerForTags)) { skipParallelizableMarkerForTags = configSection.Generator.SkipParallelizableMarkerForTags.Select(i => i.Value).ToArray(); } if (IsSpecified(configSection.Generator.Dependencies)) { generatorContainerRegistrationCollection = configSection.Generator.Dependencies; } } if (IsSpecified(configSection.Trace)) { if (!string.IsNullOrEmpty(configSection.Trace.Listener)) // backwards compatibility { runtimeContainerRegistrationCollection.Add(configSection.Trace.Listener, typeof(ITraceListener).AssemblyQualifiedName); } traceSuccessfulSteps = configSection.Trace.TraceSuccessfulSteps; traceTimings = configSection.Trace.TraceTimings; minTracedDuration = configSection.Trace.MinTracedDuration; stepDefinitionSkeletonStyle = configSection.Trace.StepDefinitionSkeletonStyle; } foreach (var element in configSection.StepAssemblies) { var assemblyName = ((StepAssemblyConfigElement)element).Assembly; additionalStepAssemblies.Add(assemblyName); } if (IsSpecified(configSection.CucumberMessages)) { cucumberMessagesConfiguration.Enabled = configSection.CucumberMessages.Enabled; foreach (CucumberMessageSinkElement cucumberMessagesSink in configSection.CucumberMessages.Sinks) { cucumberMessagesConfiguration.Sinks.Add(new CucumberMessagesSink(cucumberMessagesSink.Type, cucumberMessagesSink.Path)); } } return(new SpecFlowConfiguration(ConfigSource.AppConfig, runtimeContainerRegistrationCollection, generatorContainerRegistrationCollection, featureLanguage, bindingCulture, stopAtFirstError, missingOrPendingStepsOutcome, traceSuccessfulSteps, traceTimings, minTracedDuration, stepDefinitionSkeletonStyle, additionalStepAssemblies, allowDebugGeneratedFiles, allowRowTests, markFeaturesParallelizable, skipParallelizableMarkerForTags, obsoleteBehavior, cucumberMessagesConfiguration )); }
public SpecFlowConfiguration LoadJson(SpecFlowConfiguration specFlowConfiguration, string jsonContent) { if (String.IsNullOrWhiteSpace(jsonContent)) { throw new ArgumentNullException(nameof(jsonContent)); } var jsonConfig = JsonConvert.DeserializeObject <JsonConfig>(jsonContent); ContainerRegistrationCollection containerRegistrationCollection = specFlowConfiguration.CustomDependencies; ContainerRegistrationCollection generatorContainerRegistrationCollection = specFlowConfiguration.GeneratorCustomDependencies; CultureInfo featureLanguage = specFlowConfiguration.FeatureLanguage; CultureInfo bindingCulture = specFlowConfiguration.BindingCulture; string unitTestProvider = specFlowConfiguration.UnitTestProvider; bool stopAtFirstError = specFlowConfiguration.StopAtFirstError; MissingOrPendingStepsOutcome missingOrPendingStepsOutcome = specFlowConfiguration.MissingOrPendingStepsOutcome; bool traceSuccessfulSteps = specFlowConfiguration.TraceSuccessfulSteps; bool traceTimings = specFlowConfiguration.TraceTimings; TimeSpan minTracedDuration = specFlowConfiguration.MinTracedDuration; StepDefinitionSkeletonStyle stepDefinitionSkeletonStyle = specFlowConfiguration.StepDefinitionSkeletonStyle; List <string> additionalStepAssemblies = specFlowConfiguration.AdditionalStepAssemblies; List <PluginDescriptor> pluginDescriptors = specFlowConfiguration.Plugins; bool allowRowTests = specFlowConfiguration.AllowRowTests; bool allowDebugGeneratedFiles = specFlowConfiguration.AllowDebugGeneratedFiles; bool markFeaturesParallelizable = specFlowConfiguration.MarkFeaturesParallelizable; string[] skipParallelizableMarkerForTags = specFlowConfiguration.SkipParallelizableMarkerForTags; ObsoleteBehavior obsoleteBehavior = specFlowConfiguration.ObsoleteBehavior; var specFlowElement = jsonConfig.SpecFlow; if (specFlowElement.Language != null) { if (specFlowElement.Language.Feature.IsNotNullOrWhiteSpace()) { featureLanguage = CultureInfo.GetCultureInfo(specFlowElement.Language.Feature); } } if (specFlowElement.BindingCulture != null) { if (specFlowElement.BindingCulture.Name.IsNotNullOrWhiteSpace()) { bindingCulture = CultureInfo.GetCultureInfo(specFlowElement.BindingCulture.Name); } } if (specFlowElement.UnitTestProvider != null) { if (specFlowElement.UnitTestProvider.Name.IsNotNullOrWhiteSpace()) { unitTestProvider = specFlowElement.UnitTestProvider.Name; } } if (specFlowElement.Runtime != null) { missingOrPendingStepsOutcome = specFlowElement.Runtime.MissingOrPendingStepsOutcome; stopAtFirstError = specFlowElement.Runtime.StopAtFirstError; obsoleteBehavior = specFlowElement.Runtime.ObsoleteBehavior; } if (specFlowElement.Generator != null) { allowDebugGeneratedFiles = specFlowElement.Generator.AllowDebugGeneratedFiles; allowRowTests = specFlowElement.Generator.AllowRowTests; markFeaturesParallelizable = specFlowElement.Generator.MarkFeaturesParallelizable; skipParallelizableMarkerForTags = specFlowElement.Generator.SkipParallelizableMarkerForTags.ToArray(); } if (specFlowElement.Trace != null) { traceSuccessfulSteps = specFlowElement.Trace.TraceSuccessfulSteps; traceTimings = specFlowElement.Trace.TraceTimings; minTracedDuration = specFlowElement.Trace.MinTracedDuration; stepDefinitionSkeletonStyle = specFlowElement.Trace.StepDefinitionSkeletonStyle; } if (specFlowElement.StepAssemblies != null) { foreach (var stepAssemblyEntry in specFlowElement.StepAssemblies) { additionalStepAssemblies.Add(stepAssemblyEntry.Assembly); } } if (specFlowElement.Plugins != null) { var pluginNames = pluginDescriptors.Select(m => m.Name).ToList(); foreach (var pluginEntry in specFlowElement.Plugins) { if (pluginNames.Contains(pluginEntry.Name)) { continue; } pluginDescriptors.Add(new PluginDescriptor(pluginEntry.Name, pluginEntry.Path, pluginEntry.Type, pluginEntry.Parameters)); pluginNames.Add(pluginEntry.Name); } } return(new SpecFlowConfiguration(ConfigSource.Json, containerRegistrationCollection, generatorContainerRegistrationCollection, featureLanguage, bindingCulture, unitTestProvider, stopAtFirstError, missingOrPendingStepsOutcome, traceSuccessfulSteps, traceTimings, minTracedDuration, stepDefinitionSkeletonStyle, additionalStepAssemblies, pluginDescriptors, allowDebugGeneratedFiles, allowRowTests, markFeaturesParallelizable, skipParallelizableMarkerForTags, obsoleteBehavior)); }