On Apr 24, 10:38 am, "Ian Bambury" <ianbamb...@gmail.com> wrote:
> JUnit is part of Eclipse. Is there something you want to do which it can't?
> Ian
Is it possible use JUnit to test a running client? For example to log- in, browse to a page and then validate say that a tree expands and collapses correctly.
On Apr 24, 11:14 am, Setya <jse...@gmail.com> wrote:
> > Thanks. Is it Selenium RC?
> Yes, exactly. Also try Selenium IDE which is an action recorder than > you can playback. Unfortunately it only runs on Firefox (for now).
> Regards,
> Setya
I'm struggling with Selenium. How do you identify elements on a page? When I try Selenium IDE it records nothing. (This maybe to do with how our developers are using GWT rather than Selenium... I managed to log in with Selenium RC but as soon as I get to a real gwt page I cannot identify the elements on the page. I've tried using firebug in firefox, but I'm no closer.
> On Apr 24, 10:38 am, "Ian Bambury" <ianbamb...@gmail.com> wrote: >> JUnit is part of Eclipse. Is there something you want to do which >> it can't?
>> Ian
> Is it possible use JUnit to test a running client? For example to log- > in, browse to a page and then validate say that a tree expands and > collapses correctly.
I use selenium extensively with all my GWT apps - and wouldn't want to live without it. You can use it to cross-platform test your applications in the two major browsers - the selenium team claims it works in almost any browser! Unfortunately it quite often records the wrong things but it follows a pattern which you can work around. Things that can go wrong and their remedies:
* It records the wrong element. I find it sometimes recording xpaths on computed attributes which you can't forsee with a reasonable investment of time. In this case I assign my own IDs (DOM.setAttribute(element,"myId")) to elements and use the respective locators (that's selenium jargon for an expression be it xpath, javascript etc which returns a DOM element). If you decide to go that way, do yourself a favor and try to design your widgets in a way that this ID assignment is done more or less automatically (inheritance?)... you don't want to see it in your code all the time.
* It doesn't record clicks on images. You have to add a user extension to the selenium recorder - don't worry, it's javascript, it's easy and it is somewhere on their site.
* It can't find the elements it's supposed to click on. That's the A in Ajax - Selenium wants to click on an element as result of a click on a link or button that is not there yet. You will make good friends with waitForText or waitForElement which you will have to append manually to your scripts where you see it fit. This way you tell selenium to pause the execution until the page has changed into the state you want it to. You can set timeouts there after which you assume that your test has failed.
* It hates frames. You will have to come to peace with the setFrame function which (I don't remember now) is or is not part of the standard distro. It works more or less like the 'cd' command on the command prompt where you descent into child frames or navigate up to the parent frame of the current frame.
* It doesn't do well with closed windows. When you have a listener that closes a window, you essentially are killing the living space of Selenium. In this case move the 'close' call to a deferred command.
I'll post more if I can remember anything :)
On Apr 24, 5:05 pm, Mike <ado...@opentext.com> wrote:
> On Apr 24, 11:14 am, Setya <jse...@gmail.com> wrote:
> > > Thanks. Is it Selenium RC?
> > Yes, exactly. Also try Selenium IDE which is an action recorder than > > you can playback. Unfortunately it only runs on Firefox (for now).
> > Regards,
> > Setya
> I'm struggling with Selenium. How do you identify elements on a page? > When I try Selenium IDE it records nothing. (This maybe to do with how > our developers are using GWT rather than Selenium... I managed to log > in with Selenium RC but as soon as I get to a real gwt page I cannot > identify the elements on the page. I've tried using firebug in > firefox, but I'm no closer.
Is that actually testing anything other than "setText(NAME)" is equal to "getText(NAME)"? Shouldn't that test set the name to something else inside of testGreet()? I did not grab the code (or look at it for more than 5 seconds), so it may be performing the test, or I may be flat out wrong. Even so, I would recommend the name get something to something different, then you demonstrate updating that something different via RPC and checking it. (Beyond that I would not recommend anyone have an RPC call update a UI element directly - but this is intended to be a simple example I suppose.)
You can (marginally) test UI level events with GWT, but you really are only testing whether or not the toolkit itself propagates it's own internal events (not your own code). You are testing if ClickListener works, not whether or not your stuff works. And I say marginally because though there are ways to do it, those ways break down in many Composite widget situations.
For more testing at the GWT UI level though, see this thread: http://groups.google.com/group/Google-Web-Toolkit/browse_thread/threa.... Also note my take there that you should not really need to do this. For that level of "integration" testing Selenium is fantastic. Because Selenium uses the JS engine in the browser, by driving the browser, you can test across different platforms and so on from the integration level (the whole app, and this is similar to, but subtly different than GWT remote testing).
For individual components, widgets, RPC calls, etc, you can *and should* test using GWTTestCase. The key to that though, is to use a client side model and controller, along with your View, MVC. This allows your tests to call the controller and test things. The view (widget) does not have logic in it that you ever need to fire an event off of to test. The view widget should just invoke controller methods, and in some cases listen for model and react to model events directly. It should not however "do stuff" in terms of manipulating the model. (Test "controller.doStuff()" instead of inside the widget having to fire - leave the UI to the widget, and move the logic out to the model, via the controller).
> > On Apr 24, 10:38 am, "Ian Bambury" <ianbamb...@gmail.com> wrote: > >> JUnit is part of Eclipse. Is there something you want to do which > >> it can't?
> >> Ian
> > Is it possible use JUnit to test a running client? For example to log- > > in, browse to a page and then validate say that a tree expands and > > collapses correctly.
> On Apr 24, 10:38 am, "Ian Bambury" <ianbamb...@gmail.com> wrote: > > JUnit is part of Eclipse. Is there something you want to do which it > can't?
> > Ian
> Is it possible use JUnit to test a running client? For example to log- > in, browse to a page and then validate say that a tree expands and > collapses correctly.
I'm trying to use Selenium to test my application.
I've added identification to some html items, to images, links which seems to work since I see clicks recorded with correct id. But now I'm facing the second problem raised in this post: clicks on image are not recorded. As suggested by George, I went to selenium site to find out the selenium user extension but saw nothing that can perform this. Could you please post the name of this user extension ? or may be I have to add some code that has been posted somewhere ? then could you post where to find this ?
> I use selenium extensively with all my GWT apps - and wouldn't want to > live without it. You can use it to cross-platform test your > applications in the two major browsers - the selenium team claims it > works in almost any browser! Unfortunately it quite often records the > wrong things but it follows a pattern which you can work around. > Things that can go wrong and their remedies:
> * It records the wrong element. I find it sometimes recording xpaths > on computed attributes which you can't forsee with a reasonable > investment of time. In this case I assign my own IDs > (DOM.setAttribute(element,"myId")) to elements and use the respective > locators (that's selenium jargon for an expression be it xpath, > javascript etc which returns a DOM element). If you decide to go that > way, do yourself a favor and try to design your widgets in a way that > this ID assignment is done more or less automatically > (inheritance?)... you don't want to see it in your code all the time.
> * It doesn't record clicks on images. You have to add a user extension > to the selenium recorder - don't worry, it's javascript, it's easy and > it is somewhere on their site.
> * It can't find the elements it's supposed to click on. That's the A > in Ajax - Selenium wants to click on an element as result of a click > on a link or button that is not there yet. You will make good friends > with waitForText or waitForElement which you will have to append > manually to your scripts where you see it fit. This way you tell > selenium to pause the execution until the page has changed into the > state you want it to. You can set timeouts there after which you > assume that your test has failed.
> * It hates frames. You will have to come to peace with the setFrame > function which (I don't remember now) is or is not part of the > standard distro. It works more or less like the 'cd' command on the > command prompt where you descent into child frames or navigate up to > the parent frame of the current frame.
> * It doesn't do well with closed windows. When you have a listener > that closes a window, you essentially are killing the living space of > Selenium. In this case move the 'close' call to a deferred command.
> I'll post more if I can remember anything :)
> On Apr 24, 5:05 pm, Mike <ado...@opentext.com> wrote:
>> On Apr 24, 11:14 am, Setya <jse...@gmail.com> wrote:
>>>> Thanks. Is it Selenium RC?
>>> Yes, exactly. Also try Selenium IDE which is an action recorder than >>> you can playback. Unfortunately it only runs on Firefox (for now).
>>> Regards,
>>> Setya
>> I'm struggling with Selenium. How do you identify elements on a page? >> When I try Selenium IDE it records nothing. (This maybe to do with how >> our developers are using GWT rather than Selenium... I managed to log >> in with Selenium RC but as soon as I get to a real gwt page I cannot >> identify the elements on the page. I've tried using firebug in >> firefox, but I'm no closer.
>> How are you getting on?
-- Boris Lenzinger -+-+-+-+-+-+- CSILL (Société en cours de création) Site Web: http://www.csill.fr
c/o Telecom Paris - ENST CICA 2229, route des Crêtes 06560 Valbonne Sophia Antipolis -+-+-+-+-+-+-
> I'm trying to use Selenium to test my application.
> I've added identification to some html items, to images, links which > seems to work since I see clicks recorded with correct id. > But now I'm facing the second problem raised in this post: clicks on > image are not recorded. As suggested by George, I went to selenium site > to find out the selenium user extension but saw nothing that can perform > this. > Could you please post the name of this user extension ? or may be I have > to add some code that has been posted somewhere ? then could you post > where to find this ?
> Thanks in advance.
> Boris
> George Georgovassilis a écrit : > > I use selenium extensively with all my GWT apps - and wouldn't want to > > live without it. You can use it to cross-platform test your > > applications in the two major browsers - the selenium team claims it > > works in almost any browser! Unfortunately it quite often records the > > wrong things but it follows a pattern which you can work around. > > Things that can go wrong and their remedies:
> > * It records the wrong element. I find it sometimes recording xpaths > > on computed attributes which you can't forsee with a reasonable > > investment of time. In this case I assign my own IDs > > (DOM.setAttribute(element,"myId")) to elements and use the respective > > locators (that's selenium jargon for an expression be it xpath, > > javascript etc which returns a DOM element). If you decide to go that > > way, do yourself a favor and try to design your widgets in a way that > > this ID assignment is done more or less automatically > > (inheritance?)... you don't want to see it in your code all the time.
> > * It doesn't record clicks on images. You have to add a user extension > > to the selenium recorder - don't worry, it's javascript, it's easy and > > it is somewhere on their site.
> > * It can't find the elements it's supposed to click on. That's the A > > in Ajax - Selenium wants to click on an element as result of a click > > on a link or button that is not there yet. You will make good friends > > with waitForText or waitForElement which you will have to append > > manually to your scripts where you see it fit. This way you tell > > selenium to pause the execution until the page has changed into the > > state you want it to. You can set timeouts there after which you > > assume that your test has failed.
> > * It hates frames. You will have to come to peace with the setFrame > > function which (I don't remember now) is or is not part of the > > standard distro. It works more or less like the 'cd' command on the > > command prompt where you descent into child frames or navigate up to > > the parent frame of the current frame.
> > * It doesn't do well with closed windows. When you have a listener > > that closes a window, you essentially are killing the living space of > > Selenium. In this case move the 'close' call to a deferred command.
> > I'll post more if I can remember anything :)
> > On Apr 24, 5:05 pm, Mike <ado...@opentext.com> wrote:
> >> On Apr 24, 11:14 am, Setya <jse...@gmail.com> wrote:
> >>>> Thanks. Is it Selenium RC?
> >>> Yes, exactly. Also try Selenium IDE which is an action recorder than > >>> you can playback. Unfortunately it only runs on Firefox (for now).
> >>> Regards,
> >>> Setya
> >> I'm struggling with Selenium. How do you identify elements on a page? > >> When I try Selenium IDE it records nothing. (This maybe to do with how > >> our developers are using GWT rather than Selenium... I managed to log > >> in with Selenium RC but as soon as I get to a real gwt page I cannot > >> identify the elements on the page. I've tried using firebug in > >> firefox, but I'm no closer.
> >> How are you getting on?
> -- > Boris Lenzinger > -+-+-+-+-+-+- > CSILL (Société en cours de création) > Site Web: http://www.csill.fr
> c/o Telecom Paris - ENST > CICA > 2229, route des Crêtes > 06560 Valbonne Sophia Antipolis > -+-+-+-+-+-+-
We are using WATIR http://www.openqa.org/watir/ from the same site. It has some level of cross browser support but is primarily for IE control. I would say the main advantage is that it uses ruby as a DSL and so the tests read like a testing script. Also no complex setup required as Selenium does to have a proxy server to bypass the javascript same site policy
<g.georgovassi...@gmail.com> wrote: > I use selenium extensively with all my GWT apps - and wouldn't want to > live without it. You can use it to cross-platform test your > applications in the two major browsers - the selenium team claims it > works in almost any browser!