Ejemplo n.º 1
0
        private void ExecuteStep()
        {
            try
            {
                if (m_JobData.taskIndex >= Tasks.Length)
                {
                    StopRun();
                    return;
                }

                if (m_Enumerator == null)
                {
                    var task = Tasks[m_JobData.taskIndex];
                    m_Enumerator = task.Execute(m_JobData);
                    if (task.SupportsResumingEnumerator)
                    {
                        PcHelper.SetEnumeratorPC(m_Enumerator, m_JobData.taskPC);
                    }
                }

                if (!m_Enumerator.MoveNext())
                {
                    m_JobData.taskIndex++;
                    m_JobData.taskPC = 0;
                    m_Enumerator     = null;
                    return;
                }

                if (Tasks[m_JobData.taskIndex].SupportsResumingEnumerator)
                {
                    m_JobData.taskPC = PcHelper.GetEnumeratorPC(m_Enumerator);
                }
            }
            catch (TestRunCanceledException)
            {
                StopRun();
            }
            catch (AggregateException ex)
            {
                StopRun();
                LogError(ex.Message);
                foreach (var innerException in ex.InnerExceptions)
                {
                    LogException(innerException);
                }
                ReportRunFailed("Multiple unexpected errors happened while running tests.");
            }
            catch (Exception ex)
            {
                StopRun();
                LogException(ex);
                ReportRunFailed("An unexpected error happened while running tests.");
            }
        }
Ejemplo n.º 2
0
        private void ExecuteStep()
        {
            if (!m_JobData.isRunning)
            {
                m_JobData.isRunning = true;
                TestJobDataHolder.instance.TestRuns.Add(m_JobData);
            }

            if (m_JobData.taskIndex >= Tasks.Length)
            {
                StopRun();
                return;
            }

            var task       = Tasks[m_JobData.taskIndex];
            var enumerator = task.Execute(m_JobData);

            m_PcHelper.SetEnumeratorPC(enumerator, m_JobData.taskPC);

            try
            {
                if (!enumerator.MoveNext())
                {
                    m_JobData.taskIndex++;
                    m_JobData.taskPC = 0;
                    return;
                }
            }
            catch (TestRunCanceledException)
            {
                StopRun();
                return;
            }
            catch (Exception ex)
            {
                StopRun();
                Debug.LogException(ex);
                CallbacksDelegator.instance.RunFailed("An unexpected error happened while running tests.");
                return;
            }

            m_JobData.taskPC = m_PcHelper.GetEnumeratorPC(enumerator);
        }
Ejemplo n.º 3
0
        private void ExecuteStep()
        {
            try
            {
                if (m_JobData.taskInfoStack.Count == 0)
                {
                    StopRun();
                    return;
                }

                var taskInfo = m_JobData.taskInfoStack.Peek();

                if (m_Enumerator == null)
                {
                    if (taskInfo.index >= m_JobData.Tasks.Length || (taskInfo.stopBeforeIndex > 0 && taskInfo.index >= taskInfo.stopBeforeIndex))
                    {
                        m_JobData.taskInfoStack.Pop();
                        return;
                    }

                    var task = m_JobData.Tasks[taskInfo.index];
                    if (!task.ShouldExecute(taskInfo))
                    {
                        taskInfo.index++;
                        return;
                    }

                    m_Enumerator = task.Execute(m_JobData);
                    if (task.SupportsResumingEnumerator)
                    {
                        PcHelper.SetEnumeratorPC(m_Enumerator, taskInfo.pc);
                    }
                }
                if (!m_JobData.executionSettings.runSynchronously && m_JobData.taskInfoStack.Count == 1 && taskInfo.taskMode == TestJobData.TaskMode.Normal)
                {
                    ReportRunProgress(false);
                }

                if (!m_Enumerator.MoveNext())
                {
                    taskInfo.index++;
                    taskInfo.pc  = 0;
                    m_Enumerator = null;
                    return;
                }

                if (m_JobData.Tasks[taskInfo.index].SupportsResumingEnumerator)
                {
                    taskInfo.pc = PcHelper.GetEnumeratorPC(m_Enumerator);
                }
            }
            catch (TestRunCanceledException)
            {
                StopRun();
            }
            catch (AggregateException ex)
            {
                MarkJobAsError();
                LogError(ex.Message);
                foreach (var innerException in ex.InnerExceptions)
                {
                    LogException(innerException);
                }

                ReportRunFailed("Multiple unexpected errors happened while running tests.");
            }
            catch (Exception ex)
            {
                MarkJobAsError();
                LogException(ex);
                ReportRunFailed("An unexpected error happened while running tests.");
            }
        }