Skip to content

Automatic screenshots — capture GUI state during tests #10

@ThomasMalletCodra

Description

@ThomasMalletCodra

Description

Add the ability to automatically capture screenshots during test execution and include them in generated reports. This is particularly useful for GUI testing workflows where visual evidence is required for validation.

Current behavior

  • No screenshot capability during test execution.
  • Users must manually capture and attach screenshots to reports.

Expected behavior

  • Tests can trigger screenshots via a simple API or marker:
    # guitest: show
    # guitest: screenshot
  • Screenshots are automatically captured at configurable moments (test start, test end, on failure).
  • Captured images are stored alongside test results.
  • Screenshots are embedded in exported HTML/DOCX reports.

Implementation ideas

  1. Use QScreen.grabWindow() or Pillow.ImageGrab for cross-platform screenshots.
  2. Add a # guitest: screenshot directive to trigger capture at specific points.
  3. Add auto_screenshot option in moduletester.ini: on_failure, on_completion, never.
  4. Store screenshots in .moduletester/screenshots/<test_name>_<timestamp>.png.
  5. Embed screenshots in Jinja2 templates as base64 images or linked files.

Acceptance criteria

  • Screenshots can be captured automatically during test execution
  • Configurable capture triggers (on failure, on completion, manual)
  • Screenshots are embedded in HTML/DOCX exports
  • Screenshot storage is organized per test
  • No performance impact when screenshots are disabled

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions