Currently a TestNG test class needs to inherit the Before and After methods which load and unload Byteman rules by subclassing class BMNGRunner i.e. the model for how you configure a Byteman-enabled test class is
@BMScript(...)
public MyTestClass extends BMNGRunner {
@BMRule(...)
@Test public void MyMethod()
. . .
Although this conforms to the expected model for implementing TestNG test classes it can be awkward in situations where it is desirable for the test class to inherit from some other library class. It would be helpful if the Before and After loading behaviour could be attached to the test class using an annotation instead of inheritance and, indeed, the @Listeners annotation provided by TestNG already makes this possible. So, the preferred alternative model for the test class configuration would be
@BMScript(...)
@Listeners({BMNGListener.class})
public MyTestClass {
@BMRule(...)
@Test public void MyMethod() { ...}
. . .
n.b. the brackets around the class list are optional