GithubHelp home page GithubHelp logo

xyb / robotframework-debuglibrary Goto Github PK

View Code? Open in Web Editor NEW
101.0 8.0 52.0 128 KB

A debug library for RobotFramework, which can be used as an interactive shell(REPL) also.

License: Other

Python 99.47% RobotFramework 0.53%
debug repl shell robotframework debugger

robotframework-debuglibrary's Introduction

Debug Library for Robot Framework

Introduction

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

Maintainability

Test Coverage

test

Latest version

Support robotframework versions

Support python versions

PyPI Downloads

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 protected]
# &{dict} = {'name': 'admin', 'email': '[email protected]'}
> 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.

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.

robotframework-debuglibrary's People

Contributors

asiekkinen avatar fspegni avatar indrakumarm avatar jokimaki avatar jollychang avatar jonesabino avatar lgtm-com[bot] avatar meallia avatar oianson avatar serhatbolsu avatar silviot avatar stdedos avatar swt-jnpr avatar tkoukkari avatar vincentfretin avatar vivainio avatar xyb avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

robotframework-debuglibrary's Issues

Suggested Keyword: View Screenshot

When debugging robot tests that use chromeheadless, I've found that more often than not I actually want to view a screenshot of what the browser is doing at the point in time when I drop into a Debug session.

This is not quite the same as just saving a screenshot, because the file should only be temporary.

Internally, I'm using something like:

    def view_screenshot(self):
        import subprocess
        import tempfile
        from robot.libraries.BuiltIn import BuiltIn

        selenium = Builtin().get_library_instance('SeleniumLibrary')
        filename = tempfile.mkstemp(suffix='.png')[1]

        subprocess.call([
            'open',
            selenium.capture_page_screenshot(filename)
        ])
        subprocess.call(['rm', filename])

Is this something you would be prepared to include? It's probably going to require a bit of tweaking (it's geared to macOS right now, which has an open command, for instance), but I'd be happy to submit a PR if you are interested.

Assign variable in interactive shell

When i try to assign value in interactive shell i have message like below:

${var} set variable test_value
< keyword: ${var} set variable test_value
! No keyword with name '${var}' found.

skip debug when not needed

Hi, first of all thanks for this cool library.

I'm facing this scenario: I'm writing my tests and from time to time I need to insert the Debug keyword in order to stop the execution and inspect variables. However, when finished, I may forget to delete some Debug keyword from my tests, and this would block the testing task in my CI/CD pipeline.

Would it be useful to add some notion of "debug mode" such that when I write tests I set the "debug mode" to ON, thus every Debug keyword actually stops the test execution, while on the CI/CD pipeline i can set the "debug mode" to OFF and every Debug keyword is returned immediately.

If this is not possible, I guess I can fork the project and send you a PR in the next weeks.

Debug when test/keyword fails (DebugLibrary as a Listener?)

Whenever a test or perhaps even a keyword fails I would like to enter the debug CLI.
I have very long running tests that are very hard to triage and I think this would be an amazing tool.

Is there an easy way to wrap the DebugLibrary in a way I can use it as a RobotListener (to fire debug when a keyword or test fails)?

ModuleNotFoundError: No module named 'prompt_toolkit.interface'

I got this error when I want to use this library to debug my script.

[ ERROR ] Error in file 'C:\Users\XXX\Desktop\XXX\test_automation\'Search.robot': Importing test library 'DebugLibrary' failed: ModuleNotFoundError: No module named 'prompt_toolkit.interface'
Traceback (most recent call last):
  File "C:\Users\XXX\AppData\Local\Programs\Python\Python36-32\lib\site-packages\DebugLibrary.py", line 22, in <module>
    from prompt_toolkit.interface import AbortAction
