-->

python3.6+pycharm+robotframework 环境搭建

2020-12-02 08:59发布

参考文档:https://www.cnblogs.com/chenyuebai/p/8359577.html,

https://www.cnblogs.com/jiyanjiao-702521/p/9235724.html,

https://blog.csdn.net/weixin_33829657/article/details/86128739

安装配置robotframework时,遇到很多很多问题,整理一下供自己以后翻阅。首先下载robotframework,如果是python3.6 ,pip install  robotframework==3.0.2, 这个版本有robot.bat文件,配置suite和case会用到。

在pycharm中点击setting,点击plug插件搜索并安装IntelliBot插件(注意:配置插件需要重启),pycharm>File>setting>Plugins>Browse reponsitories,如果pycharm没有此插件到https://plugins.jetbrains.com/plugin/7386-intellibot   下载至本地,然后进入pycharm>File>setting>Plugins>install plugin from disk。

下面配置file tpyes ,pycharm>File>setting>File Types>选择robot,如果没有*.txt,需要手动添加。

接下来继续配置suite和case的运行配置

因为我们在运行脚本时,可以单独运行一个用例,也可以直接运行一个用例集合:suite,所以我们这里要配置两个(此处需要robot.bat文件,最新版本的robotframework没有此文件,robotframework 3.0.2才有

配置suite

Robot Run TestSuite

-d results $FileName$

$FileDir$

设置case

Robot Run SingleTestCase

-d results -t "$SelectedText$" ./

$FileDir$

 创建新的项目文件,创建test.robot通过右键调出编辑菜单,然后右击通过External Tools来运行

test.robot

****** Settings ***
*** Test Cases ***
testcase
log robot framework

****** Settings *** 部分表示的是引用Library,当前没有引用,默认为空。
*** Test Cases *** 部分用于编写测试用例。
testcase 顶格写,表示测试的名称
    log    robot framework  log前面是四个空格,表示该行属于testcase用例的一行语句,‘log’为打印关键字,与python中的‘print’类似;‘robot framework’为打印的字符串。关键字与字符之间的间距为四个空格。




标签: