Package org.testng

Interface ITestContext

All Superinterfaces:
IAttributes
All Known Implementing Classes:
TestRunner

public interface ITestContext extends IAttributes
This class defines a test context which contains all the information for a given test run. An instance of this context is passed to the test listeners so they can query information about their environment.
  • Method Details

    • getName

      String getName()
      Returns:
      The name of this test.
    • getStartDate

      Date getStartDate()
      Returns:
      When this test started running.
    • getEndDate

      Date getEndDate()
      Returns:
      When this test stopped running.
    • getPassedTests

      IResultMap getPassedTests()
      Returns:
      A list of all the tests that run successfully.
    • getSkippedTests

      IResultMap getSkippedTests()
      Returns:
      A list of all the tests that were skipped
    • getFailedButWithinSuccessPercentageTests

      IResultMap getFailedButWithinSuccessPercentageTests()
      Returns:
      A list of all the tests that failed but are being ignored because annotated with a successPercentage.
    • getFailedTests

      IResultMap getFailedTests()
      Returns:
      A map of all the tests that passed, indexed by their ITextMethor.
      See Also:
    • getIncludedGroups

      String[] getIncludedGroups()
      Returns:
      All the groups that are included for this test run.
    • getExcludedGroups

      String[] getExcludedGroups()
      Returns:
      All the groups that are excluded for this test run.
    • getOutputDirectory

      String getOutputDirectory()
      Returns:
      Where the reports will be generated.
    • getSuite

      ISuite getSuite()
      Returns:
      The Suite object that was passed to the runner at start-up.
    • getAllTestMethods

      ITestNGMethod[] getAllTestMethods()
      Returns:
      All the test methods that were run.
    • getHost

      String getHost()
      Returns:
      The host where this test was run, or null if it was run locally. The returned string has the form: host:port
    • getExcludedMethods

      Collection<ITestNGMethod> getExcludedMethods()
      Returns:
      All the methods that were not included in this test run.
    • getPassedConfigurations

      IResultMap getPassedConfigurations()
      Returns:
      The information about the successful configuration method invocations.
    • getSkippedConfigurations

      IResultMap getSkippedConfigurations()
      Returns:
      The information about the skipped configuration method invocations.
    • getFailedConfigurations

      IResultMap getFailedConfigurations()
      Returns:
      The information about the failed configuration method invocations.
    • getCurrentXmlTest

      XmlTest getCurrentXmlTest()
      Returns:
      the current XmlTest.
    • getGuiceModules

      @Deprecated List<com.google.inject.Module> getGuiceModules(Class<? extends com.google.inject.Module> cls)
      Deprecated.
      This method stands deprecated as of TestNG 7.3.0
    • addGuiceModule

      @Deprecated default void addGuiceModule(com.google.inject.Module module)
      Deprecated.
      This method stands deprecated as of TestNG 7.3.0
    • getAllGuiceModules

      @Deprecated default List<com.google.inject.Module> getAllGuiceModules()
      Deprecated.
      This method stands deprecated as of TestNG 7.3.0
    • getInjector

      @Deprecated com.google.inject.Injector getInjector(List<com.google.inject.Module> moduleInstances)
      Deprecated.
      This method stands deprecated as of TestNG 7.3.0
    • getInjector

      @Deprecated com.google.inject.Injector getInjector(IClass iClass)
      Deprecated.
      This method stands deprecated as of TestNG 7.3.0
    • addInjector

      @Deprecated void addInjector(List<com.google.inject.Module> moduleInstances, com.google.inject.Injector injector)
      Deprecated.
      This method stands deprecated as of TestNG 7.3.0
    • getInjectorFactory

      default IInjectorFactory getInjectorFactory()