[英]Using Selenium-IDE with a rich Javascript application?
At my workplace, we're trying to find the best way to create automated-tests for an almost wholly javascript-driven intranet application. 在我的工作场所,我们正在努力寻找为几乎完全由javascript驱动的Intranet应用程序创建自动化测试的最佳方法。 Right now we're stuck trying to find a good tradeoff between:
现在我们一直试图找到一个很好的权衡:
XPath expressions (or other possible expressions, like jQuery selectors) naively generated from Selenium-IDE are often non-repeatable and very fragile. 从Selenium-IDE天真地生成的XPath表达式(或其他可能的表达式,如jQuery选择器)通常是不可重复的并且非常脆弱。 Conversely, having the JS code generate special unique ID values for every important DOM-element on the page... well, that is its own headache, complicated by re-usable GUI components and IDs needing to be consistent when the test is re-run.
相反,让JS代码为页面上的每个重要DOM元素生成特殊的唯一ID值...好吧,这是它自己的头痛,复杂的可重用GUI组件和ID需要在测试重新进行时保持一致跑。
What successes have other people had with this kind of thing? 其他人对这种事情有什么成功? How do you do automated application-level testing of a rich JS interface?
如何对丰富的JS接口进行自动化应用程序级测试?
I'm considering a system where a custom locator-builder (javascript code) for Selenium-IDE will talk with our application code as the tester is recording. 我正在考虑一个系统,其中Selenium-IDE的自定义定位器构建器(javascript代码)将与测试人员正在录制的应用程序代码进行通信。 In this way, our application becomes partially responsible for generating a mostly-flexible expression (XPath or jQuery) for any given DOM element.
通过这种方式,我们的应用程序成为为任何给定DOM元素生成大多数灵活的表达式(XPath或jQuery)的部分责任。 While this can avoid requiring more training for testers, I worry it may be over-thinking things.
虽然这可以避免对测试人员进行更多的培训,但我担心这可能是过度思考的事情。
Record and Playback will not work in large scale testing. 录制和播放不适用于大规模测试。 It may work for smoke tests and small repetitive tasks.
它可能适用于烟雾测试和小型重复性任务。
Instead of trying to generate unique IDs, try to solve that with CSS based selectors. 尝试使用基于CSS的选择器来解决这个问题,而不是尝试生成唯一ID。 Generating unique ids is ideal goal but I don't think that is possible in all practical cases.
生成唯一ID是理想的目标,但我认为在所有实际情况下都不可能。
If you trying to look for custom locators, it is better to look into BDD. 如果您尝试查找自定义定位器,最好查看BDD。
Can't you use css selectors with Selenium? 你不能用selenium的css选择器吗? That seems a little more straightforward than using XPath.
这似乎比使用XPath更直接。
http://saucelabs.com/blog/index.php/2010/01/selenium-totw-css-selectors-in-selenium-demystified/ http://saucelabs.com/blog/index.php/2010/01/selenium-totw-css-selectors-in-selenium-demystified/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.