private IRuntimeStatusInfo CreateRuntimeStatusInfo(StatusMessage message) { Dictionary <string, string> watchData = message.WatchData; Dictionary <IVariable, string> varValues; if (null != watchData) { varValues = new Dictionary <IVariable, string>(watchData.Count); Regex varNameRegex = new Regex(CoreUtils.GetVariableNameRegex(_sequenceData, Session)); foreach (KeyValuePair <string, string> varToValue in watchData) { if (varNameRegex.IsMatch(varToValue.Key)) { IVariable variable = CoreUtils.GetVariable(_sequenceData, varToValue.Key); varValues.Add(variable, varToValue.Value); } } } else { varValues = new Dictionary <IVariable, string>(1); } ulong dataStatusIndex = (ulong)_stateManageContext.DataStatusIndex; return(new RuntimeStatusInfo(this, dataStatusIndex, null, varValues)); }
public DebugInformation(DebugEventInfo eventInfo, ISequenceFlowContainer parentSequenceData) { this.BreakPoint = eventInfo.BreakPoint; this.WatchDatas = new Dictionary <IVariable, string>(eventInfo.WatchData.Count); for (int i = 0; i < eventInfo.WatchData.Count; i++) { IVariable variable = CoreUtils.GetVariable(parentSequenceData, eventInfo.WatchData.Names[i]); WatchDatas.Add(variable, eventInfo.WatchData.Values[i]); } }
// 更新所有被ref或out修饰的参数值。如果变量的LogRecordLevel为Trace,则将更新的值写入日志。 private void UpdateParamVariableValue() { for (int i = 0; i < Params.Length; i++) { IArgument argument = Function.ParameterType[i]; IParameterData parameter = Function.Parameters[i]; // 如果参数值是直接传递值,或者参数没有使用ref或out修饰,则返回 if (parameter.ParameterType == ParameterType.Value || argument.Modifier == ArgumentModifier.None) { continue; } object value = Params[i]; // variableName已经是运行时名称 string runtimeVariableName = ModuleUtils.GetVariableNameFromParamValue(parameter.Value); Context.VariableMapper.SetParamValue(runtimeVariableName, parameter.Value, value); IVariable variable = CoreUtils.GetVariable(Context.Sequence, runtimeVariableName); if (variable.LogRecordLevel == RecordLevel.Trace) { LogTraceVariable(variable, value); } } }
private void UpdateSequenceTestResult(IFailedInfo failedInfo, Dictionary <string, string> watchData) { _sequenceTestResult.ResultState = this.State; _sequenceTestResult.StartTime = this.StartTime; _sequenceTestResult.EndTime = this.EndTime; _sequenceTestResult.ElapsedTime = this.ElapsedTime.TotalMilliseconds; _sequenceTestResult.FailedInfo = failedInfo; _sequenceTestResult.VariableValues.Clear(); if (null != watchData) { Regex varNameRegex = new Regex(CoreUtils.GetVariableNameRegex(_sequence, Session)); foreach (KeyValuePair <string, string> varToValue in watchData) { if (varNameRegex.IsMatch(varToValue.Key)) { IVariable variable = CoreUtils.GetVariable(_sequence, varToValue.Key); _sequenceTestResult.VariableValues.Add(variable, varToValue.Value); } } } }
private IRuntimeStatusInfo CreateRuntimeStatusInfo(StatusMessage message) { Dictionary <string, string> watchData = message.WatchData; Dictionary <IVariable, string> varValues; if (null != watchData) { varValues = new Dictionary <IVariable, string>(watchData.Count); Regex varNameRegex = new Regex(CoreUtils.GetVariableNameRegex(_sequenceData, Session)); foreach (KeyValuePair <string, string> varToValue in watchData) { if (varNameRegex.IsMatch(varToValue.Key)) { IVariable variable = CoreUtils.GetVariable(_sequenceData, varToValue.Key); varValues.Add(variable, varToValue.Value); } } } else { varValues = new Dictionary <IVariable, string>(1); } Dictionary <ICallStack, StepResult> stepResults = null; if (null != message.Results && message.Results.Count > 0) { stepResults = new Dictionary <ICallStack, StepResult>(message.Results.Count); List <CallStack> callStacks = message.Stacks; List <StepResult> results = message.Results; for (int i = 0; i < results.Count; i++) { stepResults.Add(callStacks[i], results[i]); } } ulong dataStatusIndex = (ulong)_stateManageContext.EventStatusIndex; return(new RuntimeStatusInfo(this, dataStatusIndex, message.FailedInfo, varValues, message.Performance, stepResults)); }
private void SetTestResultStatistics(IDictionary <string, string> watchData) { _testResults.WatchData.Clear(); _testResults.SetUpSuccess = _testResults[CommonConst.SetupIndex].ResultState == RuntimeState.Success; _testResults.SuccessCount = (from result in _testResults.Values where (result.SequenceIndex >= 0 && result.ResultState == RuntimeState.Success) select result).Count(); _testResults.FailedCount = (from result in _testResults.Values where (result.SequenceIndex >= 0 && result.ResultState == RuntimeState.Failed || result.ResultState == RuntimeState.Error) select result).Count(); _testResults.TimeOutCount = (from result in _testResults.Values where (result.SequenceIndex >= 0 && result.ResultState == RuntimeState.Timeout) select result).Count(); _testResults.TearDownSuccess = _testResults[CommonConst.TeardownIndex].ResultState == RuntimeState.Success; _testResults.AbortCount = (from result in _testResults.Values where (result.SequenceIndex >= 0 && result.ResultState == RuntimeState.Abort) select result).Count(); _testResults.TestOver = _testResults.Values.All(item => item.ResultState > RuntimeState.AbortRequested); if (null != watchData) { Regex varNameRegex = new Regex(CoreUtils.GetVariableNameRegex(_sequenceData, Session)); foreach (KeyValuePair <string, string> varToValue in watchData) { if (varNameRegex.IsMatch(varToValue.Key)) { IVariable variable = CoreUtils.GetVariable(_sequenceData, varToValue.Key); _testResults.WatchData.Add(variable, varToValue.Value); } } } }