public static TestCase GetNewTestCase(FlowTest flowTest) { TestCase tc = flowTest.TC; tc.tcbList.Clear(); foreach (IStep step in (List <IStep>)flowTest.Steps) { TestCaseBase tcb = new TestCaseBase(); if (step is RequestBuildStep) { tcb = StepToTestCaseRequest((RequestBuildStep)step); } else if (step is ResponseCheckStep) { tcb = StepToTestCaseResponse((ResponseCheckStep)step); } tc.tcbList.Add(tcb); } return(tc); }
public static TestCase NodeToTestCase(XmlNode node) { //XmlNodeList nodeList=node.ChildNodes; TestCase tc = new TestCase(); string name = ((XmlElement)node).GetAttribute("name"); if (name != null) { tc.Name = name; } XmlNodeList xnlGroup = ((XmlElement)node).GetElementsByTagName("group"); if (xnlGroup != null && xnlGroup.Count > 0) { tc.Group = xnlGroup.Item(0).InnerText; } XmlNodeList xnlIdentifier = ((XmlElement)node).GetElementsByTagName("identifier"); if (xnlIdentifier != null && xnlIdentifier.Count > 0) { tc.Identifier = xnlIdentifier.Item(0).InnerText; } XmlNodeList xnlObjective = ((XmlElement)node).GetElementsByTagName("objective"); if (xnlObjective != null && xnlObjective.Count > 0) { tc.Objective = xnlObjective.Item(0).InnerText; } XmlNodeList xnlConfiguration = ((XmlElement)node).GetElementsByTagName("configuration"); if (xnlConfiguration != null && xnlConfiguration.Count > 0) { tc.Configuration = xnlConfiguration.Item(0).InnerText; } XmlNodeList xnlPreTestCondition = ((XmlElement)node).GetElementsByTagName("pre-testconditions"); if (xnlPreTestCondition != null && xnlPreTestCondition.Count > 0) { tc.Pre_testconditions = xnlPreTestCondition.Item(0).InnerText; } XmlNodeList xnlTestSequence = ((XmlElement)node).GetElementsByTagName("testSequence"); if (xnlTestSequence != null && xnlTestSequence.Count > 0) { tc.TestSequence = xnlTestSequence.Item(0).InnerText; } List <TestCaseBase> tcbList = new List <TestCaseBase>(); tc.tcbList = tcbList; XmlNodeList xnlTestCaseItem = ((XmlElement)node).GetElementsByTagName("testCaseItem"); if (xnlTestCaseItem != null && xnlTestCaseItem.Count > 0) { XmlNodeList xnlRequestResponseList = xnlTestCaseItem.Item(0).ChildNodes; foreach (XmlNode reNode in xnlRequestResponseList) { TestCaseBase tcb = NodeToTestCaseBase(reNode); tcbList.Add(tcb); } } return(tc); }