Do your scripts suffer from the following automation test flaky symptoms?

  • Test randomly fail
  • Works on your machine but not on another machine
  • Test take a long time to run
  • False positives/negatives results
  • Unreliable test run in CI have you contemplating a new career as a sheep herder

If so, your test might suffer from a common under-diagnosed automation disease known as Stinky Synchronization Syndrome.

One of the biggest killers of test automation script reliability is the failure to use proper synchronization/wait points in Selenium. Read the rest of this post to learn how to treat this world wide epidemic.

http://www.joecolantonio.com/2014/04/01/the-1-killer-of-selenium-script-performance-and-reliability/

自动化测试中经常遇到失败的脚本,但是很多情况下,这些失败的脚本是没有意义的,可能是对象没有出现导致的。因为在web程序中对象的显示反应时间是不一致的。不同的网络环境,不同的操作会导致相应的时间的不同。如果避免?

尽量不用使用以下两种方式等待对象出现:

1. driver.manage().timeouts().implicitlyWait(GlobalDefinition.WEBELEMENT_LOADING_TIME, TimeUnit.SECONDS);

2.Thread.sleep();

推荐使用如下方式进行对象同步操作:

try{
WebDriverWait wait = new WebDriverWait(getDriver(),10);
wait.until(ExpectedConditions.visibility(joeLogo));
return true;
}catch(org.openqa.selenium.NoSuchElementException e){
return false;
}

最新文章

  1. oracle 的 nubmer 类型与 C# 的 float double decimal 对应关系
  2. Java学习笔记(二二)——Java HashMap
  3. HttpClient工具类v1.7
  4. php 错误 Strict Standards: PHP Strict Standards: Declaration of .... should be compatible with that of 解决办法
  5. JDBC的URL设置allowMultiQueries的原因
  6. 51nod1262 扔球
  7. /proc/sys/vm/ 内存参数
  8. trash目录: ~/.local/share/Trash
  9. 百思不得其解—这些年做Web开发遇到的坑?
  10. Java面向对象程序设计--接口和内部类
  11. MyEclipse右键new菜单项的设置 及 Eclipse中各种文件不能保存中文的问题
  12. shopnc怎么开启伪静态 shopnc开启伪静态的方法
  13. .Net日期处理之格式化
  14. Google mobile test
  15. C#基础(四)--值类型和引用类型,栈和堆的含义
  16. AtomicInteger类的使用
  17. Http长连接
  18. Spring Boot入门(13)自制音乐平台
  19. PSi-Population Stability Index (PSI)
  20. 十步轻松搞定IIS+PHP环境搭建

热门文章

  1. python3 使用SimpleHTTPServer搭建web服务器
  2. 转发(Forward)和重定向(Redirect)的区别
  3. POJ 2718【permutation】
  4. 【AtCoder】ARC082
  5. BZOJ1303 [CQOI2009]中位数图 其他
  6. 051 日志案例分析(PV,UV),以及动态分区
  7. Android:contentDescription 不是无用
  8. Unity报错 : BCE0004: Ambiguous reference 'preview': CameraMotionBlurEditor.preview, UnityEditor.Editor.preview.
  9. Manjaro 初始配置----anaconda-pycharm-opencv-tensorflow
  10. springboot springcloud 父项目pom工程创建pom文件