示例#1
0
        private bool LoadContainerEntityFromFile()
        {
            LoadError     = null;
            TestContainer = null;

            XElement xtestContainer = null;
            XElement xerror         = null;

            try
            {
                xtestContainer = TestContainerUtil.LoadTestContainer(_containerPath, true);

                // Look for an error
                if (xtestContainer.Name == XConcurrencyNames.Error)
                {
                    xerror         = xtestContainer;
                    xtestContainer = null;
                }
                else
                {
                    xerror = xtestContainer.Element(XConcurrencyNames.Error);
                    if (xerror != null)
                    {
                        xerror.Remove();
                    }
                }
            }
            catch (Exception ex)
            {
                xerror = XConcurrencyNames.CreateXError(ex);
            }

            // This is outside of the try-catch because it's updating the xdocument tree only
            // and any errors during events regarding the tree changing will be caught elsewhere.
            if (xerror != null)
            {
                LoadError = (ErrorEntity)Model.EntityBuilder.CreateEntityAndBindToElement(xerror);
                return(false);
            }

            TestContainer = (TestGroupingEntity)Model.EntityBuilder.CreateEntityAndBindToElement(xtestContainer);
            TestContainer.LoadChildren(true);
            return(true);
        }
示例#2
0
        public RunTestsEngine(string containerFilePath)
        {
            _containerFilePath    = containerFilePath;
            _testsContainerEntity = LoadTestContainer(_containerFilePath);

            // Need to setup any test assemblies
            foreach (var testAssy in _testsContainerEntity.DescendantsAndSelf <TestAssemblyEntity>())
            {
                Model.Instance.Session.RegisterTestAssembly(testAssy);
            }

            _taskController = new AppTaskController(Model.Instance, Model.Instance.Session.BaseTasksFolderPath)
            {
                MaxConcurrentTasks = 1,
            };
            _taskController.TaskStarted   += new AppTaskEventHandler(TaskController_TaskStarted);
            _taskController.TaskCompleted += new AppTaskEventHandler(TaskController_TaskCompleted);

            _normalConsoleColor = Console.ForegroundColor;
        }