Package org.apache.maven.surefire.testng
Class TestNGReporter
- java.lang.Object
-
- org.apache.maven.surefire.testng.TestNGReporter
-
- All Implemented Interfaces:
TestOutputReceiver<OutputReportEntry>
,RunModeSetter
,org.testng.ISuiteListener
,org.testng.ITestListener
,org.testng.ITestNGListener
- Direct Known Subclasses:
ConfigurationAwareTestNGReporter
public class TestNGReporter extends java.lang.Object implements TestOutputReceiver<OutputReportEntry>, org.testng.ITestListener, org.testng.ISuiteListener, RunModeSetter
Listens for and provides and adaptor layer so that TestNG tests can report their status to the currentRunListener
.
-
-
Field Summary
Fields Modifier and Type Field Description private ClassMethodIndexer
classMethodIndexer
private TestReportListener<TestOutputReportEntry>
reporter
private RunMode
runMode
-
Constructor Summary
Constructors Constructor Description TestNGReporter(TestReportListener<TestOutputReportEntry> reportManager)
Constructs a new instance that will listen to test updates from aTestNG
class instance.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected RunListener
getRunListener()
private static java.lang.String
groupString(java.lang.String[] groups, java.lang.String defaultValue)
Creates a string out of the list of testng groups in the form ofvoid
onConfigurationFailure(org.testng.ITestResult result)
void
onConfigurationSkip(org.testng.ITestResult result)
void
onConfigurationSuccess(org.testng.ITestResult result)
void
onFinish(org.testng.ISuite suite)
void
onFinish(org.testng.ITestContext context)
void
onStart(org.testng.ISuite suite)
void
onStart(org.testng.ITestContext context)
void
onTestFailedButWithinSuccessPercentage(org.testng.ITestResult result)
void
onTestFailure(org.testng.ITestResult result)
void
onTestSkipped(org.testng.ITestResult result)
void
onTestStart(org.testng.ITestResult result)
void
onTestSuccess(org.testng.ITestResult result)
void
setRunMode(RunMode runMode)
private static java.lang.String
testName(org.testng.ITestResult result)
Acquire a better representation of the test name that includes parameters and the invocation count, if there are any parametersvoid
writeTestOutput(OutputReportEntry reportEntry)
Forwards process output from the running test-case into the reporting system
-
-
-
Field Detail
-
classMethodIndexer
private final ClassMethodIndexer classMethodIndexer
-
reporter
private final TestReportListener<TestOutputReportEntry> reporter
-
runMode
private volatile RunMode runMode
-
-
Constructor Detail
-
TestNGReporter
public TestNGReporter(TestReportListener<TestOutputReportEntry> reportManager)
Constructs a new instance that will listen to test updates from aTestNG
class instance.
It is assumed that the requisiteorg.testng.TestNG#addListener(ITestListener)
method call has already associated with this instance before the test suite is run.- Parameters:
reportManager
- Instance to report suite status to
-
-
Method Detail
-
getRunListener
protected final RunListener getRunListener()
-
onTestStart
public void onTestStart(org.testng.ITestResult result)
- Specified by:
onTestStart
in interfaceorg.testng.ITestListener
-
onTestSuccess
public void onTestSuccess(org.testng.ITestResult result)
- Specified by:
onTestSuccess
in interfaceorg.testng.ITestListener
-
onTestFailure
public void onTestFailure(org.testng.ITestResult result)
- Specified by:
onTestFailure
in interfaceorg.testng.ITestListener
-
onTestSkipped
public void onTestSkipped(org.testng.ITestResult result)
- Specified by:
onTestSkipped
in interfaceorg.testng.ITestListener
-
onTestFailedButWithinSuccessPercentage
public void onTestFailedButWithinSuccessPercentage(org.testng.ITestResult result)
- Specified by:
onTestFailedButWithinSuccessPercentage
in interfaceorg.testng.ITestListener
-
onStart
public void onStart(org.testng.ITestContext context)
- Specified by:
onStart
in interfaceorg.testng.ITestListener
-
onFinish
public void onFinish(org.testng.ITestContext context)
- Specified by:
onFinish
in interfaceorg.testng.ITestListener
-
onStart
public void onStart(org.testng.ISuite suite)
- Specified by:
onStart
in interfaceorg.testng.ISuiteListener
-
onFinish
public void onFinish(org.testng.ISuite suite)
- Specified by:
onFinish
in interfaceorg.testng.ISuiteListener
-
groupString
private static java.lang.String groupString(java.lang.String[] groups, java.lang.String defaultValue)
Creates a string out of the list of testng groups in the form of"group1,group2,group3"
.- Parameters:
groups
- The groups being rundefaultValue
- The default to use if no groups- Returns:
- a string describing the groups
-
onConfigurationFailure
public void onConfigurationFailure(org.testng.ITestResult result)
-
onConfigurationSkip
public void onConfigurationSkip(org.testng.ITestResult result)
-
onConfigurationSuccess
public void onConfigurationSuccess(org.testng.ITestResult result)
-
testName
private static java.lang.String testName(org.testng.ITestResult result)
Acquire a better representation of the test name that includes parameters and the invocation count, if there are any parameters- Parameters:
result
- the test result to extract from- Returns:
- a descriptive name for the test
-
setRunMode
public void setRunMode(RunMode runMode)
- Specified by:
setRunMode
in interfaceRunModeSetter
-
writeTestOutput
public void writeTestOutput(OutputReportEntry reportEntry)
Description copied from interface:TestOutputReceiver
Forwards process output from the running test-case into the reporting system- Specified by:
writeTestOutput
in interfaceTestOutputReceiver<OutputReportEntry>
- Parameters:
reportEntry
- wraps test output with descriptive information of the output
-
-