Skip to content

Commit

Permalink
Merge branch 'master' of git://github.com/cbeust/testng
Browse files Browse the repository at this point in the history
  • Loading branch information
nullin committed Jul 6, 2010
2 parents 3ea3d26 + b519fa0 commit bd52e4e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 9 deletions.
11 changes: 3 additions & 8 deletions src/org/testng/xml/XmlClass.java
Expand Up @@ -135,13 +135,9 @@ public String toXml(String indent) {
xsb.push("methods");

for (XmlInclude m : getIncludedMethods()) {
Properties p = new Properties();
p.setProperty("name", m.getName());
if (m.getInvocationNumbers().size() > 0) {
p.setProperty("invocation-numbers", listToString(m.getInvocationNumbers()).toString());
}
xsb.addEmptyElement("include", p);
xsb.getStringBuffer().append(m.toXml(indent + " "));
}

for (String m: getExcludedMethods()) {
Properties p= new Properties();
p.setProperty("name", m);
Expand All @@ -154,13 +150,12 @@ public String toXml(String indent) {
else {
xsb.addEmptyElement("class", pro);
}


return xsb.toXML();

}

private String listToString(List<Integer> invocationNumbers) {
public static String listToString(List<Integer> invocationNumbers) {
StringBuilder result = new StringBuilder();
int i = 0;
for (Integer n : invocationNumbers) {
Expand Down
14 changes: 14 additions & 0 deletions src/org/testng/xml/XmlInclude.java
Expand Up @@ -2,6 +2,9 @@

import java.util.Collections;
import java.util.List;
import java.util.Properties;

import org.testng.reporters.XMLStringBuffer;

import com.google.inject.internal.Lists;

Expand Down Expand Up @@ -36,4 +39,15 @@ public int getIndex() {
return m_index;
}

public String toXml(String indent) {
XMLStringBuffer xsb = new XMLStringBuffer(indent);
Properties p = new Properties();
p.setProperty("name", getName());
if (getInvocationNumbers().size() > 0) {
p.setProperty("invocation-numbers", XmlClass.listToString(getInvocationNumbers()).toString());
}
xsb.addEmptyElement("include", p);

return xsb.toXML();
}
}
2 changes: 1 addition & 1 deletion test/testng-single.xml
Expand Up @@ -26,7 +26,7 @@
</groups>
<parameter name="count" value="10"/>
<classes>
<class name="test.preserveorder.PreserveOrderTest" />
<class name="test.tmp.TestFactory" />
<!--
<class name="test.tmp.A" />
<class name="test.thread.MultiThreadedDependentTest" />
Expand Down

0 comments on commit bd52e4e

Please sign in to comment.