Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

import com.google.common.base.Joiner;
import io.airlift.log.Logger;
import org.testng.IClassListener;
import org.testng.ITestClass;
import org.testng.ITestContext;
import org.testng.ITestListener;
import org.testng.ITestResult;
Expand All @@ -25,7 +27,7 @@
import static java.lang.String.format;

public class ProgressLoggingListener
implements ITestListener
implements IClassListener, ITestListener
{
private static final Logger LOGGER = Logger.get(ProgressLoggingListener.class);
private final boolean enabled;
Expand Down Expand Up @@ -106,6 +108,26 @@ public void onFinish(ITestContext context)
{
}

@Override
public void onBeforeClass(ITestClass testClass)
{
if (!enabled) {
return;
}

LOGGER.info("[BEFORE CLASS] %s", getName(testClass));
}

@Override
public void onAfterClass(ITestClass testClass)
{
if (!enabled) {
return;
}

LOGGER.info("[AFTER CLASS] %s", getName(testClass));
}

private String formatTestName(ITestResult testCase)
{
// See LogTestDurationListener.getName
Expand Down Expand Up @@ -141,4 +163,9 @@ private static BigDecimal durationInSeconds(long millis)
{
return (new BigDecimal(millis)).divide(new BigDecimal(1000), 1, RoundingMode.HALF_UP);
}

private static String getName(ITestClass testClass)
{
return testClass.getName();
}
}