testng - How to pass ITestNGMethod in @AfterClass method as parameter? -
i trying know after @test(test method), @afterclass got invoked. know wrote following code that:
@afterclass(alwaysrun = true) public synchronized void teardownclass(final itestngmethod itx) { final method m = itx.getconstructorormethod().getmethod(); system.out.println(m.getname()); }
but testng throws following error: method teardownclass requires 1 parameters 0 supplied in @configuration annotation.
so question how resolve above issue, or there other way achieve this.
thanks in advance.
this wouldn't make sense: it's @afterclass
method, gets invoked after test methods of class have run. specific scenario (wanting know last method invoked) specific should implement yourself.
for example, create field lastmethod
, have each method set name when reach @afterclass
, know 1 ran last.
Comments
Post a Comment