Skip to content

Commit

Permalink
added a custom reporter: DisplayNameReporter
Browse files Browse the repository at this point in the history
  • Loading branch information
ericdeback committed May 28, 2024
1 parent c6d1571 commit 8f09cae
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/test/java/runners/DisplayNameReporter.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
package runners;

import org.junit.jupiter.api.extension.*;

public class DisplayNameReporter implements TestWatcher {

@Override
public void testSuccessful(ExtensionContext context) {
logDisplayName(context);
}

@Override
public void testFailed(ExtensionContext context, Throwable cause) {
logDisplayName(context);
}

private void logDisplayName(ExtensionContext context) {
String displayName = context.getDisplayName();
System.out.println("DisplayName: " + displayName); // This will appear in the Surefire console output
}
}
3 changes: 3 additions & 0 deletions src/test/java/tests/Playwright_MainTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,15 @@
import com.microsoft.playwright.*;
import com.microsoft.playwright.junit.*;
import org.junit.jupiter.api.*;
import org.junit.jupiter.api.extension.*;
import runners.*;

import java.util.regex.*;

import static com.microsoft.playwright.assertions.PlaywrightAssertions.*;

@UsePlaywright
@ExtendWith(DisplayNameReporter.class)
class Playwright_MainTest {

static BrowserType browserType;
Expand Down

0 comments on commit 8f09cae

Please sign in to comment.