Robot Framework Stack Trace Listener
Robotframework-stacktrace is a specialized listener for Robot Framework designed to enhance debugging by printing a full stack trace to the console when a test failure occurs. It addresses a common pain point where standard Robot Framework output might not provide sufficient detail to quickly pinpoint the exact line of code causing a failure. The library currently supports Robot Framework versions 4.0 and higher, with its latest release being 0.4.1. It is actively maintained as a utility to improve test debugging workflows.
Warnings
- gotcha Although `setup.py` declares a dependency on `robotframework >= 3.2`, the `robotframework-stacktrace` project's README and PyPI description explicitly state it is 'A listener for RF >= 4.0'. Using it with Robot Framework versions between 3.2 and 3.9 (inclusive) might lead to unexpected behavior or incompatibility, even if installation succeeds.
- breaking Versions prior to 0.4.1 had potential side-effects from library variable resolving, which could lead to unexpected behavior or incorrect test execution outcomes.
- gotcha Robot Framework does not, by default, print a detailed stack trace on failures, making it difficult to locate the exact line of code that caused an issue, especially with reusable keywords. This library solves that specific problem.
Install
-
pip install robotframework-stacktrace
Imports
- RobotStackTracer
robot --listener RobotStackTracer <your_test_file.robot>
Quickstart
# Create a simple Robot Framework test file (e.g., my_test.robot)
# my_test.robot
*** Settings ***
Library OperatingSystem
*** Test Cases ***
Example Failing Test
Log This test will fail
Fail Intentional Failure
# Run Robot Framework with the listener
# Make sure to install robotframework-stacktrace first: pip install robotframework-stacktrace
# In your terminal, navigate to the directory containing my_test.robot and run:
# robot --listener RobotStackTracer my_test.robot
# You should see a detailed stack trace in the console output upon failure.