简体   繁体   English

Selenium v​​s. SimpleTest vs. WatiN

[英]Selenium vs. SimpleTest vs. WatiN

It seems there is very few comparison between Selenium / WatiN and SimpleTest (which has web testing features too). 似乎Selenium / WatiNSimpleTest之间的比较很少(它也有Web测试功能)。

I tried Selenium and found the GUI great to create tests as you can see what's going on and record without typing all commands manually. 我尝试了Selenium并发现GUI非常适合创建测试,因为您可以看到正在进行的操作并且无需手动键入所有命令即可进行记录。

As for running the tests, Selenium is way more complex than SimpleTest. 至于运行测试,Selenium比SimpleTest更复杂。 For SimpleTest you just have to run a PHP script which does all the tests (client or browser side). 对于SimpleTest,您只需运行一个PHP脚本来执行所有测试 (客户端或浏览器端)。 This means that whatever browser or browser settings you're using, you can simply go to the test URL and it'll work just the same . 这意味着无论您使用何种浏览器或浏览器设置 ,您都可以直接转到测试网址, 它的工作方式也相同

What would be useful here are some comments from people that used Selenium or WatiN: Why is Selenium so famous? 这里有用的是使用Selenium或WatiN的人的一些评论:为什么Selenium如此着名? In other words, what would be the main benefit of using Selenium for example, over SimpleTest? 换句话说,与SimpleTest相比,使用Selenium的主要好处是什么?

PS: Please exclude reasons like "SimpleTest requires PHP"; PS:请排除“SimpleTest需要PHP”等原因; that's pretty obvious is PHP is included in most LAMP anyway. 很明显,PHP无论如何都包含在大多数LAMP中。

There is a major difference between SimpleTest's web-tester and the Selenium suite : SimpleTest的Web测试器Selenium套件之间存在重大差异:

  • Selenium works with a real browser : Selenium使用真正的浏览器
    • Each time a test is launched, a real Firefox, or a real Internet Explorer, is launched 每次启动测试时,都会启动真正的Firefox或真正的Internet Explorer
    • All the browsing is done in that real browser 所有浏览都在真实的浏览器中完成
    • Which means you get all the Javascript features from the browser -- ie you can test fully-dynamic webpages. 这意味着您可以从浏览器获得所有Javascript功能 - 即您可以测试完全动态的网页。
  • SimpleTest's web-tester simulates a browser : SimpleTest的网络测试程序模拟浏览器
    • An HTTP request is sent, the HTML content is fetched 发送HTTP请求,获取HTML内容
    • And that HTML content is parsed 并且解析了HTML内容
    • There is some level of features to test cookies and forms ; 测试cookie和表单有一定的功能; but nothing about Javascript 但没有关于Javascript


A couple of consequences and thoughs : 一些后果和结果:

  • Selenium tests take a lot of time to execute : launching a browser, and surfing (which includes downloading the JS/CSS/images, display everything including the ads, ...) , is long and slow Selenium测试需要花费大量时间来执行:启动浏览器和冲浪(包括下载JS / CSS /图像,显示包括广告在内的所有内容......) ,漫长而缓慢
  • SimpleTest tests should be faster : only send the HTTP request, parse the HTML, and that's it SimpleTest测试应该更快:只发送HTTP请求,解析HTML,就是这样
  • Selenium requires a machine with a graphical interface, to launch the browser, which is a graphical software ; Selenium需要一台带有图形界面的机器来启动浏览器,这是一个图形软件; which also means it's harder to install/configure 这也意味着它更难安装/配置
  • Selenium allows you to test rich/dynamic/javascript-based applications much better that only fetching and parsing HTML Selenium允许您更好地测试基于丰富/动态/ javascript的应用程序,仅提取和解析HTML
  • If you are testing a PHP application, PHPUnit is generally considered much better (it's activelly maintained and developped, at least) that SimpleTest ; 如果您正在测试PHP应用程序,那么通常认为PHPUnit比SimpleTest要好得多(它至少得到了积极的维护和开发) ; and PHPUnit has support for Selenium tests 和PHPUnit支持Selenium测试


I would recommend a combinaison of both, if you can : 如果可以的话,我会推荐两者的组合:

  • Test HTML-related stuff with SimpleTest (Or Zend_Test , if using Zend Framework) : 使用SimpleTest测试与HTML相关的东西(或Zend_Test ,如果使用Zend Framework)
    • it'll be faster 它会更快
    • those tests will not depend on a browser 这些测试不依赖于浏览器
  • Test dynamic pages with Selenium 使用Selenium测试动态页面

ie use the best of both tools ;-) 即使用两种工具中最好的;-)

Since SimpleTest only deals with the HTML content of a page you can't test pages with it that rely on JavaScript behavior. 由于SimpleTest仅处理页面的HTML内容,因此无法使用依赖于JavaScript行为的页面对其进行测试。 At the end of the day it's a speed and functionality tradeoff. 在一天结束时,这是速度和功能的权衡。

  • If you need JavaScript functionality or want to test browser-specific behavior, use Selenium. 如果您需要JavaScript功能或想要测试特定于浏览器的行为,请使用Selenium。
  • If you want speed and have static HTML pages, use SimpleTest. 如果您想要速度并拥有静态HTML页面,请使用SimpleTest。

BTW, Selenium can be integrated into a PHPUnit test suite: http://www.phpunit.de/manual/3.1/en/selenium.html BTW,Selenium可以集成到PHPUnit测试套件中: http//www.phpunit.de/manual/3.1/en/selenium.html

Just to add another option, TestPlan works with both the Selenium back-end and HTMLUnit, so it can be used with our without a browser. 只是为了添加另一个选项,TestPlan可以与Selenium后端和HTMLUnit一起使用,因此它可以在没有浏览器的情况下使用。 The scripting language is simple and allows fast creation of automation tasks. 脚本语言很简单,可以快速创建自动化任务。

The browserless backend supports JavaScript very well, but for those cases where it just doesn't work you just switch to the Selenium mode and use a real browser. 无浏览器后端支持JavaScript非常好,但对于那些无法工作的情况,您只需切换到Selenium模式并使用真正的浏览器。

Also note that simpletest needs the drupal codebase to be patched. 另请注意,simpletest需要修补drupal代码库。 You cannot test your site on an exact mirror of your production site. 您无法在生产站点的精确镜像上测试您的站点。

Regards. 问候。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM