问题:

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. 怎样使用 fiddler抓取网络数据包?

    今天我们使用的工具是一个非常著名的抓包工具,百度搜索一下即可找到(或者关注/私信我,查看共享,一般我在百度经验中使用到的软件类工具,都可以在共享网盘中找到),因此这里不演示下载,相信您能很容易得到它的 ...

  2. oracle 11g/12c 密码复杂度验证设置

    ############################################################################### ###### 11g ###### ## ...

  3. 2018/04/14 理解oAuth2.0

    最近都近没有更新博客了,卡在 oAuth 上了. 之前公司做统一身份的认证,不了解 oAuth 的我在这卡了两天. 于是决定仔细研究原理,理论指导实践. -- 什么是 oAuth ? 简单来说 oAu ...

  4. springboot 整合swagger-ui

    一.添加maven依赖 <dependency> <groupId>io.springfox</groupId> <artifactId>springf ...

  5. VSCode代码修改后跑起来没反应,打开本地文件,代码没变化

    两种解决办法: 首先:修改VSCode默认配置文件,点击左下角设置标志图 -> 设置,出来了设置相关的东西,搜索 files.autoSave 第一种:把"files.autoSave ...

  6. session操作类

    using System;using System.Web; /// <summary> ///session操作类 /// </summary> public class a ...

  7. php 的Boolean类型

    1. bool值不用区分大小写 $flag = Ture; $flag = TRUE $flag = true; 2. 其他类型在运算中转换为bool值 var_dump((bool) '0'); / ...

  8. 微星笔记本每次都进bios

    解决方法 bios中更改启动模式,要更改为LEGACY

  9. 5 jmeter性能测试小小的实战

    项目描述 被测网址:www.sogou.com指标:相应时间以及错误率场景:线程数 20.Ramp-Up Period(in seconds) 10.循环次数 10 测试步骤 1.打开jmeter工具 ...

  10. Linux命令:linux软链接的创建、删除和更新---ln

    大家都知道,有的时候,我们为了省下空间,都会使用链接的方式来进行引用操作.同样的,在系统级别也有.在Windows系列中,我们称其为快捷方式,在Linux中我们称其为链接(基本上都差不多了,其中可能有 ...