问题:

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:

  1. Go to File > Settings > External Tools
  2. Click '+' button under 'External Tools' panel
  3. 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$
  4. 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的更多相关文章

  1. python3+Robot Framework+PyCharm环境部署及执行脚本

    Robot Framework是一个非常优秀的开源关键字驱动自动化测试框架,目前已经支持python2和python3,但是GUI界面RIDE只支持python2,但是python的未来是python ...

  2. Robot Framework(十三) 执行测试用例——创建输出

    3.5创建输出 执行测试时会创建几个输出文件,并且所有这些文件都与测试结果有某种关联.本节讨论创建的输出,如何配置它们的创建位置以及如何微调其内容. 3.5.1不同的输出文件 输出目录 输出文件 日志 ...

  3. 一:robot framework环境安装

    1.安装robot framework: 打开cmd进入dos下,输入 pip install robotframework Microsoft Windows [版本 10.0.18362.267] ...

  4. python3+Robot Framework+PyCharm自动化测试框架设计

    关于自动化测试框架的设计,笔者在前面的随笔里面有介绍和总结,这里结合实际的项目例子做个demo,环境部署参考笔者的的随笔<python3+Robot Framework+PyCharm环境部署及 ...

  5. robot framework 在pycharm中语法无法高亮显示的,显示绿色解决办法(Robot Framework with PyCharm)

    Robot Framework with PyCharm up vote1down votefavorite 1 I am totally new to automation and trying t ...

  6. robot framework error: [ ERROR ] Suite 'XXX' contains no tests or tasks.(解决方法)

    robot framework 按照如下操作创建项目 一.创建项目 选择菜单栏file----->new Project Name 输入项目名称. Type 选择Directory. 二.创建测 ...

  7. Robot Framework(六)变量

    变量 2.5.1简介 变量是Robot Framework的一个不可或缺的特性,它们可以在测试数据的大多数地方使用.最常见的是,它们用于测试用例表和关键字表中关键字的参数,但所有设置都允许在其值中使用 ...

  8. [E2E] Robot Framework introduction

    We will use demo project as an example, go though QuickStart repo. Install: First you should have py ...

  9. Robot Framework 快速入门_英文版

    Copyright © Nokia Siemens Networks 2008 Licensed under the Apache License, Version 2.0 Table of Cont ...

随机推荐

  1. ORACLE监听配置及测试实验(2)

    实验四 在tnsname.ora里添加默认监听代号 [oracle@oracle01 admin]$ vi tnsnames.ora 添加一行 PORT1528=(ADDRESS = (PROTOCO ...

  2. select下拉菜单实现通过数据库查询来设置默认值

    查询网上各种资料要不比较难理解,要么有问题,现有一种简单通俗的理解方法 思路:读取数据库数据1,数据2需用到select选择菜单,但是又想每次查看是都显示读数据库的默认信息 demo: {% for ...

  3. NumPy 广播机制(Broadcasting)

    一.何为广播机制 a.广播机制是Numpy(开源数值计算工具,用于处理大型矩阵)里一种向量化数组操作方法. b.Numpy的通用函数(Universal functions) 中要求输入的两个数组sh ...

  4. webmin小结

    centos7安装webmin https://www.cnblogs.com/andy9468/p/10537201.html webmin重置密码 重置webmin账户root的密码为例: htt ...

  5. MongoDB pymongo模块 更新数据

    现在chat集合里有3条数据 import pymongo mongo_client = pymongo.MongoClient( host='192.168.0.112', port=27017, ...

  6. 别让Open Sans字体拖慢wordpress后台速度

    最近打开wordpress后台是不是很慢?国内GG登不上了?这两者有没什么直接的联系?没错,WordPress后台是自动加载的谷歌Open Sans字体,据说gg服务器已经迁移到阿嘛丽可,需要一些小手 ...

  7. UniConnectDialog使用

    对话框中文显示 设计视图 设置参数 取值结果 获取根据参数设置的值关键代码 UniConnection1.ConnectDialog := UniConnectDialog1; UniConnecti ...

  8. 手把手教你用 Git(转)

    转自:http://blog.jobbole.com/78960/ 一:Git是什么? Git是目前世界上最先进的分布式版本控制系统. 二:SVN与Git的最主要的区别? SVN是集中式版本控制系统, ...

  9. sap gui 配置

    1: sap gui 安全配置 ,在左下角搜索sap gui configuration.

  10. Object.keys(),Object.values() 用法

    ES8新特性 Object.keys() 用法 返回键名组成的数组, let arr={ name:'js', sex:'body' } let keys=Object.keys(arr); cons ...