Beispiel #1
0
        public RunningData GetRunningData()
        {
            var rd = new RunningData();

            rd.SaveDriver(this.webBrowser.GetPropertyValue <object>("Driver"));

            rd.FeatureContext = FeatureContext.Current.Where(
                item =>
            {
                var isSer = item.Value.GetType().IsSerializable;
                if (isSer)
                {
                    return(true);
                }

                this.logger.Trace("Item from feature context with key '{0}' and type '{1}' is not serialize.", item.Key, item.Value.GetType());
                return(false);
            }
                ).ToDictionary(k => k.Key, v => v.Value);

            rd.ScenarioContext = ScenarioContext.Current.Where(
                item =>
            {
                var isSer = item.Value.GetType().IsSerializable;
                if (isSer)
                {
                    return(true);
                }

                this.logger.Trace("Item from scenario context with key '{0}' and type '{1}' is not serialize.", item.Key, item.Value.GetType().ToString());
                return(false);
            }
                ).ToDictionary(k => k.Key, v => v.Value);

            rd.CurrentFeature  = this.CurrentFeature;
            rd.CurrentScenario = this.CurrentScenario;

            return(rd);
        }
Beispiel #2
0
        public void ApplyRunningData(RunningData rd)
        {
            rd.ChangeDriverData(this.GetDriver());

            // TODO: Implement for namespaces of feature
            if (rd.CurrentFeature != null)
            {
                try
                {
                    this.InitFeature(rd.CurrentFeature);
                }
                catch (Exception)
                {
                    this.logger.Trace("Feature '{0}' is not found.", rd.CurrentFeature);
                }
            }

            if (rd.CurrentScenario != null)
            {
                try
                {
                    this.InitScenario(rd.CurrentScenario);
                }
                catch (Exception)
                {
                    this.logger.Trace("Feature '{0}' is not found.", rd.CurrentScenario);
                }
            }

            foreach (var o in rd.FeatureContext)
            {
                FeatureContext.Current.Add(o.Key, o.Value);
            }
            foreach (var o in rd.ScenarioContext)
            {
                ScenarioContext.Current.Add(o.Key, o.Value);
            }
        }
Beispiel #3
0
 public void SaveRunningData()
 {
     this.runningData = this.specManager.GetRunningData();
     logger.Trace("Running data was saved.");
 }