Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Ask HN: Any Javascript Framework specific Selenium Version?
10 points by digamber_kamat on June 3, 2009 | hide | past | favorite | 12 comments
I am developing a site which is completely written in Extjs Framework. Which means 0 lines of static HTML code. All the Ids, classes etc are assigned during run time. I am not sure how to use selenium in such situations. Can some one help me out?


You have complete control over which classes are assigned to what nodes.

For example if you create an alert box with ExtJS you can always add a no-op classname to it. This way you can write your Selenium test to do class based look ups and then verify the contents of the child nodes within.


This sounds the most promising one. But say I have an Extjs COmboBox and I want to select a particular item in it. It becomes too difficult to do it your way. I have to use the Selenium.Eval function and write some javascript in it.


If all the ids and classes are assigned during run-time, you're kinda SOL. Though Selenium does support other locator strategies like XPath, and even plain old JavaScript expressions to find an element. I would ask the the ExtJS folks how they would expect someone to test their app from a GUI perspective. You need some kind of reliable handle to find an element on the page so you can act on it.


The only advice I can offer is to keep as much code gui-agnostic as possible. The usual advice, really, just applied to javascript. Then you can use something like http://jsunity.com/ to test most of it. Gui testing is inevitably harder anyway, even if there are tools.


"Gui testing is inevitably harder anyway, even if there are tools"

I agree. The Selenium project could really use some volunteers to look at the major JS frameworks out there and help make them more testable with Selenium (or WebDriver, which Selenium is merging with in Se 2.0).


jsunity I feel is for unit testing only, that is where when one has many functions with strict parameters and return values. I am not sure how it can be used for GUI testing.



yes that helped a good deal, but not solved the problem completely.


Oh boy. Someone found a hammer and quickly ran out of thumbs.

I am developing a site

Everything that followed that utterance was a bad idea. At that point, you're not using javascript for the portability, light weight OR "scripting". You should have used any "applet" RIA technology out there and you would have been fine; java, flash, silverlight.


@mahmud - what a useless, unconstructive comment. There's no reason why you can't create rich webs using an Ajax framework - in fact that's the whole reason they exist.

As regards the original question, I'm sorry I can't help. You should try the ExtJS website, they have a vibrant community there.


Neither Flash, Java or Silverlight will work with Selenium either. In fact, it's pretty hard to get any form of automated acceptance testing working with any of the RIA technologies.


A very unuseful comment indeed.

It is a wrong perception that JS needs to be used only for portability, light weight OR "scripting". AJAX frameworks exist for a reason.

The reason being they are far more scalable, modifiable, flexible, compatible and most importantly they have seamless integration with any server side technology. Also the development is possible to break into distinct task and get them outsourced/shared as required.

I am not claiming that other technologies cant do all this but, JS based AJAX frameworks make your life easy.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: