RobotFramework调试外壳
项目描述
简介
本库是由René Rohner从Xie Yanbo的原始robotframework-debuglibrary分支而来的。
Robotframework-RobotDebug是RobotFramework的调试库,也可以用作交互式外壳(REPL)。
安装
使用pip安装
pip install robotframework-debug
使用
您可以将它作为库使用,导入RobotDebug并在测试文件中调用Debug关键字,如下所示
*** Settings *** Library RobotDebug ** test case ** SOME TEST # some keywords... Debug # some else... ${count} = Get Element Count name:div_name
或者您也可以作为独立的RobotFramework外壳运行
$ irobot [...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 > exit >>>>> Exit shell.
交互式外壳支持robotframework关键字和命令的自动完成。尝试输入BuiltIn然后按Control + Space键感受一下。
历史记录将保存在默认的~/.rfdebug_history或由环境变量RFDEBUG_HISTORY定义的任何文件中。
在使用 irobot 时,如果您不记得关键字名称,可以使用 libs 或 ls 命令列出导入的库和内置库,以及使用 keywords <lib name> 或 k 命令列出库中的关键字。
irobot 接受任何 robot 参数,但默认情况下,rfdebug 使用 -l None -x None -o None -L None -r None 禁用了所有日志。
逐步调试
RobotDebug 从版本 2.1.0 开始支持逐步调试。您可以使用 step/s、next/n、continue/c、list/l 和 longlist/ll 来逐步跟踪和查看代码,就像在 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 RobotDebug 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
注意:目前逐步调试不支持 FOR 循环。
提交问题
错误和增强功能在 问题跟踪器 中跟踪。
在提交新问题之前,始终检查是否已报告相同的错误或增强功能。如果是,请在现有问题中添加您的评论,而不是创建一个新的问题。
开发
如果您想在本地开发和运行 RobotDebug,可以使用
$ python RobotDebug/shell.py tests/step.robot
shell.py 通过子进程调用 robot,因此它将中断 Python 调试功能。如果您想在类似 vscode、pdb 的工具中进行调试,应运行
$ python -m robot tests/step.robot
如果您想运行测试,请先安装依赖包,然后执行测试
$ python setup.py develop $ python setup.py test
由于 RF 控制了 stdout,调试信息可以通过
import sys print('some information', file=sys.stdout)
许可
本软件根据 New BSD License 许可。有关完整许可文本,请参阅顶级分发目录中的 LICENSE 文件。
项目详情
下载文件
下载适用于您的平台的文件。如果您不确定选择哪个,请了解更多关于 安装软件包 的信息。
源代码分发
构建分发
robotframework-debug-4.5.0.tar.gz 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 925d830cd7c17d578d9822bfb969147d153da057369e31a17e205144a368e8a4 |
|
MD5 | ad49d7fbf99d17748444a0c832fb96bd |
|
BLAKE2b-256 | 33c980ca51bc6528c4255e3a62846879d5b14e305b2c68ad49bba75a7ac23a04 |
robotframework_debug-4.5.0-py3-none-any.whl 的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 7591c3418016a0356158c43e47548a9e9c4ca1ac51b33d7267fccf4153c0952e |
|
MD5 | ef72bf2b2803fa7866efc303e8b6f403 |
|
BLAKE2b-256 | 15a926171e61d8e2315c8c59a12206b6a4e5a313fcb834f186b2c9c3267ba47c |