RobotFramework DebugLibrary
Robotframework-DebugLibrary (current version 2.5.0) is a debugging library for Robot Framework, offering an interactive shell (REPL) and step-debugging capabilities. It allows users to set breakpoints within test cases, inspect variables, evaluate expressions, and try out keywords during test execution. The library is actively maintained, with releases typically occurring a few times a year to ensure compatibility with newer Robot Framework and Python versions.
Common errors
-
ImportError: No module named debuglibrary
cause Robot Framework library imports are case-sensitive. The library name 'DebugLibrary' was not capitalized correctly.fixChange the import statement in your Robot Framework file from `Library debuglibrary` to `Library DebugLibrary`. -
Interactive console does not appear when calling Debug keyword (on Windows)
cause This can sometimes occur on Windows due to terminal input handling or missing dependencies like `pyreadline` in older environments, or general environment issues preventing the interactive shell from spawning correctly.fixEnsure `prompt-toolkit` is correctly installed. While `prompt-toolkit` generally handles cross-platform terminal interactions, if issues persist on older Windows Python environments, try `pip install pyreadline`. Also, ensure that standard input (stdin) is not being redirected in your test execution environment. -
Keyword 'Debug If' expected 1 to 2 arguments, got 0.
cause The 'Debug If' keyword requires a condition to evaluate as an argument.fixProvide a valid Robot Framework condition as an argument to 'Debug If', e.g., `Debug If ${STATUS} == 'FAIL'`.
Warnings
- breaking Python 3.7 support was dropped in v2.5.0. Earlier versions (v2.4.0) dropped Python 3.6 support, and v2.3.0 dropped Python 3.5 support. Version 2.0.0 dropped Python 2.x and 3.4 support.
- breaking Robot Framework 7.0 support was added in v2.5.0. Prior to v2.4.0, Robot Framework <4.0 was supported. Changes related to `exc.full_message` (removed in RF 5.0) were addressed in v2.3.0.
- breaking The `prompt-toolkit` dependency was upgraded to version 3.x in `robotframework-debuglibrary` v2.4.0, which might introduce incompatibilities with older Python versions or `prompt-toolkit` versions. Explicitly declared `prompt-toolkit >=2` in v2.2.1, and 2.x in v2.0.0.
- gotcha The short name for listing available libraries was changed from `l` to `ls` in v2.2.0 to avoid conflict with the new `list` command for step debugging.
Install
-
pip install robotframework-debuglibrary
Imports
- DebugLibrary
Library debuglibrary
*** Settings *** Library DebugLibrary
Quickstart
*** Settings ***
Library DebugLibrary
*** Test Cases ***
Example Debugging Test
Log To Console Starting test execution...
Debug # Execution pauses here, interactive shell opens
Log To Console Resuming test after breakpoint.
${sum} = Evaluate ${1} + ${2}
Log To Console The sum is: ${sum}
Debug If ${sum} > 10 # Pauses if condition is true
Log To Console Test finished.