Пример #1
0
        /* void Start()
         * Start testing.
         */
        public void Start()
        {
            //print version information
            PrintHeaders();

            //init jobs.
            InitEngines();
            _index            = 0;
            _currentTestSteps = _parser.GetAllMainTestSteps();

            while (true)
            {
                try
                {
                    //perform action of each step.
                    PerformEachStep();

                    if (_end)
                    {
                        break;
                    }
                }
                catch (TestException e)
                {
                    OnNewMessage(e.ToString());

                    //use ExceptionEngine to handle exceptions
                    //can not go to next step.
                    if (!_exEngine.HandleException(e))
                    {
                        //main test step, stop testing.
                        if (_testStepStack.Count == 0)
                        {
                            break;
                        }
                        else
                        {
                            // return to parent test step.
                            TestStepStatus tmp = _testStepStack.Pop();
                            _index            = tmp._index;
                            _currentTestSteps = tmp._stepList;
                        }
                    }
                    else
                    {
                        //we can handle it...
                    }
                }
                catch (Exception ex)
                {
                    OnNewMessage(ex.ToString());
                    break;
                }
            }

            End();
        }
Пример #2
0
        /*  void PerformCall(TestStep step)
         *  call subs.
         */
        private void PerformCall(TestStep step)
        {
            string          subName = step._testControl;
            List <TestStep> subSteps;

            subSteps = _subEngine.BuildTestStepBySubName(subName);

            if (subSteps == null || subSteps.Count < 1)
            {
                throw new CannotLoadSubException("Sub steps must contains step.");
            }

            TestStepStatus tmp = new TestStepStatus();

            tmp._index    = _index;
            tmp._stepList = _currentTestSteps;
            _testStepStack.Push(tmp);

            _currentTestSteps = subSteps;
            _index            = 0;

            this._logEngine.WriteLog();
        }
Пример #3
0
        /*  void PerformCall(TestStep step)
         *  call subs.
         */
        private void PerformCall(TestStep step)
        {
            string subName = step._testControl;
            List<TestStep> subSteps;
            subSteps = _subEngine.BuildTestStepBySubName(subName);

            if (subSteps == null || subSteps.Count < 1)
            {
                throw new CannotLoadSubException("Sub steps must contains step.");
            }

            TestStepStatus tmp = new TestStepStatus();
            tmp._index = _index;
            tmp._stepList = _currentTestSteps;
            _testStepStack.Push(tmp);

            _currentTestSteps = subSteps;
            _index = 0;

            this._logEngine.WriteLog();
        }