Ejemplo n.º 1
0
        public void Initialize(ISequenceFlowContainer sequenceData)
        {
            _stateManageContext = new StateManageContext(_globalInfo, sequenceData);
            if (sequenceData is ITestProject)
            {
                ITestProject       testProject            = (ITestProject)sequenceData;
                SessionStateHandle testProjectStateHandle = new SessionStateHandle(testProject,
                                                                                   _stateManageContext);
                _sessionStateHandles.Add(testProjectStateHandle.Session, testProjectStateHandle);

                for (int index = 0; index < testProject.SequenceGroups.Count; index++)
                {
                    SessionStateHandle stateHandle = new SessionStateHandle(index, testProject.SequenceGroups[index],
                                                                            _stateManageContext);
                    _sessionStateHandles.Add(stateHandle.Session, stateHandle);
                }
            }
            else
            {
                SessionStateHandle stateHandle = new SessionStateHandle(0, (ISequenceGroup)sequenceData,
                                                                        _stateManageContext);
                _sessionStateHandles.Add(stateHandle.Session, stateHandle);
            }

            _globalInfo.EventDispatcher = _stateManageContext.EventDispatcher;
        }
Ejemplo n.º 2
0
        public SessionStateHandle(ITestProject testProject, StateManageContext stateManageContext)
        {
            this._stateManageContext = stateManageContext;
            InitializeBasicInfo(CommonConst.TestGroupSession, testProject);

            this._sequenceHandles = new Dictionary <int, SequenceStateHandle>(Constants.DefaultRuntimeSize);
            _sequenceHandles.Add(CommonConst.SetupIndex, new SequenceStateHandle(Session,
                                                                                 testProject.SetUp, _stateManageContext));
            _sequenceHandles.Add(CommonConst.TeardownIndex, new SequenceStateHandle(Session,
                                                                                    testProject.TearDown, _stateManageContext));
        }
Ejemplo n.º 3
0
        public SessionStateHandle(int session, ISequenceGroup sequenceGroup, StateManageContext stateManageContext)
        {
            this._stateManageContext = stateManageContext;
            InitializeBasicInfo(session, sequenceGroup);

            // 初始化SequenceHandles
            this._sequenceHandles = new Dictionary <int, SequenceStateHandle>(Constants.DefaultRuntimeSize);
            _sequenceHandles.Add(CommonConst.SetupIndex, new SequenceStateHandle(Session,
                                                                                 sequenceGroup.SetUp, _stateManageContext));
            _sequenceHandles.Add(CommonConst.TeardownIndex, new SequenceStateHandle(Session,
                                                                                    sequenceGroup.TearDown, _stateManageContext));
            for (int i = 0; i < sequenceGroup.Sequences.Count; i++)
            {
                _sequenceHandles.Add(i, new SequenceStateHandle(Session, sequenceGroup.Sequences[i], _stateManageContext));
            }
        }
Ejemplo n.º 4
0
        public SequenceStateHandle(int session, ISequence sequence, StateManageContext stateManageContext)
        {
            this.Session             = session;
            this._sequence           = sequence;
            this.SequenceIndex       = sequence.Index;
            this.State               = RuntimeState.Idle;
            this._eventDispatcher    = stateManageContext.EventDispatcher;
            this._stateManageContext = stateManageContext;
            this.BlockedTime         = TimeSpan.Zero;
            this._blockedStart       = DateTime.MaxValue;
            this.RunStack            = CallStack.GetEmptyStack(session, sequence.Index);

            _sequenceTestResult = this._stateManageContext.GetSequenceResults(Session, SequenceIndex);
            _sequenceResultData = new SequenceResultData()
            {
                Name          = sequence.Name,
                Description   = sequence.Description,
                StartTime     = DateTime.MaxValue,
                EndTime       = DateTime.MaxValue,
                CoroutineId   = -1,
                ElapsedTime   = 0,
                RuntimeHash   = stateManageContext.RuntimeHash,
                FailInfo      = null,
                Result        = RuntimeState.Idle,
                FailStack     = null,
                Session       = session,
                SequenceIndex = sequence.Index,
            };
            _stateManageContext.DatabaseProxy.WriteData(_sequenceResultData);
            _statusData = new RuntimeStatusData()
            {
                RuntimeHash = _stateManageContext.RuntimeHash,
                Sequence    = this.SequenceIndex,
                Session     = Session,
                Stack       = string.Empty,
                Time        = CurrentTime,
                ElapsedTime = this.ElapsedTime.TotalMilliseconds,
                Result      = StepResult.NotAvailable,
                WatchData   = null,
                StatusIndex = -1
            };
        }