CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-allure-python-commons

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

Overall
score

94%

Overview
Eval results
Files

task.mdevals/scenario-7/

Test Result Tracker

Build a simple test result tracking system that programmatically creates and manages test execution data.

Requirements

Implement a test result tracker that can:

  1. Create and schedule test cases with unique identifiers
  2. Track multi-step test execution with hierarchical steps (steps within steps)
  3. Record setup and teardown operations as fixtures
  4. Capture test results with status information (passed/failed)
  5. Finalize and write test results to output

Your implementation should support:

  • Creating a test case with a name and UUID
  • Adding multiple steps to a test, where each step has a name
  • Supporting nested steps (a step can contain sub-steps)
  • Recording before-fixtures (setup operations) with names
  • Recording after-fixtures (teardown operations) with names
  • Setting test status (PASSED or FAILED)
  • Writing the final test result

Test Cases

  • Creates a test case with name "Sample Test", adds a step named "Step 1", sets status to PASSED, and writes the result without errors @test
  • Creates a test case, adds a step "Parent Step" containing a nested step "Child Step", and writes the result successfully @test
  • Creates a test case, adds a before-fixture named "setup", adds a step "Test Step", adds an after-fixture named "teardown", and writes the result successfully @test

Implementation

@generates

API

class TestResultTracker:
    """
    A tracker for managing test execution lifecycle and results.
    """

    def __init__(self):
        """Initialize the tracker with lifecycle management."""
        pass

    def create_test(self, name: str, uuid: str):
        """
        Create and schedule a new test case.

        Args:
            name: The name of the test
            uuid: Unique identifier for the test
        """
        pass

    def add_step(self, name: str, uuid: str, parent_uuid: str = None):
        """
        Add a test step. If parent_uuid is provided, creates a nested step.

        Args:
            name: The name of the step
            uuid: Unique identifier for the step
            parent_uuid: UUID of parent step for nesting (optional)
        """
        pass

    def add_before_fixture(self, name: str, uuid: str, parent_uuid: str):
        """
        Add a setup fixture to the test.

        Args:
            name: The name of the fixture
            uuid: Unique identifier for the fixture
            parent_uuid: UUID of the parent test
        """
        pass

    def add_after_fixture(self, name: str, uuid: str, parent_uuid: str):
        """
        Add a teardown fixture to the test.

        Args:
            name: The name of the fixture
            uuid: Unique identifier for the fixture
            parent_uuid: UUID of the parent test
        """
        pass

    def set_test_status(self, uuid: str, status: str):
        """
        Set the status of a test.

        Args:
            uuid: The test UUID
            status: The status ("PASSED" or "FAILED")
        """
        pass

    def write_result(self, uuid: str):
        """
        Finalize and write the test result.

        Args:
            uuid: The test UUID to write
        """
        pass

Dependencies { .dependencies }

allure-python-commons { .dependency }

Provides test lifecycle management and reporting capabilities.

Install with Tessl CLI

npx tessl i tessl/pypi-allure-python-commons

tile.json