RobotFramework的使用

新建一个项目

Robotframework-ride的界面

分了四个区域:菜单栏、工具栏、案例及资源区、工作区,如下图:

创建项目

首先,点击File-New Project
注意把Type类型切换为:Directory目录

创建测试套件

右键点击“测试项目”选择new Suite 选项
Type:File
Format:TXT

创建测试用例

右键点击“测试项目”选择new Test Case

导入seleniumLibrary库

基于web的测试用例需要selenium的库支持。所以,我们在使用的过程中需要加载SeleniumLibrary库


使用SeleniumLibrary操作网页

RobotFramework查看操作命令帮助

在RobotFramework中操作命令都被称作:关键字
在Robotframework中按F5,可以打开相应关键字的帮助和搜索界面,如下图:

准备浏览器和驱动程序

打开浏览器之前需要先准备相应浏览器的驱动程序driver
推荐使用chrome浏览器,对应驱动下载地址为:http://npm.taobao.org/mirrors/chromedriver/
注意每个版本的驱动程序只能驱动匹配的2-3个版本chrome浏览器,具体可以查看驱动版本目录下的notes.txt,比如:
----------ChromeDriver v2.46 (2019-02-01)----------
Supports Chrome v71-73
则表示2.46版本只能驱动chrome71-73版本
Firefox的驱动程序为GeckoDriver,IE的驱动程序为IEDriverServer
将相应的驱动程序下载之后解压为.exe文件,复制到一个加入了环境变量的路径下,比如:C:\Python27

打开浏览器Open Browser

作用:用指定的浏览器打开url网址
参数:url, browser=firefox, alias=None, remote_url=False, desired_capabilities=None, ff_profile_dir=None
url:打开的网址
browser:指定的浏览器,下表是seleniumLibrary支持的浏览器列表:

例如:

关闭浏览器Close BrowserClose All Browsers

Close Browser

关闭当前打开的浏览器窗口

Close All Browsers

关闭所有打开的浏览器并重置浏览器缓存
运行后,浏览器的数量下标将会被重置为1
这个关键字在测试用例或测试套件运行完毕前一定要被运行,确保所有的浏览器都被关闭

测试用例的运行

测试用例的运行有两种方式:
1. 通过edit->start按键,运行当前单个用例

  1. 通过菜单栏->运行按键,运行指定的用例

注意:如果一个用例也不勾选,点击运行按键,当前项目中所有测试套件中的所有测试用例将会依次执行

查看运行结果和测试报告

运行过后,可以通过控制台信息看到运行的结果(包括运行时间在内)

也可以通过点击Report点击查看详细测试报告

点击Log或在Report中点击log.html查看具体的步骤信息(当步骤Fail时,RFS会自动截图,贴在Log该步骤信息中)

*:first-child {
margin-top: 0 !important;
}

body>*:last-child {
margin-bottom: 0 !important;
}

/* BLOCKS
=============================================================================*/

p, blockquote, ul, ol, dl, table, pre {
margin: 15px 0;
}

/* HEADERS
=============================================================================*/

h1, h2, h3, h4, h5, h6 {
margin: 20px 0 10px;
padding: 0;
font-weight: bold;
-webkit-font-smoothing: antialiased;
}

h1 tt, h1 code, h2 tt, h2 code, h3 tt, h3 code, h4 tt, h4 code, h5 tt, h5 code, h6 tt, h6 code {
font-size: inherit;
}

h1 {
font-size: 28px;
color: #000;
}

h2 {
font-size: 24px;
border-bottom: 1px solid #ccc;
color: #000;
}

h3 {
font-size: 18px;
}

h4 {
font-size: 16px;
}

h5 {
font-size: 14px;
}

h6 {
color: #777;
font-size: 14px;
}

body>h2:first-child, body>h1:first-child, body>h1:first-child+h2, body>h3:first-child, body>h4:first-child, body>h5:first-child, body>h6:first-child {
margin-top: 0;
padding-top: 0;
}

a:first-child h1, a:first-child h2, a:first-child h3, a:first-child h4, a:first-child h5, a:first-child h6 {
margin-top: 0;
padding-top: 0;
}

h1+p, h2+p, h3+p, h4+p, h5+p, h6+p {
margin-top: 10px;
}

/* LINKS
=============================================================================*/

