public void setAnnotations(String annotations) { m_annotations = AnnotationTypeEnum.valueOf(annotations); }
public String toXml(String indent) { XMLStringBuffer xsb = new XMLStringBuffer(indent); Properties p = new Properties(); p.setProperty("name", getName()); p.setProperty("junit", m_isJUnit != null ? m_isJUnit.toString() : "false"); if (null != m_parallel && !"".equals(m_parallel)) { p.setProperty("parallel", m_parallel); } if (null != m_verbose) { p.setProperty("verbose", m_verbose.toString()); } if (null != m_annotations) { p.setProperty("annotations", m_annotations.toString()); } if (null != m_timeOut) { p.setProperty("time-out", m_timeOut.toString()); } xsb.push("test", p); if (null != getMethodSelectors() && !getMethodSelectors().isEmpty()) { xsb.push("method-selectors"); for (XmlMethodSelector selector : getMethodSelectors()) { xsb.getStringBuffer().append(selector.toXml(indent + " ")); } xsb.pop("method-selectors"); } // parameters if (!m_parameters.isEmpty()) { for (Map.Entry<String, String> para : m_parameters.entrySet()) { Properties paramProps = new Properties(); paramProps.setProperty("name", para.getKey()); paramProps.setProperty("value", para.getValue()); xsb.addEmptyElement("parameter", paramProps); // BUGFIX: TESTNG-27 } } // groups if (!m_metaGroups.isEmpty() || !m_includedGroups.isEmpty() || !m_excludedGroups.isEmpty()) { xsb.push("groups"); // define for (String metaGroupName : m_metaGroups.keySet()) { Properties metaGroupProp = new Properties(); metaGroupProp.setProperty("name", metaGroupName); xsb.push("define", metaGroupProp); for (String groupName : m_metaGroups.get(metaGroupName)) { Properties includeProps = new Properties(); includeProps.setProperty("name", groupName); xsb.addEmptyElement("include", includeProps); } xsb.pop("define"); } if (!m_includedGroups.isEmpty() || !m_excludedGroups.isEmpty()) { xsb.push("run"); for (String includeGroupName : m_includedGroups) { Properties includeProps = new Properties(); includeProps.setProperty("name", includeGroupName); xsb.addEmptyElement("include", includeProps); } for (String excludeGroupName : m_excludedGroups) { Properties excludeProps = new Properties(); excludeProps.setProperty("name", excludeGroupName); xsb.addEmptyElement("exclude", excludeProps); } xsb.pop("run"); } xsb.pop("groups"); } // HINT: don't call getXmlPackages() cause you will retrieve the suite packages too if (null != m_xmlPackages && !m_xmlPackages.isEmpty()) { xsb.push("packages"); for (XmlPackage pack : m_xmlPackages) { xsb.getStringBuffer().append(pack.toXml(" ")); } xsb.pop("packages"); } // classes if (null != getXmlClasses() && !getXmlClasses().isEmpty()) { xsb.push("classes"); for (XmlClass cls : getXmlClasses()) { xsb.getStringBuffer().append(cls.toXml(indent + " ")); } xsb.pop("classes"); } xsb.pop("test"); return xsb.toXML(); }
public String getAnnotations() { return null != m_annotations ? m_annotations.toString() : m_suite.getAnnotations(); }