Test

October 11, 2012

[iframe width=’480′ height=’360′ src=’http://www.vyclone.com/embedded/5074a98b52fcef1a1f000a29′ frameborder=’0′ scrolling=’no’ allowFullScreen]


Agile Recruitment Agents

October 7, 2010

You are agile…


Some GWT testing techniques.

October 28, 2009

Just a collection of links to other people’s GWT testing techniques:

Testing GWT’s async services: http://www.jmock.org/gwt.html

Mocking widgets in the view: http://www.assertinteresting.com/2009/05/unit-testing-gwt/

Simon Stewart’s example app: http://code.google.com/p/tdd-gwt-gae/


Extending Selenium

October 5, 2008

I think Selenium is great for acceptance testing websites. But I’ve found it can be pretty slow to do certain things in Internet Explorer, in particular anything to do with xpath queries.

Something we need to test in work is that a particular CSS class is set on a particular element. Currently Selenium doesn’t provide a way to do this without using an XPath query. However, it is fairly easy to extend Selenium and implement this without the use of XPath. The basic idea is to use Selenium’s getEval method within an extended DefaultSelenium and wrap a particular call inside a standard Java method.

Here’s an example of what I’m waffling on about:

public class ExtendedSelenium extends DefaultSelenium {
  public String getCssClass(String elementId) {
    return getEval("{selenium.browerbot.findElement('" + elementId + "').className;}")
  }
}

Selenium provides the browserbot object, this has many handy methods that work cross browser. They tend to be pretty efficient too. However you’ll have to be careful that any extensions you write, are either only going to be run on a single browser, or you write cross browser code.

Have fun!


Deleting code – what the inspector wasn’t told.

September 17, 2008

I like deleting unused code, it’s fun and satisfying. IntelliJ is brilliant at helping discover unused code too, with it’s code inspector.

Oddly, some developers go to great lengths to try and stop tools like this being able to identify if code is actually in use. One of the common techniques is to stick a class name into a database table – the reasoning for this tends to be ‘so we can change it dynamically’. This quite rightly induces a certain amount of fear in developers when it comes to deleting any code, as it might be in use.

A solution: Move the code in the database back into code.

By writing a script that runs a series of select statements on each of the columns and tables that contain the class names, then you can generate a java file that in turn has a static reference to each of the classes. This can then temporarily be included in your source tree, and the inspector can get on with it’s job. Lovely!

I’m sure this can be expanded to cover field/method names too with a little bit of generated casting.


Technical Debt.

September 14, 2008

I was ambling through some blogs that Google Reader suggested to me, and came across an article by Joe Ocampo on ‘How healthy is your code‘. It reminded me of something I heard mentioned on a project recently. It went something along the lines of ‘You are not properly stuck into a project until you have introduced some technical debt’.

It’s no surprise that the project is now struggling to maintain the rate of delivery that it started off with. Check out ‘Listening to test smells‘, a good way of showing there may be trouble ahead.

Another interesting outcome of a discussion on the subject can be found at Exploration Through Example, Brian Marick’s blog.


GWT Drag and Drop

July 29, 2008

We’re in the process of removing GWT-EXT from our app due to a large download overhead with the extjs javascript file. One of things we use is the portal drag and drop stuff… however there’s an excellent library written by Fred Sauer called GWT-DND that does a much better job. It also has a pretty simple API. The compiled GWT javascript is tiny ~9k!

Brilliant!


GWT Tools, Geez and GStyle.

July 12, 2008

I’m loving developing web applications in GWT at the moment – it’s great being back in the Java world, rather than XML / HTML / Javascript / whatever.

There’s a few things that annoy me, the widgets in GWT don’t easily allow you set an id on them, which means when it comes to testing, Selenium etc. has difficulty. So I’ve started a project called Geez that aims to add a bit more of a fluent way of building GWT apps… find it here:

http://code.google.com/p/geez/

Another thing that annoys me is still having to write style sheets for the application, and having to integrate these using string names as per defined in the style sheet. Browser incompatibilities annoy me, as GWT has abstracted away all the Javascript incompatibilities, I do wonder why they didn’t do CSS at the same time. Anyway, here’s another project I’ve started to address this:

http://code.google.com/p/gstyle4gwt/

Please note, they are very young, and I haven’t spent lots of time on them yet – so don’t whinge too much! That said, I’m more than happy for people to contribute ideas, code, tea – anything, just ping me.


Good cop, bad cop… in the pairing world

July 8, 2008

I had an interesting discussion with someone I work with over pairing sessions today, and I was very impressed with his conclusion. This was, albeit subtle – ‘there are some people that you pair with, where the best of both of you come out in the code, and there are others, where the worst of both of you come out in the code’.

Too true… there are definite boundaries when pairing, and allowing your pair to explore the code within those boundaries, before reeling them in, is a good thing. However it is definitely down to the pair as to where those boundaries lie. Sometimes there may be no scope for allowing debt / poor quality code in, and in others, it may be acceptable as the pair trusts itself to go back and fix the poor quality code before (or immediately after) checking in.


GWT and P.A.C.

June 14, 2008

I’m currently having the pleasure of developing a system using GWT, and it’s truly a step beyond typical Java web apps. The application is written in Java and hence you can use all your favourite IDEs, and it compiles to browser compatible Javascript which builds the page using the DOM directly. Meaning there’s no need to write any Javascript, or browser specific hacks.

I’ve learned a lot in the few months I’ve been working with it, but I thought I’d share a application design pattern that a previous team I was on used to develop Swing applications.

It’s called PAC (Presentation-Abstraction-Control), and it lends itself remarkably well to GWT applications.

I’m working on an example screencast which runs through the basics – hopefully this will be followed by some more in depth stuff.