robotframework-debuglibrary


Namerobotframework-debuglibrary JSON
Version 2.5.0 PyPI version JSON
download
home_pagehttps://github.com/xyb/robotframework-debuglibrary/
SummaryRobotFramework debug library and an interactive shell
upload_time2024-01-12 09:29:09
maintainer
docs_urlNone
authorXie Yanbo
requires_python
licenseNew BSD
keywords robotframework debug shell repl
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            Debug Library for Robot Framework
=================================

.. contents::
   :local:

Introduction
------------

Robotframework-DebugLibrary is a debug library for `RobotFramework`_,
which can be used as an interactive shell(REPL) also.

.. _`RobotFramework`: http://robotframework.org/

.. image:: https://api.codeclimate.com/v1/badges/5201026ff11b63530cf5/maintainability
   :target: https://codeclimate.com/github/xyb/robotframework-debuglibrary/maintainability
   :alt: Maintainability

.. image:: https://api.codeclimate.com/v1/badges/5201026ff11b63530cf5/test_coverage
   :target: https://codeclimate.com/github/xyb/robotframework-debuglibrary/test_coverage
   :alt: Test Coverage

.. image:: https://github.com/xyb/robotframework-debuglibrary/actions/workflows/test.yml/badge.svg
   :target: https://github.com/xyb/robotframework-debuglibrary/actions/workflows/test.yml
   :alt: test

.. image:: https://img.shields.io/pypi/v/robotframework-debuglibrary.svg
   :target: https://pypi.org/project/robotframework-debuglibrary/
   :alt: Latest version

.. image:: https://img.shields.io/badge/robotframework-4%20%7C%205%20%7C%206%20%7C%207-blue
   :target: https://github.com/xyb/robotframework-debuglibrary
   :alt: Support robotframework versions

.. image:: https://img.shields.io/pypi/pyversions/robotframework-debuglibrary
   :target: https://github.com/xyb/robotframework-debuglibrary
   :alt: Support python versions

.. image:: https://img.shields.io/pypi/dm/robotframework-debuglibrary
   :target: https://pypi.org/project/robotframework-debuglibrary/
   :alt: PyPI Downloads

.. image:: https://img.shields.io/pypi/l/robotframework-debuglibrary.svg
   :target: https://github.com/xyb/robotframework-debuglibrary/blob/master/LICENSE
   :alt: License


Installation
------------

To install using ``pip``::

    pip install robotframework-debuglibrary

NOTICE: 2.0 is not compatible with python 2
*******************************************

``DebugLibrary`` >= 2.0.0 supports Python versions 3.x only.
If you still using python 2.7, please use ``DebugLibrary`` < 2.0.0 ::

    pip install 'robotframework-debuglibrary<2'

Usage
-----

You can use this as a library, import ``DebugLibrary`` and call ``Debug``
or ``Debug If`` keywords in your test files like this::

    *** Settings ***
    Library         DebugLibrary

    ** test case **
    SOME TEST
        # some keywords...
        Debug
        # some else...
        ${count} =  Get Element Count  name:div_name
        Debug If  ${count} < 1

Or you can run it standalone as a ``RobotFramework`` shell::

    $ rfdebug
    [...snap...]
    >>>>> Enter interactive shell
    > help
    Input Robotframework keywords, or commands listed below.
    Use "libs" or "l" to see available libraries,
    use "keywords" or "k" to see the list of library keywords,
    use the TAB keyboard key to autocomplete keywords.

    Documented commands (type help <topic>):
    ========================================
    EOF  continue  docs  help  keywords  libs  ll        n     pdb  selenium
    c    d         exit  k     l         list  longlist  next  s    step
    > log  hello
    > get time
    < '2011-10-13 18:50:31'
    > # use TAB to auto complete commands
    > BuiltIn.Get Time
    < '2011-10-13 18:50:39'
    > import library  String
    > get substring  helloworld  5  8
    < 'wor'
    > # define variables as you wish
    > ${secs} =  Get Time  epoch
    # ${secs} = 1474814470
    > Log to console  ${secs}
    1474814470
    > @{list} =  Create List    hello    world
    # @{list} = ['hello', 'world']
    > Log to console  ${list}
    ['hello', 'world']
    > &{dict} =  Create Dictionary    name=admin    email=admin@test.local
    # &{dict} = {'name': 'admin', 'email': 'admin@test.local'}
    > Log  ${dict.name}
    > # print value if you input variable name only
    > ${list}
    [u'hello', u'world']
    > ${dict.name}
    admin
    > # start a selenium server quickly
    > help selenium
    Start a selenium webdriver and open url in browser you expect.

            s(elenium)  [<url>]  [<browser>]

            default url is google.com, default browser is firefox.
    > selenium  google.com  chrome
    # import library  SeleniumLibrary
    # open browser  http://google.com  chrome
    < 1
    > close all browsers
    > Ctrl-D
    >>>>> Exit shell.

