Beispiel #1
0
 public TestTracer(ITraceListener traceListener, IStepFormatter stepFormatter, IStepDefinitionSkeletonProvider stepDefinitionSkeletonProvider, RuntimeConfiguration runtimeConfiguration)
 {
     this.traceListener = traceListener;
     this.stepFormatter = stepFormatter;
     this.stepDefinitionSkeletonProvider = stepDefinitionSkeletonProvider;
     this.runtimeConfiguration = runtimeConfiguration;
 }
Beispiel #2
0
 public GhprTestExecutionEngine(
     IStepFormatter stepFormatter,
     ITestTracer testTracer,
     IErrorProvider errorProvider,
     IStepArgumentTypeConverter stepArgumentTypeConverter,
     RuntimeConfiguration runtimeConfiguration,
     IBindingRegistry bindingRegistry,
     IUnitTestRuntimeProvider unitTestRuntimeProvider,
     IStepDefinitionSkeletonProvider stepDefinitionSkeletonProvider,
     IContextManager contextManager,
     IStepDefinitionMatchService stepDefinitionMatchService,
     IDictionary <string, IStepErrorHandler> stepErrorHandlers,
     IBindingInvoker bindingInvoker)
 {
     _engine = new TestExecutionEngine(stepFormatter,
                                       testTracer,
                                       errorProvider,
                                       stepArgumentTypeConverter,
                                       runtimeConfiguration,
                                       bindingRegistry,
                                       unitTestRuntimeProvider,
                                       stepDefinitionSkeletonProvider,
                                       contextManager,
                                       stepDefinitionMatchService,
                                       stepErrorHandlers,
                                       bindingInvoker);
     _reporter = new Reporter(TestingFramework.SpecFlow);
 }
Beispiel #3
0
        public void TraceNoMatchingStepDefinition(StepArgs stepArgs, ProgrammingLanguage targetLanguage, List <BindingMatch> matchesWithoutScopeCheck)
        {
//            string stepDescription = stepFormatter.GetStepDescription(stepArgs);
//            return new BindingException(
//                string.Format("Multiple step definitions found, but none of them have matching scope for step '{0}': {1}",
//                    stepDescription,
//                    string.Join(", ", matches.Select(m => GetMethodText(m.StepBinding.MethodInfo)).ToArray())));


            IStepDefinitionSkeletonProvider stepDefinitionSkeletonProvider = ObjectContainer.StepDefinitionSkeletonProvider(targetLanguage);

            StringBuilder message = new StringBuilder();

            if (matchesWithoutScopeCheck == null || matchesWithoutScopeCheck.Count == 0)
            {
                message.AppendLine("No matching step definition found for the step. Use the following code to create one:");
            }
            else
            {
                string preMessage = string.Format("No matching step definition found for the step. There are matching step definitions, but none of them have matching scope for this step: {0}.",
                                                  string.Join(", ", matchesWithoutScopeCheck.Select(m => stepFormatter.GetMatchText(m, null)).ToArray()));
                traceListener.WriteToolOutput(preMessage);
                message.AppendLine("Change the scope or use the following code to create a new step definition:");
            }
            message.Append(
                stepDefinitionSkeletonProvider.GetBindingClassSkeleton(
                    stepDefinitionSkeletonProvider.GetStepDefinitionSkeleton(stepArgs))
                .Indent(StepDefinitionSkeletonProviderBase.CODEINDENT));

            traceListener.WriteToolOutput(message.ToString());
        }
Beispiel #4
0
 public TestTracer(ITraceListener traceListener, IStepFormatter stepFormatter, IStepDefinitionSkeletonProvider stepDefinitionSkeletonProvider, Configuration.SpecFlowConfiguration specFlowConfiguration)
 {
     this.traceListener = traceListener;
     this.stepFormatter = stepFormatter;
     this.stepDefinitionSkeletonProvider = stepDefinitionSkeletonProvider;
     this.specFlowConfiguration          = specFlowConfiguration;
 }
