watir测试报告(一)
本文讲述的是利用watir来生成html报告。
其一: 使用test/unit, 这样结构上看其里比较清晰。
其二: 订制html样式, 这样每次只要套用就可以了。
其三: 本文尚有不足之处。 需不断修改, 以为己用。
require 'test/unit'
require 'watir'
require 'html.class'
class Google_search_test < Test::Unit::TestCase
def setup
@browser_type = 'IE'
#~ browser_type = 'Firefox'
@site = "www.google.com"
@test_environment = 'QA'
# initialize HTML report
@html = HTMLReport.new()
# createReport(reportName, header, browser_type)
@report = @html.createReport('google_search', 'Google Search', @browser_type)
end
def test_001
#this method can be set comm method.
if @browser_type == 'IE'
@browser = Watir::IE.new
@browser.goto @site
elsif @browser_type == 'Firefox'
Watir::Browser.default = 'firefox'
@browser = Watir::Browser.start(@site)
end
######################################
test_case = @html.newTestName('Verify controls')
######################################
test = 'Step 1: Check search text field'
@html.add_to_report(@browser.text_field(:name, 'q').exists?, test, 'PASS: Located search text field', 'FAIL: Unable to locate search field')
test = 'Step 2: Check Google Search button'
@html.add_to_report(@browser.button(:name, 'btnG').exists?, test, 'PASS: Located Google Search button', 'FAIL: Unable to locate Google Search button')
test = 'Step 3: Check Feeling Lucky button'
@html.add_to_report(@browser.button(:name, 'btnI').exists?, test, 'PASS: Located Feeling Lucky button', 'FAIL: Unable to locate Feeling Lucky button')
######################################
test_case = @html.newTestName('Perfom Watir search')
######################################
@browser.text_field(:name, 'q').set 'Watir'
@browser.button(:name, 'btnG').click
test = 'Step 1: Check valid search results (1)'
@html.add_to_report(@browser.text.include?('Babysteps in WATIR'), test, 'PASS: Located text "Babysteps in WATIR"', 'FAIL: Unable to locate text "Babysteps in WATIR"')
test = 'Step 2: Check valid search results (2)'
@html.add_to_report(@browser.text.include?('Project Info'), test, 'PASS: Located text "Project Info"', 'FAIL: Unable to locate text "Project Info"')
test = 'Step 3: Check for invalid search results'
@html.add_to_report(@browser.text.include?('Suez Canal'), test, 'PASS: Did not locate text "Suez Canal"', 'FAIL: Found text "Suez Canal"')
end
def teardown
# teardown
#@browser.close
@html.finishReport(@report, @browser_type, @test_environment)
rescue => e
puts $!
puts e.backtrace
@html.finishReport(@report, @browser_type, @test_environment)
#~ @browser.close
end
end
watir测试报告(一)相关推荐
- 建立企业级产品测试报告体系(概述)
基本上每个制造企业都有自己定制得测试报告.这种报告通常是提供给客户作为数据参考,甚至会导入数据库进行调测使用. 所以,建立统一的测试报告中心进行数据和报告的管理是有必要的. 1.1测试报告体系的愿景 ...
- 全球SDN测试认证中心发布OpenDaylight测试报告
随着软件定义网络(Software Defined Network, SDN)商业部署速度地加快,关乎整个SDN 网络性能表现的控制平面核心组件--SDN 控制器也越来越成为网络用户关心的焦点.日前, ...
- Robotium测试报告的生成方法(上)
7.1 使用junit-report生成报告 这个是参考网上的:http://www.xuebuyuan.com/2148574.html,经我个人验证是可行的方法,网上写的挺详细的,不过有些不太清楚 ...
- python自动生成测试报告步骤_生成HTMLTestRunner测试报告的操作步骤——Python+selenium自动化...
HTMLTestRunner是Python标准库的unittest模块的一个扩展,具体操作如下 1.安装 环境:Window8 步骤:1)http://tungwaiyip.info/software ...
- 测试报告-1.1组成和要点
个人知识脑图总结 1.测试报告组成,结合工作总结 转载于:https://www.cnblogs.com/bf-blackfish/p/10263743.html
- 给接口自动化测试框架增色,实现企业微信测试报告
作者在新项目中搭建了python+requests+unittest+HTMLTestRunner接口自动化测试框架,通过修改配置文件实现环境隔离,一份脚本即可在不同的环境执行接口测试用例. 但是没有 ...
- 阿里软件测试工程师手把手教学——自动化测试报告太丑,怎么办?
TestNG的报告太难看了?测试结果维度显示受限?无法确定用例的优先级?查看错误信息不方便吗? Allure测试报告框架帮助您轻松实现"高"报告呈现.本文通过实例演示了如何将All ...
- emqx速度_EMQX-3.0性能测试报告-ReadtheDocs.PDF
EMQX-3.0性能测试报告-ReadtheDocs.PDF EMQX-3.0性性性能能能测测测试试试报报报告告告 Release 3.0.4 杭杭杭州州州 云云云科科科技技技有有有限限限公公公司司司 ...
- 第九次作业-测试报告和用户使用手册
第九次作业-测试报告和用户使用手册 测试报告 测试原则:所有的测试都应追溯到用户需求.测试必须基于"质量第一"的思想去开展各项工作. 网站计划应该在测试工作真正开始前的较长时间内进 ...
最新文章
- Scala函数式编程(三) scala集合和函数
- python基础代码-python基础,python基础代码大全
- 茶香账簿小程序开发进度(1)
- Power BI 可视化交互/视觉对象交互
- 2020年_Jsp Jstl 学习笔记
- 小米空调来了,意外的是还一起来了一个马桶盖
- UNIX编程艺术 UNIX哲学
- Hibernate各个版本的下载地址
- C6678/C6657+ZYNQ/K7/A7 FPGA+AD+北斗的软硬件设计方案
- 文档数据库-MongoDB
- word如何设置页眉横线的磅数
- Python爬虫120例之案例58,手机APP爬虫,“武器库”的准备and皮皮虾APP的测试
- 蝴蝶效应---。。。
- Vuepress Reco主题备忘
- SLAM代码(SVO ros )
- 看片会员php源码,会员碎片 · THINKPHP插件 · 看云
- 在windows生成SSH秘钥连接linux远程主机
- kafka之broker
- pdf转换成word转换器在线哪个最好
- http方法有哪些?get、post、put、delete,为什么一般只用过get和post?什么时候用put、delete,为什么没用过