Author: emuckenhuber
Date: 2007-10-20 11:47:17 -0400 (Sat, 20 Oct 2007)
New Revision: 8726
Modified:
modules/test/trunk/unit/src/main/org/jboss/unit/report/impl/junit/JUnitTestReport.java
Log:
- using TestInfo.name instead of TestId
Modified:
modules/test/trunk/unit/src/main/org/jboss/unit/report/impl/junit/JUnitTestReport.java
===================================================================
---
modules/test/trunk/unit/src/main/org/jboss/unit/report/impl/junit/JUnitTestReport.java 2007-10-20
14:29:10 UTC (rev 8725)
+++
modules/test/trunk/unit/src/main/org/jboss/unit/report/impl/junit/JUnitTestReport.java 2007-10-20
15:47:17 UTC (rev 8726)
@@ -159,13 +159,12 @@
{
this.tests++;
this.errors++;
+ StringBuffer nb = new StringBuffer();
+ /** The current tested Class */
Element e = document.createElement(XMLConstants.ERROR);
e.setAttribute(XMLConstants.ATTR_TYPE, event.getFailure().getType().name());
e.setAttribute(XMLConstants.ATTR_MESSAGE, event.getFailure().getMessage());
- if ( event.getFailure().getCause() != null)
- {
-
e.appendChild(document.createCDATASection(stackToString(event.getFailure().getCause())));
- }
+
e.appendChild(document.createCDATASection(stackToString(event.getFailure().getStackTrace())));
rootElement.appendChild(e);
}
@@ -174,6 +173,8 @@
TestId testId = event.getTestId();
TestResult result = event.getTestResult();
Element test = document.createElement(XMLConstants.TESTCASE);
+ TestInfo info = this.startedTests.get(testId);
+
/** The testcase name */
StringBuffer nb = new StringBuffer();
/** The current tested Class */
@@ -182,15 +183,9 @@
nb.append(testSuiteName);
nb.append(".");
}
- /** TestId */
- for(int i = 0; i < testId.getLength(); i ++)
- {
- if (i > 0)
- {
- nb.append(".");
- }
- nb.append(testId.getName(i));
- }
+ /** Adding testcase name */
+ nb.append(info.getName());
+
String testName = nb.toString();
/** The testcase parameters */
@@ -209,12 +204,10 @@
if ( parameters.length() > 0)
testName = testName + "?" + parameters.toString();
-
/** Test case attributes */
test.setAttribute(XMLConstants.ATTR_NAME, testName);
test.setAttribute(XMLConstants.ATTR_TIME, FORMAT.format(result.getDurationMillis()
/ 1000.0));
/** Check if test was started */
- TestInfo info = this.startedTests.get(testId);
if ( info != null)
{
// remove test from started List
@@ -246,10 +239,8 @@
this.errors++;
failureType = XMLConstants.ERROR;
}
- if (failure.getCause() != null)
- {
- test.appendChild(addError(failureType, failure.getCause()));
- }
+
+ test.appendChild(addError(failureType, failure.getStackTrace()));
}
this.rootElement.appendChild(test);
@@ -401,7 +392,6 @@
}
}
-
public String getTestSuiteName()
{
if (testSuiteName == null)