The interactive shell support auto-completion for robotframework keywords and
commands. Try input ``BuiltIn.`` then type ``<TAB>`` key to feeling it.
The history will save at ``~/.rfdebug_history`` default or any file
defined in environment variable ``RFDEBUG_HISTORY``.

In case you don't remember the name of keyword during using ``rfdebug``,
there are commands ``libs`` or ``ls`` to list the imported libraries and
built-in libraries, and ``keywords <lib name>`` or ``k`` to list
keywords of a library.

``rfdebug`` accept any ``pybot`` arguments, but by default, ``rfdebug``
disabled all logs with ``-l None -x None -o None -L None -r None``.

Step debugging
**************

``DebugLibrary`` support step debugging since version ``2.1.0``.
You can use ``step``/``s``, ``next``/``n``, ``continue``/``c``,
``list``/``l`` and ``longlist``/``ll`` to trace and view the code
step by step like in ``pdb``::

    $ robot some.robot
    [...snap...]
    >>>>> Enter interactive shell
    > l
    Please run `step` or `next` command first.
    > s
    .> /Users/xyb/some.robot(7)
    -> log to console  hello
    => BuiltIn.Log To Console  hello
    > l
      2   	Library  DebugLibrary
      3
      4   	** test case **
      5   	test
      6   	    debug
      7 ->	    log to console  hello
      8   	    log to console  world
    > n
    hello
    .> /Users/xyb/some.robot(8)
    -> log to console  world
    => BuiltIn.Log To Console  world
    > c
    >>>>> Exit shell.
    world

Note: Single-step debugging does not support ``FOR`` loops currently.

Submitting issues
-----------------

Bugs and enhancements are tracked in the `issue tracker
<https://github.com/xyb/robotframework-debuglibrary/issues>`_.

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

Development
-----------

If you want to develop and run DebugLibrary locally, you can use ::

    $ python DebugLibrary/shell.py tests/step.robot

`shell.py` is calling `robot` through a child process, so it will interrupt
python debugging capabilities. If you want to debug in tools like vscode,
pdb, you should run ::

    $ python -m robot tests/step.robot

If you want to run the test, please install the dependency packages first
and then execute the test ::

    $ python -m pip install setuptools
    $ python setup.py develop
    $ python setup.py test

Since RF takes over stdout, debugging information can be output with ::

    import sys
    print('some information', file=sys.stdout)

License
-------

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

