Added: ISuite#getAllMethods, to retrieve all the methods at the start of a suite.
diff --git a/CHANGES.txt b/CHANGES.txt
index 8a12e68..9df83f0 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -16,6 +16,7 @@
Added: Tycho compatibility (Aleksander Pohl)
Added: New <test> and <suite> flag: group-by-instances
Added: -xmlpathinjar to specify the path of testng.xml inside a test jar file
+Added: ISuite#getAllMethods, to retrieve all the methods at the start of a suite.
Fixed: Dependency failures only impact the same instance
Fixed: Static classes could cause a StackOverFlowError
Fixed: IConfigurationListener was not extending ITestNGListener
diff --git a/src/main/java/org/testng/ISuite.java b/src/main/java/org/testng/ISuite.java
index dec2fb2..1655ae1 100755
--- a/src/main/java/org/testng/ISuite.java
+++ b/src/main/java/org/testng/ISuite.java
@@ -102,4 +102,11 @@
public XmlSuite getXmlSuite();
public void addListener(ITestNGListener listener);
+
+ /**
+ * @return the total number of methods found in this suite. The presence of
+ * factories or data providers might cause the actual number of test methods
+ * run be bigger than this list.
+ */
+ List<ITestNGMethod> getAllMethods();
}
diff --git a/src/main/java/org/testng/SuiteRunner.java b/src/main/java/org/testng/SuiteRunner.java
index b398c3e..425edbc 100644
--- a/src/main/java/org/testng/SuiteRunner.java
+++ b/src/main/java/org/testng/SuiteRunner.java
@@ -12,13 +12,13 @@
import org.testng.reporters.JUnitXMLReporter;
import org.testng.reporters.TestHTMLReporter;
import org.testng.reporters.TextReporter;
-import org.testng.xml.XmlClass;
import org.testng.xml.XmlSuite;
import org.testng.xml.XmlTest;
import java.io.File;
import java.io.Serializable;
import java.lang.reflect.Method;
+import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
@@ -70,6 +70,8 @@
private List<IInvokedMethod> m_invokedMethods =
Collections.synchronizedList(Lists.<IInvokedMethod>newArrayList());
+ private List<ITestNGMethod> m_allTestMethods = Lists.newArrayList();
+
// transient private IAnnotationTransformer m_annotationTransformer = null;
public SuiteRunner(IConfiguration configuration, XmlSuite suite,
@@ -164,6 +166,9 @@
// (this is used to display the final suite report at the end)
tr.addListener(m_textReporter);
m_testRunners.add(tr);
+
+ // Add the methods found in this test to our global count
+ m_allTestMethods.addAll(Arrays.asList(tr.getAllTestMethods()));
}
}
@@ -636,4 +641,8 @@
public List<IInvokedMethod> getAllInvokedMethods() {
return m_invokedMethods;
}
+
+ public List<ITestNGMethod> getAllMethods() {
+ return m_allTestMethods;
+ }
}