Пример #1
0
        private void AddTestStateToExecutor(IExecuteTestStep executor, TestState testState)
        {
            if (testState.GetInstanceWithKey("driver") == null && Attribute.GetCustomAttribute(executor.GetType(), typeof(InitWebDriver)) != null)
            {
                var webDriver = WebDriverProvider.Get(testState.SessionId).Result;
                var id        = Guid.NewGuid().ToString();

                testState.SaveInstanceWithKey("driver", webDriver);
                testState.SaveInstanceWithKey("driverid", id);
            }

            executor.TestState = testState;
        }
        private async Task <bool> AddTestStateToExecutor(IExecuteTestStep executor, TestState testState)
        {
            if (testState.GetInstanceWithKey("driver") == null && Attribute.GetCustomAttribute(executor.GetType(), typeof(InitWebDriver)) != null)
            {
                _logger.Debug("Claiming webdriver");

                var webDriver = await WebDriverProvider.Get(testState.SessionId);

                var id = Guid.NewGuid().ToString();

                _logger.Debug($"Webdriver with id {id} claimed");
                testState.SaveInstanceWithKey("driver", webDriver);
                testState.SaveInstanceWithKey("driverid", id);
            }

            executor.TestState = testState;

            return(true);
        }