Package org.testng

Class TestRunner

    • Method Detail

      • getInvoker

        public org.testng.internal.invokers.IInvoker getInvoker()
      • getBeforeSuiteMethods

        public ITestNGMethod[] getBeforeSuiteMethods()
      • getAfterSuiteMethods

        public ITestNGMethod[] getAfterSuiteMethods()
      • getBeforeTestConfigurationMethods

        public ITestNGMethod[] getBeforeTestConfigurationMethods()
      • getAfterTestConfigurationMethods

        public ITestNGMethod[] getAfterTestConfigurationMethods()
      • getTestClasses

        public java.util.Collection<ITestClass> getTestClasses()
      • setTestName

        public void setTestName​(java.lang.String name)
      • setOutputDirectory

        public void setOutputDirectory​(java.lang.String od)
      • run

        public void run()
        The main entry method for TestRunner.

        This is where all the hard work is done: - Invoke configuration methods - Invoke test methods - Catch exceptions - Collect results - Invoke listeners - etc...

      • createWorkers

        public java.util.List<IWorker<ITestNGMethod>> createWorkers​(java.util.List<ITestNGMethod> methods)
        Create a list of workers to run the methods passed in parameter. Each test method is run in its own worker except in the following cases: - The method belongs to a class that has @Test(sequential=true) - The parallel attribute is set to "classes" In both these cases, all the methods belonging to that class will then be put in the same worker in order to run in the same thread.
        Specified by:
        createWorkers in interface IThreadWorkerFactory<ITestNGMethod>
        Parameters:
        methods - tasks that need to be executed
        Returns:
        list of workers
      • getName

        public java.lang.String getName()
        Specified by:
        getName in interface ITestContext
        Returns:
        The name of this test.
      • getStartDate

        public java.util.Date getStartDate()
        Specified by:
        getStartDate in interface ITestContext
        Returns:
        Returns the startDate.
      • getEndDate

        public java.util.Date getEndDate()
        Specified by:
        getEndDate in interface ITestContext
        Returns:
        Returns the endDate.
      • getIncludedGroups

        public java.lang.String[] getIncludedGroups()
        Specified by:
        getIncludedGroups in interface ITestContext
        Returns:
        All the groups that are included for this test run.
      • getExcludedGroups

        public java.lang.String[] getExcludedGroups()
        Specified by:
        getExcludedGroups in interface ITestContext
        Returns:
        All the groups that are excluded for this test run.
      • getOutputDirectory

        public java.lang.String getOutputDirectory()
        Specified by:
        getOutputDirectory in interface ITestContext
        Returns:
        Where the reports will be generated.
      • getHost

        public java.lang.String getHost()
        Specified by:
        getHost in interface ITestContext
        Returns:
        The host where this test was run, or null if it was run locally. The returned string has the form: host:port
      • getConfigurationsScheduledForInvocation

        public IResultMap getConfigurationsScheduledForInvocation()
        Specified by:
        getConfigurationsScheduledForInvocation in interface org.testng.internal.IConfigEavesdropper
      • addPassedTest

        public void addPassedTest​(ITestNGMethod tm,
                                  ITestResult tr)
        Specified by:
        addPassedTest in interface org.testng.internal.ITestResultNotifier
      • getPassedTests

        public java.util.Set<ITestResult> getPassedTests​(ITestNGMethod tm)
        Specified by:
        getPassedTests in interface org.testng.internal.ITestResultNotifier
      • getFailedTests

        public java.util.Set<ITestResult> getFailedTests​(ITestNGMethod tm)
        Specified by:
        getFailedTests in interface org.testng.internal.ITestResultNotifier
      • getSkippedTests

        public java.util.Set<ITestResult> getSkippedTests​(ITestNGMethod tm)
        Specified by:
        getSkippedTests in interface org.testng.internal.ITestResultNotifier
      • addSkippedTest

        public void addSkippedTest​(ITestNGMethod tm,
                                   ITestResult tr)
        Specified by:
        addSkippedTest in interface org.testng.internal.ITestResultNotifier
      • addFailedTest

        public void addFailedTest​(ITestNGMethod testMethod,
                                  ITestResult result)
        Specified by:
        addFailedTest in interface org.testng.internal.ITestResultNotifier
      • addFailedButWithinSuccessPercentageTest

        public void addFailedButWithinSuccessPercentageTest​(ITestNGMethod testMethod,
                                                            ITestResult result)
        Specified by:
        addFailedButWithinSuccessPercentageTest in interface org.testng.internal.ITestResultNotifier
      • getTest

        public XmlTest getTest()
        Specified by:
        getTest in interface org.testng.internal.ITestResultNotifier
      • getTestListeners

        public java.util.List<ITestListener> getTestListeners()
        Specified by:
        getTestListeners in interface org.testng.internal.ITestResultNotifier
      • getConfigurationListeners

        public java.util.List<IConfigurationListener> getConfigurationListeners()
        Specified by:
        getConfigurationListeners in interface org.testng.internal.ITestResultNotifier
      • getVerbose

        public static int getVerbose()
      • setVerbose

        public void setVerbose​(int n)
      • getExitCodeListener

        public ITestListener getExitCodeListener()
        Specified by:
        getExitCodeListener in interface org.testng.internal.ITestResultNotifier
      • getAttribute

        public java.lang.Object getAttribute​(java.lang.String name)
        Specified by:
        getAttribute in interface IAttributes
        Parameters:
        name - The name of the attribute to return
        Returns:
        The attribute
      • setAttribute

        public void setAttribute​(java.lang.String name,
                                 java.lang.Object value)
        Description copied from interface: IAttributes
        Set a custom attribute.
        Specified by:
        setAttribute in interface IAttributes
        Parameters:
        name - The attribute name
        value - The attribute value
      • getAttributeNames

        public java.util.Set<java.lang.String> getAttributeNames()
        Specified by:
        getAttributeNames in interface IAttributes
        Returns:
        all the attributes names.
      • removeAttribute

        public java.lang.Object removeAttribute​(java.lang.String name)
        Description copied from interface: IAttributes
        Remove the attribute
        Specified by:
        removeAttribute in interface IAttributes
        Parameters:
        name - The attribute name
        Returns:
        the attribute value if found, null otherwise