问题:

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. LeetCode 929 Unique Email Addresses 解题报告

    题目要求 Every email consists of a local name and a domain name, separated by the @ sign. For example, i ...

  2. Java之旅_高级教程_实例_打印图形

    1.打印菱形 public class MainClass{ public static void main(String[] args){ printStar(10); } public stati ...

  3. 去除字符串中的html代码

    public static String Html2Text(String inputString) { String htmlStr = inputString; // 含html标签的字符串 St ...

  4. win 右键菜单栏出现sublime打开方式

    win + r 输入 regedit 看图操作

  5. easyui——validType属性值

  6. [py]python写一个通讯录step by step V3.0

    python写一个通讯录step by step V3.0 参考: http://blog.51cto.com/lovelace/1631831 更新功能: 数据库进行数据存入和读取操作 字典配合函数 ...

  7. Django-认证系统

    一.Django实现cookie与session 一.Django实现的cookie 1.获取cookie request.COOKIES['key'] request.get_signed_cook ...

  8. PLSQL的SQL%NOTFOUND的使用场景

    SELECT * INTO v_ticketStorageRow FROM BDM_TICKET_STORAGE WHERE p_startTicketNo >= START_NO_ AND p ...

  9. windows-spidermonkey

    听过Mozilla(火狐浏览器的娘家)的javascript引擎吗?感兴趣吗?想在windows平台的应用开发中使用这个引擎吗? 肯定? 好,往下看! 本文给出Windows平台SpiderMonke ...

  10. jmeter 二次开发---实现自定义函数插件

    1.前提: 有时候,Jmeter自带的函数,可能不能满足于业务的需求,这时候,我们可以自己写一个函数插件: 2.创建maven工程 一直next,输入GroupID,ArtifactId->fi ...