Selenium testing for Ext GWT/GXT
November 08, 2008
Ext JS blog has a post about testing web application with Selenium. It provides quick overview of Selenium and gives instructions how to set it up. For me the most interesting part of the article was the example Selenium test case code.
At work we have been using Selenium to create acceptance tests for Ext GWT application and it has been quite painless so far. In our case the most important factor was to set id's for fields we wanted to test. That makes locating the right field in Selenium much easier. Another issue was the right mouse click because the application has some contextual menus. The Selenium IDE does not register right clicks properly so it was necessary to modify those actions manually to use mouseUpRightAt.
Yesterday I was wondering how to handle Ext GWT DateField's date picker in Selenium test and I ended up typing the date value in the field instead of clicking the calendar icon. After mentioning this to my colleague he told me to check the blog entry above. From the example I learnt about /following-sibling::img. It seems to be the way to handle trigger fields nicely - something to try out next week.
At work we have been using Selenium to create acceptance tests for Ext GWT application and it has been quite painless so far. In our case the most important factor was to set id's for fields we wanted to test. That makes locating the right field in Selenium much easier. Another issue was the right mouse click because the application has some contextual menus. The Selenium IDE does not register right clicks properly so it was necessary to modify those actions manually to use mouseUpRightAt.
Yesterday I was wondering how to handle Ext GWT DateField's date picker in Selenium test and I ended up typing the date value in the field instead of clicking the calendar icon. After mentioning this to my colleague he told me to check the blog entry above. From the example I learnt about /following-sibling::img. It seems to be the way to handle trigger fields nicely - something to try out next week.
GWT in Practice reviewed
October 28, 2008
Available on Java User Group Scotland website, GWT in Practice.
Stack Overflow Joy
October 22, 2008
The first time I saw something about Stack Overflow was while I was reading Joel on Software. Couple days ago I finally created my account there and started using it. So far my impression has been very positive.
Stack Overflow is basically just a question-answer site for software developers. But because of its active user mass good questions are replied rapidly and bad ones are moderated. Users receive more privileges the more they are writing good questions and answers.
What is a good question or answer then? That is up to other users who can vote, edit or close your entry.
Stack Overflow is basically just a question-answer site for software developers. But because of its active user mass good questions are replied rapidly and bad ones are moderated. Users receive more privileges the more they are writing good questions and answers.
What is a good question or answer then? That is up to other users who can vote, edit or close your entry.
Another book to be reviewed - GWT in Practice
October 02, 2008
Yesterday I hosted Java User Group Scotland - JUGS meeting at my workplace for the second time. This meeting was about JBoss Seam and there was a presentation by Ashish Kulkarni. It was pretty useful as I did not know much about Seam before.
I was also looking forward to receive a review copy of GWT in Practice by Robert T. Cooper and Charlie E. Collins. I have been using GWT for a couple months and it is definitely a fascinating piece of software. It will be interesting to see how this book brings up some new approaches or tricks. Eventually the review will be online under JUGS website's book review section.
Actually, GWT is not the only new technology I have been lucky enough to use at work. We are using agile approach in a new project and therefore our database schemas are under constant change. H2 is a Java database engine written by Thomas Mueller and it allows us to have disposable in-memory database which gets populated by a migration process fed by a legacy database. The H2 project is also very active and bugs are fixed pretty quickly.
I was also looking forward to receive a review copy of GWT in Practice by Robert T. Cooper and Charlie E. Collins. I have been using GWT for a couple months and it is definitely a fascinating piece of software. It will be interesting to see how this book brings up some new approaches or tricks. Eventually the review will be online under JUGS website's book review section.
Actually, GWT is not the only new technology I have been lucky enough to use at work. We are using agile approach in a new project and therefore our database schemas are under constant change. H2 is a Java database engine written by Thomas Mueller and it allows us to have disposable in-memory database which gets populated by a migration process fed by a legacy database. The H2 project is also very active and bugs are fixed pretty quickly.
GWT 1.5 Tree and RichTextArea testing with Selenium
August 06, 2008
Last couple weeks I have been working in a project which utilizes Google Web Toolkit for the user interface. The development has been quite straightforward but testing has caused some headaches.
We are using GWT 1.5 RC 2 and one of the new features compared to 1.4 is the debug id. It allows to set a specific id for most of the elements by calling onEnsureDebugId method. This addition in UIObject helps Selenium testing because elements can be referred with their id instead of xpath.
But the first problem came up with Tree and TreeItem. Expanding tree with Selenium RC test case was tricky. Clicking those plus and minus images was quite impossible because I did not manage to set an id for them. After several attempts I decided to use double clicking to expand a tree item. This was also easy on the test side as Selenium has doubleClick command and the tree item itself can have a debug id.
The second problem was with GWT's RichTextArea. I wanted to type text in the area but Selenium IDE did not recognize or record my typing. The problem here was the iframe used by the editor. Some searching revealed that most WYSIWYG editors have the same testing issue. The solution was to select the right frame with Selenium's selectFrame, type text to //body/html and finally select the top frame again.
We are using GWT 1.5 RC 2 and one of the new features compared to 1.4 is the debug id. It allows to set a specific id for most of the elements by calling onEnsureDebugId method. This addition in UIObject helps Selenium testing because elements can be referred with their id instead of xpath.
But the first problem came up with Tree and TreeItem. Expanding tree with Selenium RC test case was tricky. Clicking those plus and minus images was quite impossible because I did not manage to set an id for them. After several attempts I decided to use double clicking to expand a tree item. This was also easy on the test side as Selenium has doubleClick command and the tree item itself can have a debug id.
The second problem was with GWT's RichTextArea. I wanted to type text in the area but Selenium IDE did not recognize or record my typing. The problem here was the iframe used by the editor. Some searching revealed that most WYSIWYG editors have the same testing issue. The solution was to select the right frame with Selenium's selectFrame, type text to //body/html and finally select the top frame again.
Mistakes exposed by Google - O2's mms2legacy privacy
July 19, 2008
Google and other search engines are quite handy for all kind of background checks. Newsgroup postings, old home pages etc of individuals can be found easily. For companies the internet presence is not just their own site but everything coming up after searching with their name. Adding 'problems', 'bad service' or 'horrible' after company name and searching with that might bring up good amount of ranting from unhappy customers.
But there are also more interesting cases from companies. Some time ago I was looking for a job and checking company background info for my interview. By accident I found complete source code for one of their products. It was exposed due some mistakes with WebDAV setup and robots file. At least I had much better idea what that company was doing.
Today I just read from one user group mailing that O2's mms2legacy service is cached by Google. Searching with inurl:mms2legacy seems to bring a lot of pages MMS messages with photos and phone numbers. I could imagine that senders of those messages did not intend them to be available like that. Maybe O2 should add a disclaimer that they take no responsibility whatsoever of the visibility of the content.
Edit: O2 pulled the plug fast, so fast that they left navigation menu items leading to 404 pages.
But there are also more interesting cases from companies. Some time ago I was looking for a job and checking company background info for my interview. By accident I found complete source code for one of their products. It was exposed due some mistakes with WebDAV setup and robots file. At least I had much better idea what that company was doing.
Today I just read from one user group mailing that O2's mms2legacy service is cached by Google. Searching with inurl:mms2legacy seems to bring a lot of pages MMS messages with photos and phone numbers. I could imagine that senders of those messages did not intend them to be available like that. Maybe O2 should add a disclaimer that they take no responsibility whatsoever of the visibility of the content.
Edit: O2 pulled the plug fast, so fast that they left navigation menu items leading to 404 pages.
Harnessing Hibernate review available
June 24, 2008
Actually it has been done for some time now but I forgot to post the link here. Feel free to comment as usually.
iReport 3 experiences
June 11, 2008
During last couple days I have been working with iReport 3.0.0. I was creating a multipage PDF report for a customer to review data from online forms. I have to say that iReport saved plenty of nerd sweat but it also caused some headache. I did not have the printed documentation (The Definitive Guide to iReport) so I ended up searching forums and other sites.
Getting started was pretty easy but I ran into my first problem when I tried to figure out how to display numerous key-value data pairs on a single page. Creating a subreport and passing the key value to it was the solution and luckily there was a screencast explaining it. So, soon my page was filled with values and the next dilemma was ready.
Creating a multipage report was a bit awkward because it required to have a subreport for each page. And each page was using a subreport already. The trick to get this working was to pass the subreport directory from root to all subreports. After this the report expanded over 8 pages and my creative colleague was ready to modify its layout. It was rather easy for him to start using iReport even he had no previous experience with it.
But he wasn't totally happy with iReport's responsiveness and it was definitely sluggish on his workstation. It turned out that there was something wrong with the new page I created by copying existing page's .jrxml file. This caused the report preview to hang without any errors and eventually he was running several stuck preview processes at the same time. This was solved by simply restarting iReport and creating that new page from scratch.
Meanwhile I was experimenting with other features of iReport and I decided to try out it with a data set which required pivoting. Each row in the database had key-value pair with grouping time stamp. The requirement was to create a table having those keys as a column headers. The database was a bit older Oracle and it did not support pivoting as well as newer versions. The solution was to use iReport's crosstab function which turned out to be quite handy.
It will be interesting to see how iReport will evolve in the future. I have the feeling that there is some demand to improve its multipage handling among some other annoyances. But even with its current status it turned out to be a valuable tool.
Getting started was pretty easy but I ran into my first problem when I tried to figure out how to display numerous key-value data pairs on a single page. Creating a subreport and passing the key value to it was the solution and luckily there was a screencast explaining it. So, soon my page was filled with values and the next dilemma was ready.
Creating a multipage report was a bit awkward because it required to have a subreport for each page. And each page was using a subreport already. The trick to get this working was to pass the subreport directory from root to all subreports. After this the report expanded over 8 pages and my creative colleague was ready to modify its layout. It was rather easy for him to start using iReport even he had no previous experience with it.
But he wasn't totally happy with iReport's responsiveness and it was definitely sluggish on his workstation. It turned out that there was something wrong with the new page I created by copying existing page's .jrxml file. This caused the report preview to hang without any errors and eventually he was running several stuck preview processes at the same time. This was solved by simply restarting iReport and creating that new page from scratch.
Meanwhile I was experimenting with other features of iReport and I decided to try out it with a data set which required pivoting. Each row in the database had key-value pair with grouping time stamp. The requirement was to create a table having those keys as a column headers. The database was a bit older Oracle and it did not support pivoting as well as newer versions. The solution was to use iReport's crosstab function which turned out to be quite handy.
It will be interesting to see how iReport will evolve in the future. I have the feeling that there is some demand to improve its multipage handling among some other annoyances. But even with its current status it turned out to be a valuable tool.
Harnessing Hibernate
June 05, 2008
I have been reading this relatively new book for couple weeks now and it seems to be a good material for Hibernate beginners. There will be a proper review but I will post it to Java User Group Scotland's site when the review is ready. But as an early comment I could recommend Harnessing Hibernate.
Hibernate presentation and the power of live coding
May 24, 2008
It was time to have my first technical presentation in my current workplace. I have experience with Hibernate and the company's technical lead has interest in it. Also the first project based on Hibernate and Spring in this company went live without disasters so the topic was clear.
The Hibernate Core is rather large and going through all the features was out of question. Instead of hundreds of slides I simply explained its main features, benefits and usage with couple plain slides. And then it was time for a demo.
The presentation room's computer did not have Eclipse or other development tools installed but remote access solved that problem. I had everything ready set up on my new workstation (no longer lousy Dell XPS 210) and I could start explaining Hibernate usage with live database and bunch of JUnit tests.
Hibernate's lazy loading is much easier to understand when audience sees different SQL queries created by Hibernate in practice while stepping through the code in Eclipse's debug mode. Same applies to Hibernate Tools. I created new table in Oracle SQL Developer and new Hibernate mappings with generated POJOs were available right after a couple mouse clicks.
I have to admit that this time I was a bit lucky because I did not spend that much time testing that setup. Compared to my very first live coding presentation in my previous work place everything went super smooth without embarrassing typos or brain-locks. There was plenty of discussion afterwards and I have a feeling that I will see more projects being implemented in combination of Hibernate and Spring.
The Hibernate Core is rather large and going through all the features was out of question. Instead of hundreds of slides I simply explained its main features, benefits and usage with couple plain slides. And then it was time for a demo.
The presentation room's computer did not have Eclipse or other development tools installed but remote access solved that problem. I had everything ready set up on my new workstation (no longer lousy Dell XPS 210) and I could start explaining Hibernate usage with live database and bunch of JUnit tests.
Hibernate's lazy loading is much easier to understand when audience sees different SQL queries created by Hibernate in practice while stepping through the code in Eclipse's debug mode. Same applies to Hibernate Tools. I created new table in Oracle SQL Developer and new Hibernate mappings with generated POJOs were available right after a couple mouse clicks.
I have to admit that this time I was a bit lucky because I did not spend that much time testing that setup. Compared to my very first live coding presentation in my previous work place everything went super smooth without embarrassing typos or brain-locks. There was plenty of discussion afterwards and I have a feeling that I will see more projects being implemented in combination of Hibernate and Spring.
Updating Ubuntu to 8.04 and broken VMware Tools
May 01, 2008
I was running Ubuntu 7.10 inside VMware player and Ubunu's updater offered update to 8.04. I checked Ubuntu website and everything seemed to be fine so I proceeded with update. But after update I noticed that shared folders were not visible for the guest OS anymore and also other features were not working properly.
Reinstalling VMware Tools did not help because installation failed. After some searching I found a good blog entry by Peter Cooper. Despite the topic the described steps work very well also on VMware Player.
Reinstalling VMware Tools did not help because installation failed. After some searching I found a good blog entry by Peter Cooper. Despite the topic the described steps work very well also on VMware Player.
Vodafone mobile broadband content block and bad image quality
April 15, 2008
My current internet connection is Vodafone's mobile broadband and it seems to work better than Three's. Unfortunately it is also more expensive. However, there are some technical issues.
I noticed many forums missing photos from their posting. It turned out that Vodafone uses content control which blocks access to the websites. For example flickr.com and imageshack.us are blocked. It is possible to remove this block but the web interface for this tries to send SMS containing password to the client settings. And Mac mobile connect software does not support SMS. So, switch SIM card from the dongle to mobile and back, visit Vodafone store or call their customer service.
Another problem is with those images which are actually visible. Vodafone uses a transparent proxy to downsize image files. The result is rather ugly as the compression is set to maximum. But this case is easier to solve. The latest Windows software has a feature for this so some smart Mac programmers observed what is happening with the network traffic and created a small application to disable compression. It is available at http://aitne.com/, it is donation ware and it works fine.
I noticed many forums missing photos from their posting. It turned out that Vodafone uses content control which blocks access to the websites. For example flickr.com and imageshack.us are blocked. It is possible to remove this block but the web interface for this tries to send SMS containing password to the client settings. And Mac mobile connect software does not support SMS. So, switch SIM card from the dongle to mobile and back, visit Vodafone store or call their customer service.
Another problem is with those images which are actually visible. Vodafone uses a transparent proxy to downsize image files. The result is rather ugly as the compression is set to maximum. But this case is easier to solve. The latest Windows software has a feature for this so some smart Mac programmers observed what is happening with the network traffic and created a small application to disable compression. It is available at http://aitne.com/, it is donation ware and it works fine.
Bad example of new banking application introduction
March 27, 2008
Finnish Sampo bank switched over to Danske Bank's information systems. This merge took over 14 months with over 3100 persons. And results was rather embarrassing.
Their online customer pages have numerous XSS vulnerabilities. In practice this means that malicious content can be injected on the web page while user sees the original domain on the URL field. There are many example floating around internet. Here is a screenshot.
The online banking is implemented with Java applet and some native code. The purpose of this native code is unknown but curious minds have already analyzed applet. Here is one wikipage.
Because there are also other problems with their banking systems the online banking has been working badly and customers have experienced bizarre issues. Balance is not matching reality, some functionality is not available and also normal ATM withdraw transactions have failed with some Sampo customer. The latest and also pretty severe problem happened to a poor customer whose mortgage payment was taken twice.
No wonder Sampo-Danske bank customers are angry and changing bank. As soon as their system is back online.
Their online customer pages have numerous XSS vulnerabilities. In practice this means that malicious content can be injected on the web page while user sees the original domain on the URL field. There are many example floating around internet. Here is a screenshot.
The online banking is implemented with Java applet and some native code. The purpose of this native code is unknown but curious minds have already analyzed applet. Here is one wikipage.
Because there are also other problems with their banking systems the online banking has been working badly and customers have experienced bizarre issues. Balance is not matching reality, some functionality is not available and also normal ATM withdraw transactions have failed with some Sampo customer. The latest and also pretty severe problem happened to a poor customer whose mortgage payment was taken twice.
No wonder Sampo-Danske bank customers are angry and changing bank. As soon as their system is back online.
Frustration with Windows and lack of my favorite tools
March 15, 2008
Recently I got a task to setup up Tomcat running on a Windows 2000 server vmware image and configure some web applications to run on it. It had already SQL Server (version 8 or so) running on it. Yea, not really the most modern software and definitely not my favorites...
Restoring the database from a file was not that complicated but took some time to figure out how to refresh the view. Setting up tomcat was a bit trickier as I missed one setting in its configuration. But the most frustrating thing was that the setup lacked all the tools I would have used on a unix platform.
Actually the list of my every day command line tools is not too long. Couple consoles with cd, mv/cp, grep, vi and tail are usually enough for setup and config tasks. But now I was doing endless clicking around and the progress was a bit slow. If I have to touch that again I'd better gather my own toolset for Windows or hire my own outsourced setup monkey.
Restoring the database from a file was not that complicated but took some time to figure out how to refresh the view. Setting up tomcat was a bit trickier as I missed one setting in its configuration. But the most frustrating thing was that the setup lacked all the tools I would have used on a unix platform.
Actually the list of my every day command line tools is not too long. Couple consoles with cd, mv/cp, grep, vi and tail are usually enough for setup and config tasks. But now I was doing endless clicking around and the progress was a bit slow. If I have to touch that again I'd better gather my own toolset for Windows or hire my own outsourced setup monkey.
Java User Group for Scotland - JUGS
February 26, 2008
I think I found out about this new Java User Group from some website, maybe it was in Scottish Developers event list. Anyways, I am about to check it out because it might be a good way to get to know other developers and share Java related knowledge. Naturally I will post some comments after their first meeting - which happens to be tomorrow.