我只是想从运行 Selenium 的人那里得到一些意见 (http://selenium.openqa.org) 我有对 WaTiN 有丰富的经验,甚至为其编写了一个录音套件。 我让它生成了一些结构良好的代码,但仅由我维护,看来我的公司几乎放弃了它。
如果您运行过 Selenium,您是否取得了很大的成功?
我将使用 .NET 3.5,Selenium 可以很好地配合它吗?
生成的代码是干净的还是只是所有交互的列表? (http:// /blogs.conchango.com/richardgriffin/archive/2006/11/14/Testing-Design-Pattern-for-using-WATiR_2F00_N.aspx)
分布式测试套件的公平性如何?
对系统的任何其他抱怨或赞美将不胜感激!
I just wanted some opinions from people that have run Selenium (http://selenium.openqa.org) I have had a lot of experience with WaTiN and even wrote a recording suite for it. I had it producing some well-structured code but being only maintained by me it seems my company all but abandoned it.
If you have run selenium have you had a lot of success?
I will be using .NET 3.5, does Selenium work well with it?
Is the code produced clean or simply a list of all the interaction? (http://blogs.conchango.com/richardgriffin/archive/2006/11/14/Testing-Design-Pattern-for-using-WATiR_2F00_N.aspx)
How well does the distributed testing suite fair?
Any other gripes or compliments on the system would be greatly appreciated!
发布评论
评论(5)
我从 Selenium IDE 和 Selenium Core 开始。 这些绝对是帮助您入门的好工具。 但它们并不是很强大,因为您只能使用 Selenese,Selenium 的基于 HTML 的逐个命令语言。
现在我将 Selenium Remote Control 与 Ruby 驱动程序结合使用,这使我能够利用 Ruby 提供的功能。 我测试了许多环境:Windows 2000、XP、Vista、Mac 10.4/10.5,对于每个适用的环境,Safari 2/3、Firefox 2/3、Internet Explorer 6/7。
Selenium 声称与所有这些操作系统和浏览器兼容,尽管我目前在使用 Internet Explorer 时遇到了问题(实际上,我在 StackOverflow 上的第一个问题就是关于这个问题)。 但我不知道有任何其他工具如此强大并且适用于如此多的平台。
我在使用 Selenium 时遇到的最大问题是 DOM 解析。 JavaScript 的 childNodes 不可靠,因为 Safari/Firefox 会忽略空格和空格。 注释节点,而 Internet Explorer 没有。 Internet Explorer 中的 XPath 比 SF/FF 中慢 10-20 倍。 innerHTML 在 IE 中并不总是可靠。
I started out with Selenium IDE and Selenium Core. Those are definitely good tools to get you started. But they're not very powerful, since you can only use Selenese, Selenium's HTML-based command-by-command language.
Now I use Selenium Remote Control with the Ruby driver, which allows me to utilize what Ruby offers. I test many environments: Windows 2000, XP, Vista, Mac 10.4/10.5, and for each of those that apply, Safari 2/3, Firefox 2/3, Internet Explorer 6/7.
Selenium claims to be compatible with all those OS's and browsers, though I'm having problems currently with Internet Explorer (my first question on StackOverflow is about that, actually). But I don't know of any other tools that are this powerful and works with so many platforms.
The biggest problem I've had with Selenium is the DOM parsing. JavaScript's childNodes is unreliable because Safari/Firefox ignore whitespace & comment nodes, while Internet Explorer doesn't. XPath in Internet Explorer is 10-20 times slower than in SF/FF. innerHTML isn't always reliable in IE.
我是 Selenium 的忠实粉丝。 不过,最好提前了解的一个主要问题是 Selenium IDE 在弹出窗口方面存在很多问题。 这些问题在 Selenium RC 中不会持续存在,但它会让开发变得有点头疼。
I'm a big fan of Selenium. One major gotcha that's good to know about ahead of time, though, is that Selenium IDE has a lot of trouble with pop-up windows. These problems don't persist in Selenium RC, but it can make development a bit of a headache.
Selenium 是相当不错的工具,但有几点需要注意:
Selenium IDE 和 Selenium 核心并不共享 100% 相同的功能。 例如,IDE 支持右键单击,但当前的核心版本不支持。 但是,使用其存储库中的较新版本可以解决这个问题。
如果是 ext js、gwt 等,请确保您的显示元素拥有正确的 ID,而不是自动生成(随机)的 ID。
如果是 ext js、gwt 等,
维护测试用例。 我见过在 Selenium 测试和良好覆盖率上投入大量精力的案例。 后来测试开始失败,因为创建测试的人正忙于其他任务并且没有其他人愿意接触它们。 但这是管理问题,而不是 Selenium。
Selenium is pretty decent tool but there are couple things to watch out:
Selenium IDE and Selenium core do not share 100% same functionality. For example right clicking is supported by IDE but current core release does not have it. However, using a newer version from their repository solves that.
In case of ext js, gwt etc make sure you have proper IDs for your display elements instead of automatically generated (random) ones.
Maintaining test cases. I have seen cases where a lot of effort was put on Selenium tests and good coverage. Later on tests started to fail as the person creating them was busy with other tasks and no-one else wanted to touch them. But this was issue with management, not Selenium.
如果您使用 Selenium IDE 生成代码,那么您只需获取 selenium 执行的每个操作的列表将执行。 对我来说,Selenium IDE 是开始或进行快速“尝试和查看”测试的好方法。 但是,当您考虑可维护性和更具可读性的代码时,您必须编写自己的代码。
实现优秀 Selenium 代码的一个好方法是在代码表示导航流程的一种方式。 这是我在 Coding Dojo Floripa(来自巴西):
希望有帮助
If you are using Selenium IDE to generate code, then you just get a list of every action that selenium will execute. To me, Selenium IDE is a good way to start or do a fast "try and see" test. But, when you think about maintainability and more readable code, you must write your own code.
A good way to achieve good selenium code is to use the Page Object Pattern in a way that the code represents your navigation flow. Here is a good example that I see in Coding Dojo Floripa (from Brazil):
Hope that Helps
我正在使用 Selenium Remote Control 来测试 ASP.Net 应用程序(这也是我假设您的目标),并且效果很好。
如果您从未使用过 Selenium,请观看一些 使用 Selenium IDE 的截屏视频。 这将使您很好地了解“Selenium”的工作原理。 IDE 是一个 Firefox 插件,基本上可以让您开发快速的录制和播放测试。 对于更大的测试套件或编写真正可维护的测试,我建议使用 Selenium Remote Control。 (如果您刚刚开始使用,那么 IDE 非常棒。)
Selenium Remote Control 让您可以使用您最喜欢的语言和单元测试框架来驱动 Web 浏览器以执行您的测试。 如果您最熟悉 C#/NUnit,则可以以这种方式编写测试并使用您喜欢的所有 NUnit 功能。 (例如,Test-Driven.net 插件)。 此外,由于您的测试是用高级语言编写的,因此您可以执行诸如从特定测试类继承之类的操作,您可以使用该测试类使实际测试方法代码更加清晰。 (或者至少这就是我编写测试的方式。它让我可以测试复杂的场景,从而使我的测试方法行数保持在合理的数量。)
您提到了分布式测试。 不幸的是,我还没有找到一种方法来将 Selenium Grid 项目与 NUnit 一起使用。 Selenium Grid 允许您在许多不同的机器和浏览器实例上执行测试套件。 因此,您可以将负载分散到一台或多台计算机上的四个 Grid 实例上(即一次在四个不同的浏览器实例中运行),而不是依次运行 200 个测试方法(即串行)。关于您想要获得的分布程度。
如果您使用 Java 或 PHP 编写测试,您可能会有更好的运气。 我期望这可以通过 NUnit 随 NUnit2.5 版本提供,其中将包括用于并行测试的 pNUnit。
如果您对硒有任何其他疑问,只需澄清您原来的问题,我将很乐意尝试帮助您。 (Selenium 只是我每天使用的工具之一,所以我喜欢帮助新人开始使用它......)
I'm using Selenium Remote Control in order to test ASP.Net apps (which is what I'm assuming you'll be targetting as well), and it works great.
If you've never used Selenium, watch some of the screencasts for using Selenium IDE. This will give you a good idea of how 'Selenium' works. The IDE is a firefox plugin that basically lets you develop quick record-and-play tests as you go. For larger test suites or for writing really maintainable tests though, I'd recommend Selenium Remote Control. (The IDE is terrific if you're just getting a start though.)
Selenium Remote Control lets you use your favourite language and unit testing framework to drive a web browser in order to execute your tests. If you're most comfortable with C#/NUnit, you can write your tests that way and use all the NUnit goodies that you like. (For example, the Test-Driven.net plugin). Also, since your tests are written in a high level language, you're able to do things like inherit from a particular test class which you can use to make your actual test method code much cleaner. (Or at least thats the way I write my tests. It lets me test complex scenarios which keeping my test method line-count at a reasonable number.)
You mention distributed testing. Unfortunately I haven't found a way to use the Selenium Grid project with NUnit. Selenium Grid allows you to execute your test suite over a number different machines and browser instances. So rather than running through say 200 test methods one after another (ie, serially), you could spread the load out over say four Grid instances (ie, running in four different browsers instances at a time) on a single machine or multiple machines depending on how distributed you want to get.
If you write your tests in Java or PHP though, you might have better luck. I'm expecting this to be available via NUnit with the release of NUnit2.5 which will include pNUnit for parallel testing.
If you have any further questions about selenium, just clarify your original question and I'll be happy to try and help you out. (Selenium is just one of those tools that I use everyday so I enjoy helping to get new people started with it..)