예제 #1
0
        public void OverrideXMLParameters(List <TestNGTestParameter> xmlParametersToOverwrite)
        {
            XmlNodeList xmlParamsList = SuiteXml.GetElementsByTagName("parameter");

            for (int i = 0; i < xmlParamsList.Count; i++)
            {
                TestNGTestParameter paramToOveride = null;
                paramToOveride = xmlParametersToOverwrite.Where(x => ((x.Name == xmlParamsList[i].Attributes.GetNamedItem("name").Value) &&
                                                                      (string.IsNullOrEmpty(x.ParentNodeName) || x.ParentNodeName == xmlParamsList[i].ParentNode.Attributes.GetNamedItem("name").Value))).FirstOrDefault();
                if (paramToOveride != null)
                {
                    xmlParamsList[i].Attributes.GetNamedItem("value").Value = paramToOveride.Value;
                }
            }
        }
예제 #2
0
        private List <TestNGTestParameter> GetTestParametersFromXmlElement(XmlElement xmlElement)
        {
            List <TestNGTestParameter> ngParams = new List <TestNGTestParameter>();

            foreach (XmlElement xmlParam in xmlElement.GetElementsByTagName("parameter"))
            {
                if (xmlParam.ParentNode.Equals(xmlElement))
                {
                    TestNGTestParameter ngParam = new TestNGTestParameter
                    {
                        Name  = xmlParam.Attributes.GetNamedItem("name").Value,
                        Value = xmlParam.Attributes.GetNamedItem("value").Value,
                    };
                    ngParams.Add(ngParam);
                }
            }

            return(ngParams);
        }