Beispiel #5
0
 public GhprTestExecutionEngine(
     IStepFormatter stepFormatter,
     ITestTracer testTracer,
     IErrorProvider errorProvider,
     IStepArgumentTypeConverter stepArgumentTypeConverter,
     SpecFlowConfiguration specFlowConfiguration,
     IBindingRegistry bindingRegistry,
     IUnitTestRuntimeProvider unitTestRuntimeProvider,
     IStepDefinitionSkeletonProvider stepDefinitionSkeletonProvider,
     IContextManager contextManager,
     IStepDefinitionMatchService stepDefinitionMatchService,
     IDictionary <string, IStepErrorHandler> stepErrorHandlers,
     IBindingInvoker bindingInvoker,
     IObsoleteStepHandler obsoleteStepHandler,
     ITestObjectResolver testObjectResolver,
     IObjectContainer objectContainer)
 {
     _engine = new TestExecutionEngine(stepFormatter,
                                       testTracer,
                                       errorProvider,
                                       stepArgumentTypeConverter,
                                       specFlowConfiguration,
                                       bindingRegistry,
                                       unitTestRuntimeProvider,
                                       stepDefinitionSkeletonProvider,
                                       contextManager,
                                       stepDefinitionMatchService,
                                       stepErrorHandlers,
                                       bindingInvoker,
                                       obsoleteStepHandler,
                                       testObjectResolver,
                                       objectContainer);
 }
