天天看点

Robot Framework's built-in tool:libdoc

Libdoc是Robot框架的内置工具之一,用于生成HTML和XML格式的测试库和资源文件的关键字文档,使用起来我感觉非常的灵活方便。

General Usage

语法使用

python -m robot.libdoc [options] library_or_resource output_file
python -m robot.libdoc [options] library_or_resource list|show|version [names]
           

选项支持

-f, --format <html|xml>
    指定输出文档的格式,如果不使用此选项,则从输出文件的扩展名自动获取格式。如以下两种写法都是支持的:
      python -m robot.libdoc -f html SeleniumLibrary SL   或  
      python -m robot.libdoc  SeleniumLibrary SL.html

-F, --docformat <robot|html|text|rest>
    指定源文档格式,可能的值为Robot框架的文档格式:HTML、纯文本和reStructuredText。默认值可以在测试库源代码中指定,初始默认值为robot,支持2.7.5版本以上版本。

-N,--name <newname>
设置源库或资源的名称。

-V, --version <newversion>
  设置文档化库或资源的版本。测试库的默认值是从源代码获得的。

-h --help
    获取帮助文档
           

Examples

# 库或资源名称字母区分大小写
python -m robot.libdoc OperatingSystem OperatingSystem.html
python -m robot.libdoc --name MyLibrary Remote::http://10.0.0.42:8270 MyLibrary.xml
python -m robot.libdoc test/resource.html doc/resource_doc.html
python -m robot.libdoc SeleniumLibrary list >list.txt
jython -m robot.libdoc --version 1.0 MyJavaLibrary.java MyJavaLibrary.html