Skip to main content

Getting Started

AskUI provides a comprehensive reporting system that allows you to track and document your automation steps. Reporters capture execution details, screenshots, and results to help you analyze and debug your automation workflows.

Available Reporters

AskUI offers several built-in reporters to suit different needs:
  • SimpleHtmlReporter - Generates HTML reports with screenshots and step details
  • AllureReporter - Integrates with Allure reporting framework
  • Custom Reporter - Create your own reporter by implementing the Reporter interface

SimpleHtmlReporter

The SimpleHtmlReporter generates HTML reports with screenshots and execution details.

Basic Usage

from askui import VisionAgent
from askui.reporting import SimpleHtmlReporter

with VisionAgent(reporters=[SimpleHtmlReporter()]) as agent:
    agent.click("text")
The reports are saved in the reports/ directory and include step-by-step execution details with screenshots.

Enable Multiple Reporters

You can combine multiple reporters:
from askui import VisionAgent
from askui.reporting import SimpleHtmlReporter

with VisionAgent(reporters=[SimpleHtmlReporter(), AllureReporter()]) as agent:
    agent.click("text")

Allure Reporter

You can use this reporter in combination with Allure Reporter. If you use it in combination with your test framework like behave, pytest or others, we assume you’ve already set up Allure with your test framework.
import io
from PIL import Image
from typing import Any, Optional, Union, override
from askui import VisionAgent
from askui.reporting import Reporter
import allure

# Define the allure reporter
class AllureReporter(Reporter):

    @override
    def add_message(
        self,
        role: str,
        content: Union[str, dict[str, Any], list[Any]],
        image: Optional[Image.Image | list[Image.Image]] = None,
    ) -> None:
        with allure.step(f"{role}: {str(content)}"):
            if image:
                images = image if isinstance(image, list) else [image]
                for img in images:
                    img_bytes = io.BytesIO()
                    img.save(img_bytes, format='PNG')
                    allure.attach(
                        img_bytes.getvalue(),
                        name="screenshot",
                        attachment_type=allure.attachment_type.PNG,
                    )

    @override
    def generate(self) -> None:
        pass

# Configure your reporter
with VisionAgent(reporters=[AllureReporter()]) as agent:
    agent.click("button")
    # Your automation steps here

Implement Your Own Reporter

To write your own reporter, you need to implement AskUI’s Reporter interface. It offers methods you can override to adapt to your specific reporting framework:
import io
from PIL import Image
from typing import Any, Optional, Union, override
from askui import VisionAgent
from askui.reporting import Reporter

class MyOwnPrintReporter(Reporter):

    @override
    def add_message(
        self,
        role: str,
        content: Union[str, dict[str, Any], list[Any]],
        image: Optional[Image.Image | list[Image.Image]] = None,
    ) -> None:
        print(f"{role}: {str(content)}")
        if image:
            images = image if isinstance(image, list) else [image]
            print(f"Images captured: {len(images)}")

    @override
    def generate(self) -> None:
        print("Report generation completed")

# Use your custom reporter
with VisionAgent(reporters=[MyOwnPrintReporter()]) as agent:
    agent.click("text")
    # Your automation steps here

Reporter Interface Methods

The Reporter interface provides the following methods:
  • add_message() - Called for each automation step to log the action, content, and optional screenshots
  • generate() - Called at the end of the session to finalize the report
Both methods are optional and can be overridden based on your reporting needs.