public SeleniumExec(TestCases testcase, List<Steps> steplist)
        {
            seleniumHandle = new SeleniumActions();

            tcSteps = steplist;
            curTc = testcase;

        }
        public void setNode(TestCases curTc)
        {
            selectedNode = curTc;

            tcCaseText.Text = curTc.Case_id;
            tcDescText.Text = curTc.Desc;
            tcTitleText.Text = curTc.Name;

        }
        public List<TestCases> GetPresets()
        {
            List<TestCases> tcList = new List<TestCases>();

            foreach (automationDataSet.presetsRow row in automationDataSet.presets)
            {

                TestCases curTc = new TestCases();

                curTc.Id = row.id;
                curTc.Version_id = row.version_id;
                curTc.Case_id = row.case_id;
                curTc.Name = row.name;
                curTc.Desc = row.desc;
                curTc.Lastrun = row.lastrun;
                curTc.State = row.state;
                curTc.Preset = row.preset;

                tcList.Add(curTc);
            }

            return tcList;
        }
Пример #4
0
        private void addPresetButton_Click(object sender, EventArgs e)
        {
            TreeNode newNode = new TreeNode();
            TestCases newTc = new TestCases();

            newTc.Case_id = "NEW_TESTCASE";
            newTc.Version_id = (versionComboBox.SelectedItem as Versions).Id;
            newTc.Preset = 1;

            newNode.Tag = newTc;
            newNode.Text = newTc.Case_id;


            newTc.Id = dataHandler.CommitPreset(newTc);
            presetBrowser.Nodes.Add(newNode);
        }
        public List<TestCases> GetTestCasesFromVersion(Versions curVer)
        {
            automationDataSet.versionsRow thisrow = automationDataSet.versions.FindByid(curVer.Id);
            automationDataSet.testcasesRow[] rows = (automationDataSet.testcasesRow[])thisrow.GetChildRows("verid");

            List<TestCases> tcList = new List<TestCases>();

            foreach (automationDataSet.testcasesRow row in rows)
            {

                TestCases curTc = new TestCases();

                curTc.Id = row.id;
                curTc.Version_id = row.version_id;
                curTc.Case_id = row.case_id;
                curTc.Name = row.name;
                curTc.Desc = row.desc;
                curTc.Lastrun = row.lastrun;
                curTc.State = row.state;
                curTc.Preset = row.preset;

                tcList.Add(curTc);
            }

            return tcList;
        }
        public void DeletePreset(TestCases curPre)
        {
            automationDataSet.presetsRow curRow = automationDataSet.presets.FindByid(curPre.Id);


            curRow.Delete();

            presetsTableAdapter.Update(curRow);
        }
        public void DeleteTestCase(TestCases curTc)
        {
            automationDataSet.testcasesRow curRow = automationDataSet.testcases.FindByid(curTc.Id);

            curRow.Delete();

            testCaseTableAdapter.Update(curRow);
        }
        public int CommitPreset(TestCases curPre)
        {
            automationDataSet.presetsRow curRow = automationDataSet.presets.FindByid(curPre.Id);

            if (curRow == null)
            {
                curRow = automationDataSet.presets.NewpresetsRow();

                curRow.version_id = curPre.Version_id;
                curRow.case_id = curPre.Case_id;
                curRow.name = curPre.Name;
                curRow.desc = curPre.Desc;
                curRow.lastrun = curPre.Lastrun;
                curRow.state = curPre.State;
                curRow.preset = curPre.Preset;

                automationDataSet.presets.Rows.Add(curRow);
            }
            else
            {
                curRow.version_id = curPre.Version_id;
                curRow.case_id = curPre.Case_id;
                curRow.name = curPre.Name;
                curRow.desc = curPre.Desc;
                curRow.lastrun = curPre.Lastrun;
                curRow.state = curPre.State;
                curRow.preset = curPre.Preset;
            }


            presetsTableAdapter.Update(curRow);

            return curRow.id;
        }
        public int CommitTestCase(TestCases curTc)
        {
            automationDataSet.testcasesRow curRow = automationDataSet.testcases.FindByid(curTc.Id);

            int id = 0;

            if (curRow == null)
            {
                id = Convert.ToInt32(testCaseTableAdapter.InsertGetId(curTc.Version_id, curTc.Case_id, curTc.Name, curTc.Desc, curTc.Lastrun, curTc.State, 0, curTc.Preset));
                testCaseTableAdapter.Fill(automationDataSet.testcases);
            }
            else
            {
                curRow.version_id = curTc.Version_id;
                curRow.case_id = curTc.Case_id;
                curRow.name = curTc.Name;
                curRow.desc = curTc.Desc;
                curRow.lastrun = curTc.Lastrun;
                curRow.state = curTc.State;
                curRow.preset = curTc.Preset;

                testCaseTableAdapter.Update(curRow);

                id = curRow.id;
            }

            return id;
        }
        public List<Variables> GetVariablesFromPreset(TestCases curTc)
        {
            variablesTableAdapter.Fill(automationDataSet.variables);
            automationDataSet.presetsRow thisrow = automationDataSet.presets.FindByid(curTc.Id);

            automationDataSet.variablesRow[] rows = (automationDataSet.variablesRow[])thisrow.GetChildRows("variables");

            List<Variables> varList = new List<Variables>();

            foreach (automationDataSet.variablesRow row in rows)
            {

                Variables curVar = new Variables();

                curVar.Id = row.id;
                curVar.Testcase_id = row.testcase_id;
                curVar.Searchstr = row.search;
                curVar.Replacestr = row.replace;

                varList.Add(curVar);
            }

            return varList;
        }
        public List<Steps> GetStepsFromPreset(TestCases curTc)
        {
            automationDataSet.presetsRow thisrow = automationDataSet.presets.FindByid(curTc.Id);

            automationDataSet.stepsRow[] rows = (automationDataSet.stepsRow[])thisrow.GetChildRows("presets_steps");

            List<Steps> stepList = new List<Steps>();

            foreach (automationDataSet.stepsRow row in rows)
            {

                Steps curStep = new Steps();

                curStep.Id = row.id;
                curStep.Testcase_id = row.testcase_id;
                curStep.Parentstep_id = row.parentstep_id;
                curStep.Order = row.order;
                curStep.Desc = row.desc;
                curStep.Keyword = row.keyword;
                curStep.Value = row.value;
                curStep.Linked_id = row.linked_id;
                curStep.Element = row.element;
                curStep.Prev = row.prev;
                curStep.Next = row.next;

                stepList.Add(curStep);
            }

            return stepList;
        }