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

[14:21:30 ERROR]: [MythicMobs] [SCHEDULER] Exception thrown whilst executing task [14:21:30 WARN]: java.lang.IllegalArgumentException: CommandLine cannot be null [14:21:30 WARN]: at org.apache.commons.lang.Validate.notNull(Validate.java:192) [14:21:30 WARN]: at org.bukkit.craftbukkit.v1_12_R1.CraftServer.dispatchCommand(CraftServer.java:649) [14:21:30 WARN]: at io.lumine.xikage.mythicmobs.adapters.bukkit.BukkitServer.dispatchCommand(BukkitServer.java:36) [14:21:30 WARN]: at io.lumine.xikage.mythicmobs.skills.mechanics.CommandMechanic.castAtEntity(CommandMechanic.java:53) [14:21:30 WARN]: at io.lumine.xikage.mythicmobs.skills.SkillMechanic.lambda$executeTargetedEntitySkill$3(SkillMechanic.java:394) [14:21:30 WARN]: at java.lang.Iterable.forEach(Unknown Source) [14:21:30 WARN]: at io.lumine.xikage.mythicmobs.skills.SkillMechanic.executeTargetedEntitySkill(SkillMechanic.java:390) [14:21:30 WARN]: at io.lumine.xikage.mythicmobs.skills.SkillMechanic.lambda$executeSkills$0(SkillMechanic.java:354) [14:21:30 WARN]: at io.lumine.utils.tasks.Scheduler.lambda$wrapRunnable$5(Scheduler.java:69) [14:21:30 WARN]: at java.util.concurrent.CompletableFuture$AsyncRun.run(Unknown Source) [14:21:30 WARN]: at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftTask.run(CraftTask.java:71) [14:21:30 WARN]: at org.bukkit.craftbukkit.v1_12_R1.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:353) [14:21:30 WARN]: at net.minecraft.server.v1_12_R1.MinecraftServer.D(MinecraftServer.java:739) [14:21:30 WARN]: at net.minecraft.server.v1_12_R1.DedicatedServer.D(DedicatedServer.java:406) [14:21:30 WARN]: at net.minecraft.server.v1_12_R1.MinecraftServer.C(MinecraftServer.java:679) [14:21:30 WARN]: at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:577) [14:21:30 WARN]: at java.lang.Thread.run(Unknown Source) [14:21:37 INFO]: Tianxuan issued server command: /mv tp world [14:21:43 INFO]: Tianxuan lost connection: Disconnected
最新发布
03-30
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值