PYTHONPATH:
  C:\Users\XXX\Desktop\XXX\test_automation
  C:\Users\XXX\AppData\Local\Programs\Python\Python36-32\python36.zip
  C:\Users\XXX\AppData\Local\Programs\Python\Python36-32\DLLs
  C:\Users\XXX\AppData\Local\Programs\Python\Python36-32\lib
  C:\Users\XXX\AppData\Local\Programs\Python\Python36-32
  C:\Users\XXX\AppData\Roaming\Python\Python36\site-packages
  C:\Users\XXX\AppData\Local\Programs\Python\Python36-32\lib\site-packages

After searching a while, I found out this error occurred because the version of prompt_toolkit is too new (2.0.3).
So I think it should specifiy the version at 1.0.15, or refine something against the new version. :-)

Python 3 support?

I'm running into a lot of issues with rfshell after moving to python 3. For starters, the "import" keyword isn't being recognized

> C:\>rfshell
==============================================================================
Robot Debug3G4Vv1Hi
==============================================================================
RFDEBUG REPL
>>>>> Enter interactive shell
Only accepted plain text format keyword seperated with two or more spaces.
Type "help" for more information.
> selenium  http://www.google.com/  chrome
# import library  Selenium2Library
! keyword: import library  Selenium2Library
! Importing test library 'Selenium2Library' failed: ModuleNotFoundError: No module named 'Selenium2Library'
Traceback (most recent call last):
  None
PYTHONPATH:
  C:\Program Files\Python36\Scripts
  c:\program files\python36\python36.zip
  c:\program files\python36\DLLs
  c:\program files\python36\lib
  c:\program files\python36
  c:\program files\python36\lib\site-packages
  c:\program files\python36\lib\site-packages\robotframework_databaselibrary-1.0.1-py3.6.egg
# open browser  http://www.google.com/  chrome
! keyword: open browser  http://www.google.com/  chrome
! No keyword with name 'open browser' found.
> Import  Selenium2Library
! keyword: Import  Selenium2Library
! No keyword with name 'Import' found.
> Import String
! keyword: Import String
! No keyword with name 'Import String' found.
> Import  String
! keyword: Import  String
! No keyword with name 'Import' found.

Keyboard interrupt inside the interactive shell makes it unusable.

Hi there! Thank you for this wonderful gem of a code.

Found an issue: sending a keyboard interrupt (by pushing ctrl+c) in the shell on one keyword, makes the shell unusable:

> Sleep    4 min             # Ctrl+C
^CSecond signal will force exit.
! keyword: Sleep    4 min
! Execution terminated by signal
> Log    Hey
! keyword: Log    Hey
! Execution terminated by signal
> Sleep    10 min
! keyword: Sleep    10 min
! Execution terminated by signal                               

Keyboard interrupt inside the interactive shell makes it unusable

Similarly to old issue #26, sending a keyboard interrupt (by pushing ctrl+c) in the shell on one keyword, makes the shell unusable:

>>>>> Enter interactive shell
Only accepted plain text format keyword separated with two or more spaces.
Type "help" for more information.
> Sleep 30s
--> Press Ctrl+C to interrupt sleep command
[ ERROR ] Execution stopped by user.
Test error, press RETURN

Robot Framework 5.0.1 (Python 3.9.16 on linux)
DebugLibrary 2.3.0 (sha256: 2c3fb8390afc3934777657d3cf8a1674c731000035d614a21552ae96ca99fd30)

Interactive shell (feature request): print the value of a variable without 'Log' keyword.

Currently, when you input a variable to the interactive shell without any other keyword, instead of showing it's value, the shell tries to execute it:

> ${variable}   Set variable    some value
# ${variable} = u'some value'
> ${variable}
! keyword: ${variable}
! FAILED: TypeError('run_keyword() takes at least 2 arguments (1 given)',)

It would be great if the shell printed the value of it instead.

Is it possible to debug a keyword that is created or updated on the fly?

Hi there. I have a keyword stored in a resource file. What I was trying to do in rfdebug mode is:

  1. Import that resource file
  2. Modify the keyword in resource file and save (or create a new keyword in that resource file)
  3. Import the resource file again

The issue is that I am not able to access the keyword got updated/created in step 2.
Am I doing anything wrong here? Please advise.

