/// <summary>
        /// Initializes test data.
        /// </summary>
        public OtherControllersTests()
        {
            IContextProvider provider = new TestContextProvider(_context);

            _controller  = new StatisticsController(provider);
            _controller2 = new UserDataController(provider);
        }
        public void Initialize()
        {
#if _Verbose
            _verbose = true;
#endif

            _testContextProvider = new TestContextProvider(TestContext);
        }
        public override void RunInAllBrowsers(ISeleniumTest testClass, Action <IBrowserWrapper> action, string callerMemberName, string callerFilePath,
                                              int callerLineNumber)
        {
            //TODO: make a review
            var context = (TestContextWrapper)TestContextProvider.GetGlobalScopeTestContext();

            context.TestName = callerMemberName;
            context.FullyQualifiedTestClassName = new System.Diagnostics.StackTrace().GetFrames()?.Select(s => s.GetMethod()?
                                                                                                          .ReflectedType?.FullName).FirstOrDefault(s => !s?.Contains(this.GetType()?.Namespace ?? "") ?? false);
            base.RunInAllBrowsers(testClass, action, callerMemberName, callerFilePath, callerLineNumber);
        }
Exemple #4
0
 protected override async Task <decimal> InvokeTestMethodAsync(ExceptionAggregator aggregator)
 {
     try
     {
         TestContextProvider.Initialize(TestMethod, TestMethodArguments);
         return(await base.InvokeTestMethodAsync(aggregator));
     }
     finally
     {
         TestContextProvider.Clear();
     }
 }
        protected override async Task <Tuple <decimal, string> > InvokeTestAsync(ExceptionAggregator aggregator)
        {
            var testOutputHelper = ConstructorArguments.OfType <TestOutputHelper>().FirstOrDefault() ?? new TestOutputHelper();

            testOutputHelper.Initialize(MessageBus, Test);
            try
            {
                TestContextProvider.Initialize(TestMethod, TestMethodArguments, testOutputHelper, SkipReason);
                var totalTime = await InvokeTestMethodAsync(aggregator);

                return(Tuple.Create(totalTime, testOutputHelper.Output));
            }
            finally
            {
                testOutputHelper.Uninitialize();
                TestContextProvider.Clear();
            }
        }
Exemple #6
0
        private void RunCase(TestClass testClass, Case testCase)
        {
            var instance = testClass.Construct();

            try
            {
                TestContextProvider.Initialize(testCase.Method, testCase.Parameters);
                testCase.Execute(instance);
                if (testCase.Exception is IgnoreException)
                {
                    testCase.Skip(testCase.Exception.Message);
                }
            }
            finally
            {
                TestContextProvider.Clear();
                instance.Dispose();
            }
        }
Exemple #7
0
 /// <summary>Executed after each test is run</summary>
 /// <param name="test">The test that has just been run.</param>
 public void AfterTest(ITest test)
 {
     TestContextProvider.Clear();
 }
Exemple #8
0
 /// <summary>Executed before each test is run</summary>
 /// <param name="test">The test that is going to be run.</param>
 public void BeforeTest(ITest test)
 {
     TestContextProvider.Initialize(test.Method.MethodInfo, test.Arguments);
 }
 public void Initialize()
 {
     _testContextProvider = new TestContextProvider(TestContext);
 }
Exemple #10
0
        /// <summary>
        /// Initializes controller and mocked database.
        /// </summary>
        public OffersControllerTests()
        {
            IContextProvider provider = new TestContextProvider(_context);

            _controller = new OffersController(provider);
        }
 protected override TestSuiteRunner CreateNewTestSuiteRunner(SeleniumTestsConfiguration configuration, TestContextProvider provider)
 {
     return(new XunitTestSuiteRunner(configuration, provider, (service, runner) =>
     {
         runner.SearchAssemblies.Add(Assembly.GetExecutingAssembly());
     }));
 }
 public XunitTestSuiteRunner(SeleniumTestsConfiguration configuration, TestContextProvider testContextProvider, Action <ServiceFactory, TestSuiteRunner> registerServices = null) : base(configuration, (ITestContextProvider)testContextProvider, registerServices)
 {
 }
 /// <summary>Executed after each test is run</summary>
 /// <param name="testDetails">Provides details about the test that has just been run.</param>
 public void AfterTest(TestDetails testDetails)
 {
     TestContextProvider.Clear();
 }
 /// <summary>Executed before each test is run</summary>
 /// <param name="testDetails">Provides details about the test that is going to be run.</param>
 public void BeforeTest(TestDetails testDetails)
 {
     TestContextProvider.Initialize(testDetails.Method);
 }
 public XunitTestSuiteRunner(SeleniumTestsConfiguration configuration, TestContextProvider testContextProvider) : base(configuration, (ITestContextProvider)testContextProvider)
 {
 }