Skip to content

feat: add structured JSON logging to test harness and collect as arti…#994

Open
nishiagarwal2006-lang wants to merge 1 commit into
imDarshanGK:mainfrom
nishiagarwal2006-lang:feat/playwright-structured-logging
Open

feat: add structured JSON logging to test harness and collect as arti…#994
nishiagarwal2006-lang wants to merge 1 commit into
imDarshanGK:mainfrom
nishiagarwal2006-lang:feat/playwright-structured-logging

Conversation

@nishiagarwal2006-lang

Copy link
Copy Markdown

Pull Request Description

Resolves #646. Adds a structured logging framework for tests, formatting console/application execution logs as machine-readable JSON entries. Each log line is injected with crucial metadata (timestamps, test name, URL context, log level, and system environment details) and saved as a test artifact.

Type of Change

  • 🧪 Testing related changes and improvements
  • 🔧 Core test harness utility

Submission Checklist

  • All testing harness architecture is stored within tests/harness/
  • Includes structured_logger.py — handles JSON formatting and file rotation/writing
  • Includes test_structured_logging.py — validation test suite verifying logging output
  • Log files include ISO timestamps, test case name context, and component identifiers

Feature Description

What does this add?
It fixes the issue of unstructured test outputs by establishing a custom JsonStructuredFormatter. When tests run, all logs are intercepting and compiled into a single JSON artifact, allowing immediate correlation with backend application logs during post-failure investigations.

How does a developer use it?
Developers simply inject the structured_log fixture into their test cases:

def test_example_flow(structured_log):
    structured_log.info("Initiating system integration handshake.")
    # Automated steps here...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add structured logging to Playwright tests

1 participant