I've added a script that generates GIF files using JUnit, created a listener that extends RunListener class and overrides testFinish function which adds screenshots in runtime.
I'm trying to do the same by TestNG but can't find the listener I need to extends instead of RunListener class in JUnit. I tried to implement multiple listeners interfaces (ITestListener, IInvokedMethodListener, IExecutionListener...), but i'm not getting the same results as JUnit.
FYI, I'm using cucumber After hook to generate GIF and running my tests by Maven and added the listener to maven POM.xml. The problem that after running by maven the cucumber hook executed before the listener implemented functions but by JUnit it works as expected.