private void RestartApp() { // Disposing existing engine var previousTestExecutionEngine = ServicesCollection.Current.Resolve <Bellatrix.Mobile.TestExecutionEngine>(); previousTestExecutionEngine.Dispose(ServicesCollection.Current); ServicesCollection.Current.UnregisterSingleInstance <TestExecutionEngine>(); // Register the ExecutionEngine that should be used for the current run. Will be used in the next test as PreviousEngineType. var testExecutionEngine = new TestExecutionEngine(); ServicesCollection.Current.RegisterInstance(testExecutionEngine); string classFullName = DetermineTestClassFullName(); _androidBrowserStackAppConfiguration.InitializeAppiumOptions(classFullName); _androidCrossBrowserTestingAppConfiguration.InitializeAppiumOptions(classFullName); _androidSauceLabsAppConfiguration.InitializeAppiumOptions(classFullName); _iosBrowserStackAppConfiguration.InitializeAppiumOptions(classFullName); _iosCrossBrowserTestingAppConfiguration.InitializeAppiumOptions(classFullName); _iosSauceLabsAppConfiguration.InitializeAppiumOptions(classFullName); // Register the Browser type that should be used for the current run. Will be used in the next test as PreviousBrowserType. ServicesCollection.Current.RegisterInstance(_currentAppConfiguration); // Start the current engine with current browser type. testExecutionEngine.StartApp(_currentAppConfiguration, ServicesCollection.Current); }
public SpecflowManager(string assemblyPath, ILogger logger) { ConfigurationManager.AppSettings["SmtpServerEnabled"] = "false"; //CoreExtensions.Host.InitializeService(); this.testAssembly = Assembly.LoadFrom(assemblyPath); this.testRunner = this.InitTestRunner(); this.executionEngine = this.testRunner.GetMemberValue <TestExecutionEngine>("executionEngine"); this.bindingRegistry = this.executionEngine.GetMemberValue <IBindingRegistry>("bindingRegistry"); this.unitTestRuntimeProvider = this.executionEngine.GetMemberValue <IUnitTestRuntimeProvider>("unitTestRuntimeProvider"); this.contextManager = this.executionEngine.GetMemberValue <IContextManager>("contextManager"); this.runtimeConfiguration = this.executionEngine.GetMemberValue <RuntimeConfiguration>("runtimeConfiguration"); this.defaultTargetLanguage = this.executionEngine.GetMemberValue <ProgrammingLanguage>("defaultTargetLanguage"); this.defaultBindingCulture = this.executionEngine.GetMemberValue <CultureInfo>("defaultBindingCulture"); var core = this.testAssembly.GetReferencedAssemblies().First(a => a.FullName.Contains("Wilco.UITest.Core")); this.webBrowser = Assembly.Load(core).GetTypes().First(t => t.Name.Contains("WebBrowser")); this.globalContainer = this.testRunnerManager.GetMemberValue <ObjectContainer>("globalContainer"); if (logger != null) { this.logger = logger; this.RegistrLogger(logger); } //this.Bind(this.testAssembly); }
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); }
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); }
public void FireMustPass() { var webDriver = new Mock <IWebDriver>(); var navigate = new Mock <INavigation>(); webDriver.Setup(x => x.Navigate()).Returns(navigate.Object); _driver.Setup(x => x.SeleniumWebDriver).Returns(webDriver.Object); var testCase1 = new Mock <ITestCase>(); var testCase2 = new Mock <ITestCase>(); var testStep = new Mock <ITestStep>(); testStep.Setup(x => x.Do).Returns(ActivityTypes.Navigate.Name); testStep.Setup(x => x.Argument).Returns("https://www.google.com"); testCase1.Setup(x => x.Steps).Returns(new List <ITestStep> { testStep.Object }); testCase2.Setup(x => x.Steps).Returns(new List <ITestStep> { testStep.Object }); var testCases = new List <ITestCase> { testCase1.Object, testCase2.Object }; var engine = new TestExecutionEngine(_driver.Object, _reporter.Object); engine.AddTestCases(testCases.ToArray()); var result = engine.Fire(); Assert.NotNull(result); }
public void AddTestCaseMustPass() { var testCase = new Mock <ITestCase>(); var engine = new TestExecutionEngine(_driver.Object, _reporter.Object); var result = engine.AddTestCase(testCase.Object); Assert.NotNull(result); }
public void AddTestCasesMustPass() { var testCase1 = new Mock <ITestCase>(); var testCase2 = new Mock <ITestCase>(); var testCases = new List <ITestCase> { testCase1.Object, testCase2.Object }; var engine = new TestExecutionEngine(_driver.Object, _reporter.Object); var result = engine.AddTestCases(testCases.ToArray()); Assert.NotNull(result); }
private void ShutdownApp(ServicesCollection container) { var currentAppConfiguration = container.Resolve <AppConfiguration>("_currentAppConfiguration"); ShutdownApp(container); // Register the ExecutionEngine that should be used for the current run. Will be used in the next test as PreviousEngineType. var testExecutionEngine = new TestExecutionEngine(); // Register the app that should be used for the current run. Will be used in the next test as PreviousappType. container.RegisterInstance(currentAppConfiguration); // Start the current engine testExecutionEngine.StartApp(currentAppConfiguration, container); }
public GhprTestExecutionEngine( IStepFormatter stepFormatter, ITestTracer testTracer, IErrorProvider errorProvider, IStepArgumentTypeConverter stepArgumentTypeConverter, SpecFlowConfiguration specFlowConfiguration, IBindingRegistry bindingRegistry, IUnitTestRuntimeProvider unitTestRuntimeProvider, IContextManager contextManager, IStepDefinitionMatchService stepDefinitionMatchService, IDictionary <string, IStepErrorHandler> stepErrorHandlers, IBindingInvoker bindingInvoker, IObsoleteStepHandler obsoleteStepHandler, ICucumberMessageSender cucumberMessageSender, ITestResultFactory testResultFactory, ITestPendingMessageFactory testPendingMessageFactory, ITestUndefinedMessageFactory testUndefinedMessageFactory, ITestRunResultCollector testRunResultCollector, IAnalyticsEventProvider analyticsEventProvider, IAnalyticsTransmitter analyticsTransmitter, ITestRunnerManager testRunnerManager, ITestObjectResolver testObjectResolver = null, IObjectContainer testThreadContainer = null) { _engine = new TestExecutionEngine(stepFormatter, testTracer, errorProvider, stepArgumentTypeConverter, specFlowConfiguration, bindingRegistry, unitTestRuntimeProvider, contextManager, stepDefinitionMatchService, stepErrorHandlers, bindingInvoker, obsoleteStepHandler, cucumberMessageSender, testResultFactory, testPendingMessageFactory, testUndefinedMessageFactory, testRunResultCollector, analyticsEventProvider, analyticsTransmitter, testRunnerManager, testObjectResolver, testThreadContainer); }
private void RestartBrowser(ServicesCollection container) { var currentBrowserConfiguration = container.Resolve <BrowserConfiguration>("_currentBrowserConfiguration"); ShutdownBrowser(container); // Register the ExecutionEngine that should be used for the current run. Will be used in the next test as PreviousEngineType. var testExecutionEngine = new TestExecutionEngine(); container.RegisterInstance(testExecutionEngine); // Register the Browser type that should be used for the current run. Will be used in the next test as PreviousBrowserType. container.RegisterInstance(currentBrowserConfiguration); // Start the current engine with current browser type. testExecutionEngine.StartBrowser(currentBrowserConfiguration, container); }
private static void Main(string[] args) { Console.WriteLine("Hello World!"); var services = new ServiceCollection(); var chromeDriverOptions = new AutomationDriverOptions { }; var driver = new DefaultChromeDriver(chromeDriverOptions); var reportEngine = new ExtentReportReporter(new ExtentReporterOptions { }); var engine = new TestExecutionEngine(driver, reportEngine); engine.Fire(); }
private void RestartBrowser(ServicesCollection container) { if (_previousBrowserConfiguration.BrowserType != BrowserType.NotSet) // NotSet = initial browser start { ShutdownBrowser(container); } // Register the ExecutionEngine that should be used for the current run. Will be used in the next test as PreviousEngineType. var testExecutionEngine = new TestExecutionEngine(); container.RegisterInstance(testExecutionEngine); // Register the Browser type that should be used for the current run. Will be used in the next test as PreviousBrowserType. container.RegisterInstance(_currentBrowserConfiguration); // Start the current engine with current browser type. testExecutionEngine.StartBrowser(_currentBrowserConfiguration, container); }
private void RestartApp() { // Disposing existing engine var previousTestExecutionEngine = ServicesCollection.Current.Resolve <TestExecutionEngine>(); previousTestExecutionEngine.Dispose(ServicesCollection.Current); ServicesCollection.Current.UnregisterSingleInstance <TestExecutionEngine>(); // Register the ExecutionEngine that should be used for the current run. Will be used in the next test as PreviousEngineType. var testExecutionEngine = new TestExecutionEngine(); ServicesCollection.Current.RegisterInstance(testExecutionEngine); // Register the Browser type that should be used for the current run. Will be used in the next test as PreviousBrowserType. ServicesCollection.Current.RegisterInstance(_currentAppConfiguration); // Start the current engine with current browser type. testExecutionEngine.StartApp(_currentAppConfiguration, ServicesCollection.Current); }
public void AddTestCasesNullCheck() { var engine = new TestExecutionEngine(_driver.Object, _reporter.Object); Assert.Throws <ArgumentNullException>(() => engine.AddTestCases(null)); }