Jboss Seam and Selenium. Part 2.

November 2nd, 2009

It has been a long time since I posted anything on this blog, longer still since I posted anything of actual value.  But today I have a tiny little nugget of useful stuff to post.

That doesn’t mean I haven’t been doing anything that wasn’t blogable, its just that never got round to it.  I am still using Jboss Seam to attempt to implement a solution at work, which contains many cool features.

-         Using Hibernate search to index and search inside documents of various formats.
-         Building a fairly advanced and somewhat sexy UI using icefaces, a library which on some occasions causes more problems than it solves.
-         Building a basic version management system
-         An extremely elaborate user management / permissions system

Each of these battles have contained a few “I should blog that” moments.  However my problem is that I am more interested in doing stuff with the cool thing I just wrote and connecting it to other cool things.  This means I forget to write that blog post and sometimes, just sometimes, I toss TDD out the door and just go, then have to come back later and update a test.

Anyway to the point of today’s post.

We were having a problem testing with Selenium due to the fact that left to its own devices Seam will generate its own element ids.  These element ids look like this:

<TD class=”panelStyle2” id=”j_id:07:j_id68-0-2”>

While these are unique for every element they are not the most readable of ids, Setting the id on an element will help clean this up a bit:

<ice:panelGroup id=”topPanel” style=”panelStyle2”>

It will let seam generate an element which looks a bit like this:

<TD class=”panelStyle2” id=”j_id07:topPanel”>

Now these are a bit better and these are how we started doing selenium tests. This format can also be seen in my previous post Introduction to testing in Selenium

However we found that whenever we added new pages to the application all the tests would break, and, after some investigation, we found that the first part of the ids had changed.

<TD class=”panelStyle2” id=”j_id07:topPanel”>

Became

<TD class=”panelStyle2” id=”j_id08:topPanel”>

Even though the page that topPanel was on remained unchanged.  This off course made testing with selenium great fun as the full id had to be used so we could get a handle on the element (we didn’t want to use the xpath).  So whenever we added a page we would have to alter the tests.

The bigger the application got the stupider that idea became,

The solution was in hindsight very simple however there was a fair bit of searching done to find a solution without success. The solution was to assign an id to the <form> element that surrounds all the elements change:

<h:form>
<ice:panelGroup id=”topPanel” style=”panelStyle2”>

</ice:panelGroup>
</h:form>

To

<h:form id=”aForm”>
<ice:panelGroup id=”topPanel” style=”panelStyle2”>

</ice:panelGroup>
</h:form>

And you get

<TD class=”panelStyle2” id=”aForm:topPanel”>

This ids wont change, Selenium will be happy and so will you.

More posts to come soon, anything you want to know, please leave a comment.

Seam, Testing, selenium

MySQL vs MySequal, nitpicking? Yes but it bugs me

April 16th, 2009

I mentioned this in my post about recruitment consultants and how I once recieved a email from them once asking for

Must know Java, EBJ, Oracle,XML and seequal

I put this down to the consultant writing something down the way client said it. since then I have spoken to a few people who have mentioned to me that they also pronounce it “MySequal” or when they here rookies to the development business they where asked by a boss to do some sequal and which resulted in them wondering what the boss was asking. One person even told me “It is sequal thats how you pronounce it” they where quite adament they where right.

However today I was on the MySQL website and I found the following:

The official way to pronounce “MySQL” is “My Ess Que Ell” (not “my sequel”), but we do not mind if you pronounce it as “my sequel” or in some other localized way source

So Ha I was right! ok it seems the other way is acceptable but its not right… and as a man of science I believe that being right is without a doubt better than being close enough.

I couldnt find a picture of a lolcat saying something funny about this.. suprisingly I may have to make one if I can think of something funny to write about this.

More Interesting technical blogs are comming. I am playing with Ruby on Rails right now and as of yet I think its good but I dont know enough to make a tutorial on any better than some of the thousands that are about.

If you want a good tutorial read my EJB3 and Jboss Seam Hello world tutorial its very good.

Database, general ,

It comes in mobile as well now?

March 14th, 2009

I have had a iPhone 3g since launch day I queued up at 4 am to get one and since then I have still not used it to it’s full potental.

One of the features I rarely use is the iTunes and app store other than buying a few songs when drunk and the odd free game or Twitter app I never use it, however I’m bored now and playing about with it I was looking through the app catalog and most of them are totally crap, why would u pay £2 for some app which once a day created an alert that u had to do some situps or a need for multiple rss readers and the stuff they pass off as entertainment is laughable some of them the graphics look worse than something I would have had on my NES 20 years ago, tho after my search today I now have 4 apps Texas holdum, bejewlled, twiterific and as off today wordpress so I can blog on the go, granted it will be difficult to post source code but at least I can post random stuff and still attach various lolcat images that somehow tie into my ramblings

Web, general ,

Have IT term dictionary and not affraid to use it

March 3rd, 2009

Anyone who has at one time or another have listed their CV on a jobs website will know that your email account will forever be cursed with spam from recruitment agents, or (Blood sucking recruitment vampires) as they are called in our office.

These email are normally about jobs you are not qualified, have no experience off and live nowhere near. anyone looking at your CV could see in a few seconds you would probably not be suitable for a particular job. “Senior Systems Architect £70k+ Cornwall” I remember getting spam like that when i was a wet behind the ears graduate living in Aberdeen looking for my first job.

Mostly these emails the ones I do read normally contain a list of technical buzz words which the agent has no idea about and just lists because the client I once got a email which contained a line like:

Must know Java, EBJ, Oracle,XML and seequal

I had to think about it for a while wondering “whats seequal?” until I released it was SQL they had just written it as the client had said it… I have a further dislike for people who pronounce SQL as “seequal” but thats a post for another time.

Anyway my point of this post is today I received one such email for a agent with the header “Java Developer – 3 month contract – Fife” I’m personally not looking for a job I’m happy where I am (Unless Blizzard or RockStar North want to talk then I’m quite willing to listen) however I have a few friends who have fallen victim to the “Credit Crush” and are currently looking for jobs. I thought I might forward to them until I read the body of the message

My Client is currently looking for an experienced Java Developer to develop a redundant, high available, distributed solution that will enable them to deliver its value added strategy. Skills: Java, J2EE,object oriented design distributed environment, RDBMS

Now I can work out what the client wants but as an attempted sales pitch to get me interested it couldn’t have been a bigger failure. it goes back to the fact the client mentioned some of the things they need or are making the agent then just listed them while also referring to their customer as a “it”

Come on recruitment people if I was the client I would be annoyed that you where attempting to get people interested in my company with a crappy email like that. and worried that I would be missing out on getting the best possible candidates because they didn’t bother to read your spam email or did read it, laughed at it, showed there colleagues who also laughed. posted it on a blog and deleted it.

Just like I did.

general , ,