Running tests on PyCharm using Robot Framework
问题:
I started using PyCharm with the robot framework, but i'm facing an issue. how can i run my tests ? All the time i right click on my tests folder, i get an Empty test suit message from the console log.
Is there anyway to run each test separatly like right click on the test case and hit the test runner ?
This is my code:
*** Settings ***
Library Selenium2Library
Resource /steps/keywords.txt
*** Variables ***
${URL} http://www.google.com
*** Keywords ***
Open browser with URL
[arguments] ${url}
Open Browser ${url} browser=gc
Set input on text box
[arguments] ${xpath} ${text}
Input text ${xpath} ${text}
Push button
[arguments] ${button}
Click Button ${button}
*** Test Cases ***
Google Access
Open browser with URL ${URL}
Set input on text box //*[@id="gbqfq"] Critical Software
Push button //*[@id="gbqfba"]
#Close Browser
回答1:
I have used the Intellibot PyCharm plugin for Robot Framework.
For running the tests, we can do the below configuration:
- Go to File > Settings > External Tools
- Click '+' button under 'External Tools' panel
- In the 'Create Tool' dialog, enter the below values:
- Name: Robot
- Program: [Path of Pybot.bat e.g.C:\Python27\Scripts\Pybot.bat]
- Parameters: $FileName$
- Working Directory: $FileDir$
- Click OK
Once the above configuration is done, we get the option 'Robot' in the context menu on the test in the IDE. Choose that option to run your test suite in PyCharm.
回答2:
The most straightforward way is to create a run configuration, and then using the Run commands.
Here's a sample screenshot - it's invoked in the menu Run->Run Configurations, explanations follows:

