Package org.testng.reporters
Class JUnitReportReporter
- java.lang.Object
-
- org.testng.reporters.JUnitReportReporter
-
- All Implemented Interfaces:
IReporter
,ITestNGListener
public class JUnitReportReporter extends java.lang.Object implements IReporter
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static class
JUnitReportReporter.TestTag
-
Constructor Summary
Constructors Constructor Description JUnitReportReporter()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description private void
addMapping(SetMultiMap<java.lang.Class<?>,ITestNGMethod> mapping, java.util.Collection<ITestNGMethod> methods)
private void
addResults(java.util.Set<ITestResult> allResults, java.util.Map<java.lang.Class<?>,java.util.Set<ITestResult>> out)
private JUnitReportReporter.TestTag
createIgnoredTestTagFor(ITestNGMethod method)
private JUnitReportReporter.TestTag
createTestTagFor(ITestResult tr, java.lang.Class<?> cls)
private java.lang.String
formatTime(float time)
void
generateReport(java.util.List<XmlSuite> xmlSuites, java.util.List<ISuite> suites, java.lang.String defaultOutputDirectory)
Generate a report for the given suites into the specified output directory.private static int
getDisabledTestCount(java.util.Set<ITestNGMethod> methods)
protected java.lang.String
getFileName(java.lang.Class cls)
private static java.lang.String
getHostName()
private long
getNextConfiguration(ListMultiMap<java.lang.Object,ITestResult> configurations, ITestResult tr)
Add the time of the configuration method to this test method.protected java.lang.String
getTestName(ITestResult tr)
private static void
handleFailure(JUnitReportReporter.TestTag testTag, java.lang.Throwable t)
private boolean
putElement(XMLStringBuffer xsb, java.lang.String tagName, java.util.Properties attributes, boolean hasChildElements)
Put a XML start or empty tag to the XMLStringBuffer depending on hasChildElements parameterprivate void
safeSetProperty(java.util.Properties p, java.lang.String key, java.lang.String value)
Set property if value is non-nullprivate static java.util.Collection<ITestResult>
sort(java.util.Set<ITestResult> results)
-
-
-
Method Detail
-
generateReport
public void generateReport(java.util.List<XmlSuite> xmlSuites, java.util.List<ISuite> suites, java.lang.String defaultOutputDirectory)
Description copied from interface:IReporter
Generate a report for the given suites into the specified output directory.- Specified by:
generateReport
in interfaceIReporter
- Parameters:
xmlSuites
- The list ofXmlSuite
suites
- The list ofISuite
defaultOutputDirectory
- The output directory
-
sort
private static java.util.Collection<ITestResult> sort(java.util.Set<ITestResult> results)
-
getHostName
private static java.lang.String getHostName()
-
getDisabledTestCount
private static int getDisabledTestCount(java.util.Set<ITestNGMethod> methods)
-
createIgnoredTestTagFor
private JUnitReportReporter.TestTag createIgnoredTestTagFor(ITestNGMethod method)
-
createTestTagFor
private JUnitReportReporter.TestTag createTestTagFor(ITestResult tr, java.lang.Class<?> cls)
-
handleFailure
private static void handleFailure(JUnitReportReporter.TestTag testTag, java.lang.Throwable t)
-
putElement
private boolean putElement(XMLStringBuffer xsb, java.lang.String tagName, java.util.Properties attributes, boolean hasChildElements)
Put a XML start or empty tag to the XMLStringBuffer depending on hasChildElements parameter
-
safeSetProperty
private void safeSetProperty(java.util.Properties p, java.lang.String key, java.lang.String value)
Set property if value is non-null
-
getNextConfiguration
private long getNextConfiguration(ListMultiMap<java.lang.Object,ITestResult> configurations, ITestResult tr)
Add the time of the configuration method to this test method.The only problem with this method is that the timing of a test method might not be added to the time of the same configuration method that ran before it but since they should all be equivalent, this should never be an issue.
-
getFileName
protected java.lang.String getFileName(java.lang.Class cls)
-
getTestName
protected java.lang.String getTestName(ITestResult tr)
-
formatTime
private java.lang.String formatTime(float time)
-
addResults
private void addResults(java.util.Set<ITestResult> allResults, java.util.Map<java.lang.Class<?>,java.util.Set<ITestResult>> out)
-
addMapping
private void addMapping(SetMultiMap<java.lang.Class<?>,ITestNGMethod> mapping, java.util.Collection<ITestNGMethod> methods)
-
-