a {
color: #4183C4;
text-decoration: none;
}

a:hover {
text-decoration: underline;
}

/* LISTS
=============================================================================*/

ul, ol {
padding-left: 30px;
}

ul li > :first-child,
ol li > :first-child,
ul li ul:first-of-type,
ol li ol:first-of-type,
ul li ol:first-of-type,
ol li ul:first-of-type {
margin-top: 0px;
}

ul ul, ul ol, ol ol, ol ul {
margin-bottom: 0;
}

dl {
padding: 0;
}

dl dt {
font-size: 14px;
font-weight: bold;
font-style: italic;
padding: 0;
margin: 15px 0 5px;
}

dl dt:first-child {
padding: 0;
}

dl dt>:first-child {
margin-top: 0px;
}

dl dt>:last-child {
margin-bottom: 0px;
}

dl dd {
margin: 0 0 15px;
padding: 0 15px;
}

dl dd>:first-child {
margin-top: 0px;
}

dl dd>:last-child {
margin-bottom: 0px;
}

/* CODE
=============================================================================*/

pre, code, tt {
font-size: 12px;
font-family: Consolas, "Liberation Mono", Courier, monospace;
}

code, tt {
margin: 0 0px;
padding: 0px 0px;
white-space: nowrap;
border: 1px solid #eaeaea;
background-color: #f8f8f8;
border-radius: 3px;
}

pre>code {
margin: 0;
padding: 0;
white-space: pre;
border: none;
background: transparent;
}

pre {
background-color: #f8f8f8;
border: 1px solid #ccc;
font-size: 13px;
line-height: 19px;
overflow: auto;
padding: 6px 10px;
border-radius: 3px;
}

pre code, pre tt {
background-color: transparent;
border: none;
}