Keyword discovery fails with AttributeError: 'str' object has no attribute 'name'

When executing the rfdebug script (or from a robot script) the k(eyword) action raises an attribute Error

The error is the same in py2 and py3.

rfdebug 
==============================================================================
robot-debug-FedQRa                                                            
==============================================================================
RFDEBUG REPL                                                          
>>>>> Enter interactive shell
Only accepted plain text format keyword seperated with two or more spaces.
Type "help" for more information.
> k
< Keywords of library BuiltIn
RFDEBUG REPL                                                          | FAIL |
AttributeError: 'str' object has no attribute 'name'
------------------------------------------------------------------------------
robot-debug-FedQRa                                                    | FAIL |
1 critical test, 0 passed, 1 failed
1 test total, 0 passed, 1 failed
==============================================================================
Output:  None

I'm in a clean venv with only those packages installed
I also tried with robotframework 2.9.2

prompt-toolkit==1.0.15
Pygments==2.2.0
robotframework==3.0.4
robotframework-debuglibrary==1.1.3
six==1.11.0
wcwidth==0.1.7

I have a quick fix, i'll submit a pull request.

Variables passed to Keywords are not accessible

When you set the Debug statement inside of a Keyword, you cannot access the variable passed into the keyword inside the REPL debugger.

*** Keywords ***
Test REPL With Variables
    [Arguments]        ${var}
    Debug

=================

>>>>> Enter interactive shell, only accepted plain text format keyword.
> Log     ${var}
< keyword:  Log     ${var}
!  Non-existing variable '${var}'.

RF 5.0: AttributeError: 'HandlerExecutionFailed' object has no attribute 'full_message'

In RF5.0 when using 'rfshell' or the 'Debug' keyword, when I am using keywords which are failing/raising exceptions I am getting the following error AttributeError: 'HandlerExecutionFailed' object has no attribute 'full_message'

root@012d6b95697e:/home/cxta# rfshell
==============================================================================
Robot-Debug-Fybfasw9
==============================================================================
RFDEBUG REPL
>>>>> Enter interactive shell
Only accepted plain text format keyword separated with two or more spaces.
Type "help" for more information.
> should contain  foo   bar
! keyword: should contain  foo   bar
RFDEBUG REPL                                                          | FAIL |
AttributeError: 'HandlerExecutionFailed' object has no attribute 'full_message'
------------------------------------------------------------------------------
Robot-Debug-Fybfasw9                                                  | FAIL |
1 test, 0 passed, 1 failed
==============================================================================
Output:  None

I do not see this on RF4.0

z2 server in debug mode

for developing robot tests, i'd love to have the z2 server in DEBUG mode, so that i can use plone.reload, Module bda.plone.orders.browser.views, line 557, in query and other canditates.
i have the feeling, that we'd need to add this feature to the setUpDebugMode in the Startup layer in https://github.com/plone/plone.testing/blob/master/src/plone/testing/z2.py#L319

maybe a DEBUG option to the robot script, which enables the DEBUG mode of Zope?
or is it easily possible to overload a method of a specific test layer, even if we don't inherit from that?

what do you think about such an feature?

In shell, Import Library ImageHorizonLibrary gives error

dleung@edgemds:~$ rfdebug
==============================================================================
robot debugH9MeJO
==============================================================================
RFDEBUG REPL
>>>>> Enter interactive shell
Only accepted plain text format keyword seperated with two or more spaces.
Type "help" for more information.
> Import Library  ImageHorizonLibrary
RFDEBUG REPL                                                          | FAIL |
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2318' in position 44: ordinal not in range(128)
------------------------------------------------------------------------------
robot debugH9MeJO                                                     | FAIL |
1 critical test, 0 passed, 1 failed
1 test total, 0 passed, 1 failed
==============================================================================
Output:  None

Listing keywords from resource files

It seems that keywords imported from .robot files using the "Resource" keyword are not listed with keywords imported from libraries.

