Example #1
0
        private TestCase AddCase(XmlNode node)
        {
            TestCase testCase = new TestCase(node.Attributes[1].InnerText);

            foreach (XmlNode n in node.ChildNodes)
            {
                if (n.Name == "preconditions")
                    testCase.Preconditions = n.InnerText;
                else if (n.Name == "summary")
                    testCase.Summary = n.InnerText;
                else if (n.Name == "externalid")
                    testCase.Id = int.Parse(n.InnerText);
                else if (n.Name == "steps")
                    testCase.Steps = AddSteps(n);
            }

            return testCase;
        }
Example #2
0
        private TestCase AddCase(XmlNode node)
        {
            TestCase testCase;

            //Baaaaaaaaaaaaaaaardzooooooooooooo brzydka konstrukcja, ale robiłem na szyyyyyybko, kiedyś się poprawi
            try
            {
                testCase = new TestCase(node.Attributes["name"].InnerText);
            }
            catch (Exception)
            {
                testCase = new TestCase("testcase");
            }

            try
            {
                testCase.InternalId = int.Parse(node.Attributes["internalid"].InnerText);
            }
            catch (Exception)
            {
                testCase.InternalId = -1;
            }

            foreach (XmlNode n in node.ChildNodes)
            {
                if (n.Name == "preconditions")
                    testCase.Preconditions = n.InnerText;
                else if (n.Name == "summary")
                    testCase.Summary = n.InnerText;
                else if (n.Name == "externalid")
                    testCase.ExternalId = int.Parse(n.InnerText);
                else if (n.Name == "steps")
                    testCase.Steps = AddSteps(n);
            }

            return testCase;
        }
 /// <summary>
 /// Show given test case in test case form and make it visible.
 /// </summary>
 /// <param name="tc"></param>
 public void DisplayCase(TestCase tc)
 {
     this.Tag = tc;
     this.LoadTestCaseForm(tc);
     this.Visible = true;
 }
        /// <summary>
        /// Fill test case form with given TestCase object data.
        /// </summary>
        /// <param name="testCase"></param>
        private void LoadTestCaseForm(TestCase testCase)
        {
            int x = 10, y = 15;

            this.txtTestCaseName.Text = testCase.Name;
            this.txtTestCaseSummary.Text = testCase.Summary;
            this.txtTestCasePreconditions.Text = testCase.Preconditions;
            this.pnlActions.Controls.Clear();
            this.pnlExpections.Controls.Clear();

            int textBoxWeight = this.pnlActions.Size.Width - x - 30 - 10;

            foreach (Step step in testCase.Steps)
            {
                this.AddStep(step, textBoxWeight, x, y);
                y += 80;
            }
        }
Example #5
0
        private XmlNode WriteTC(TestCase tc)
        {
            XmlElement node = this.suite.CreateElement("", "testcase", "");
            node.SetAttribute("name", tc.Name);
            XmlElement externalid = this.suite.CreateElement("", "externalid", "");
            externalid.AppendChild(this.suite.CreateCDataSection(tc.Id.ToString()));
            node.AppendChild(externalid);
            XmlElement summary = this.suite.CreateElement("", "summary", "");
            summary.AppendChild(this.suite.CreateCDataSection(tc.Summary));
            node.AppendChild(summary);
            XmlElement preconditions = this.suite.CreateElement("", "preconditions", "");
            preconditions.AppendChild(this.suite.CreateCDataSection(tc.Preconditions));
            node.AppendChild(preconditions);

            if (tc.Steps.Count > 0)
            {
                XmlElement steps = this.suite.CreateElement("", "steps", "");

                foreach (Step step in tc.Steps)
                    steps.AppendChild(WriteStep(step));

                node.AppendChild(steps);
            }

            return node;
        }
Example #6
0
 public void AddTestCase(TestCase tc)
 {
     this.Tcs.Add(tc);
 }
        /// <summary>
        /// Update given test case node Text to equals with test case Name.
        /// </summary>
        /// <param name="tc"></param>
        /// <param name="nodes"></param>
        private void UpdateTreeViewCaseNames(TestCase tc, TreeNodeCollection nodes)
        {
            foreach (TreeNode node in nodes)
            {
                TestCase tcTag = node.Tag as TestCase;

                if (tcTag != null && tcTag.Equals(tc))
                {
                    this.suiteTreeView.BeginUpdate();
                    node.Text = node.Text = tc.Name;
                    this.suiteTreeView.EndUpdate();
                }
                else if (node.Nodes.Count > 0)
                {
                    this.UpdateTreeViewCaseNames(tc, node.Nodes);
                }
            }
        }
        private TestCase CloneCase(TreeNode node)
        {
            TestCase originalCase = node.Tag as TestCase;
            TestCase cloneCase = new TestCase(originalCase.Name);
            cloneCase.ExternalId = originalCase.ExternalId;
            cloneCase.Preconditions = originalCase.Preconditions;
            cloneCase.Summary = originalCase.Summary;

            cloneCase.Steps = new List<Step>();

            foreach (Step step in originalCase.Steps)
                cloneCase.Steps.Add(new Step() { Action = step.Action, ExpectedResult = step.ExpectedResult, StepNumber = step.StepNumber });

            cloneCase.PropertyChanged += new PropertyChangedEventHandler(TestCase_PropertyChanged);

            return cloneCase;
        }
        private void AddTestCaseToSuit(TreeNode node, TestCase testCase)
        {
            if (node != null)
            {
                TestSuite suite = node.Tag as TestSuite;

                if (suite != null)
                {
                    suite.Tcs.Add(testCase);

                    testCase.PropertyChanged += new PropertyChangedEventHandler(TestCase_PropertyChanged);

                    TreeNode tcNode = new TreeNode();

                    tcNode.Text = testCase.Name;
                    tcNode.Tag = testCase;
                    tcNode.ImageIndex = 1;
                    tcNode.SelectedImageIndex = 0;
                    node.Nodes.Add(tcNode);
                }
            }
        }