Debug Skills

Reference Links

robotframework-debuglibrary 0.3

https://pypi.python.org/pypi/robotframework-debuglibrary

RobotFramework debug library and an interactive shell

Introduction

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

Installation

Installation is done just as for any other Python library. Using the pip oreasy_install command from setuptools is the easiest.

To install using pip:

pip install robotframework-debuglibrary

To install using easy_install:

easy_install robotframework-debuglibrary

Usage

You can use this as a library, import DebugLibrary and call Debug keyword in your test files like this:

*** Settings ***
Library         DebugLibrary

** test case **
SOME TEST
    # some keywords...
    Debug

Or you can run it standalone as a RobotFramework shell:

$ rfshell
[...snap...]
>>>>> Enter interactive shell, only accepted plain text format keyword.
> log  hello
> get time
< '2011-10-13 18:50:31'
> import library  String
> get substring  helloworld  5  8
< 'wor'
> selenium  http://www.douban.com/
import library  SeleniumLibrary
start selenium server
open browser  http://www.douban.com/
> Ctrl-D
>>>>> Exit shell.


Add Breakpoint in Library

import sys, pdb; pdb.Pdb(stdout=sys.__stdout__).set_trace()

BuiltIn.Log and Print

from robot.libraries.BuiltIn import BuiltIn

Log of info levelis output to report.html:

BuiltIn().log(message = CM_NAME + " initialize" + "Initializing  [%s] " % (self.ip_addr), level = "INFO")

Warn message isoutput to console window:

BuiltIn().log(message = CM_NAME + " initialize" + "Initializing [%s] " % (self.ip_addr), level = "WARN")

Print Warning Message:

print("*WARN* Test Message") same effect as log as warnlevel.

Add Debug Option in CommandLine

For pybot,--debugfile <file> can be added, and a debug file will be created.

-b, --debugfile <file>

 

A debug file that is written during execution.

pybot -v RootTarget:D:\Rwbot -vProductTarget:D:\Rwbot\targets\ap_qa_auto --variablefiletargets/ap_qa_auto/resources/variables/VAR.py --include"2g&mcast"--debugfile debug.log targets/ap_qa_auto/testsuites/qos

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值