Ejemplo n.º 1
0
        private void OnSeqRun()
        {
            var testStepList = ManualConnectionList[currentConnIndex].TestStepList;

            for (int i = stopIndex; i < testStepList.Count; i++)
            {
                if (IsRun)
                {
                    if (testStepList[i].IsTest)
                    {
                        try
                        {
                            if (StepStart != null)
                            {
                                StepStart.Invoke(i);
                            }
                            testStepList[i].DetailProgressReport = (traceIndex, markerIndex) =>
                            {
                                if (PointFinish != null)
                                {
                                    PointFinish.Invoke(i, traceIndex, markerIndex);
                                }
                            };
                            testStepList[i].RunState = () => GetRunState();
                            if (!GeneTestSetup.Instance.IsSimulated)
                            {
                                //set path config
                                if (pathConfig == null)
                                {
                                    DataUtils.LOGINFO.WriteLog(testStepList[i].DisplayName + " path is empty");
                                }
                                else
                                {
                                    string configName = testStepList[i].PathConfigName;
                                    if (string.IsNullOrWhiteSpace(configName))
                                    {
                                        DataUtils.LOGINFO.WriteLog(testStepList[i].DisplayName + " path is empty");
                                    }
                                    else
                                    {
                                        var config = testStepList[i].GetPathConfigInfo(configName);
                                        if (config != null)
                                        {
                                            string   configValue    = config.Path;
                                            string[] pathConfigList = pathConfig.GetPathConfigNameList();
                                            if (pathConfigList != null && pathConfigList.Contains(configValue))
                                            {
                                                pathConfig.SetPathConfig(configValue);
                                            }
                                            else
                                            {
                                                DataUtils.LOGINFO.WriteLog(testStepList[i].DisplayName + " " + configValue + " path is not found");
                                                throw (new Exception(testStepList[i].DisplayName + " " + configValue + " path is not found"));
                                            }
                                        }
                                    }
                                }
                            }
                            DataUtils.LOGINFO.WriteLog(DateTime.Now.ToString() + testStepList[i].DisplayName + " single start");
                            testStepList[i].Single();
                            DataUtils.LOGINFO.WriteLog(DateTime.Now.ToString() + testStepList[i].DisplayName + " single finish");
                            if (!GeneTestSetup.Instance.IsSimulated)
                            {
                                if (pathConfig == null)
                                {
                                    DataUtils.LOGINFO.WriteLog(testStepList[i].DisplayName + " path is empty");
                                }
                                else
                                {
                                    string configName = testStepList[i].PathConfigName;
                                    if (string.IsNullOrWhiteSpace(configName))
                                    {
                                        DataUtils.LOGINFO.WriteLog(testStepList[i].DisplayName + " path is empty");
                                    }
                                    else
                                    {
                                        var config = testStepList[i].GetPathConfigInfo(configName);
                                        if (config != null)
                                        {
                                            string   configValue    = config.Path;
                                            string[] pathConfigList = pathConfig.GetPathConfigNameList();
                                            if (pathConfigList != null && pathConfigList.Contains(configValue))
                                            {
                                                pathConfig.PostPathConfig(configValue);
                                            }
                                            else
                                            {
                                                DataUtils.LOGINFO.WriteLog(testStepList[i].DisplayName + " " + configValue + " path is not found");
                                                throw (new Exception(testStepList[i].DisplayName + " " + configValue + " path is not found"));
                                            }
                                        }
                                    }
                                }
                            }
                            testStepList[i].CalcStepInfo();
                            //更新连接步骤中的passfail
                            ManualConnectionList[currentConnIndex].PassFail = Symtant.GeneFunLib.GeneFun.NullBoolAndList(testStepList.Select(x => x.PassFail).ToList());
                            if (StepFinish != null)
                            {
                                StepFinish.Invoke(i);
                            }
                        }
                        catch (Exception exp)
                        {
                            testStepList[i].CleanUp();
                            ExceptionCollection.Add(exp);
                            IsRun = IsRunWhenException;
                        }
                    }
                }
                else
                {
                    stopIndex = i;
                    System.Diagnostics.Debug.WriteLine(stopIndex);
                    break;
                }
            }
            if (DXSplashScreen.IsActive)
            {
                DXSplashScreen.Close();
            }
            IsRuning = false;
            if (SeqFinish != null)
            {
                SeqFinish.Invoke();
            }
        }
Ejemplo n.º 2
0
 private void OnStepStart(PageStepEventArgs e)
 {
     StepStart?.Invoke(this, e);
 }