or run

tessl search
Log in

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/allure-python-commons@2.15.x
tile.json

tessl/pypi-allure-python-commons

tessl install tessl/pypi-allure-python-commons@2.15.0

Contains the API for end users as well as helper functions and classes to build Allure adapters for Python test frameworks

Agent Success

Agent success rate when using this tile

94%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.27x

Baseline

Agent success rate without this tile

74%

task.mdevals/scenario-4/

Test Report Attachment Utility

Build a test utility module that captures and attaches various artifacts during test execution for debugging and documentation purposes.

Requirements

Your module should provide a utility class that can:

  1. Attach text-based logs: Accept a string containing log data and attach it to the test report with a descriptive name.

  2. Attach JSON data: Accept Python dictionaries and serialize them as JSON before attaching to the test report.

  3. Attach screenshot files: Accept a file path to an image and attach it to the test report. The attachment should be properly labeled.

  4. Attach HTML reports: Accept HTML content as a string and attach it to the test report.

Test Cases

  • Given a string "Error occurred at line 42", when attached as a log, then it appears in the test report as a TEXT attachment named "Test Log" @test

  • Given a dictionary {"status": "success", "count": 5}, when attached as JSON data, then it appears in the test report as a JSON attachment named "API Response" @test

  • Given a file path "./screenshot.png" that exists, when attached as a screenshot, then it appears in the test report as an image attachment named "Page Screenshot" @test

  • Given an HTML string "<html><body><h1>Test Results</h1></body></html>", when attached as an HTML report, then it appears in the test report as an HTML attachment named "HTML Report" @test

@generates

API

class TestReporter:
    """Utility class for attaching various artifacts to test reports."""

    def attach_log(self, log_content: str, name: str = "Test Log") -> None:
        """Attach text log content to the test report.

        Args:
            log_content: The log text to attach
            name: The name for the attachment
        """
        pass

    def attach_json_data(self, data: dict, name: str = "JSON Data") -> None:
        """Attach JSON data to the test report.

        Args:
            data: Dictionary or object to serialize as JSON
            name: The name for the attachment
        """
        pass

    def attach_screenshot_file(self, file_path: str, name: str = "Screenshot") -> None:
        """Attach an image file to the test report.

        Args:
            file_path: Path to the image file
            name: The name for the attachment
        """
        pass

    def attach_html_report(self, html_content: str, name: str = "HTML Report") -> None:
        """Attach HTML content to the test report.

        Args:
            html_content: The HTML string to attach
            name: The name for the attachment
        """
        pass

Dependencies { .dependencies }

allure-python-commons { .dependency }

Provides test reporting and attachment capabilities.

@satisfied-by