Following this sample mentioned in the Karate 1.0 upgrade guide I wrote this simple test class:
package feature;
import com.intuit.karate.RuntimeHook;
import com.intuit.karate.Suite;
import com.intuit.karate.Results;
import com.intuit.karate.Runner;
import static org.junit.jupiter.api.Assertions.*;
public class KarateTest implements RuntimeHook {
private static final int THREAD_COUNT = 1;
@Override
public void beforeSuite(Suite suite)
{
System.out.println("########## beforeSuite() is fired! ##########");
}
@Test
public void testParallel() {
Results results = Runner.path("classpath:feature")
.parallel(THREAD_COUNT);
assertEquals(0, results.getFailCount(), results.getErrorMessages());
}
@Override
public void afterSuite(Suite suite)
{
System.out.println("########## afterSuite() is fired! ##########");
}
}
I expected to see the lines printed by the beforeSuite() and afterSuite() methods appearing in the logs. The test ran successfully, but the hooks did not seem to trigger. What did I miss?