Пример #1
0
        public void ExecRunAll()
        {
            try
            {
                SetRunning(true);

                BuildList.Clear();
                RunList.Clear();

                if (m_dte.Solution.IsOpen)
                {
                    LevelCount levelCount = new LevelCount();
                    foreach (TreeNode projectNode in TestList.Nodes)
                    {
                        TreeNodeTag tag = (TreeNodeTag)projectNode.Tag;
                        ArrayList projectList = GetProjectList(m_dte);
                        foreach (Project project in projectList)
                        {
                            if (project.UniqueName == tag.key)
                            {
                                TestRule rule = TestRule.CheckProject(project);
                                if (rule == null)
                                    continue;

                                if (RefreshProject(project, true) == false)
                                    continue;

                                ClearNode(projectNode, ICON_TYPE.READY, false);
                                GetLevelCount(projectNode, ref levelCount);

                                Runner newRunner = new Runner(this, project, GetConfigurationName( project.UniqueName ));
                                if( newRunner.EnableBind == true )
                                    BuildList.Add(newRunner);
                                else
                                    ClearNode(projectNode, ICON_TYPE.ERROR, false);

                                break;
                            }
                        }
                    }
                    progressBar.MaxValue = levelCount.TestCount;
                }

                CheckSave();
                ThreadRunSelectedNode = null;
                if (bUseThread)
                {
                    RunningThread = new System.Threading.Thread(new System.Threading.ThreadStart(this.ThreadFuncRun));
                    RunningThread.Start();
                }
                else
                {
                    ThreadFuncRun();
                }
            }
            catch (System.Exception ex)
            {
                int a = 0;
            }
        }
Пример #2
0
        public void ExecRunSelected()
        {
            if( TestList.SelectedNode == null )
                return;

            TreeNodeTag tag = (TreeNodeTag)TestList.SelectedNode.Tag;
            if (tag.type == TREENODE_TYPE.FAILURE)
                return;

            SetRunning(true);

            TreeNode projectNode = TestList.SelectedNode;
            while (projectNode.Parent != null) projectNode = projectNode.Parent;
            TreeNodeTag projectTag = (TreeNodeTag)projectNode.Tag;

            BuildList.Clear();
            RunList.Clear();

            if (m_dte.Solution.IsOpen)
            {
                ArrayList projectList = GetProjectList(m_dte);
                foreach (Project project in projectList)
                {
                    if (project.UniqueName == projectTag.key)
                    {
                        TestRule rule = TestRule.CheckProject(project);
                        if (rule == null)
                            continue;

                        if (RefreshProject(project, true) == false)
                            continue;

                        ClearNode(TestList.SelectedNode, ICON_TYPE.READY, false);

                        if (tag.type == TREENODE_TYPE.TEST)
                            progressBar.MaxValue = 1;
                        else
                        {
                            LevelCount levelCount = new LevelCount();
                            GetLevelCount(TestList.SelectedNode, ref levelCount);

                            progressBar.MaxValue = levelCount.TestCount;
                        }
                        Runner newRunner = new Runner(this, project, GetConfigurationName( project.UniqueName ));
                        if (newRunner.EnableBind == true)
                            BuildList.Add(newRunner);
                        else
                            ClearNode(projectNode, ICON_TYPE.ERROR, false);
                        break;
                    }
                }
            }
            CheckSave();
            ThreadRunSelectedNode = TestList.SelectedNode;
            if (bUseThread)
            {
                RunningThread = new System.Threading.Thread(new System.Threading.ThreadStart(this.ThreadFuncRun));
                RunningThread.Start();
            }
            else
            {
                ThreadFuncRun();
            }
        }
Пример #3
0
        private bool ProcessTest(TreeNode node, Runner runner, bool bInternal)
        {
            if (bRunning == false)
            {
                SetRunning(false);
                return false;
            }

            CheckBuild();

            SetIcon(node, ICON_TYPE.START);

            TreeNodeTag tag = (TreeNodeTag)node.Tag;

            switch (tag.type)
            {
                case TREENODE_TYPE.TEST:
                    try
                    {
                        if( runner.Process(node) == false && bRunning == true )
                        {
                            SetIcon(node, ICON_TYPE.ERROR);
                            return false;
                        }
                        else if( bRunning == true )
                            SetIcon(node, node.Nodes.Count == 0 ? ICON_TYPE.SUCCESS : ICON_TYPE.CHECK);
                    }
                    catch (System.Exception)
                    {
                        SetIcon(node, ICON_TYPE.ERROR);
                        return false;
                    }
                    break;

                case TREENODE_TYPE.SUITE:
                case TREENODE_TYPE.PROJECT:
                    {
                        bool bExpand = IsTreeNodeExpanded( node );
                        if( bExpand == false )
                            TreeNodeExpand( node );

                        foreach (TreeNode child in node.Nodes)
                        {
                            if (ProcessTest(child, runner, true) == false && bRunning == true)
                            {
                                SetIcon(node, ICON_TYPE.ERROR);
                                return false;
                            }
                        }
                        CheckIcon(node);
                        if( bExpand == false && node.ImageIndex == (int)ICON_TYPE.SUCCESS )
                            node.Collapse();
                    }
                    break;

                default:
                    return true;
            }

            if (bInternal == false)
            {
                TreeNode parentNode = node.Parent;
                while (parentNode != null)
                {
                    CheckIcon(parentNode);
                    parentNode = parentNode.Parent;
                }
            }

            return true;
        }