On Fri, Sep 12, 2008 at 8:12 PM, German Morales <[EMAIL PROTECTED]>wrote:
> Hi Jan, > > We are using Watir, which lets you write tests in ruby. > For those who don't want to use Ruby, Watij is the Java equivalent of Watir. http://watij.com/ But the problem with both Watij and Watir is that you have to use Microsoft Internet Explorer. FireFox is not supported. I use Selenium-RC with JUnit, works fine for me. I wrote some code to run JUnit test methods in guranteed order for functional tests and also "clickAndWait". About the problem of tests being brittle and being able to use the Wicket id-s etc. you can look at this wiki page on JMeter and Wicket: http://cwiki.apache.org/WICKET/wicket-and-jmeter-with-regular-expressions.html I haven't tried but maybe you can apply some of the ideas there to Selenium tests. So if you know the wicket:id beforehand, you could possibly access the component you need. - Peter. And we are using mainly wicket generated names for identification of > components, but sometimes we use generated attributes too (for example <a> > does not have name), or just the text in the html. > > Since the code is all in ruby, it is in theory easy to refactor in case of > some changes. > For example, you can do this: > > textfield = ie.text_field(:name, "your:very:long:wicket:generated:name") > > or, in case of page changes... > > constant_defined_somewhere = "your:very:long:wicket" > textfield = ie.text_field(:name, constant_defined_somewhere + > ":generated:name") > > then you could fix all tests just changing the constant. > Well, this is an explanation of a quick solution to your particular case of > changing the hierarchy. > But the idea is that you have a full (and good) programming language to do > things "right": refactoring, reuse, and so on. > > Beware: > Watir does not always runs perfectly... the tests are somehow dependent on > timing, which depends on the machine you run the tests, and other factors. > This is specially problematic in ajax calls. > That means that sometimes we get errors, then we run the same test again > and > it works. > > Hope this helps, > > German > > 2008/9/12 Jan Stette <[EMAIL PROTECTED]> > > > This is a bit of a general question: I'd be interested in hearing about > how > > people do automated tests of their Wicket applications. I'm thinking > about > > system tests of the full application, not unit tests. > > > > There are of course tools like Selenium which let you automate actions on > a > > web application. My colleagues with experience of this from other > > applications tell me that one of the main challenges is to stop test > cases > > from being very brittle by relying on the details of the generated > markup. > > It would be nice if it was possible to target components on a page in a > way > > that related them back to roughly the hierarchy of Wicket components. Or > > even better, if individual parts of the page (links, input fields, > buttons > > etc.) could be identified in a way that didn't break when there were > > changes > > to the Wicket component hierarchy (say, new grouping components being > > inserted higher up in the component tree). > > > > I realise this isn't the responsibility of Wicket, but are there ways in > > which Wicket can help here, e.g. by generating ids or other attributes > > inside the markup in a way that makes it easier to locate items on a > page? > > Are there other tools than Selenium that people use, that makes things > > easier? > > > > I'm looking forward to hearing about how other Wicket users deal with > these > > issues! > > > > Regards, > > Jan > > >