.. # vim: syntax=rst expandtab tabstop=4 shiftwidth=4 shiftround

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/xyb/robotframework-debuglibrary/",
    "name": "robotframework-debuglibrary",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "robotframework,debug,shell,repl",
    "author": "Xie Yanbo",
    "author_email": "xieyanbo@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/fd/b3/c5fa5fb8e0786efacc30a16f9ae62d90d838516c2dea08ad2733d679bd66/robotframework-debuglibrary-2.5.0.tar.gz",
    "platform": "Linux",
    "description": "Debug Library for Robot Framework\n=================================\n\n.. contents::\n   :local:\n\nIntroduction\n------------\n\nRobotframework-DebugLibrary is a debug library for `RobotFramework`_,\nwhich can be used as an interactive shell(REPL) also.\n\n.. _`RobotFramework`: http://robotframework.org/\n\n.. image:: https://api.codeclimate.com/v1/badges/5201026ff11b63530cf5/maintainability\n   :target: https://codeclimate.com/github/xyb/robotframework-debuglibrary/maintainability\n   :alt: Maintainability\n\n.. image:: https://api.codeclimate.com/v1/badges/5201026ff11b63530cf5/test_coverage\n   :target: https://codeclimate.com/github/xyb/robotframework-debuglibrary/test_coverage\n   :alt: Test Coverage\n\n.. image:: https://github.com/xyb/robotframework-debuglibrary/actions/workflows/test.yml/badge.svg\n   :target: https://github.com/xyb/robotframework-debuglibrary/actions/workflows/test.yml\n   :alt: test\n\n.. image:: https://img.shields.io/pypi/v/robotframework-debuglibrary.svg\n   :target: https://pypi.org/project/robotframework-debuglibrary/\n   :alt: Latest version\n\n.. image:: https://img.shields.io/badge/robotframework-4%20%7C%205%20%7C%206%20%7C%207-blue\n   :target: https://github.com/xyb/robotframework-debuglibrary\n   :alt: Support robotframework versions\n\n.. image:: https://img.shields.io/pypi/pyversions/robotframework-debuglibrary\n   :target: https://github.com/xyb/robotframework-debuglibrary\n   :alt: Support python versions\n\n.. image:: https://img.shields.io/pypi/dm/robotframework-debuglibrary\n   :target: https://pypi.org/project/robotframework-debuglibrary/\n   :alt: PyPI Downloads\n\n.. image:: https://img.shields.io/pypi/l/robotframework-debuglibrary.svg\n   :target: https://github.com/xyb/robotframework-debuglibrary/blob/master/LICENSE\n   :alt: License\n\n\nInstallation\n------------\n\nTo install using ``pip``::\n\n    pip install robotframework-debuglibrary\n\nNOTICE: 2.0 is not compatible with python 2\n*******************************************\n\n``DebugLibrary`` >= 2.0.0 supports Python versions 3.x only.\nIf you still using python 2.7, please use ``DebugLibrary`` < 2.0.0 ::\n\n    pip install 'robotframework-debuglibrary<2'\n\nUsage\n-----\n\nYou can use this as a library, import ``DebugLibrary`` and call ``Debug``\nor ``Debug If`` keywords in your test files like this::\n\n    *** Settings ***\n    Library         DebugLibrary\n\n    ** test case **\n    SOME TEST\n        # some keywords...\n        Debug\n        # some else...\n        ${count} =  Get Element Count  name:div_name\n        Debug If  ${count} < 1\n\nOr you can run it standalone as a ``RobotFramework`` shell::\n\n    $ rfdebug\n    [...snap...]\n    >>>>> Enter interactive shell\n    > help\n    Input Robotframework keywords, or commands listed below.\n    Use \"libs\" or \"l\" to see available libraries,\n    use \"keywords\" or \"k\" to see the list of library keywords,\n    use the TAB keyboard key to autocomplete keywords.\n\n    Documented commands (type help <topic>):\n    ========================================\n    EOF  continue  docs  help  keywords  libs  ll        n     pdb  selenium\n    c    d         exit  k     l         list  longlist  next  s    step\n    > log  hello\n    > get time\n    < '2011-10-13 18:50:31'\n    > # use TAB to auto complete commands\n    > BuiltIn.Get Time\n    < '2011-10-13 18:50:39'\n    > import library  String\n    > get substring  helloworld  5  8\n    < 'wor'\n    > # define variables as you wish\n    > ${secs} =  Get Time  epoch\n    # ${secs} = 1474814470\n    > Log to console  ${secs}\n    1474814470\n    > @{list} =  Create List    hello    world\n    # @{list} = ['hello', 'world']\n    > Log to console  ${list}\n    ['hello', 'world']\n    > &{dict} =  Create Dictionary    name=admin    email=admin@test.local\n    # &{dict} = {'name': 'admin', 'email': 'admin@test.local'}\n    > Log  ${dict.name}\n    > # print value if you input variable name only\n    > ${list}\n    [u'hello', u'world']\n    > ${dict.name}\n    admin\n    > # start a selenium server quickly\n    > help selenium\n    Start a selenium webdriver and open url in browser you expect.\n\n            s(elenium)  [<url>]  [<browser>]\n\n            default url is google.com, default browser is firefox.\n    > selenium  google.com  chrome\n    # import library  SeleniumLibrary\n    # open browser  http://google.com  chrome\n    < 1\n    > close all browsers\n    > Ctrl-D\n    >>>>> Exit shell.\n\nThe interactive shell support auto-completion for robotframework keywords and\ncommands. Try input ``BuiltIn.`` then type ``<TAB>`` key to feeling it.\nThe history will save at ``~/.rfdebug_history`` default or any file\ndefined in environment variable ``RFDEBUG_HISTORY``.\n\nIn case you don't remember the name of keyword during using ``rfdebug``,\nthere are commands ``libs`` or ``ls`` to list the imported libraries and\nbuilt-in libraries, and ``keywords <lib name>`` or ``k`` to list\nkeywords of a library.\n\n``rfdebug`` accept any ``pybot`` arguments, but by default, ``rfdebug``\ndisabled all logs with ``-l None -x None -o None -L None -r None``.\n\nStep debugging\n**************\n\n``DebugLibrary`` support step debugging since version ``2.1.0``.\nYou can use ``step``/``s``, ``next``/``n``, ``continue``/``c``,\n``list``/``l`` and ``longlist``/``ll`` to trace and view the code\nstep by step like in ``pdb``::\n\n    $ robot some.robot\n    [...snap...]\n    >>>>> Enter interactive shell\n    > l\n    Please run `step` or `next` command first.\n    > s\n    .> /Users/xyb/some.robot(7)\n    -> log to console  hello\n    => BuiltIn.Log To Console  hello\n    > l\n      2   \tLibrary  DebugLibrary\n      3\n      4   \t** test case **\n      5   \ttest\n      6   \t    debug\n      7 ->\t    log to console  hello\n      8   \t    log to console  world\n    > n\n    hello\n    .> /Users/xyb/some.robot(8)\n    -> log to console  world\n    => BuiltIn.Log To Console  world\n    > c\n    >>>>> Exit shell.\n    world\n\nNote: Single-step debugging does not support ``FOR`` loops currently.\n\nSubmitting issues\n-----------------\n\nBugs and enhancements are tracked in the `issue tracker\n<https://github.com/xyb/robotframework-debuglibrary/issues>`_.\n\nBefore submitting a new issue, it is always a good idea to check is the\nsame bug or enhancement already reported. If it is, please add your comments\nto the existing issue instead of creating a new one.\n\nDevelopment\n-----------\n\nIf you want to develop and run DebugLibrary locally, you can use ::\n\n    $ python DebugLibrary/shell.py tests/step.robot\n\n`shell.py` is calling `robot` through a child process, so it will interrupt\npython debugging capabilities. If you want to debug in tools like vscode,\npdb, you should run ::\n\n    $ python -m robot tests/step.robot\n\nIf you want to run the test, please install the dependency packages first\nand then execute the test ::\n\n    $ python -m pip install setuptools\n    $ python setup.py develop\n    $ python setup.py test\n\nSince RF takes over stdout, debugging information can be output with ::\n\n    import sys\n    print('some information', file=sys.stdout)\n\nLicense\n-------\n\nThis software is licensed under the ``New BSD License``. See the ``LICENSE``\nfile in the top distribution directory for the full license text.\n\n.. # vim: syntax=rst expandtab tabstop=4 shiftwidth=4 shiftround\n",
    "bugtrack_url": null,
    "license": "New BSD",
    "summary": "RobotFramework debug library and an interactive shell",
    "version": "2.5.0",
    "project_urls": {
        "Homepage": "https://github.com/xyb/robotframework-debuglibrary/"
    },
    "split_keywords": [
        "robotframework",
        "debug",
        "shell",
        "repl"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "733294f7b214f9bbbbf4d461e44a58533a7bf144477df43d3d741fe57f5a5143",
                "md5": "8d504f238e7c1daf075da386d3e1fede",
                "sha256": "a2bfb2636ead7be440c224317891b4b406a9a71d84b26924031ccf3791a00b96"
            },
            "downloads": -1,
            "filename": "robotframework_debuglibrary-2.5.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8d504f238e7c1daf075da386d3e1fede",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 19245,
            "upload_time": "2024-01-12T09:29:08",
            "upload_time_iso_8601": "2024-01-12T09:29:08.425044Z",
            "url": "https://files.pythonhosted.org/packages/73/32/94f7b214f9bbbbf4d461e44a58533a7bf144477df43d3d741fe57f5a5143/robotframework_debuglibrary-2.5.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "fdb3c5fa5fb8e0786efacc30a16f9ae62d90d838516c2dea08ad2733d679bd66",
                "md5": "ce8c5ea441437c7a194889a97833a912",
                "sha256": "c8e135c7561721d36210d6f59a09b7538064367e82d8a3be67cb87088cf9cba7"
            },
            "downloads": -1,
            "filename": "robotframework-debuglibrary-2.5.0.tar.gz",
            "has_sig": false,
            "md5_digest": "ce8c5ea441437c7a194889a97833a912",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 18407,
            "upload_time": "2024-01-12T09:29:09",
            "upload_time_iso_8601": "2024-01-12T09:29:09.718093Z",
            "url": "https://files.pythonhosted.org/packages/fd/b3/c5fa5fb8e0786efacc30a16f9ae62d90d838516c2dea08ad2733d679bd66/robotframework-debuglibrary-2.5.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-12 09:29:09",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "xyb",
    "github_project": "robotframework-debuglibrary",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "lcname": "robotframework-debuglibrary"
}
        
Elapsed time: 0.18013s