Pages

Monday 18 March 2013

Mea culpa everyone





Cute cat pictures are the accepted currency of apologies on the internet, right?








I'm very sorry nothing new appeared for a week


Sincere apologies for the lack of content this past week. I was working away from home in London for part of the week, and my family was blighted by illness and teething for the other part which led to no time for writing a half sensible blog post.

"That's all well and good. But what are you going to do to stop it happening again, huh?"


After discussing various ways of getting around this issue with my friend and avid blogger Alec, I have decided to try macroblogging. 

This is going to be a learning curve for all of us. If you would like to let me know if it is working, not working, or have a suggestion please comment below or tweet me.

Monday 11 March 2013

Get Sinatra to sing it your way


Everybody in software loves up to the minute statistics. Including being able to stay abreast of the latest test run from anywhere. So why not go one step further and have Sinatra sing it for you. 




In ancient times they had no statistics, so they had to fall back on lies Stephen Leacock


This may sound a little strong, but I've heard it become a reality in the workplace far too many times:

Smith: "I say Perkins, you're scrum master for the web store. How are the latest test runs looking?"
Perkins: "I... Uh... They're... They're looking spiffing Smith. All just fine. We'll be releasing bang on time."

Problem is, the test runs aren't looking spiffing. They look terrible. And there isn't a snowball's chance in hell that the release is going to be bang on time. Problem is, Perkins wasn't paying attention in the daily standup, one too many sherrys last night meant all he could think about was the paracetamol in Victoria from HR's desk. If only he'd had something quick and meaningful to look at. Something that was green when all was well, and red when things were decidedly not well. But that also had all the detail he could wish for should he need the facts. If only the web store test department had known Sinatra.


Don't allow others to lie when it comes to your reputation. Get Sinatra to sing the truth for you. Tweet this post


You'll be amazed at how little it takes to get Frank up and performing


If you're outputting your test runs in HTML format (–format html –out latest_run.html) Cucumber has already done most of the heavy lifting, you just need to follow a few additional steps. First, install the Sinatra gem 'gem install sinatra'. Next, create a file called broadcast_results.rb or similar in the same folder as your HTML output and paste in the following:


Now, in a terminal window navigate to the folder containing the broadcast_results.rb file and run 'ruby broadcast_results.rb'. You'll see output (run in a screen session if you want to close or reuse this terminal window) that looks like this... 

== Sinatra/1.3.3 has taken the stage on 4567 for development with backup from WEBrick
 [2013-03-11 14:39:31] INFO  WEBrick::HTTPServer#start: pid=8852 port=4567

which means you're done. Navigate to localhost:4567 in a browser and you'll see Cucumber's HTML output displaying the latest test run. If you want others to view these results too, simply replace localhost with your IP address and Sinatra will take care of the rest.

If you found this post helpful, please share it. If you have any questions, or use another method to broadcast your test results quickly and easily, please comment below or tweet me.

Thursday 7 March 2013

FFCFC. Democracy at it's finest



It's 8 o' clock. The baby is in bed. "Let's watch a film" is uttered by your other half. The sweat beads on your forehead, "Oh no! She'll never agree to watch Die Hard!" But it doesn't have to end in bad feeling. You need...





Fair Film Choosing For Couples


I'm a huge fan of gamification. I'm also a huge fan of fairness. So when an opportunity arises to combine the two, I find myself unable to resist. Me and my better half are both self confessed cinephiles and love nothing more than finishing up a hard day with a bottle of wine and a film. Sadly, on occasion the overlap in the Venn diagram of our preferred genre is smaller than we'd like, and we can find ourselves at loggerheads as to what to watch. We will critique each others choices until one of two things happen; 1) We realise it's nearly midnight and we go to bed having not watched a film, or 2) One of us will relent and watch the other's film while moaning about the "total lack of credible storyline" or sniping "you don't really believe you can take out a chopper with a police car do you?". And that's what led to the invention of FFCFC.


I guarantee these 10 simple rules will lead to a lifetime of happy evenings or your money back. Tweet this post


FFCFC Rules


  1. Each member gets three choices
  2. Choices do not have to be unique
  3. Choices do not have to be a film. A choice can be episodes of a series but must equate to the average length of a film (90 to 120 mins)
  4. Strictly no criticising of choice by the loser before, during, or after viewing of the choice
  5. The winner must make the loser a commiseration beverage of the losers choice. Ingredients must be currently present in the dwelling or new choice must be made
  6. If the choice has to be streamed and streaming is not available then the winner may pick one of their remaning two choices. If no other unique choice exists a new choice must be made within a five minute time frame or the win is null and void
  7. Choices to be written on equally sized pieces of paper
  8. Choices are folded in half, then in half again. No special folding
  9. The member who first suggested watching a film flips a coin. The other member calls. Whoever loses the coin toss places the choices in the choosing vessel and mixes until happy. If you flip, but fail to catch the coin, you automatically lose the toss
  10. The winner of the coin toss picks one choice from the choosing vessel whilst looking away


FFCFC led you to a great evening of democratic movie watching? Please share this post as repayment. If you have any suggestion as to how FFCFC could be improved, have noticed any loop holes in the rules, or would like to thank me for saving your relationship, tweet me or comment below.

Wednesday 6 March 2013

Embed screenshots in your HTML output



Cucumber's HTML output is fantastic. But I began to wonder if there was a way to embed the screenshots I was capturing separately. Turns out there is, and it's incredibly simple to do.




You have failed me test. Now say "Cheeeeeese!"


