Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add info into TVS about TestClass started/finished #170

Merged
merged 1 commit into from
Aug 20, 2024
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 @@ -5,7 +5,9 @@
package io.skodjob.testframe.listeners;

import io.skodjob.testframe.utils.LoggerUtils;
import org.junit.jupiter.api.extension.AfterAllCallback;
import org.junit.jupiter.api.extension.AfterEachCallback;
import org.junit.jupiter.api.extension.BeforeAllCallback;
import org.junit.jupiter.api.extension.BeforeEachCallback;
import org.junit.jupiter.api.extension.ExtensionContext;
import org.slf4j.Logger;
Expand All @@ -14,23 +16,36 @@
/**
* jUnit5 specific class which listening on test callbacks
*/
public class TestVisualSeparatorExtension implements BeforeEachCallback, AfterEachCallback {
public class TestVisualSeparatorExtension implements BeforeEachCallback, AfterEachCallback,
BeforeAllCallback, AfterAllCallback {
private final Logger logger = LoggerFactory.getLogger(TestVisualSeparatorExtension.class);

private TestVisualSeparatorExtension() {
// Private constructor to prevent instantiation
}

@Override
public void beforeAll(ExtensionContext extensionContext) {
LoggerUtils.logSeparator();
logger.info("TestClass {} STARTED", extensionContext.getRequiredTestClass().getName());
}

@Override
public void afterAll(ExtensionContext extensionContext) {
logger.info("TestClass {} FINISHED", extensionContext.getRequiredTestClass().getName());
LoggerUtils.logSeparator();
}

@Override
public void beforeEach(ExtensionContext extensionContext) {
LoggerUtils.logSeparator();
logger.info("{}.{}-STARTED", extensionContext.getRequiredTestClass().getName(),
logger.info("Test {}.{} STARTED", extensionContext.getRequiredTestClass().getName(),
extensionContext.getDisplayName().replace("()", ""));
}

@Override
public void afterEach(ExtensionContext extensionContext) {
logger.info("{}.{}-FINISHED", extensionContext.getRequiredTestClass().getName(),
logger.info("Test {}.{} FINISHED", extensionContext.getRequiredTestClass().getName(),
extensionContext.getDisplayName().replace("()", ""));
LoggerUtils.logSeparator();
}
Expand Down
Loading