Page Based Testing With Tools Like Selenium - tips

After the grand experiment described below I ported a large number of the smoke tests over, these happily ran on my Mac under both Safari and Firefox 3.

Of course despite my bias for OSX/Linux apparently one or two internet users still use IE. So we probably need to test on that “other” platform too.

To do this I setup three VirtualBox instances, running IE6/7/8 respectively. I then modified our base test to take a set of parameters for test server/port/browser. i.e. make our base test setup the driver as follows :

Page Based Testing With Tools Like Selenium

For a while I have been doing ad hoc runtime smoke testing of deployments with tools like Selenium. i.e. running a set of simple tests that exercise a series of pre-defined application points. The scripts where typically recorded using the excellent Selenium IDE then replayed through ant/Junit on one or more target browser platforms.

Not full regression testing but a start - right? Well these tests become a pain to maintain, and unmaintained/unreliable tests are pointless. A typical test would be something like the following :

Selenium - OSX Safari not opening second window

I’ve been testing a new site with Selenium. Part of this work was on my Mac and in addition to running the tests in Firefox, I wanted to use Safari too. Whenever I launched the test case the first driver window opened, but the content window didn’t ever appear. No errors, no fuss, it just didn’t happen.

After walking away from the problem for a while, the penny finally dropped……..Safari blocks pop-ups by default! Turning that off instantly solved all my problems.

SVN commit hook

If you need to enforce certain patterns in commit messages for svn (eg. ticket nos etc) create a script in ~repos/hooks/pre-commit :

REPOS="$1"  
TXN="$2"  
  
# Make sure that the log message contains some text of form Feedback nnnnn:  
  
SVNLOOK=/usr/local/bin/svnlook  
match=\`$SVNLOOK log -t "$TXN" "$REPOS" | grep -i 'feedback.\*\[0-9\]:'| wc -c\`  
if \[ $match -eq 0 \]  
then  
	echo "COMMIT HAS FAILED:Log message does not contain feedback number eg. feedback nnnn: commit message" 2>&1  
	exit 1  
else  
	exit 0  
fi  
exit 0

Apache SSL config on Solaris 10 for 443

After installing most recent Apache on our Solaris 10 box we got a lot of errors with the default config for listening on SSL. Many many lines like :

(128)Network is unreachable: connect to listener on [::]:443

Basically on Solaris Listen 443 doesn’t hack it anymore. If you want to listen on all interfaces use :

Listen 0.0.0.0:443

IE 7 behaviour when passed pdf via https

We have had a very odd issue with IE7 being sent pdf files over https.

Standard headers that look like this :

Cache-Control: no-cache, must-revalidate  
Content-Disposition: attachment;filename=mysecretpdffile.pdf  
Content-Type: application/pdf  
Content-Length: 19180  
Keep-Alive: timeout=5, max=100  
Connection: Keep-Alive  

Work fine under IE 5/5.5/6, Opera, Safari et al, but IE 7 reports that the content is not available.

After a bit of searching I found an excellent post at :

http://in2.php.net/manual/en/function.header.php#74736

For us adding the following headers in Java have resolved the issue :

Bash Search History

I’m kind of an old school command line hacker, but I’ve got to face up to the fact that the rest of the world seems to be moving on from the ksh. As such my previous super powers for editing command histories with vi commands (Esc-k, /, etc) are going to have to be retired. As the rest of the planet has embraced bash, I’ve found myself struggling with the fact that crtl-r only lets me get the previous command.

Oracle 10g doubles and Hibernate

I needed to migrate a chunk of data from an example Derby database up to Oracle 10g today. I found a minor issue with the Hibernate mappings that I was creating. In Derby I could happily have double columns, and these needed to be converted to binary_double columns in Oracle.

However I kept having issues with the schema validation in hibernate :

**Wrong column type: binary_double, expected: double precision **

After looking into the source for the dialect mappings I’ve found that creating a new dialect that extends the Oracle 9 one as follows solves this problem :

Eclipse Mac Memory Settings

I always seem to forget this :

Edit the eclipse.ini in the Application package, not the one in the install dir.

Parallels Update Problem

I’ve had a problem with upgrading Parallels the excellent tool for running VMs in OSX. For some reason that I could not initially spot the install would hang in the preflight check before applying all the files. I also had a similar problem trying to force an uninstall.

To cut a long story short it appears that the install/uninstall scripts try to shut down the InternetSharing and bootpd daemons…..in my case these would simply not die through the current script and I had to intervene manually - the install then ran fine.