Screenshots are invaluable in the diagnosis of a test failure. Often a quick look at a screenshot is sufficient to know exactly why a test has failed, saving you the time of looking back through log files or manually retesting the failure in the event of an unhelpful test output such as 'Unable to capture snippet for eval'. For a long time I used to capture the screenshots in a dedicated folder within my framework. But this made adding screenshots a little cumbersome when emailing results, and I found myself constantly adding entries in my todo list to research embedding them in the HTML output of a Cucumber run, but I kept putting it off as I assumed it would be awkward or time consuming. I was really wrong, and it is really useful.

Sometimes, a screenshot is worth a thousand log files. Tweet this post

Remember I told it you it was simple to implement?


Just paste the following code snippet into your hooks.rb (or env.rb if you're not using a separate hooks file) and you're done. You'll now notice a small 'screenshot' link underneath failed tests in your HTML output. Just click the link to expand the screenshot, and again to collapse it.


If this post helped you, please share it. If you have any questions, or use another method to manage your screenshots, please comment below or tweet me.

Monday 4 March 2013

Sweet potato and rosemary boule



Dense, cakey, and moist, with a hint of floral rosemary. So filling it's almost a meal in itself, allow me to introduce a firm favourite of the women in my life.





Rosemary and potatoes, a match made in heaven


There are three smells in this world guaranteed to make me close my eyes, inhale deeply, and smile; the smell of freshly cut grass, the smell of a baking loaf, and the smell of potatoes roasting with a sprig or two of rosemary. This beautiful rustic boule (along with a morning of manual labour in the garden) allows me to combine all three in an olfactory opus in my kitchen. As I stated in the opening to this post, this boule has made me somewhat of a rockstar amongst the lady folk, even my gluten avoiding sister in law! To the point where I have had to take bread flour, yeast, and potatoes on a family holiday to bake this in a tiny electric oven that we had to feed with coins to keep running during the bake. I'm still not sure what it is that causes such unbridled emotion, but it seems to tick all the right boxes. 

Bear this boule in mind singleton bakers of the world, I might be on to something! Tweet this post


How you too can gain fame, fortune, and fancy with rustic bread (your millage may vary)


Ingredients:

  • 1 large sweet potato
  • 1 medium large maris piper potato
  • 450g strong white bread flour
  • 300g tepid water
  • 10g fresh yeast (7g active dried)
  • 8g fine sea salt
  • 10g roughly chopped fresh rosemary
  • 1 tsp honey
  • 1 tbsp light extra virgin olive oil

Method:

  1. Bake potatoes until flesh is soft all the way through, but remove before skins become too crispy as you want to retain a good amount of moisture in the potato
  2. Once potatoes have cooled (this takes a lot longer than you think), skin them and pass them through a potato ricer or force them through a metal sieve with the back of a wooden spoon.
  3. In a large bowl combine the flour and yeast
  4. To the bowl add the salt, oil, honey, rosemary and potato and stir well with a wooden spoon until combined
  5. Slowly add water while stirring until the dough comes away from the bowl cleanly
  6. Tip onto a lightly floured surface and knead with floured hands for around 15 to 20 mins. Ensure you have turned the radio on prior to this step as the dough is incredibly tacky at first and will stick to everything until suitably kneaded
  7. Place the dough into a floured bowl, cover with a damp tea towel and leave to rest in a warm place (or wrapped in a warm towel) until the dough has doubled in size
  8. Knock back the dough, shape into a boule shape, cover with a well floured tea towel and prove for 15 to 20 mins
  9. Brush dough with a little olive oil and cut four slahes to form a square on top of the dough
  10. Transfer to a baking stone (or a thick pre heated baking tray) and bake for 25 to 30 minutes at 220 degrees. You will know it's done when the crust is a deep golden brown and the bottom will sound hollow when tapped with a finger

Protip: Place a few ice cubes in a baking tray in the bottom of your oven along with the loaf to create steam and improve the crunch and colour of your crust. Also, don't open the oven until at least 10 minutes into the bake, this is another common crust killer.

If you liked this post, please share it. If you have any questions, or would like to brag about the fame, fortune and/or fancy this boule has brought into your life please comment below.

Saturday 2 March 2013

Hello, Bonjour, Hola, Buon Giorno, Hej, Aloha...





I've been told this is where my elevator pitch goes. Problem is, I work from home. I've forgotten what the inside of an elevator looks like, or how I'd pitch myself to a visiting CTO from the continent. But bear with me and I'll do my best.





"I can teach you stuff... and things!"


Now if that's not an honest and heartfelt elevator pitch I don't know what is. And it's true, I can. But most importantly; I'd like to. I've worked my way up from the dark days of selling mobile phones in the back of a smelly record store, to the halcyon heights of writing automated test frameworks for software that gets delivered to UK Central Government. And I've learnt a lot along the way, things I feel should get shared and added to the knowledge pool so those that come after me can have a less arduous journey than I did. Also I want my peers to gain new points of view from frank and open discussion of our shared experiences. Having said all that, I think my new elevator pitch for this blog is:

"I'd like to teach you some things. Things I think can and will help you. But I'd like it to be a discussion, not a lesson." Tweet this


Want to craft a cutting edge test framework, or bake a delicious artisan loaf? Let me show you how.


That's right, I said bake. While this blog is going to be very technical, full of helpful code snippets, and overflowing with discussion on the place of testing in modern software development, I am also going to include content from another skill I learnt the hard way, how to create an edible loaf of bread. If I'm honest, baking was probably the harder skill to learn, and I'm keen to share my experiences in this area too. But fear not, I shall endeavour to keep the two as separate as possible, so if one subject holds no interest for you it should be easy to avoid. 

As I've said above, I'd like to teach you things, I enjoy teaching people. But I don't want it to be prescriptive. I don't want to tell you what you should learn, I want to teach you what you want to learn. So please, subscribe to this blog, comment on it, tweet me, let me know what it is I can help you with and I will.