Beispiel #6
0
 public TestTracer(ITraceListener traceListener, IStepFormatter stepFormatter, IStepDefinitionSkeletonProvider stepDefinitionSkeletonProvider, RuntimeConfiguration runtimeConfiguration)
 {
     this.traceListener = traceListener;
     this.stepFormatter = stepFormatter;
     this.stepDefinitionSkeletonProvider = stepDefinitionSkeletonProvider;
     this.runtimeConfiguration           = runtimeConfiguration;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="TestProjectTestTracerWrapper"/> class.
 /// </summary>
 /// <param name="traceListener">Two.</param>
 /// <param name="stepFormatter">Three.</param>
 /// <param name="stepDefinitionSkeletonProvider">Four.</param>
 /// <param name="specFlowConfiguration">Five.</param>
 public TestProjectTestTracerWrapper(
     ITraceListener traceListener,
     IStepFormatter stepFormatter,
     IStepDefinitionSkeletonProvider stepDefinitionSkeletonProvider,
     SpecFlowConfiguration specFlowConfiguration)
     : base(traceListener, stepFormatter, stepDefinitionSkeletonProvider, specFlowConfiguration)
 {
 }
        public TestExecutionEngine(IStepFormatter stepFormatter, ITestTracer testTracer, IErrorProvider errorProvider, IStepArgumentTypeConverter stepArgumentTypeConverter, 
            RuntimeConfiguration runtimeConfiguration, IBindingRegistry bindingRegistry, IUnitTestRuntimeProvider unitTestRuntimeProvider, 
            IDictionary<ProgrammingLanguage, IStepDefinitionSkeletonProvider> stepDefinitionSkeletonProviders, IContextManager contextManager)
        {
            this.errorProvider = errorProvider;
            this.contextManager = contextManager;
            this.stepDefinitionSkeletonProviders = stepDefinitionSkeletonProviders;
            this.unitTestRuntimeProvider = unitTestRuntimeProvider;
            this.bindingRegistry = bindingRegistry;
            this.runtimeConfiguration = runtimeConfiguration;
            this.testTracer = testTracer;
            this.stepFormatter = stepFormatter;
            this.stepArgumentTypeConverter = stepArgumentTypeConverter;

            this.currentStepDefinitionSkeletonProvider = stepDefinitionSkeletonProviders[ProgrammingLanguage.CSharp]; // fallback if feature initialization was not proper
        }
 public TestExecutionEngine(IStepFormatter stepFormatter, ITestTracer testTracer, IErrorProvider errorProvider, IStepArgumentTypeConverter stepArgumentTypeConverter,
                            RuntimeConfiguration runtimeConfiguration, IBindingRegistry bindingRegistry, IUnitTestRuntimeProvider unitTestRuntimeProvider,
                            IStepDefinitionSkeletonProvider stepDefinitionSkeletonProvider, IContextManager contextManager, IStepDefinitionMatchService stepDefinitionMatchService,
                            IDictionary <string, IStepErrorHandler> stepErrorHandlers, IBindingInvoker bindingInvoker)
 {
     this.errorProvider                  = errorProvider;
     this.bindingInvoker                 = bindingInvoker;
     this.contextManager                 = contextManager;
     this.unitTestRuntimeProvider        = unitTestRuntimeProvider;
     this.stepDefinitionSkeletonProvider = stepDefinitionSkeletonProvider;
     this.bindingRegistry                = bindingRegistry;
     this.runtimeConfiguration           = runtimeConfiguration;
     this.testTracer                 = testTracer;
     this.stepFormatter              = stepFormatter;
     this.stepArgumentTypeConverter  = stepArgumentTypeConverter;
     this.stepErrorHandlers          = stepErrorHandlers == null ? null : stepErrorHandlers.Values.ToArray();
     this.stepDefinitionMatchService = stepDefinitionMatchService;
 }
 public TestExecutionEngine(IStepFormatter stepFormatter, ITestTracer testTracer, IErrorProvider errorProvider, IStepArgumentTypeConverter stepArgumentTypeConverter, 
     RuntimeConfiguration runtimeConfiguration, IBindingRegistry bindingRegistry, IUnitTestRuntimeProvider unitTestRuntimeProvider, 
     IStepDefinitionSkeletonProvider stepDefinitionSkeletonProvider, IContextManager contextManager, IStepDefinitionMatchService stepDefinitionMatchService,
     IDictionary<string, IStepErrorHandler> stepErrorHandlers, IBindingInvoker bindingInvoker)
 {
     this.errorProvider = errorProvider;
     this.bindingInvoker = bindingInvoker;
     this.contextManager = contextManager;
     this.unitTestRuntimeProvider = unitTestRuntimeProvider;
     this.stepDefinitionSkeletonProvider = stepDefinitionSkeletonProvider;
     this.bindingRegistry = bindingRegistry;
     this.runtimeConfiguration = runtimeConfiguration;
     this.testTracer = testTracer;
     this.stepFormatter = stepFormatter;
     this.stepArgumentTypeConverter = stepArgumentTypeConverter;
     this.stepErrorHandlers = stepErrorHandlers == null ? null : stepErrorHandlers.Values.ToArray();
     this.stepDefinitionMatchService = stepDefinitionMatchService;
 }
Beispiel #11
0
        public void OnFeatureStart(FeatureInfo featureInfo)
        {
            // if the unit test provider would execute the fixture teardown code 
            // only delayed (at the end of the execution), we automatically close 
            // the current feature if necessary
            if (unitTestRuntimeProvider.DelayedFixtureTearDown &&
                ObjectContainer.FeatureContext != null)
            {
                OnFeatureEnd();
            }

            stepDefinitionSkeletonProvider = ObjectContainer.StepDefinitionSkeletonProvider(featureInfo.GenerationTargetLanguage);

            // 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
            CultureInfo bindingCulture = ObjectContainer.Configuration.BindingCulture ?? featureInfo.Language;
            ObjectContainer.FeatureContext = new FeatureContext(featureInfo, bindingCulture);
            FireEvents(BindingEvent.FeatureStart, ObjectContainer.FeatureContext.FeatureInfo.Tags);
        }
        public TestExecutionEngine(IStepFormatter stepFormatter, ITestTracer testTracer, IErrorProvider errorProvider, IStepArgumentTypeConverter stepArgumentTypeConverter,
                                   RuntimeConfiguration runtimeConfiguration, IBindingRegistry bindingRegistry, IUnitTestRuntimeProvider unitTestRuntimeProvider,
                                   IDictionary <ProgrammingLanguage, IStepDefinitionSkeletonProvider> stepDefinitionSkeletonProviders, IContextManager contextManager, IStepDefinitionMatcher stepDefinitionMatcher,
                                   IDictionary <string, IStepErrorHandler> stepErrorHandlers)
        {
            this.errorProvider                   = errorProvider;
            this.stepDefinitionMatcher           = stepDefinitionMatcher;
            this.contextManager                  = contextManager;
            this.stepDefinitionSkeletonProviders = stepDefinitionSkeletonProviders;
            this.unitTestRuntimeProvider         = unitTestRuntimeProvider;
            this.bindingRegistry                 = bindingRegistry;
            this.runtimeConfiguration            = runtimeConfiguration;
            this.testTracer                = testTracer;
            this.stepFormatter             = stepFormatter;
            this.stepArgumentTypeConverter = stepArgumentTypeConverter;
            this.stepErrorHandlers         = stepErrorHandlers == null ? null : stepErrorHandlers.Values.ToArray();

            this.currentStepDefinitionSkeletonProvider = stepDefinitionSkeletonProviders[ProgrammingLanguage.CSharp]; // fallback if feature initialization was not proper
        }
Beispiel #13
0
        public void OnFeatureStart(FeatureInfo featureInfo)
        {
            // if the unit test provider would execute the fixture teardown code
            // only delayed (at the end of the execution), we automatically close
            // the current feature if necessary
            if (unitTestRuntimeProvider.DelayedFixtureTearDown &&
                ObjectContainer.FeatureContext != null)
            {
                OnFeatureEnd();
            }

            stepDefinitionSkeletonProvider = ObjectContainer.StepDefinitionSkeletonProvider(featureInfo.GenerationTargetLanguage);

            // 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
            CultureInfo bindingCulture = ObjectContainer.Configuration.BindingCulture ?? featureInfo.Language;

            ObjectContainer.FeatureContext = new FeatureContext(featureInfo, bindingCulture);
            FireEvents(BindingEvent.FeatureStart, ObjectContainer.FeatureContext.FeatureInfo.Tags);
        }
 public TestExecutionEngine(IStepFormatter stepFormatter, ITestTracer testTracer, IErrorProvider errorProvider, IStepArgumentTypeConverter stepArgumentTypeConverter,
                            Configuration.SpecFlowConfiguration specFlowConfiguration, IBindingRegistry bindingRegistry, IUnitTestRuntimeProvider unitTestRuntimeProvider,
                            IStepDefinitionSkeletonProvider stepDefinitionSkeletonProvider, IContextManager contextManager, IStepDefinitionMatchService stepDefinitionMatchService,
                            IDictionary <string, IStepErrorHandler> stepErrorHandlers, IBindingInvoker bindingInvoker, ITestObjectResolver testObjectResolver = null, IObjectContainer testThreadContainer = null) //TODO: find a better way to access the container
 {
     this.errorProvider                  = errorProvider;
     this.bindingInvoker                 = bindingInvoker;
     this.contextManager                 = contextManager;
     this.unitTestRuntimeProvider        = unitTestRuntimeProvider;
     this.stepDefinitionSkeletonProvider = stepDefinitionSkeletonProvider;
     this.bindingRegistry                = bindingRegistry;
     this.specFlowConfiguration          = specFlowConfiguration;
     this.testTracer                 = testTracer;
     this.stepFormatter              = stepFormatter;
     this.stepArgumentTypeConverter  = stepArgumentTypeConverter;
     this.stepErrorHandlers          = stepErrorHandlers == null ? null : stepErrorHandlers.Values.ToArray();
     this.stepDefinitionMatchService = stepDefinitionMatchService;
     this.testObjectResolver         = testObjectResolver;
     this.TestThreadContainer        = testThreadContainer;
 }
        public TestExecutionEngine(IStepFormatter stepFormatter, ITestTracer testTracer, IErrorProvider errorProvider, IStepArgumentTypeConverter stepArgumentTypeConverter, 
            RuntimeConfiguration runtimeConfiguration, IBindingRegistry bindingRegistry, IUnitTestRuntimeProvider unitTestRuntimeProvider, 
            IDictionary<ProgrammingLanguage, IStepDefinitionSkeletonProvider> stepDefinitionSkeletonProviders, IContextManager contextManager, IStepDefinitionMatchService stepDefinitionMatchService,
            IDictionary<string, IStepErrorHandler> stepErrorHandlers, IBindingInvoker bindingInvoker, IRuntimeBindingRegistryBuilder bindingRegistryBuilder)
        {
            this.errorProvider = errorProvider;
            //this.stepDefinitionMatcher = stepDefinitionMatcher;
            this.bindingInvoker = bindingInvoker;
            this.bindingRegistryBuilder = bindingRegistryBuilder;
            this.contextManager = contextManager;
            this.stepDefinitionSkeletonProviders = stepDefinitionSkeletonProviders;
            this.unitTestRuntimeProvider = unitTestRuntimeProvider;
            this.bindingRegistry = bindingRegistry;
            this.runtimeConfiguration = runtimeConfiguration;
            this.testTracer = testTracer;
            this.stepFormatter = stepFormatter;
            this.stepArgumentTypeConverter = stepArgumentTypeConverter;
            this.stepErrorHandlers = stepErrorHandlers == null ? null : stepErrorHandlers.Values.ToArray();

            this.currentStepDefinitionSkeletonProvider = stepDefinitionSkeletonProviders[ProgrammingLanguage.CSharp]; // fallback if feature initialization was not proper

            this.stepDefinitionMatchService = stepDefinitionMatchService;
        }
        public void OnFeatureStart(FeatureInfo featureInfo)
        {
            // if the unit test provider would execute the fixture teardown code
            // only delayed (at the end of the execution), we automatically close
            // the current feature if necessary
            if (unitTestRuntimeProvider.DelayedFixtureTearDown &&
                contextManager.FeatureContext != null)
            {
                OnFeatureEnd();
            }

            if (!stepDefinitionSkeletonProviders.ContainsKey(featureInfo.GenerationTargetLanguage))
            {
                currentStepDefinitionSkeletonProvider = stepDefinitionSkeletonProviders[ProgrammingLanguage.CSharp]; // fallback case for unsupported skeleton provider
            }
            currentStepDefinitionSkeletonProvider = stepDefinitionSkeletonProviders[featureInfo.GenerationTargetLanguage];

            // 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
            CultureInfo bindingCulture = runtimeConfiguration.BindingCulture ?? featureInfo.Language;

            contextManager.InitializeFeatureContext(featureInfo, bindingCulture);
            FireEvents(BindingEvent.FeatureStart);
        }
 public GenerateStepDefinitionSkeletonCommand(IServiceProvider serviceProvider, DTE dte, IGherkinLanguageServiceFactory gherkinLanguageServiceFactory, IStepDefinitionSkeletonProvider stepDefinitionSkeletonProvider, IProjectScopeFactory projectScopeFactory) : base(serviceProvider, dte)
 {
     this.gherkinLanguageServiceFactory = gherkinLanguageServiceFactory;
     this.stepDefinitionSkeletonProvider = stepDefinitionSkeletonProvider;
     this.projectScopeFactory = projectScopeFactory;
 }
 public GoToStepDefinitionCommand(IServiceProvider serviceProvider, DTE dte, IGherkinLanguageServiceFactory gherkinLanguageServiceFactory, IStepDefinitionSkeletonProvider stepDefinitionSkeletonProvider)
 {
     this.gherkinLanguageServiceFactory  = gherkinLanguageServiceFactory;
     this.stepDefinitionSkeletonProvider = stepDefinitionSkeletonProvider;
 }
 public GenerateStepDefinitionSkeletonCommand(IServiceProvider serviceProvider, DTE dte, IGherkinLanguageServiceFactory gherkinLanguageServiceFactory, IStepDefinitionSkeletonProvider stepDefinitionSkeletonProvider, IProjectScopeFactory projectScopeFactory) : base(serviceProvider, dte)
 {
     this.gherkinLanguageServiceFactory  = gherkinLanguageServiceFactory;
     this.stepDefinitionSkeletonProvider = stepDefinitionSkeletonProvider;
     this.projectScopeFactory            = projectScopeFactory;
 }
Beispiel #20
0
 public AllureTestTracerWrapper(ITraceListener traceListener, IStepFormatter stepFormatter, IStepDefinitionSkeletonProvider stepDefinitionSkeletonProvider, RuntimeConfiguration runtimeConfiguration)
     : base(traceListener, stepFormatter, stepDefinitionSkeletonProvider, runtimeConfiguration)
 {
 }
 public GoToStepDefinitionCommand(IServiceProvider serviceProvider, DTE dte, IGherkinLanguageServiceFactory gherkinLanguageServiceFactory, IStepDefinitionSkeletonProvider stepDefinitionSkeletonProvider) 
 {
     this.gherkinLanguageServiceFactory = gherkinLanguageServiceFactory;
     this.stepDefinitionSkeletonProvider = stepDefinitionSkeletonProvider;
 }
 public void Init()
 {
     skeletonProviderCS = new StepDefinitionSkeletonProviderCS();
     skeletonProviderVB = new StepDefinitionSkeletonProviderVB();
 }
Beispiel #23
0
        /// <summary>
        /// Generates the missing steps for the given feature file and determines whether they
        /// should be added to an existing file or put in a new file
        /// </summary>
        private void ProcessMissingSteps(IStepDefinitionSkeletonProvider skeletonProvider, string classExtension)
        {
            var missingSteps = _analyser.GetMissingSteps(); //Get the steps which did not match any bindings
            if (missingSteps.Count <= 0)
            {
                throw new FileGeneratorException("There are no unimplemented steps for this feature.");
            }

            var result = MessageBox.Show("Do you wish to add your step definitions to an existing file?",
                                         MessageBoxHeader, MessageBoxButtons.YesNoCancel,
                                         MessageBoxIcon.Question);
            switch (result)
            {
                case DialogResult.No:
                    {
                        WriteStepsToFile(skeletonProvider, missingSteps);
                        break;
                    }
                case DialogResult.Yes:
                    {
                        AddStepsToFile(skeletonProvider, missingSteps, classExtension);
                        break;
                    }
            }
        }
 public TestUndefinedMessageFactory(IStepDefinitionSkeletonProvider stepDefinitionSkeletonProvider, IErrorProvider errorProvider, SpecFlowConfiguration specFlowConfiguration)
 {
     _stepDefinitionSkeletonProvider = stepDefinitionSkeletonProvider;
     _errorProvider         = errorProvider;
     _specFlowConfiguration = specFlowConfiguration;
 }
Beispiel #25
0
 /// <summary>
 /// Creates a new file containing the missing steps and adds them to the visual studio
 /// solution. Then displays a message conveying whether it succeeded.
 /// </summary>
 private void WriteStepsToFile(IStepDefinitionSkeletonProvider skeletonProvider, List<StepInstance> missingSteps)
 {
     //Store info on file
     StepDefSkeletonInfo info = new StepDefSkeletonInfo(_suggestedStepDefName,
                                                        _defaultNamespace);
     //Generate the skeleton for the new file
     string skeleton = skeletonProvider.GetFileSkeleton(missingSteps, info);
     string file;
     try
     {
         //Try to write the skeleton to a file
         file = _handler.WriteToFile(skeleton, false, _suggestedStepDefName, _featurePath);
     }
     catch (FileHandlerException fileHandlerException)
     {
         //If the file already existed, ask to overwrite
         var overwrite = MessageBox.Show(fileHandlerException.Message, MessageBoxHeader,
                                         MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
         //If they have selected to overwrite then add again, this time allowing overwrites
         if (overwrite == DialogResult.Yes)
             file = _handler.WriteToFile(skeleton, true, _suggestedStepDefName, _featurePath);
         else
             throw new FileGeneratorException("Cancelled creating step definition file.");
     }
     //Add the file generated to the visual studio solution
     if (!_handler.AddToSolution(_sln, _featurePath, file))
         MessageBox.Show(
             "A step defintion file has been created but it could not be added to an existing visual studio project",
             MessageBoxHeader, MessageBoxButtons.OK, MessageBoxIcon.Warning);
     else
         MessageBox.Show("Success! A step definition file has been generated",
                         MessageBoxHeader);
 }
Beispiel #26
0
 /// <summary>
 /// Adds the missing steps to a file already existing through use of the skeletonProvider.
 /// Shows a message if succesful.
 /// </summary>
 private void AddStepsToFile(IStepDefinitionSkeletonProvider skeletonProvider,
     List<StepInstance> missingSteps, string classExtension)
 {
     string dir = Path.GetDirectoryName(_featurePath);
     OpenFileDialog ofd = new OpenFileDialog
     {
         DefaultExt = ".cs",
         Title = "Choose the file your step definitions should be added to.",
         InitialDirectory = dir,
         FileName = _suggestedStepDefName
     };
     DialogResult dialogResult = ofd.ShowDialog();
     if (dialogResult == DialogResult.OK)
     {
         try
         {
             string contents = _handler.GetFileText(ofd.FileName, classExtension);
             string newText = skeletonProvider.AddStepsToExistingFile(contents, missingSteps);
             if (!String.IsNullOrEmpty(newText))
             {
                 _handler.WriteToFile(newText, true, ofd.FileName);
                 MessageBox.Show("Success! Your steps have been added successfully",
                                 MessageBoxHeader);
             }
             else
             {
                 MessageBox.Show("The file you selected does not contain a binding class",
                                 MessageBoxHeader, MessageBoxButtons.OK, MessageBoxIcon.Error);
             }
         }
         catch (FileHandlerException fileHandlerException)
         {
             MessageBox.Show(fileHandlerException.Message, MessageBoxHeader,
                             MessageBoxButtons.OK, MessageBoxIcon.Error);
         }
     }
 }
        public void OnFeatureStart(FeatureInfo featureInfo)
        {
            // if the unit test provider would execute the fixture teardown code 
            // only delayed (at the end of the execution), we automatically close 
            // the current feature if necessary
            if (unitTestRuntimeProvider.DelayedFixtureTearDown &&
                contextManager.FeatureContext != null)
            {
                OnFeatureEnd();
            }

            if (!stepDefinitionSkeletonProviders.ContainsKey(featureInfo.GenerationTargetLanguage))
                currentStepDefinitionSkeletonProvider = stepDefinitionSkeletonProviders[ProgrammingLanguage.CSharp]; // fallback case for unsupported skeleton provider
            currentStepDefinitionSkeletonProvider = stepDefinitionSkeletonProviders[featureInfo.GenerationTargetLanguage];

            // 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
            CultureInfo bindingCulture = runtimeConfiguration.BindingCulture ?? featureInfo.Language;
            contextManager.InitializeFeatureContext(featureInfo, bindingCulture);
            FireEvents(BindingEvent.FeatureStart);
        }
Beispiel #28
0
 public AllureTestExecutionEngine(IStepFormatter stepFormatter, ITestTracer testTracer, IErrorProvider errorProvider, IStepArgumentTypeConverter stepArgumentTypeConverter, RuntimeConfiguration runtimeConfiguration, IBindingRegistry bindingRegistry, IUnitTestRuntimeProvider unitTestRuntimeProvider, IStepDefinitionSkeletonProvider stepDefinitionSkeletonProvider, IContextManager contextManager, IStepDefinitionMatchService stepDefinitionMatchService, IDictionary <string, IStepErrorHandler> stepErrorHandlers, IBindingInvoker bindingInvoker) : base(stepFormatter, testTracer, errorProvider, stepArgumentTypeConverter, runtimeConfiguration, bindingRegistry, unitTestRuntimeProvider, stepDefinitionSkeletonProvider, contextManager, stepDefinitionMatchService, stepErrorHandlers, bindingInvoker)
 {
 }