1) in the screenshot is the location of the RF run.py file - it is located in the directory Lib\site-packages\robot in your python install - or virtualenv as in the shown case.
2) is the very same python interpreter - make sure it's the same as the one used in 1) (or it may get messy :)
3) are the parameters you'd normally pass on to robot when running it from the command line. The bare minimum is to provide the path to the suite(s) that must be ran - the last parameter in the example screenshot.
PyCharm doesn't have the option to "run this specific test case" by right-clicking on it - because RF depends this information to be provided on the CLI.
This can be done in a number of ways - all involving setting it in the "Script parameters:" box in the run config; for example, to run tests having a tag Sanity, use --include sanity, to run a specific test case - --name "My test case", and so on.
By the way, one of the greatest benefits of using run configuraitons is that you can debug the execution - i.e. using an IDE for what it's best suited :)
A run configuration does not depend on any plugin being installed - IntelliBot is an "absolute must" developing the cases, but as can be seen from the steps, it had no time for the execution.
回答3:
How to run tests through test configuration 1) Add a new Python configuration in ‘Run/Debug Configurations’ dialogue (Run -> Edit Configurations…) with next settings Set ‘Script’ to point to the run.py file in RobotFramework folder. Set ‘Script parameter’s to the list of parameters you want to execute your tests with. (these are the parameters you pass to pybot command). Set ‘Working directory’ to the test project working directory
Save it and it will create a new configuration for you.
2) Run configuration that you will be able to run by pressing run button. And see the test output in tests output window.
How to run tests with one click (from the context menu) What you could do is to setup the external tool in Pycharm/IntellijIDEA to do it. 1) Open File -> Settings (Alt+F7) and search for 'External Tools', click Add to add new configuration and set fields not next values external tool
Duplicated values here:
C:\Python27\Scripts\pybot.bat
<your variables> --test "$SelectedText$" TestSuite
$ProjectFileDir$
Save the changes
2) Run tests by highlighting test case name and running external tool: right click -> External tool -> Individual test
BTW, you can also debug your tests (python code) from test configs. Hope it helps.
I have a detailed blog post on how to run tests with Pycharm/IntellijIDEA, feel free to give to it a check.
回答4:
I followed the steps mention for The most straightforward way is to create a run configuration, and then using the Run commands.
Here's a sample screenshot - it's invoked in the menu Run->Run Configurations, explanations follows:
However I am getting below error. Parsing 'sample.robot' failed: Data source does not exist.
转载:https://www.e-learn.cn/content/wangluowenzhang/447834
Running tests on PyCharm using Robot Framework的更多相关文章
- python3+Robot Framework+PyCharm环境部署及执行脚本
Robot Framework是一个非常优秀的开源关键字驱动自动化测试框架,目前已经支持python2和python3,但是GUI界面RIDE只支持python2,但是python的未来是python ...
- Robot Framework(十三) 执行测试用例——创建输出
3.5创建输出 执行测试时会创建几个输出文件,并且所有这些文件都与测试结果有某种关联.本节讨论创建的输出,如何配置它们的创建位置以及如何微调其内容. 3.5.1不同的输出文件 输出目录 输出文件 日志 ...
- 一:robot framework环境安装
1.安装robot framework: 打开cmd进入dos下,输入 pip install robotframework Microsoft Windows [版本 10.0.18362.267] ...
- python3+Robot Framework+PyCharm自动化测试框架设计
关于自动化测试框架的设计,笔者在前面的随笔里面有介绍和总结,这里结合实际的项目例子做个demo,环境部署参考笔者的的随笔<python3+Robot Framework+PyCharm环境部署及 ...
- robot framework 在pycharm中语法无法高亮显示的,显示绿色解决办法(Robot Framework with PyCharm)
Robot Framework with PyCharm up vote1down votefavorite 1 I am totally new to automation and trying t ...
- robot framework error: [ ERROR ] Suite 'XXX' contains no tests or tasks.(解决方法)
robot framework 按照如下操作创建项目 一.创建项目 选择菜单栏file----->new Project Name 输入项目名称. Type 选择Directory. 二.创建测 ...
- Robot Framework(六)变量
变量 2.5.1简介 变量是Robot Framework的一个不可或缺的特性,它们可以在测试数据的大多数地方使用.最常见的是,它们用于测试用例表和关键字表中关键字的参数,但所有设置都允许在其值中使用 ...
- [E2E] Robot Framework introduction
We will use demo project as an example, go though QuickStart repo. Install: First you should have py ...
- Robot Framework 快速入门_英文版
Copyright © Nokia Siemens Networks 2008 Licensed under the Apache License, Version 2.0 Table of Cont ...
随机推荐
- CF997C Sky Full of Stars 数论
正解:容斥 解题报告: 传送门! 两个方法,分别港下QAQ 先说第一种 首先要推出式子,就∑2*C(i,n)*(-1)i+1*3i*3n*n-n+3*∑∑(-1)i+j+1*C(i,n)*C(j,n) ...
- MSSQL2008 部署及开启远程连接
最近不少用户在windows2003 server 32位操作系统上安装SQL Server2008总是失败,出现大量错误.今天经过通过我反复测试安装,找出了一个便捷的安装方法,节省大家宝贵时间,具体 ...
- Ubuntu14.04 LTS 安装Chrome浏览器(转)
add zhj: 亲测过,可以,原来不用FQ就可以下载,有点意外 原文:http://www.jianshu.com/p/8220578d0b15 1.打开终端(ctrl + alt + t),下载6 ...
- 代码控如何实现配置fiddler
很多小哥哥总觉得测试点点点很low,总想码代码.那么fiddler除了一些手动设置外,还可以进行丰富的代码编写,用以完成任务. 打开fiddler,工具栏选择Rules->Customize R ...
- Github上Laravel开源排行榜Star数前30名
Github上Laravel开源排行榜前30名,罗列所有 Laravel 开源扩展包,含 Github Star 数量,下载数量和项目简介.默认排序是按Star数量从多到少来排 1.cachethq/ ...
- chrome版本与对应的谷歌驱动(chromedriver)
chrome版本与对应的谷歌驱动(chromedriver) 1.下载chromedriver:http://chromedriver.storage.googleapis.com/index.htm ...
- PXE安装操作系统
TFTP服务 用PXE安装操作系统依赖于DHCP服务和TFTP服务 网卡一般都内置的TFTP客户端的程序 systemctl enable tftp systemctl enable dhc ...
- fasttext学习笔记
When to use FastText? The main principle behind fastText is that the morphological structure of a wo ...
- 第二弹:超全Python学习资源整理(进阶系列)
造一个草原要一株三叶草加一只蜜蜂.一株三叶草,一只蜂,再加一个梦.要是蜜蜂少,光靠梦也行. - 狄金森 "成为编程大牛要一门好语言加一点点天分.一门好语言,一点点天分,再加一份坚持.要是天分 ...
- Let Encrypt延期(转自虞大胆的叽叽喳喳)
前几天发现我的 letsencrypt 通配符证书快过期了,想为这两张证书续期(renew). 首先运行命令查看我的所有证书: $ certbot-auto certificates 其中证书名 si ...