Take the 2-minute tour ×

The method onFinish(ITestContext context) is invoked after all the tests and configuration methods have run.

I'm searching an equivalent method which is invoked after a single test and all of it's configuration methods?

share|improve this question
add comment

3 Answers

up vote 0 down vote accepted

Guess you are looking for IInvokedMethodListener..

share|improve this answer
add comment

A method annotated with Junit's @after will be run after each method is run, you can also use @afterClass to be run after the who unit test class. For example

public final void setUp() { //Set up some data to use }

public final void tearDown() { //remove the data }
share|improve this answer
thx for the answer, but that's not what i'm want. I'm searching a TestNG listener, who is invoked after test method and configuration methods (etc. after, before). –  theBell Aug 10 '12 at 13:41
add comment

According to Dependency injection section of TestNG documentation, you can specify a parameter of type java.lang.reflect.Method:

Any @BeforeMethod (and @AfterMethod) can declare a parameter of type java.lang.reflect.Method. This parameter will receive the test method that will be called once this @BeforeMethod finishes (or after the method as run for @AfterMethod).

share|improve this answer
add comment

Your Answer


