I would like to understand how the com.intuit.karate.RuntimeHook class behaves when the methods are overwritten. I did the following
public class MyHook implements RuntimeHook {
@Override
public void beforeSuite(Suite suite){
Runner.runFeature("call my feature", null, true);
}
@Override
public void afterSuite(Suite suite) {
Runner.runFeature("call another feature", null, true);
}
}
After I called this class: MyHook from my Runner Class: Inside my Runner class I have this method
@Test
void testParallel() {
Results results = Runner.path("my classpath")
.hook(new MyHook())
.parallel(1);
assertEquals(0, results.getFailCount(), results.getErrorMessages());
}
When I run my test Suite the methods** beforeSuite and afterSuite are called twice.** Why this is happening? If I remove the call of the class: MyHook from my Runner the methods are called just once. My intention with this class is to run a set of data before my tests and clean the data after all the tests are finished.