Would it be possible to add this feature?

Importing test library 'Selenium2Library' failed: ImportError: cannot import name GLOBAL_VARIABLES

When I call Import Library in rfshell I am getting following error:

> import library  Selenium2Library
< keyword: import library  Selenium2Library
! Importing test library 'Selenium2Library' failed: ImportError: cannot import name GLOBAL_VARIABLES

Traceback (most recent call last):
  File "C:\Python27\lib\site-packages\Selenium2Library\__init__.py", line 2, in <module>
    from keywords import *
  File "C:\Python27\lib\site-packages\Selenium2Library\keywords\__init__.py", line 1, in <module>
    from _logging import _LoggingKeywords
  File "C:\Python27\lib\site-packages\Selenium2Library\keywords\_logging.py", line 3, in <module>
    from robot.variables import GLOBAL_VARIABLES
PYTHONPATH:
  C:\Python27\Scripts
  C:\Windows\SYSTEM32\python27.zip
  C:\Python27\DLLs
  C:\Python27\lib
  C:\Python27\lib\plat-win
  C:\Python27\lib\lib-tk
  C:\Python27
  C:\Python27\lib\site-packages
  C:\Python27\lib\site-packages\win32
  C:\Python27\lib\site-packages\win32\lib
  C:\Python27\lib\site-packages\Pythonwin
  C:\Python27\lib\site-packages\wx-2.8-msw-unicode
>

Step debugging .robot files in rfdebug

Have you considered adding step-debugging capabilities to rfdebug? It seems as though it would be pretty useful. I may be able to implement this if you would accept the PR.

Breaking back out of pdb

Is it possible, after launching pdb through rfdebug, to return to rfdebug? If not, do you believe this would be a useful feature?

Get value to a variable

Hello,

So far debuglibrary helping me alot, only missing function is like setting the left hand side of a function.

# ex.  
${arg1}  set test variable  my_var_text

Is it possible to add this feature ?

Importing test library 'DebugLibrary' failed: AttributeError: StringIO instance has no attribute 'encoding'

Using Debian Jessie and robot is installed via pip. Python 2.7.9. After upgrading to robotframework-debuglibrary 0.8.2 (or 0.9.0), I started getting the following on every suite:

[ ERROR ] Error in file '/tests/robot/resources/keywords.txt': Importing test library 'DebugLibrary' failed: AttributeError: StringIO instance has no attribute 'encoding'
Traceback (most recent call last):
  File "/usr/local/lib/python2.7/dist-packages/DebugLibrary.py", line 64, in <module>
    COMMAND_LINE_ENCODING = sys.stdout.encoding or 'utf-8'

Line in question in keywords.txt is Library DebugLibrary. There are no Debug used.

post-mortem resp. failure debugging

is there a chance to add a keyword or debug-option to allow post-failure debugging, like the python post-mortem debugging feature? so, when i develop or debug robot tests, instead of failing hardly, i'd love to be prompted with the debug-shell to see what went wrong.

can't start rfshell

Got following exception during running rfshell

[ WARN ] 'robot/runner.py' entry point is deprecated and will be removed in Robot Framework 2.8. Use new 'robot/run.py
' instead.
Traceback (most recent call last):
File "c:\Program Files (x86)\python27\Scripts\rfshell-script.py", line 8, in
load_entry_point('robotframework-debuglibrary==0.2.3', 'console_scripts', 'rfshell')()
File "C:\Program Files (x86)\python27\lib\site-packages\DebugLibrary.py", line 181, in shell
rc = robot.run_from_cli(args.split(), robot.runner.doc)
AttributeError: 'module' object has no attribute 'run_from_cli'

Versions 2.4.0 and later crash when the test case is started inside VSCode using the RobotCode (d-biehl.robotcode) extension.

With robotframework-debuglibrary 2.40 and later, when the Debug keyword is called in a test case started in VSCode using the RobotCode extension instead of getting the interactive debug prompt you get...

| FAIL | asyncio.run() cannot be called from a running event loop

