Homepage | About Me | Mayday | Testing ASP.net Book | Follow me on Twitter | GitHub | SlideShare | RSS | DropBox referral link
Blog.BenHall.me.uk

Being careful with Cucumber step names

Tuesday, October 26, 2010

Today I had an interesting problem with Cucumber the step “I sign in” was being called when my feature file had “When I sign in to the ….”.

The step looked like this:

When /I sign in/ do
    visit "/signin"

    …
end

Turns out, this is actually acceptance – and nice behaviour! The reason is because the regex doesn’t state start \ end characters, as such it would make to any step with the text “I sign in”

Why is it nice? Well I also had two step definitions called

Given I do something
And I do something again

Both did exactly the same thing, but to make the feature more readable I added the again word. Sadly the implementation looked something like this with the step being duplicated.

Given /^do something again$/ do
  Given 'do something'
end

With the trick above, I could simply have the step below which would be called with and without the again word.

Given /^do something/ do
   # Work goes here.

end

Simple, but effective.

Labels: ,

Which Ruby gems are loaded?

I’ve just been trying to debug an issue with a Ruby gem monkey patching methods which resulted in a bug.

It turns out that it’s easy to find out which gems loaded at a particular point within your application by simply including the following line:

puts Gem.loaded_specs.keys

This happily outputs the loaded gems, sadly it didn’t help me find the problem but did rule out a possible cause.

Labels:

I’m a pirate – let’s make change - @PromoteJS

Wednesday, October 13, 2010

Ian Cooper posted a link to a talk from JSConf about Pirate vs Privateers. This an inspirational talk for anyone who’s passionate about their craft. It discusses many of the issues faced by the JavaScript community today with calls to action for improving the life of everyone – one being better documentation, hence the link below. I highly recommend you watch the video, or read the transcript for the talk.

Alt.Net tried this but was held back by “Sex, Lies, and Comparing Sizes”. C# and the .Net platform is becoming a ghetto with many leaving the neighbourhood – like Javascript, now is the time to change it.

I’m a pirate. Let’s make change.

JS Array reverse

TDD Painkillers slides from DDD Dublin 2010

Saturday, October 09, 2010

Attached are my slides on TDD Painkillers from DDD Dublin. Thank you to everyone who came to the session, I hope you gained some value and tips you can apply on Monday.

One thing I did mention during the presentation was with regard to pairing. I know some people want to learn, but sadly are environments which make it difficult. As such, if people want to pair with me (over skype or in a bar) on a coding kata then please give me a shout! Alternatively, if you fancy a test review or feedback on your current approach then just let me know. Twitter is always the best way to contact me.

If people want to know more about my approach to testing, then you could always buy our book Testing ASP.net Web Applications

Labels: , , ,

CouchDBX – Essential for installing CouchDB on Windows and OSX

Monday, October 04, 2010

I’ve been developing a number of prototypes against CouchDB recently. As CouchDB takes advantage of a number of different infrastructure frameworks and languages (Erlang etc) I didn’t originally want to have everything installed on my main PC which meant I used a virtual machine to keep everything isolated. This also allowed for a much easier installation as I was able to use Ubuntu – if you haven’t used the Ubuntu package management system then you don’t know what you are missing as it makes installing applications a single-command process – something far removed from Windows today.

While at DevCon London last week I wanted to install CouchDB onto my OSX partition. Sadly, this wasn’t as simple as I had hoped. CouchDB uses the Mozilla SpiderMonkey Javascript engine which caused me a few issues during installation. After some searching online I came across CouchDBX, developed by CouchOne

CouchDBX is a one-click runtime for CouchDB. Without having to install anything you can have a fully functional server with a single click. Very impressive!

After starting the OSX app, you are given direct access to the admin section to get started.

image

They also have packages for Windows, allowing you to start developing against the database instantly without having to worry about having everything setup. Once the server has started you can access the above interface by navigating to the URL with a browser.

image

Download the packages from http://www.couchone.com/get 

While this was a very easy and pleasant way to get started, It’s important to note that CouchDB is not the only easy to install document database. RavenDB is also a self contained zip, allowing you to execute the server without any additional dependencies. Download from http://builds.hibernatingrhinos.com/builds/ravendb

Labels: ,