Added Reporter#clear
diff --git a/CHANGES.txt b/CHANGES.txt
index 2802dd6..b59d83a 100644
--- a/CHANGES.txt
+++ b/CHANGES.txt
@@ -5,6 +5,7 @@
Added: ITestNGListenerFactory
Added: Passing command line properties via the ant task and doc update (Todd Wells)
Added: Hierarchical XmlSuites (Nalin Makar)
+Added: Reporter#clear()
Fixed: Initialize all Suite/Test runners at beginning to catch configuration issues right at start (Nalin Makar)
Fixed: Issue24 OOM errors in SuiteHTMLReporter (Nalin Makar)
Fixed: Time outs specified in XML were not honored for <suite parallel="tests">
diff --git a/src/org/testng/Reporter.java b/src/org/testng/Reporter.java
index 0c58a97..1d90a5e 100755
--- a/src/org/testng/Reporter.java
+++ b/src/org/testng/Reporter.java
@@ -47,6 +47,13 @@
return m_output;
}
+ /**
+ * Erase the content of all the output generated so far.
+ */
+ public static void clear() {
+ m_methodOutputMap.clear();
+ }
+
private static synchronized void log(String s, ITestResult m) {
// synchronization needed to ensure the line number and m_output are updated atomically
int n = getOutput().size();
diff --git a/test/src/test/tmp/A.java b/test/src/test/tmp/A.java
index cf66d3e..f0a2b22 100644
--- a/test/src/test/tmp/A.java
+++ b/test/src/test/tmp/A.java
@@ -1,7 +1,7 @@
package test.tmp;
+import org.testng.Reporter;
import org.testng.annotations.DataProvider;
-import org.testng.annotations.Factory;
import org.testng.annotations.Test;
//@Test(sequential = true)
@@ -37,17 +37,14 @@
@Test
public void atest1() {
- try {
- Thread.sleep(12*1000);
- } catch (InterruptedException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
+ Reporter.log("line 1");
+ Reporter.log("line 2");
}
-// @Test(dependsOnMethods = "atest1")
+ @Test(dependsOnMethods = "atest1")
public void atest2() {
- log("atest2");
+ Reporter.clear();
+ Reporter.log("atest2");
}
// @Test(priority = 3)
diff --git a/test/testng-single.xml b/test/testng-single.xml
index bb74f54..99946a6 100644
--- a/test/testng-single.xml
+++ b/test/testng-single.xml
@@ -1,7 +1,7 @@
<!DOCTYPE suite SYSTEM "http://beust.com/testng/testng-1.0.dtd" >
-<suite name="SingleSuite" verbose="2" parallel="tests" thread-count="4"
- data-provider-thread-count="3" time-out="8000">
+<suite name="SingleSuite" verbose="2" parallel="false" thread-count="4"
+ data-provider-thread-count="3">
<parameter name="n" value="42" />
@@ -26,10 +26,10 @@
</groups>
<parameter name="count" value="10"/>
<classes>
- <class name="test.thread.MultiThreadedDependentTest" />
-<!--
- <class name="test.thread.FactoryTest" />
<class name="test.tmp.A" />
+<!--
+ <class name="test.thread.MultiThreadedDependentTest" />
+ <class name="test.thread.FactoryTest" />
<class name="test.tmp.B" />
<class name="test.failedreporter.FailedReporterTest" />
<methods>