Sunday, December 03, 2006

Terminator - Tabbed Terminal

My formative education was all shell based, and its a tough habbit for an old timer like me to break. I've never quite got on with screens so was delighted to find Terminator.

Terminator is a java application that provides a fast responsive terminal with additional features like searching. However the killer feature for me is tabbed terminals, this is going to save me so much desktop realestate!

I've only run it on OSX so far, but ports are available for Windows and Linux.

Monday, October 09, 2006

JChav

I've been working on JChav with a couple of colleagues. It allows you to take the output generated by JMeter and track performance over time.

The general idea is that you build a JMeter script that gets run from ant. So after every automated build/deploy the ant task generates an XML file showing the performance for that build.

The JChav ant task then operates on the stored XML files to produce a set of charts. Each chart shows the performance of a given page for each build that has run. Each chart shows you how the performance of the page has changed over time. That way you can show everyone how much better your code is improving (or not) over time.

Pictures are worth a thousand words, a live demo is available here showing some statistics on accessing digg.

Saturday, September 23, 2006

Distributed Browser Testing With Selenium and CruiseControl

Introduction

Selenium RC provides an excellent framework for automating UI tests. The issue that we have had with this approach in the past is that we have struggled to automate the use of these tools as no single platform can run the full set of browsers we need for our regression testing.

I missed the google London Test Automation conference but google video has an excellent presentation by Jason Huggons from the day on exactly these topics. Jason suggests using subordinate machines to perform browser specific tests after deployment. Inspired by this I've rolled up the following as a proof of concept :

Overview

The top level build is just a normal instance of CruiseControl running any normal build/unit-test/deploy cycle. If you are not familiar with CruiseControl, in a nutshell it allows you to fully automate the build/test/deploy cycle with ant. It can be configured to trigger builds automatically after source code is checked into the repository, and report through a variety of mechanisms on completion.

CruiseControl also provides a JMX interface which is what I am using to launch the Selenium cruise builds. i.e. on completion of my test/deploy cycle I use an ant target as follows to trigger the remote Selenium builds :

<target name="trigger_remote_selenium_instances">
<get dest="tempcontents.html" src="http://testmac1:8000/invoke?operation=build&objectname=CruiseControl+Project%3Aname%3Dseleniumtestproject">
<get dest="tempcontents.html" src="http://testlinux:8000/invoke?operation=build&objectname=CruiseControl+Project%3Aname%3Dseleniumtestproject">
<get dest="tempcontents.html" src="http://testxp1:8000/invoke?operation=build&objectname=CruiseControl+Project%3Aname%3Dseleniumtestproject">
</target>

Process flow


Flow

The Selenium client ant script being run from CruiseControl pulls the latest tests out of cvs and executes them. Each Selenium cruise instance can have a different execution target (set in the config.xml ant tag).

Using the antcall tag in the target build its possible to generalise the script so you can perform the set of tests on multiple browsers on the client.

This is a sample of the ant file I use for this :

<target name="init">
<echo>Loading properties from ${user.name}.properties</echo>
<property file="${user.name}.properties">
<property name="selenium-server-jar" value="./buildlib/selenium-server.jar">
<property name="selenium-timeout" value="180">

<!-- application specific info -->
<property name="root.path" value="/Users/goul/Documents/seleniumtestproject">
<!--NB base URL must not include a trailing slash -->
<property name="baseURL" value="http://thetesthost.com">

<!--NB SUITES HAVE TO BE FULL PATHS NOT RELATIVE RELATIVE PATHS FAIL!!! -->
<property name="testsuite" value="${root.path}/selenium/suites/my-suite.html">

<!-- this will have the specific browsers appended to it as they are run -->
<property name="baseresult" value="../selenium/results/my-results">
</target>

<target name="run-tests-in-all-browsers" depends="init">
<!-- add each browser you want this instance to run here -->
<target="runSeleniumTests">
<param name="testbrowser" value="*iexplore">
<param name="testresult" value="${baseresult}-ie.html">
</antcall>

<antcall target="runSeleniumTests">
<param name="testbrowser" value="*firefox">
<param name="testresult" value="${baseresult}-firefox.html">
</antcall>
</target>

<target name="runSeleniumTests" depends="init">
<echo message="running tests with browser ${testbrowser}">
<java jar="${selenium-server-jar}" fork="true" failonerror="true">
<arg line="-htmlSuite "${testbrowser}"">
<arg line=""${baseURL}"">
<arg line=""${testsuite}"">
<arg line=""${testresult}"">
<arg line="-timeout ${selenium-timeout}">
</java>

</target>

The produced result files are checked back into the main repository so that they are available to all. The standard cruise mail notification and web site links also provide this information.

In his talk, Jason described how he was experimenting with capturing the running tests themselves as screen cams for review at a later date. I've not pursued that route for now as it seems to be pretty difficult to do in a totally cross platform way.

I'm hoping that this will help speed up some of our regression testing.

Sunday, September 03, 2006

Mac Essentials

