Skip to main content

Debug Library for Robot Framework

Introduction

This library is a fork by René Rohner from the original robotframework-debuglibrary by Xie Yanbo.

Robotframework-RobotDebug is a debug library for RobotFramework, which can be used as an interactive shell(REPL) and listener also.

Installation

To install using pip:

pip install robotframework-debug

Usage

You can use RobotDebug library in 3 different modes:

  • REPL mode,
  • Library mode,
  • Listener mode.

REPL mode

Just call irobot in the terminal with all available robot arguments. An interactive shell will open. To exit use the command exit or shortcut Ctrl+D. It is possible to evaluate both single-line and multi-line expressions.

irobot

  • you can execute keywords and define variables

keywords and variables

  • You can set a variable and use this variable in another keyword in one step. Use the keyboard shortcut Shift + Down Arrow to go to the next line without evaluating the first line. Then press the Enter key twice to evaluate expressions.

two lines evaluation

  • irobot can evaluate multi line expressions as FOR and WHILE loops, IF / ELSE statements and TRY / EXCEPT expressions.

multi line evaluation

  • you can import libraries, resources and variable files

import library, resource and variable file

  • you can use the resource file syntax like *** Settings *** , *** Variables *** and *** Keywords *** and write the resource file directly into the irobot shell. Press the Enter key twice to import your resource.

resource file

Library mode

Import RobotDebug as library and use the Debug keyword to set a breakpoint in your test cases:

*** Settings ***
Library         RobotDebug

*** Test Cases ***
Some Test
    # some keywords...
    Debug
    # some else...

The Debug keyword pauses test execution and opens an interactive shell. Then you can evaluate expressions, try out keywords, inspect the variables and trace and view the code step by step. See also the section step debugging.

Listener mode

You can attach it as a listener and run your test until it fails. Just add --listener RobotDebug.Listener to you robot call.

robot --listener RobotDebug.Listener some.robot

If your test case fails, RobotDebug will stop there and the interactive shell will be opened at that point. Then you can try out keywords and analyze the issue.

https://github.com/user-attachments/assets/18c48b1c-e870-45fd-ad67-f0424e88f172

Step debugging

RobotDebug supports step debugging in Library and Listner mode.

Use keys F7 (INTO), F8 (OVER) and F9 (OUT) to trace and view the code step by step.

F7: INTO The F7 key allows you to go into the keyword if it contains further keywords inside. The first line within the user keyword is executed and the execution is paused again.

F8: OVER The F8 key allows you to execute the current line completely in one step, even if it contains other keywords inside.

F9: OUT You can use the F9 key to exit the keyword if you have entered it previously.

F10: CONTINUE You can use the F10 key or the continue or c command to continue execution until the next Debug keyword if you use this in library mode or the next failure of the test if you use this in listner mode.

SHIFT TAB: DETACH Shift Tab allows you to run the rest of the test case to the end without opening the interactive shell.

List The commands list or l and ll display the test case snippet including the line being executed: list command

Overview of commands

Use exit or keys Ctrl+D to exit the interactive shell.

Use clear or cls to clear the screen.

The interactive shell supports auto-completion for robotframework keywords and commands. Try input BuiltIn. then hit Control + Space key to feel it.

You can use the F5 key to enable or disable live completion. Live completion ON: live completion

You can use the F12 key to enable or disable mouse support within the shell. Mouse support ON: toglle mouse on To be able to scroll, disable mouse support.

You can use the command history or key F4 to view the history in your irobot shell. You can see used keywords and commands on the left and imported resources on the right side. Use TAB to switch focus from one part to another. To close history, press key F4.

https://github.com/user-attachments/assets/cfa2b7c7-a2eb-4063-b1c4-30bff48da850

The history will save at ~/.rfdebug_history located in user home directory default or any path defined in the environment variable RFDEBUG_HISTORY.

Use help to view possible commands:

help

To import a library, use Library <lib_name>. To show all imported Libraries, use libs and to show sources for each library, use libs -s.

help library

The command res lists the imported resource files. res -s lists the imported resources files with source:

help resource

The command keywords or k lists all keywords of imported libraries. The command keywords <lib_name> lists keywords of a specified library.

To get keyword documentation for individual keywords, use docs <keyword_name> or d <keyword_name>:

help docs

Submitting issues

Bugs and enhancements are tracked in the issue tracker.

Before submitting a new issue, it is always a good idea to check if the same bug or enhancement already been reported. If it is, please add your comments to the existing issue instead of creating a new one.

Development

See CONTRIBUTION.md for local setup, running and debugging RobotDebug, testing, and the release process.

License

This software is licensed under the New BSD License. See the LICENSE file in the top distribution directory for the full license text.

Metadata

Release files for robotframework-debug 4.6.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for robotframework-debug 4.6.1
File Size Uploaded
robotframework_debug-4.6.1.tar.gz 1.5 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for robotframework-debug 4.6.1
File Interpreter ABI Platform
robotframework_debug-4.6.1-py3-none-any.whl Python 3 none any Details

Total release size: 1.5 MB

Release files / robotframework_debug-4.6.1.tar.gz

Download URL robotframework_debug-4.6.1.tar.gz
Size 1.5 MB
Tags Source
SHA-256 checksum
How to use checksums
dedc251149ad98d88813244467d9b4b3fead23c81db88612902b2c567d47905f
BLAKE2b-256 checksum
How to use checksums
8b5b61e8de15988a7a8e489c45e9baf0b6c4991d4f17789f66f3d0b2122291e1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.34.2

Release files / robotframework_debug-4.6.1-py3-none-any.whl

Download URL robotframework_debug-4.6.1-py3-none-any.whl
Size 29.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
13f6f79d752d2ccec629091b447bf1382e17c6e8f6381ec744305adf1fa163e8
BLAKE2b-256 checksum
How to use checksums
943cd059bb392a19fed70fc527c7b8bbe76d6d584304bb04652fdf3018a4c4d9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via python-requests/2.34.2

Release history Release notifications | RSS feed

This release

4.6.1 This release

2 release files

4.6.0

2 release files

4.5.0

2 release files

4.4.0

2 release files

4.3.4

2 release files

4.3.3

2 release files

4.3.2

2 release files

4.3.1

2 release files

4.3.0

2 release files

4.2.0

2 release files

4.1.0

2 release files

4.0.1

2 release files

4.0.0

2 release files

3.10.0

2 release files

3.9.0

2 release files

3.8.0

2 release files

3.7.0

2 release files

3.6.1

2 release files

3.6.0

2 release files

3.5.3

2 release files

3.5.2

2 release files

3.5.1

2 release files

3.5.0

2 release files

3.4.0

2 release files

3.3.0

2 release files

3.2.0

2 release files

3.1.0

2 release files

3.0.1

2 release files

3.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page