Class VerboseReporter

  • All Implemented Interfaces:
    IConfigurationListener, ITestListener, ITestNGListener

    public class VerboseReporter
    extends java.lang.Object
    implements IConfigurationListener, ITestListener
    Reporter printing out detailed messages about what TestNG is going to run and what is the status of what has been just run.

    To see messages from this reporter, either run Ant in verbose mode ('ant -v') or set verbose level to 5 or higher

    Since:
    6.4
    • Field Detail

      • LISTENER_PREFIX

        public static final java.lang.String LISTENER_PREFIX
        Default prefix for messages printed out by this reporter
        See Also:
        Constant Field Values
      • suiteName

        private java.lang.String suiteName
      • prefix

        private final java.lang.String prefix
    • Constructor Detail

      • VerboseReporter

        public VerboseReporter​(java.lang.String prefix)
        Create VerboseReporter with custom prefix
        Parameters:
        prefix - prefix for messages printed out by this reporter
    • Method Detail

      • onTestStart

        public void onTestStart​(ITestResult tr)
        Description copied from interface: ITestListener
        Invoked each time before a test will be invoked. The ITestResult is only partially filled with the references to class, method, start millis and status.
        Specified by:
        onTestStart in interface ITestListener
        Parameters:
        tr - the partially filled ITestResult
        See Also:
        ITestResult.STARTED
      • onStart

        public void onStart​(ITestContext ctx)
        Description copied from interface: ITestListener
        Invoked before running all the test methods belonging to the classes inside the <test> tag and calling all their Configuration methods.
        Specified by:
        onStart in interface ITestListener
        Parameters:
        ctx - The test context
      • onFinish

        public void onFinish​(ITestContext context)
        Description copied from interface: ITestListener
        Invoked after all the test methods belonging to the classes inside the <test> tag have run and all their Configuration methods have been called.
        Specified by:
        onFinish in interface ITestListener
        Parameters:
        context - The test context
      • logResults

        private void logResults​(ITestContext context)
        Print out test summary
      • logTestResult

        private void logTestResult​(VerboseReporter.Status st,
                                   ITestResult itr,
                                   boolean isConfMethod)
        Log meaningful message for passed in arguments. Message itself is of form: $status: "$suiteName" - $methodDeclaration ($actualArguments) finished in $x ms ($run of $totalRuns)
        Parameters:
        st - status of passed in itr
        itr - test result to be described
        isConfMethod - is itr describing configuration method
      • log

        protected void log​(java.lang.String message)
      • getMethodDeclaration

        private java.lang.String getMethodDeclaration​(ITestNGMethod method,
                                                      ITestResult tr)
        Parameters:
        method - method to be described
        Returns:
        FQN of a class + method declaration for a method passed in ie. test.triangle.CheckCount.testCheckCount(java.lang.String)
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object