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-7/

Test Fixture Tracker

Build a test fixture tracking utility that monitors and reports on setup and teardown operations during test execution.

Requirements

Create a Python module that tracks fixture execution in a test environment. The system should:

  1. Track both setup (before) and teardown (after) fixtures with unique identifiers
  2. Record fixture execution status (passed, failed, broken)
  3. Associate fixtures with their parent test cases
  4. Capture timing information for each fixture
  5. Generate a summary report showing all executed fixtures

The utility should be able to:

  • Start tracking a setup fixture with a name and parent test
  • Start tracking a teardown fixture with a name and parent test
  • Stop tracking fixtures and record their final status
  • Provide a report of all tracked fixtures with their details

Implementation

@generates

API

class FixtureTracker:
    """Tracks test fixtures and generates execution reports."""

    def start_setup_fixture(self, test_id: str, fixture_name: str) -> str:
        """
        Begin tracking a setup (before) fixture.

        Args:
            test_id: The UUID of the parent test case
            fixture_name: The name of the setup fixture

        Returns:
            A unique fixture UUID for this fixture
        """
        pass

    def start_teardown_fixture(self, test_id: str, fixture_name: str) -> str:
        """
        Begin tracking a teardown (after) fixture.

        Args:
            test_id: The UUID of the parent test case
            fixture_name: The name of the teardown fixture

        Returns:
            A unique fixture UUID for this fixture
        """
        pass

    def stop_fixture(self, fixture_id: str, status: str, message: str = None) -> None:
        """
        Complete tracking a fixture and record its final status.

        Args:
            fixture_id: The UUID of the fixture to stop
            status: The final status ('passed', 'failed', 'broken')
            message: Optional status message or error details
        """
        pass

    def get_report(self) -> dict:
        """
        Generate a summary report of all tracked fixtures.

        Returns:
            A dictionary containing:
            - 'setup_fixtures': list of setup fixture details
            - 'teardown_fixtures': list of teardown fixture details
            Each fixture should include: fixture_id, test_id, name, status, duration_ms, message
        """
        pass

Test Cases

Basic Setup Fixture Tracking

  • The tracker can start and stop a setup fixture, recording it in the report @test

Test: Create a tracker, start a setup fixture named "database_connection" for test "test-001", stop it with status "passed", and verify it appears in the report with correct details.

Basic Teardown Fixture Tracking

  • The tracker can start and stop a teardown fixture, recording it in the report @test

Test: Create a tracker, start a teardown fixture named "cleanup_files" for test "test-002", stop it with status "passed", and verify it appears in the report with correct details.

Multiple Fixtures for Same Test

  • The tracker can handle multiple fixtures associated with the same parent test @test

Test: Create a tracker, start two setup fixtures ("setup_db" and "setup_cache") and one teardown fixture ("cleanup_all") all for test "test-003", stop them all with status "passed", and verify all three appear correctly in the report.

Failed Fixture Tracking

  • The tracker records fixtures that fail with appropriate status and message @test

Test: Create a tracker, start a setup fixture named "init_service" for test "test-004", stop it with status "failed" and message "Connection timeout", and verify the failure is recorded in the report.

Dependencies { .dependencies }

allure-python-commons { .dependency }

Provides test lifecycle management and fixture tracking capabilities.