分享一个大牛的人工智能教程。零基础!通俗易懂!风趣幽默!希望你也加入到人工智能的队伍中来!请点击http://www.captainbed.net

  1. Use page objects pattern, and consider use Selenium PageFactory. (Page object methods should return a value.)
  2. Preferred selector order : id > name > links text > css > xpath.
  3. Get name of the running test.
  4. Be fluent.
  5. Be robust and portable.
  6. Avoid Thread.sleep prefer Wait or FluentWait.
  7. Use relative URLs.
  8. Create your dataset.
  9. Fresh browser per test.
  10. Keep your test scripts separate from the framework, though it is in the same codebase.
  11. In page objects and other framework classes, if there is some issue to log/write, output it as a state other than a failure (e.g. "[WARN] Login link was not found." or "[INFO] Homepage initialization complete."). Only use assertions and report [FAIL] in the actual test code/script.
  12. From the start, build your framework read a configuration file for things like the target server url to test, database to get data from, logging levels, etc. You may want to also start with the ability to pass the config file name as a parameter when launching your tests. And place your configuration in .properties.
  13. Use TestNG. JUnit works fine, but use TestNG. Then learn about grouping tests and using datasources. They will give you incredible flexibility.
  14. Keep driver use (FireFoxDriver, ChromeDriver, etc) inside the page objects. Don't let them appear in your test scripts.
  15. Use @BeforeClass and @AfterClass (or their variants) to setup and teardown drivers and connections to outside resources (a driver is an outside resource).
  16. Reporting.
    This is a very crucial piece which many ignore while creating the framework. The report that you present is what other teams would see. It should be simple, concise and easy to access.
    Another point about reporting is sending email alerts to the team whenever a test fails. No one wants to/can keep an eye on a test suite all the time. If something fails, framework should alert the users. It should also be noted that too much of alerts will cause the teams to ignore it. So alert the teams only on failures and not at the end of every execution.
  17. Write a test case script as small as possible.
  18. Write test cases as independent with each other. Write each test as its own unit. Write the tests in a way that won't be reliant on other tests to complete.
  19. Store locators separately. (Do not include locators in test script flow.)
  20. Write a different method for each common/unique/specific action. (Even though it has one line to execute no problem but, it should be a separate method.)
  21. Reuse the code (methods). Do not duplicate code anywhere. (I mean don't copy paste any lines from one file to another. Instead of the create a methods with those lines and call that method in both files.)
  22. Have separate library called utility with Reporting, necessary credentials, browser configurations, etc.
  23. Have common naming structure. Such as method name, class name, variable names.
  24. Creating methods to pre-load data for testing should not be done using Selenium, existing APIs should be leveraged to create data for the AUT.

Selenium - Selenium best practices相关推荐

  1. [Selenium] Selenium定向爬取海量精美图片及搜索引擎杂谈

    我自认为这是自己写过博客中一篇比较优秀的文章,同时也是在深夜凌晨2点满怀着激情和愉悦之心完成的.首先通过这篇文章,你能学到以下几点:         1.可以了解Python简单爬取图片的一些思路和方 ...

  2. python + selenium - selenium常用元素定位

    1. Chrome定位工具 打开Chrome浏览器,按F12会弹出开发者工具选项,选择Elements: 1)鼠标点击最左边箭头 2)鼠标滑动到页面中你要操作的元素,单击一下 3)对应的html元素内 ...

  3. Selenium 不同版本的区别

    Selenium 是用于测试 Web 应用程序用户界面 (UI) 的常用框架.它是一款用于运行端到端功能测试的超强工具.您可以使用多个编程语言编写测试,并且 Selenium 能够在一个或多个浏览器中 ...

  4. Python:Selenium和PhantomJS

    Selenium Selenium是一个Web的自动化测试工具,最初是为网站自动化测试而开发的,类型像我们玩游戏用的按键精灵,可以按指定的命令自动操作,不同是Selenium 可以直接运行在浏览器上, ...

  5. python selenium p_Python爬虫(二十一)_Selenium与PhantomJS

    本章将介绍使用Selenium和PhantomJS两种工具用来加载动态数据,更多内容请参考:Python学习指南 Selenium Selenium是一个Web的自动化测试工具,最初是为网站自动化测试 ...

  6. 三天学会Selenium,阿里p7精心整理自动化测试Selenium大礼包

    大家都知道Selenium很好用,Selenium作为一个 Web 应用程序自动化测试工具,Selenium 可以直接驱动浏览器,模拟真正的用户操作,解决回归测试和多浏览器兼容性测试问题:而且跟 Py ...

  7. Python+Selenium自动化

    2019独角兽企业重金招聘Python工程师标准>>> 1,什么是selenium selenium是一个开源的自动化测试框架,主要适用WEB测试,可以支持多种语言(Java, C# ...

  8. Selenium + Nightwatch 自动化测试环境搭建

    首先要安装 Java 7 或更高 ,(http://www.oracle.com/technetwork/java/javase/downloads/index.html) 并且 java 命令可正常 ...

  9. selenium RC 环境配置

    在网上搜索了许久,没找到有具体的配置,只是简单了写了几个步骤,自己琢磨了一下,于是,就想整理一篇文章,便于以后温习. 本文是参照官网的步骤进行了,当然了,也不完成相同.在这里我要说的是java的环境, ...

最新文章

  1. ios软件商店上架老被打回_安卓神级特殊站点+苹果下载神器上架
  2. php读取大文件某行内容,php读取大文件最后几行数据的实现代码
  3. 查看ocx控件CLSID的方法
  4. DirectSound的应用
  5. react开发心路历程
  6. 【windows gdi+】GDI+ Image类加载图片时异常问题处理与分析
  7. 为何要领域驱动设计?
  8. jQuery:1.5.4.3,表格变色(单击行,把当行的单选按钮(radio)设为选中状态,并应用当前样式)...
  9. 数学思维比数学运算更重要
  10. C++(STL):12--- list基本介绍
  11. 宝塔php安装那个合_使用宝塔面板安装nextcloud | 启用本地存储 | 安装smbclient
  12. Google搜索语法
  13. ORA-28056,安装Oracle出错
  14. Unity Koreographer 之 音乐制作插件介绍学习,一般使用步骤介绍(包括:一般音乐游戏制作流程简绍) 一
  15. 单声道数据转双声道_单声道转双声道
  16. 能解方程的计算机在线计算,解方程计算器在线计算
  17. 教团1886:高端的半成品电影
  18. 小程序携带参数跳转的方式wx.navigateTo的URL和通过data-传递
  19. 搭建容器私有创库Harbor
  20. uniapp 即时通讯_uniapp中与webview的即时通讯

热门文章

  1. 如何将Excel数据快速生成炫酷仪表盘
  2. CSS自适应实现图标右上角消息数字提示
  3. Matlab:查找要使用的函数
  4. 西门子PLC_300F系列PLC_初始化MMC卡实验教程 S_L01
  5. 【3D目标检测】SECOND: Sparsely Embedded Convolutional Detection论文解读(2018)
  6. Stunnel 的用法
  7. UIKit 框架讲解
  8. 运用PyPDF2模块,解密PDF文件
  9. 阿里云大学公益人才培养平台上线,让科技更有温度,让人才大有作为
  10. JSP+MySQL校园新闻网站实战教程与源代码