Version 2.3.0 works as expected.

Attached is a sample VSCode project that show the problem. Open the project in VSCode, click "Reopen in Container". After the project reloads open the debugtest.robot file and click the run button next to the Check DebugLibrary test case. Instead of the interactive prompt you'll get...

 /workspaces/robotdebuglibrarybug #  /usr/bin/env /usr/bin/python /root/.vscode-server/extensions/d-biehl.robotcode-0.69.0/bundled/tool/robotcode --default-path . debug --
no-debug -- --parse-include debugtest.robot --name Robotdebuglibrarybug --suite Robotdebuglibrarybug.Debugtest --by-longname Robotdebuglibrarybug.Debugtest.Check\ DebugLi
brary 
==============================================================================
Robotdebuglibrarybug                                                          
==============================================================================
Robotdebuglibrarybug.Debugtest                                                
==============================================================================
Check DebugLibrary                                                    
>>>>> Enter interactive shell
Only accepted plain text format keyword separated with two or more spaces.
Type "help" for more information.
Check DebugLibrary                                                    | FAIL |
asyncio.run() cannot be called from a running event loop
------------------------------------------------------------------------------
Robotdebuglibrarybug.Debugtest                                        | FAIL |
1 test, 0 passed, 1 failed
==============================================================================
Robotdebuglibrarybug                                                  | FAIL |
1 test, 0 passed, 1 failed
==============================================================================
Output:  /workspaces/robotdebuglibrarybug/results/output.xml
Log:     /workspaces/robotdebuglibrarybug/results/log.html
Report:  /workspaces/robotdebuglibrarybug/results/report.html
sys:1: RuntimeWarning: coroutine 'Application.run_async' was never awaited
RuntimeWarning: Enable tracemalloc to get the object allocation traceback
/workspaces/robotdebuglibrarybug # 

If you edit the Dockerfile to install robotframework-debuglibrary 2.3.0 instead of 2.5.0 when you run the test case you'll get...

/workspaces/robotdebuglibrarybug #  /usr/bin/env /usr/bin/python /root/.vscode-server/extensions/d-biehl.robotcode-0.69.0/
bundled/tool/robotcode --default-path . debug --no-debug -- --parse-include debugtest.robot --name Robotdebuglibrarybug --
suite Robotdebuglibrarybug.Debugtest --by-longname Robotdebuglibrarybug.Debugtest.Check\ DebugLibrary 
==============================================================================
Robotdebuglibrarybug                                                          
==============================================================================
Robotdebuglibrarybug.Debugtest                                                
==============================================================================
Check DebugLibrary                                                    
>>>>> Enter interactive shell
Only accepted plain text format keyword separated with two or more spaces.
Type "help" for more information.
>    

as expected.
robotdebuglibrarybug.tar.gz

rfdebug raise PermissionError when running on Windows

This started happening after we update from v1.0.3 to v1.1.1, and updated python from 27 to 36. When I run "rfshell" or "rfdebug" from the command line, I'm getting a permissions error(below). My first guess is it has something to do with the refactoring commit that renames the files and changes from a suite to a file (commit 9edff34). However, I don't get this error when using the "debug" keyword within a test to open the interactive shell.

ksmoland@KSMOLAND-LT MINGW64 /c/git/automation-framework-cpp.reporting/BI/API/Tests/Objects from Content Store (dev)
$ rfshell
[ ERROR ] Parsing 'C:\Users\ksmoland\AppData\Local\Temp\robot-debug-kpm1lysz.txt' failed: PermissionError: [Errno 13] Permission denied: 'C:\Users\ksmoland\AppData\Local\Temp\robot-debug-kpm1lysz.txt'

Try --help for usage information.

ksmoland@KSMOLAND-LT MINGW64 /c/git/automation-framework-cpp.reporting/BI/API/Tests/Objects from Content Store (dev)
$ rfdebug
[ ERROR ] Parsing 'C:\Users\ksmoland\AppData\Local\Temp\robot-debug-6xheiz2e.txt' failed: PermissionError: [Errno 13] Permission denied: 'C:\Users\ksmoland\AppData\Local\Temp\robot-debug-6xheiz2e.txt'

