public StepDefinitionRegexCalculatorTests() { specFlowConfiguration = ConfigurationLoader.GetDefault(); }
public TestExecutionEngineTests() { specFlowConfiguration = ConfigurationLoader.GetDefault(); testThreadContainer = new ObjectContainer(); featureContainer = new ObjectContainer(); scenarioContainer = new ObjectContainer(); beforeScenarioEvents = new List <IHookBinding>(); afterScenarioEvents = new List <IHookBinding>(); beforeStepEvents = new List <IHookBinding>(); afterStepEvents = new List <IHookBinding>(); beforeFeatureEvents = new List <IHookBinding>(); afterFeatureEvents = new List <IHookBinding>(); beforeTestRunEvents = new List <IHookBinding>(); afterTestRunEvents = new List <IHookBinding>(); beforeScenarioBlockEvents = new List <IHookBinding>(); afterScenarioBlockEvents = new List <IHookBinding>(); stepDefinitionSkeletonProviderMock = new Mock <IStepDefinitionSkeletonProvider>(); testObjectResolverMock = new Mock <ITestObjectResolver>(); testObjectResolverMock.Setup(bir => bir.ResolveBindingInstance(It.IsAny <Type>(), It.IsAny <IObjectContainer>())) .Returns((Type t, IObjectContainer container) => defaultTestObjectResolver.ResolveBindingInstance(t, container)); var culture = new CultureInfo("en-US"); contextManagerStub = new Mock <IContextManager>(); scenarioInfo = new ScenarioInfo("scenario_title", "scenario_description"); scenarioContext = new ScenarioContext(scenarioContainer, scenarioInfo, testObjectResolverMock.Object); scenarioContainer.RegisterInstanceAs(scenarioContext); contextManagerStub.Setup(cm => cm.ScenarioContext).Returns(scenarioContext); featureInfo = new FeatureInfo(culture, "feature_title", "", ProgrammingLanguage.CSharp); var featureContext = new FeatureContext(featureContainer, featureInfo, specFlowConfiguration); featureContainer.RegisterInstanceAs(featureContext); contextManagerStub.Setup(cm => cm.FeatureContext).Returns(featureContext); contextManagerStub.Setup(cm => cm.StepContext).Returns(new ScenarioStepContext(new StepInfo(StepDefinitionType.Given, "step_title", null, null))); bindingRegistryStub = new Mock <IBindingRegistry>(); bindingRegistryStub.Setup(br => br.GetHooks(HookType.BeforeStep)).Returns(beforeStepEvents); bindingRegistryStub.Setup(br => br.GetHooks(HookType.AfterStep)).Returns(afterStepEvents); bindingRegistryStub.Setup(br => br.GetHooks(HookType.BeforeScenarioBlock)).Returns(beforeScenarioBlockEvents); bindingRegistryStub.Setup(br => br.GetHooks(HookType.AfterScenarioBlock)).Returns(afterScenarioBlockEvents); bindingRegistryStub.Setup(br => br.GetHooks(HookType.BeforeFeature)).Returns(beforeFeatureEvents); bindingRegistryStub.Setup(br => br.GetHooks(HookType.AfterFeature)).Returns(afterFeatureEvents); bindingRegistryStub.Setup(br => br.GetHooks(HookType.BeforeTestRun)).Returns(beforeTestRunEvents); bindingRegistryStub.Setup(br => br.GetHooks(HookType.AfterTestRun)).Returns(afterTestRunEvents); bindingRegistryStub.Setup(br => br.GetHooks(HookType.BeforeScenario)).Returns(beforeScenarioEvents); bindingRegistryStub.Setup(br => br.GetHooks(HookType.AfterScenario)).Returns(afterScenarioEvents); specFlowConfiguration = ConfigurationLoader.GetDefault(); errorProviderStub = new Mock <IErrorProvider>(); testTracerStub = new Mock <ITestTracer>(); stepDefinitionMatcherStub = new Mock <IStepDefinitionMatchService>(); methodBindingInvokerMock = new Mock <IBindingInvoker>(); stepErrorHandlers = new Dictionary <string, IStepErrorHandler>(); obsoleteTestHandlerMock = new Mock <IObsoleteStepHandler>(); cucumberMessageSenderMock = new Mock <ICucumberMessageSender>(); cucumberMessageSenderMock.Setup(m => m.SendTestRunStarted()) .Callback(() => { }); _testPendingMessageFactory = new TestPendingMessageFactory(errorProviderStub.Object); _testUndefinedMessageFactory = new TestUndefinedMessageFactory(stepDefinitionSkeletonProviderMock.Object, errorProviderStub.Object, specFlowConfiguration); }
public TestRunnerManager(IObjectContainer globalContainer, IContainerBuilder containerBuilder, SpecFlowConfiguration specFlowConfiguration, IRuntimeBindingRegistryBuilder bindingRegistryBuilder, ITestTracer testTracer) { this.globalContainer = globalContainer; this.containerBuilder = containerBuilder; this.specFlowConfiguration = specFlowConfiguration; this.bindingRegistryBuilder = bindingRegistryBuilder; this.testTracer = testTracer; }
public AllureTestTracerWrapper(ITraceListener traceListener, IStepFormatter stepFormatter, IStepDefinitionSkeletonProvider stepDefinitionSkeletonProvider, SpecFlowConfiguration specFlowConfiguration) : base(traceListener, stepFormatter, stepDefinitionSkeletonProvider, specFlowConfiguration) { }
public UnitTestMethodGenerator(IUnitTestGeneratorProvider unitTestGeneratorProvider, IDecoratorRegistry decoratorRegistry, CodeDomHelper codeDomHelper, ScenarioPartHelper scenarioPartHelper, SpecFlowConfiguration specFlowConfiguration) { _unitTestGeneratorProvider = unitTestGeneratorProvider; _decoratorRegistry = decoratorRegistry; _codeDomHelper = codeDomHelper; _scenarioPartHelper = scenarioPartHelper; _specFlowConfiguration = specFlowConfiguration; }
internal FeatureContext(IObjectContainer featureContainer, FeatureInfo featureInfo, SpecFlowConfiguration specFlowConfiguration) { Stopwatch = new Stopwatch(); Stopwatch.Start(); FeatureContainer = featureContainer; FeatureInfo = featureInfo; // The Generator defines the value of FeatureInfo.Language: either feature-language or language from App.config or the default // The runtime can define the binding-culture: Value is configured on App.config, else it is null BindingCulture = specFlowConfiguration.BindingCulture ?? featureInfo.Language; }
public SpecFlowConfiguration LoadConfiguration(SpecFlowConfiguration specFlowConfiguration) { return(_configurationLoader.Load(specFlowConfiguration)); }
public static void AddLinePragmaInitial(this CodeDomHelper codeDomHelper, CodeTypeDeclaration testType, string sourceFile, SpecFlowConfiguration specFlowConfiguration) { if (specFlowConfiguration.AllowDebugGeneratedFiles) { return; } codeDomHelper.BindTypeToSourceFile(testType, Path.GetFileName(sourceFile)); }
public static void AddLineDirectiveHidden(this CodeDomHelper codeDomHelper, CodeStatementCollection statements, SpecFlowConfiguration specFlowConfiguration) { if (specFlowConfiguration.AllowDebugGeneratedFiles) { return; } //codeDomHelper.AddDisableSourceLinePragmaStatement(statements); }
public ScenarioPartHelper(SpecFlowConfiguration specFlowConfiguration, CodeDomHelper codeDomHelper, IUnitTestGeneratorProvider testGeneratorProvider) { _specFlowConfiguration = specFlowConfiguration; _codeDomHelper = codeDomHelper; _testGeneratorProvider = testGeneratorProvider; }
public CombinationFeatureGenerator(CodeDomHelper codeDomHelper, SpecFlowConfiguration specFlowConfiguration, IDecoratorRegistry decoratorRegistry, Combination combination) : base(new CustomXUnitGeneratorProvider(codeDomHelper, combination), codeDomHelper, specFlowConfiguration, decoratorRegistry) { }
public SinkProvider(SpecFlowConfiguration specFlowConfiguration, IBinaryFileAccessor binaryFileAccessor, IProtobufFileNameResolver protobufFileNameResolver) { _specFlowConfiguration = specFlowConfiguration; _binaryFileAccessor = binaryFileAccessor; _protobufFileNameResolver = protobufFileNameResolver; }
public void Setup() { specFlowConfiguration = ConfigurationLoader.GetDefault(); }
public void RaiseCustomizeGlobalDependencies(ObjectContainer container, SpecFlowConfiguration specFlowConfiguration) { CustomizeGlobalDependencies?.Invoke(this, new CustomizeGlobalDependenciesEventArgs(container, specFlowConfiguration)); }
public TestClassGenerator(IDecoratorRegistry decoratorRegistry, IUnitTestGeneratorProvider testGeneratorProvider, CodeDomHelper codeDomHelper, SpecFlowConfiguration specFlowConfiguration) { _decoratorRegistry = decoratorRegistry; _testGeneratorProvider = testGeneratorProvider; _codeDomHelper = codeDomHelper; _specFlowConfiguration = specFlowConfiguration; }
public static void AddLineDirective(this CodeDomHelper codeDomHelper, Background background, CodeStatementCollection statements, SpecFlowConfiguration specFlowConfiguration) { AddLineDirective(statements, background.Location, specFlowConfiguration, codeDomHelper); }
//NEW CODE END public FeatureGeneratorExtended(IUnitTestGeneratorProvider testGeneratorProvider, CodeDomHelper codeDomHelper, SpecFlowConfiguration specFlowConfiguration, IDecoratorRegistry decoratorRegistry, string variantKey) : base(decoratorRegistry, testGeneratorProvider, codeDomHelper, specFlowConfiguration) { _testGeneratorProvider = testGeneratorProvider; _codeDomHelper = codeDomHelper; _specFlowConfiguration = specFlowConfiguration; _decoratorRegistry = decoratorRegistry; _linePragmaHandler = new LinePragmaHandler(_specFlowConfiguration, _codeDomHelper); _variantHelper = new VariantHelper(variantKey); //NEW CODE }
public static void AddLineDirective(this CodeDomHelper codeDomHelper, StepsContainer scenarioDefinition, CodeStatementCollection statements, SpecFlowConfiguration specFlowConfiguration) // CHANGED FROM ScenarioDefinitio to StepsContainter { AddLineDirective(statements, scenarioDefinition.Location, specFlowConfiguration, codeDomHelper); }
public virtual SpecFlowConfiguration LoadConfiguration(SpecFlowConfiguration specFlowConfiguration, SpecFlowConfigurationHolder specFlowConfigurationHolder) { return(_configurationLoader.Load(specFlowConfiguration, specFlowConfigurationHolder)); }
public static void AddLineDirective(this CodeDomHelper codeDomHelper, Step step, CodeStatementCollection statements, SpecFlowConfiguration specFlowConfiguration) { AddLineDirective(statements, step.Location, specFlowConfiguration, codeDomHelper); }
public AllureBindingInvoker(SpecFlowConfiguration specFlowConfiguration, IErrorProvider errorProvider) : base(specFlowConfiguration, errorProvider) { }
private static void AddLineDirective(CodeStatementCollection statements, Location location, SpecFlowConfiguration specFlowConfiguration, CodeDomHelper codeDomHelper) { if (location == null || specFlowConfiguration.AllowDebugGeneratedFiles) { return; } //codeDomHelper.AddSourceLinePragmaStatement(statements, location.Line, location.Column); }
public SpecFlowConfiguration LoadJson(SpecFlowConfiguration specFlowConfiguration, string jsonContent) { if (string.IsNullOrWhiteSpace(jsonContent)) { // TODO: dei clarify whether to upgrade to C# 6 since support for VS2013 has been dropped throw new ArgumentNullException("jsonContent"); } var jsonConfig = JsonConvert.DeserializeObject <JsonConfig>(jsonContent); var featureLanguage = specFlowConfiguration.FeatureLanguage; var bindingCulture = specFlowConfiguration.BindingCulture; var additionalStepAssemblies = specFlowConfiguration.AdditionalStepAssemblies; var stepDefinitionSkeletonStyle = specFlowConfiguration.StepDefinitionSkeletonStyle; bool usesPlugins = false; string generatorPath = null; if (jsonConfig.Language != null) { if (!string.IsNullOrWhiteSpace(jsonConfig.Language.Feature)) { featureLanguage = CultureInfo.GetCultureInfo(jsonConfig.Language.Feature); } } if (jsonConfig.BindingCulture != null) { if (!string.IsNullOrWhiteSpace(jsonConfig.BindingCulture.Name)) { featureLanguage = CultureInfo.GetCultureInfo(jsonConfig.BindingCulture.Name); } } if (jsonConfig.StepAssemblies != null) { foreach (var stepAssemblyEntry in jsonConfig.StepAssemblies) { additionalStepAssemblies.Add(stepAssemblyEntry.Assembly); } } if (jsonConfig.Trace != null) { stepDefinitionSkeletonStyle = jsonConfig.Trace.StepDefinitionSkeletonStyle; } if (jsonConfig.Generator != null) { generatorPath = jsonConfig.Generator.GeneratorPath; if (jsonConfig.Generator.Dependencies != null) { usesPlugins = true; } } if (jsonConfig.UnitTestProvider != null && !string.IsNullOrEmpty(jsonConfig.UnitTestProvider.GeneratorProvider)) { usesPlugins = true; } return(new SpecFlowConfiguration(ConfigSource.Json, featureLanguage, bindingCulture, additionalStepAssemblies, stepDefinitionSkeletonStyle, usesPlugins, generatorPath)); }
public AllureBindingInvoker(SpecFlowConfiguration specFlowConfiguration, IErrorProvider errorProvider, ISynchronousBindingDelegateInvoker invoker) : base(specFlowConfiguration, errorProvider, invoker) { }
public ParallelizeDecorator(ITagFilterMatcher tagFilterMatcher, SpecFlowConfiguration generatorConfiguration) { this.tagFilterMatcher = tagFilterMatcher; this.generateParallelCodeForFeatures = generatorConfiguration.MarkFeaturesParallelizable; this.ignoreParallelCodeGenerationTags = generatorConfiguration.SkipParallelizableMarkerForTags; }
public IEnumerable <PluginDescriptor> GetPlugins(SpecFlowConfiguration specFlowConfiguration, SpecFlowConfigurationHolder specFlowConfigurationHolder) { var config = LoadConfiguration(specFlowConfiguration, specFlowConfigurationHolder); return(config.Plugins); }
public LinePragmaHandler(SpecFlowConfiguration specFlowConfiguration, CodeDomHelper codeDomHelper) { _specFlowConfiguration = specFlowConfiguration; _codeDomHelper = codeDomHelper; }
public TestExecutionEngineTests() { specFlowConfiguration = ConfigurationLoader.GetDefault(); testThreadContainer = new ObjectContainer(); featureContainer = new ObjectContainer(); scenarioContainer = new ObjectContainer(); beforeScenarioEvents = new List <IHookBinding>(); afterScenarioEvents = new List <IHookBinding>(); beforeStepEvents = new List <IHookBinding>(); afterStepEvents = new List <IHookBinding>(); beforeFeatureEvents = new List <IHookBinding>(); afterFeatureEvents = new List <IHookBinding>(); beforeTestRunEvents = new List <IHookBinding>(); afterTestRunEvents = new List <IHookBinding>(); beforeScenarioBlockEvents = new List <IHookBinding>(); afterScenarioBlockEvents = new List <IHookBinding>(); stepTransformations = new List <IStepArgumentTransformationBinding>(); stepDefinitionSkeletonProviderMock = new Mock <IStepDefinitionSkeletonProvider>(); testObjectResolverMock = new Mock <ITestObjectResolver>(); testObjectResolverMock.Setup(bir => bir.ResolveBindingInstance(It.IsAny <Type>(), It.IsAny <IObjectContainer>())) .Returns((Type t, IObjectContainer container) => defaultTestObjectResolver.ResolveBindingInstance(t, container)); var culture = new CultureInfo("en-US", false); contextManagerStub = new Mock <IContextManager>(); scenarioInfo = new ScenarioInfo("scenario_title", "scenario_description", null, null); scenarioContext = new ScenarioContext(scenarioContainer, scenarioInfo, testObjectResolverMock.Object); scenarioContainer.RegisterInstanceAs(scenarioContext); contextManagerStub.Setup(cm => cm.ScenarioContext).Returns(scenarioContext); featureInfo = new FeatureInfo(culture, "feature path", "feature_title", "", ProgrammingLanguage.CSharp); var featureContext = new FeatureContext(featureContainer, featureInfo, specFlowConfiguration); featureContainer.RegisterInstanceAs(featureContext); contextManagerStub.Setup(cm => cm.FeatureContext).Returns(featureContext); contextManagerStub.Setup(cm => cm.StepContext).Returns(new ScenarioStepContext(new StepInfo(StepDefinitionType.Given, "step_title", null, null))); bindingRegistryStub = new Mock <IBindingRegistry>(); bindingRegistryStub.Setup(br => br.GetHooks(HookType.BeforeStep)).Returns(beforeStepEvents); bindingRegistryStub.Setup(br => br.GetHooks(HookType.AfterStep)).Returns(afterStepEvents); bindingRegistryStub.Setup(br => br.GetHooks(HookType.BeforeScenarioBlock)).Returns(beforeScenarioBlockEvents); bindingRegistryStub.Setup(br => br.GetHooks(HookType.AfterScenarioBlock)).Returns(afterScenarioBlockEvents); bindingRegistryStub.Setup(br => br.GetHooks(HookType.BeforeFeature)).Returns(beforeFeatureEvents); bindingRegistryStub.Setup(br => br.GetHooks(HookType.AfterFeature)).Returns(afterFeatureEvents); bindingRegistryStub.Setup(br => br.GetHooks(HookType.BeforeTestRun)).Returns(beforeTestRunEvents); bindingRegistryStub.Setup(br => br.GetHooks(HookType.AfterTestRun)).Returns(afterTestRunEvents); bindingRegistryStub.Setup(br => br.GetHooks(HookType.BeforeScenario)).Returns(beforeScenarioEvents); bindingRegistryStub.Setup(br => br.GetHooks(HookType.AfterScenario)).Returns(afterScenarioEvents); bindingRegistryStub.Setup(br => br.GetStepTransformations()).Returns(stepTransformations); specFlowConfiguration = ConfigurationLoader.GetDefault(); errorProviderStub = new Mock <IErrorProvider>(); testTracerStub = new Mock <ITestTracer>(); stepDefinitionMatcherStub = new Mock <IStepDefinitionMatchService>(); methodBindingInvokerMock = new Mock <IBindingInvoker>(); obsoleteTestHandlerMock = new Mock <IObsoleteStepHandler>(); cucumberMessageSenderMock = new Mock <ICucumberMessageSender>(); cucumberMessageSenderMock.Setup(m => m.SendTestRunStarted()) .Callback(() => { }); _testPendingMessageFactory = new TestPendingMessageFactory(errorProviderStub.Object); _testUndefinedMessageFactory = new TestUndefinedMessageFactory(stepDefinitionSkeletonProviderMock.Object, errorProviderStub.Object, specFlowConfiguration); _analyticsEventProvider = new Mock <IAnalyticsEventProvider>(); _analyticsTransmitter = new Mock <IAnalyticsTransmitter>(); _analyticsTransmitter.Setup(at => at.TransmitSpecFlowProjectRunningEvent(It.IsAny <SpecFlowProjectRunningEvent>())) .Callback(() => { }); _testRunnerManager = new Mock <ITestRunnerManager>(); _testRunnerManager.Setup(trm => trm.TestAssembly).Returns(Assembly.GetCallingAssembly); _runtimePluginTestExecutionLifecycleEventEmitter = new Mock <IRuntimePluginTestExecutionLifecycleEventEmitter>(); _testThreadExecutionEventPublisher = new Mock <ITestThreadExecutionEventPublisher>(); _stepArgumentTypeConverterMock = new Mock <IStepArgumentTypeConverter>(); }
protected virtual void LoadPlugins(IRuntimeConfigurationProvider configurationProvider, ObjectContainer container, RuntimePluginEvents runtimePluginEvents, SpecFlowConfiguration specFlowConfiguration) { // initialize plugins that were registered from code foreach (var runtimePlugin in container.Resolve <IDictionary <string, IRuntimePlugin> >().Values) { // these plugins cannot have parameters runtimePlugin.Initialize(runtimePluginEvents, new RuntimePluginParameters()); } // load & initalize parameters from configuration var pluginLoader = container.Resolve <IRuntimePluginLoader>(); foreach (var pluginDescriptor in configurationProvider.GetPlugins(specFlowConfiguration).Where(pd => (pd.Type & PluginType.Runtime) != 0)) { LoadPlugin(pluginDescriptor, pluginLoader, runtimePluginEvents); } }
public void RegisterCustomizations(BoDi.ObjectContainer container, SpecFlowConfiguration runtimeConfiguration) { }