org.springframework.test.context.testng

Class AbstractTestNGSpringContextTests

  • java.lang.Object
    • org.springframework.test.context.testng.AbstractTestNGSpringContextTests
    • Constructor Detail

      • AbstractTestNGSpringContextTests

        public AbstractTestNGSpringContextTests()
        Construct a new AbstractTestNGSpringContextTests instance and initialize the internal TestContextManager for the current test class.
    • Method Detail

      • springTestContextBeforeTestClass

        @BeforeClass(alwaysRun=true)
        protected void springTestContextBeforeTestClass()
                                                                              throws java.lang.Exception
        Delegates to the configured TestContextManager to call 'before test class' callbacks.
        Throws:
        java.lang.Exception - if a registered TestExecutionListener throws an exception
      • springTestContextPrepareTestInstance

        @BeforeClass(alwaysRun=true,
                     dependsOnMethods="springTestContextBeforeTestClass")
        protected void springTestContextPrepareTestInstance()
                                                                                                                                                    throws java.lang.Exception
        Delegates to the configured TestContextManager to prepare this test instance prior to execution of any individual tests, for example for injecting dependencies, etc.
        Throws:
        java.lang.Exception - if a registered TestExecutionListener throws an exception
      • springTestContextBeforeTestMethod

        @BeforeMethod(alwaysRun=true)
        protected void springTestContextBeforeTestMethod(java.lang.reflect.Method testMethod)
                                                                                throws java.lang.Exception
        Delegates to the configured TestContextManager to pre-process the test method before the actual test is executed.
        Parameters:
        testMethod - the test method which is about to be executed
        Throws:
        java.lang.Exception - allows all exceptions to propagate
      • run

        public void run(org.testng.IHookCallBack callBack,
                        org.testng.ITestResult testResult)
        Delegates to the test method in the supplied callback to execute the actual test and then tracks the exception thrown during test execution, if any.
        Specified by:
        run in interface org.testng.IHookable
        See Also:
        IHookable.run(IHookCallBack, ITestResult)
      • springTestContextAfterTestMethod

        @AfterMethod(alwaysRun=true)
        protected void springTestContextAfterTestMethod(java.lang.reflect.Method testMethod)
                                                                              throws java.lang.Exception
        Delegates to the configured TestContextManager to post-process the test method after the actual test has executed.
        Parameters:
        testMethod - the test method which has just been executed on the test instance
        Throws:
        java.lang.Exception - allows all exceptions to propagate
      • springTestContextAfterTestClass

        @AfterClass(alwaysRun=true)
        protected void springTestContextAfterTestClass()
                                                                            throws java.lang.Exception
        Delegates to the configured TestContextManager to call 'after test class' callbacks.
        Throws:
        java.lang.Exception - if a registered TestExecutionListener throws an exception