public void Should_expose_the_test_thread_container()
        {
            TestThreadContext result = ContextManagerStub.TestThreadContext;

            result.Should().NotBeNull();
            result.TestThreadContainer.Should().BeSameAs(TestThreadContainer);
        }
 public BeforeScenarioBlockHooks(
     TestThreadContext testThreadContext,
     FeatureContext featureContext,
     ScenarioContext scenarioContext)
     : base(testThreadContext, featureContext, scenarioContext)
 {
 }
Пример #3
0
 public IntegerSetGeneratorStepDefinitions(
     TestThreadContext testThreadContext,
     FeatureContext featureContext,
     ScenarioContext scenarioContext)
     : base(testThreadContext, featureContext, scenarioContext)
 {
 }
Пример #4
0
 public AfterTestRunHooks(
     TestThreadContext testThreadContext,
     FeatureContext featureContext,
     ScenarioContext scenarioContext)
     : base(testThreadContext, featureContext, scenarioContext)
 {
 }
 public BaseSeleniumTestStepDefinition(
     TestThreadContext testThreadContext,
     FeatureContext featureContext,
     ScenarioContext scenarioContext)
     : base(testThreadContext, featureContext, scenarioContext)
 {
 }
Пример #6
0
 public static void BeforeFeature2(
     TestThreadContext testThreadContext,
     FeatureContext featureContext)
 {
     featureContext.Set(new Stopwatch(), nameof(FeatureStopwatch));
     featureContext.Get <Stopwatch>(nameof(FeatureStopwatch)).Start();
 }
        public void Should_ContextManager_initialize_TestThreadContext_when_constructed()
        {
            var contextManager = CreateContextManager();

            TestThreadContext result = contextManager.TestThreadContext;

            result.Should().NotBeNull();
            result.Should().BeSameAs(TestThreadContainer.Resolve <TestThreadContext>());
        }
Пример #8
0
 public BaseBindingClass(
     TestThreadContext testThreadContext,
     FeatureContext featureContext,
     ScenarioContext scenarioContext)
 {
     TestThreadContext = testThreadContext;
     FeatureContext    = featureContext;
     ScenarioContext   = scenarioContext;
 }
Пример #9
0
        private void InitializeTestThreadContext()
        {
            // Since both TestThreadContext and ContextManager are in the same container (test thread container)
            // their lifetime is the same, so we do not need the swop infrastructure like for the other contexts.
            // We just need to initialize it during construction time.
            var testThreadContext = testThreadContainer.Resolve <TestThreadContext>();

            this.TestThreadContext = testThreadContext;
        }
Пример #10
0
 /// <summary>
 ///     <inheritdoc cref="BaseBindingClass" />
 /// </summary>
 /// <param name="testThreadContext">Context object, that can be used during the usage of the TestThread.</param>
 /// <param name="featureContext">Context object, that can be used during the execution of the Feature.</param>
 /// <param name="scenarioContext">Context object, that can be used during the execution of the Scenario.</param>
 protected BaseBindingClass(
     [NotNull] TestThreadContext testThreadContext,
     [NotNull] FeatureContext featureContext,
     [NotNull] ScenarioContext scenarioContext)
 {
     TestThreadContext = testThreadContext ?? throw new ArgumentNullException(nameof(testThreadContext));
     FeatureContext    = featureContext ?? throw new ArgumentNullException(nameof(featureContext));
     ScenarioContext   = scenarioContext ?? throw new ArgumentNullException(nameof(scenarioContext));
 }
Пример #11
0
        public static void AfterTestRun(TestThreadContext TestThreadContext)
        {
            var objectContainer = TestThreadContext?.Get <IObjectContainer>("objectContainer");

            if (objectContainer.IsRegistered <WebDriverContext>())
            {
                objectContainer.Resolve <WebDriverContext>().CloseBrowser();
            }

            AppiumLocalService?.Dispose();
        }
Пример #12
0
        public static void BeforeFeature2(
            TestThreadContext testThreadContext,
            FeatureContext featureContext)
        {
            var testThreadStopWatch = featureContext.Get <Stopwatch>(nameof(TestThreadStopWatch));

            testThreadStopWatch.Stop();

            testThreadContext.Get <Logger>(nameof(Logger)).Information(
                $"Elapsed time in the TestThread: {Math.Round(testThreadStopWatch.Elapsed.TotalSeconds, 2)} seconds");
        }
Пример #13
0
        public static void BeforeFeature3(
            TestThreadContext testThreadContext,
            FeatureContext featureContext)
        {
            var driver = DriverInitializer.StartWebDriver(
                ExecutionMode.LOCAL,
                BrowserType.CHROME,
                new ChromeOptions(),
                Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location));

            testThreadContext.Set(driver, "Driver");
        }
Пример #14
0
 public StepDefinition1(TestThreadContext testThreadContext, FeatureContext featureContext,
                        ScenarioContext scenarioContext) : base(testThreadContext, featureContext, scenarioContext)
 {
 }
Пример #15
0
 public static void AfterFeature3(
     TestThreadContext testThreadContext,
     FeatureContext featureContext)
 {
     testThreadContext.Get <IWebDriver>(nameof(Driver)).Quit();
 }