I switched back in April and I thought I should share some of the software I'm now using on a daily basis.

Non Commercial

Smultron is a fantastic little text editor. It supports multiple open files, syntax highlighting etc etc.

Shrook is a nice RSS feed aggregator, with a simple well thought out GUI.

NeoOffice is an Aqua port of Open Office.

Mail Scripts whilst not something I use every day I'm including it here as it has some hugely useful functions. These include exports of mail in a variety of formats, linking mail and iCal for sending mail and a host of other handy tools.

Commercial

I still use Parallels for the one piece of vpn software I cannot use under OSX.

OmniGraffle is bar far the best diagramming application I have ever used. I have saved so much time using this tool, I cannot recommend it highly enough.

Monday, August 28, 2006

Simple Way To Create An Encrypted Mountable Disk On OSXSimple Way To Create An Encrypted Mountable Disk On OSX

I needed a simple encrypted partition for some my Mac laptop. After a bit of searching around, I realised that this is actually a built in feature in OSX. To create/use an encrypted partition perform the following steps :

Applications/Utility

launch Disk Utility

Select New Image

Give the image a name, size and select AES for encryption.

Then set a password for the disk. Make sure you do not select the Remember Password option as this means the partition can be automatically mounted.

The drive image will then be created.

To mount the drive select the image in finder and double click it - enter the password and the driver is then available.

Simply select the eject icon to then remover the image.


This

would work well in this env.

Sunday, April 16, 2006

RealPlayer

Trying to keep up with the football this afternoon showed up a little problem listening to RealPlayer streams on the Intel version of OS X.

Bottom line is that RealPlayer is not yet a universal binary. So although it runs fine stand alone it doesn't support being embedded in a universal binary.

i.e. because Safari and Firefox 1.5.0.2 are in universal format, they cannot embed plugins that are not.

So the options are :

a) Regress to a nont universal binary version of Firefox
b) Use RealPlayer as both a browser and player - i.e. when you want radion/video enter http://news.bbc.co.uk/ into RealPlayer and browse using it.

I've gone for b) - but I will investigate mplayer for time shifting shows.

Saturday, April 15, 2006

Mac OS X Intel mod_jk

hmmm non for months then two in a day......

I struggled to find a binary copy of mod_jk to link Apache and JBoss over AJP.

Quick summary for anyone else needing to play this game :

a) Snag the code from jakarta.apache.org
b) ./configure -with-apxs=/usr/sbin/apxs
c) copy the resultin mod_jk.so to /usr/libexec/httpd
d) edit httpd.conf in /private/etc/httpd/ to add

LoadModule jk_module libexec/httpd/mod_jk.so
AddModule mod_jk.c

JkWorkersFile /usr/local/jakarta-tomcat/conf/workers.properties
JkLogFile /usr/local/jakarta-tomcat/logs/mod_jk.log
JkLogLevel info
JkLogStampFormat "[%a %b %d %H:%M:%S %Y] "

JKMount /myapp/* ajp13

e) Create/edit workers.properties in /usr/local/jakarta-tomcat/conf/
workers.tomcat_home=/usr/local/jakarta-tomcat
workers.java_home=/System/Library/Frameworks/JavaVM.framework/
#workers.java_home=/usr/java
ps=/
worker.list=ajp12, ajp13

# Definition for Ajp13 worker (Ajp12 left to readers imagination)
#
worker.ajp13.port=8009
worker.ajp13.host=localhost
worker.ajp13.type=ajp13


f) Restart Apache - all done.

Looks like I've switched

I've been suffering Mac envy in OS/hardware terms for a long time.

The problem has been that nagging doubt in the back of my head that says that there will be one requirement that I can't solve without windows (vpn being the main issue up until now). Well once Apple announced Boot Camp I realised that excuse had vanished. The only remaining one was around video games and the XBox 360 is already out pacing anything I can afford in PC graphics cards for a year or so (for the record Oblivion is dominating my time when the kids are in bed).

So last weekend I ended up in an Apple store buying a MacBook Pro. I'm sure everyone has read enough I switched and the decision I made was right posts from others so I will summarise where I am.

Cons

Battery life seems short - that said I'm still playing with *everything* at once, so that could be the core reason, however I suspect the dual core is a little thirsty ;)

The base gets a little toasty, never mind - I've already had children.

The only version of Eclipse I can find that supports Intel is a 3.2 RC - thats fine except MyEclipseIDE does not support this yet but the v5 releases will and they are imminent.

Pros

Its all so easy - iCal, iSync, my phone, work calendar.

Unix command line - I grew up with Unix, at last I have a great GUI, with that command line goodness I know and love.

Screen/hardware - glorious.

Its a *very* fast machine.

Tools I know/use regularly like OpenOffice/Firefox/Skype all work fine under OS X.

Instant Hibernate/Instant on that actually works.

Open vpn works instantly

Parallels machine vitualisation - installed both Win98 and linux trivially for the 2 dependent applications I still need (The linux will dissapear once I get to grips with gcc).