Try --help for usage information.

Temporary files deleted too soon

I had some problems with rfshell on my WinXP with Python 2.7. I installed the tool with pip command.
After that I got 'Permission denied' every time I tried to run the rfshell:

[ ERROR ] Parsing 'c:\docume~1\tporeba\locals~1\temp\robot_debugyigx5j.txt' fail
ed: IOError: [Errno 13] Permission denied: u'c:\\docume~1\\tporeba\\locals~1\\te
mp\\robot_debugyigx5j.txt'

Try --help for usage information.

It seems, the temporary file the tool is looking for is being deleted too soon. I found a dirty workaround and wanted to share it :) In line 167 in DebugLibrary.py I added 'delete=False', now temporary files are not removed at all.

source = tempfile.NamedTemporaryFile(prefix='robot_debug', suffix='.txt', delete=False)

Then I had to install library from fixed source and it is working.
Great thanks for the tool, I love it.

Support Python3 ?

Trying to use this library using Python 3 and this happens:

> Element Should Be Enabled  accessibility_id=Foo
< keyword: Element Should Be Enabled  accessibility_id=Foo
! FAILED: AttributeError("'str' object has no attribute 'decode'",)

I can haz Python3 support ?

Not able to use `Set Variable` keyword from rfshell

In a .robot file I can use ${label_id}= Set Variable SOME TEXT to assign a value to ${label_id}.

When I try the same in rfshell, I get this error:

> ${labe_id}=  Set Variable  SOME TEXT
< keyword: ${labe_id}=  Set Variable  SOME TEXT
! FAILED: ExecutionFailed(u"No keyword with name '${labe_id}=' found.",)
>

Am I doing something wrong or is it not implemented yet?

BTW: Thank you for this great library! It really speeds up test development a lot!

Step command does not work since robotframework 4.x

robotframework-debuglibrary's step command does not work with robotframework 4.x and 5.x. The unit test results also reveal this problem.

Steps to reproduce the problem:

# checkout robotframework-debuglibrary
$ python setup.py develop
# install rf 4.x
$ pip install -U "robotframework<5"
# step command does not work
$ python DebugLibrary/shell.py tests/step.robot
==============================================================================
Step & Robot-Debug-Ua7Hv44X
==============================================================================
Step & Robot-Debug-Ua7Hv44X.Step
==============================================================================
test1
>>>>> Enter interactive shell
Only accepted plain text format keyword separated with two or more spaces.
Type "help" for more information.
> l
Please run `step` or `next` command first.
> s
.=> BuiltIn.Log To Console  working
> l
> s
working
.=> @{list} = BuiltIn.Create List  hello  world
> l
> s
test1                                                                 | PASS |
------------------------------------------------------------------------------
test2                                                                 => BuiltIn.Log To Console  another test case
> l
> s
another test case
.=> BuiltIn.Log To Console  end
> l
> s
end
test2                                                                 | PASS |
------------------------------------------------------------------------------
Step & Robot-Debug-Ua7Hv44X.Step                                      | PASS |
2 tests, 2 passed, 0 failed
==============================================================================
Step & Robot-Debug-Ua7Hv44X.Robot-Debug-Ua7Hv44X
==============================================================================
RFDEBUG REPL                                                          => DebugLibrary.Debug
> l
> s
> s
RFDEBUG REPL                                                          | PASS |
------------------------------------------------------------------------------
Step & Robot-Debug-Ua7Hv44X.Robot-Debug-Ua7Hv44X                      | PASS |
1 test, 1 passed, 0 failed
==============================================================================
Step & Robot-Debug-Ua7Hv44X                                           | PASS |
3 tests, 3 passed, 0 failed
==============================================================================
Output:  /Users/xyb/Projects/debuglibrary/output.xml
Log:     /Users/xyb/Projects/debuglibrary/log.html
Report:  /Users/xyb/Projects/debuglibrary/report.html