kbd {
-moz-border-bottom-colors: none;
-moz-border-left-colors: none;
-moz-border-right-colors: none;
-moz-border-top-colors: none;
background-color: #DDDDDD;
background-image: linear-gradient(#F1F1F1, #DDDDDD);
background-repeat: repeat-x;
border-color: #DDDDDD #CCCCCC #CCCCCC #DDDDDD;
border-image: none;
border-radius: 2px 2px 2px 2px;
border-style: solid;
border-width: 1px;
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
line-height: 10px;
padding: 1px 4px;
}

/* QUOTES
=============================================================================*/

blockquote {
border-left: 4px solid #DDD;
padding: 0 15px;
color: #777;
}

blockquote>:first-child {
margin-top: 0px;
}

blockquote>:last-child {
margin-bottom: 0px;
}

/* HORIZONTAL RULES
=============================================================================*/

hr {
clear: both;
margin: 15px 0;
height: 0px;
overflow: hidden;
border: none;
background: transparent;
border-bottom: 4px solid #ddd;
padding: 0;
}

/* TABLES
=============================================================================*/

table th {
font-weight: bold;
}

table th, table td {
border: 1px solid #ccc;
padding: 6px 13px;
}

table tr {
border-top: 1px solid #ccc;
background-color: #fff;
}

table tr:nth-child(2n) {
background-color: #f8f8f8;
}

/* IMAGES
=============================================================================*/

img {
max-width: 100%
}
-->

RobotFramework_2.新建项目、新建用例、运行用例和查看测试报告的更多相关文章

  1. android开发_Eclipse新建项目+新建模拟器

    一.新建项目 1 Eclipse->右键->new->Android Application Project,得到下图: 2 输入创建项目信息 3 点击next 4 点击 next ...

  2. idea新建项目打包 ,运行jar,并放入maven仓库

    1.新建项目(转自:http://www.cnblogs.com/wql025/p/5215570.html) 创建一个新Maven项目 new 一个project 不选择任何Maven模板 起个Gr ...

  3. 关于Android Studio3.2新建项目无法运行出现Failed to find Build Tools revision 28.0.3的解决方法

    关于Android Studio3.2新建项目无法运行出现Failed to find Build Tools revision 28.0.3的解决方法 https://blog.csdn.net/h ...

  4. # pycharm新建项目后运行按钮为灰色

    pycharm新建项目后运行按钮为灰色 第一次运行需要先为项目创建解释器,第一次可以对项目右键选中Run或者Ctrl+Shift+F10自动为项目创建解释器.或者手动Run->Edit Conf ...

  5. Jenkins 安装、配置与项目新建及构建

    1.Jenkins的安装与配置 1.1 java环境配置 Jenkins基于Java, Linux下安装java只要配置java环境变量即可. 首先,解压java到相应目录,我一般习惯把安装的软件放到 ...

  6. (Java初学篇)IDEA项目新建流程和软件配置优化以及怎么彻底删除项目

    相信很多小伙伴们在初学 Java 时都会出现这样的情况,就是在网上一顿搜索加捣鼓终于把 JDK 和IDEA 这两款软件安装配置好,但是发现面对这个陌生的软件此时却无从下手,那么接下来我就给大家简单地介 ...

  7. MVC3 新建项目

    一.安装工具 二.新建项目 step1:新建MVC3项目 打开新建项目窗口,在“已安装的模板”列表中选择“Web”,在右侧应用程序模板列表中选择“ASP.NET MVC3 Web应用程序”,修改项目名 ...

  8. vue新建项目

    一直都被如何用vue.js新建一个项目的问题困扰着,经过好久的实践,终于搞清楚如何用vue新建项目了: 1.官网对于vue-cli介绍: Vue.js provides an official CLI ...

  9. VS 2015打开项目闪退,新建项目提示未将对象引用到实例

    因为开发需要,要把开发工具换成visual studio2015,装完之后会有警告“js”安装的问题,打开VS也没有问题, 但是一打开项目就闪退,新建项目也不行,查看应用程序日志,报错提示如下: .N ...

  10. ASP.NET MVC 5 入门教程 (1) 新建项目

    文章来源: Slark.NET-博客园 http://www.cnblogs.com/slark/p/mvc-5-get-started-create-project.html 下一节:ASP.NET ...

随机推荐

  1. 如何自学PHP做一个网站 PHP可以做什么项目?网站 小程序 公众号能用PHP开发吗?

    很多想从事程序开发的人员,想自学一门语言,不知道从哪里下手学习,如何入门学习?今天我们就以PHP为例子,来讲述一下如何快速的学习一门开发语言,让你快速入门.PHP是一个什么语言?它能开发什么项目呢?下 ...

  2. spring与springmvc父子容器

    转载地址:http://www.tianshouzhi.com/api/tutorials/spring 1.spring和springmvc父子容器概念介绍 在spring和springmvc进行整 ...

  3. Storm 学习之路(八)—— Storm集成HDFS和HBase

    一.Storm集成HDFS 1.1 项目结构 本用例源码下载地址:storm-hdfs-integration 1.2 项目主要依赖 项目主要依赖如下,有两个地方需要注意: 这里由于我服务器上安装的是 ...

  4. spring cloud 系列第7篇 —— sleuth+zipkin 服务链路追踪 (F版本)

    源码Gitub地址:https://github.com/heibaiying/spring-samples-for-all 一.简介 在微服务架构中,几乎每一个前端的请求都会经过多个服务单元协调来提 ...

  5. Idea中maven项目中导入本地jar包

    说一下正确的流程: 1.将jar包导入到本地maven库或者远程nexus仓库,再使用maven引用: 2.导入命令: //通过一下信息引入maven -DgroupId=com.test -Dart ...

  6. Fastjson的SerializerFeature序列化属性

    Fastjson的SerializerFeature序列化属性 fastJson在key的value为null时,默认是不显示出这个字段的 JSONObject.toJSONString(Object ...

  7. 牛客假日团队赛1 B

    B.便便传送门(一) 题目链接:https://ac.nowcoder.com/acm/contest/918/B 题目 Farmer John最讨厌的农活是运输牛粪.为了精简这个过程,他制造了一个伟 ...

  8. Apicloud 接入海康摄像头

    1准备工作 , 加载apicloud 海康视频模块. 引入 SDK 重新生成项目测试 再config.xml写入appid 话不多说直接上代码 video=api.require("haik ...

  9. GRPC Oauth IdentityServer4

    Server端 StartUp类: using System; using System.Collections.Generic; using System.Linq; using System.Th ...

  10. Node.js实现PC端类微信聊天软件(五)

    Github StackChat 学习回顾 Socket.io 结合Express创建Socket.io服务器 const app = require('express')() const http ...