コード例 #1
0
        private bool ShouldRestartBrowser(BrowserConfiguration browserConfiguration)
        {
            if (_previousBrowserConfiguration == null)
            {
                return(true);
            }

            bool shouldRestartBrowser =
                browserConfiguration.BrowserBehavior == BrowserBehavior.RestartEveryTime || browserConfiguration.Browser == Browser.NotSet;

            return(shouldRestartBrowser);
        }
コード例 #2
0
        public override void PreTestInit(TestContext context, MemberInfo memberInfo)
        {
            _currentBrowserConfiguration = GetBrowserConfiguration(memberInfo);

            bool shouldRestartBrowser = ShouldRestartBrowser(_currentBrowserConfiguration);

            if (shouldRestartBrowser)
            {
                RestartBrowser();
            }

            _previousBrowserConfiguration = _currentBrowserConfiguration;
        }
コード例 #3
0
        private BrowserConfiguration GetBrowserConfiguration(MemberInfo memberInfo)
        {
            var result            = new BrowserConfiguration();
            var classBrowserType  = GetExecutionBrowserClassLevel(memberInfo.DeclaringType);
            var methodBrowserType = GetExecutionBrowserMethodLevel(memberInfo);

            if (methodBrowserType != null)
            {
                result = methodBrowserType;
            }
            else if (classBrowserType != null)
            {
                result = classBrowserType;
            }

            return(result);
        }
 public ExecutionBrowserAttribute(Browser browser, BrowserBehavior browserBehavior)
 {
     BrowserConfiguration = new BrowserConfiguration(browser, browserBehavior);
 }