# install rf 3.x
$ pip install -U "robotframework<4"
# step command works
$ python DebugLibrary/shell.py tests/step.robot
==============================================================================
Step & Robot-Debug-Liqmv00V
==============================================================================
Step & Robot-Debug-Liqmv00V.Step
==============================================================================
test1
>>>>> Enter interactive shell
Only accepted plain text format keyword separated with two or more spaces.
Type "help" for more information.
> l
Please run `step` or `next` command first.
> s
.> /Users/xyb/Projects/debuglibrary/tests/step.robot(7)
-> log to console  working
=> BuiltIn.Log To Console  working
> l
  2   	Library  DebugLibrary
  3
  4   	** test case **
  5   	test1
  6   	    debug
  7 ->	    log to console  working
  8   	    @{list} =  Create List    hello    world
  9
 10   	test2
 11   	    log to console  another test case
 12   	    log to console  end
> s
working
.> /Users/xyb/Projects/debuglibrary/tests/step.robot(8)
-> @{list} =  Create List    hello    world
=> @{list} = BuiltIn.Create List  hello  world
> s
test1                                                                 | PASS |
------------------------------------------------------------------------------
test2                                                                 > /Users/xyb/Projects/debuglibrary/tests/step.robot(11)
-> log to console  another test case
=> BuiltIn.Log To Console  another test case
> s
another test case
.> /Users/xyb/Projects/debuglibrary/tests/step.robot(12)
-> log to console  end
=> BuiltIn.Log To Console  end
> s
end
test2                                                                 | PASS |
------------------------------------------------------------------------------
Step & Robot-Debug-Liqmv00V.Step                                      | PASS |
2 critical tests, 2 passed, 0 failed
2 tests total, 2 passed, 0 failed
==============================================================================
Step & Robot-Debug-Liqmv00V.Robot-Debug-Liqmv00V
==============================================================================
RFDEBUG REPL                                                          > /var/folders/t1/yzgk5r1x0w33lvm1x3n807k80000gn/T/robot-debug-liqmv00v.robot(6)
-> debug
=> DebugLibrary.Debug
> s
> s
RFDEBUG REPL                                                          | PASS |
------------------------------------------------------------------------------
Step & Robot-Debug-Liqmv00V.Robot-Debug-Liqmv00V                      | PASS |
1 critical test, 1 passed, 0 failed
1 test total, 1 passed, 0 failed
==============================================================================
Step & Robot-Debug-Liqmv00V                                           | PASS |
3 critical tests, 3 passed, 0 failed
3 tests total, 3 passed, 0 failed
==============================================================================
Output:  /Users/xyb/Projects/debuglibrary/output.xml
Log:     /Users/xyb/Projects/debuglibrary/log.html
Report:  /Users/xyb/Projects/debuglibrary/report.html

Error on starting rfshell - ImportError: No module named readline

Installed with pip install robotframework-debuglibrary

When calling rfshell in cmd on Windows 8.1 I´m getting following error:

C:\Users\Tset>rfshell
Traceback (most recent call last):
  File "C:\Python27\Scripts\rfshell-script.py", line 9, in <module>
    load_entry_point('robotframework-debuglibrary==0.4', 'console_scripts', 'rfshell')()
  File "C:\Python27\lib\site-packages\pkg_resources\__init__.py", line 552, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "C:\Python27\lib\site-packages\pkg_resources\__init__.py", line 2672, in load_entry_point
    return ep.load()
  File "C:\Python27\lib\site-packages\pkg_resources\__init__.py", line 2345, in load
    return self.resolve()
  File "C:\Python27\lib\site-packages\pkg_resources\__init__.py", line 2351, in resolve
    module = __import__(self.module_name, fromlist=['__name__'], level=0)
  File "C:\Python27\lib\site-packages\DebugLibrary.py", line 43, in <module>
    import readline
ImportError: No module named readline

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.