BDD with JS

About 6 months ago when I started this job and I was trying to find my feet with a lot of unfamiliar tech, I came across this in my quest to get my head around BDD with CucumberJS. When I had no idea about JavaScript or much of an idea about how to do BDD well, it was all a bit much.

Now however it actually explains a lot of what I’m involved in. I’m using Chai instead of Mocha but the ideas are the same, just different syntax. Sometimes I wish we weren’t using Chai and rather had implemented something like Mocha or Jasmine but we didn’t because reasons. And those reasons were arrived at well before I got here.

Have a read if you’re stuck. I’m gradually coming around to the idea that JavaScript works really well when you’re testing JavaScript, in particular Angular with it’s asynchronous behaviour.

Spring things

Work has me doing a lot of stuff with REST services developed using the Spring framework. We’re using REST Assured to do the testing of the services even before we get a UI layered on top so I’ve been learning quite a bit.

I’ve heard that some of the best advice others have received for learning to code has been to find a problem and work out how to solve it with the code you’re learning. I have a specific problem I want to solve and my initial thought was to do so using Javascript (hence earlier posts on the subject). This however promised to be far more complex than needed. That’s where REST services come in.

Spring provide a handy set of guides and seems to be a nice, out of the box solution to all your RESTful needs. Granted, I don’t know if it’s the best solution to my problem., but it’s something I work with day to day and I’m familiar with it. I’ll use Gradle to build the project (because omfg it’s so much better than maven) and then layer on a front end once I can get the service playing back and storing data.


My git cheat sheet

I wrote this while I was getting the hang of using git in my current role. Over time I’ve added to it but to be honest, I rarely have to refer to it now.

If you’re wondering at the shorthand ‘g’ rather than ‘git’ it’s because I use oh-my-zsh with the git plugin (the dev VM I use at work runs Ubuntu and it also plays nice with OS X. Windows users can suck it). You can get a similar result by aliasing git commands.

Initial Setup

g clone
g pull

If you don’t know those two, stop reading now.

Continue reading

Handy Sublime Text addons

You need to be a bit careful with these as adding lots of them can really slow Sublime Text down.

I found this list of handy addons while looking around for a way to get grunt running from within ST. It starts off with installing the excellent Package Control which makes installing and managing addon packages sooooo much easier. Trust me on this. I found it only after an annoying process of manually installing an addon. With Package Control those days are gone for good.

Now that was a weird sentence to write.


Lots more to write about this tool, but I was looking to get a VM up and running with Jira on it, mainly to trial some workflows and customisations.

In the search for installation gotchas, I found this handy github project: jira-vagrant-install.


I wanted to play around with some JS

A guy at work put me on to yoeman which gives your node package manager the ability to quickly deploy a scaffold for building lots of other stuff. Mainly because I want to learn some JS (using CucumberJS at work) but also so I can start building a simple web based application for a hobby of mine.

Some stuff that was installed:

  • Sublime Text 2 – an excellent editor
  • Java for Mac – I was prompted to install this at some point, can’t remember when
  • nodejs – download from
  • github – so it doesn’t matter where I am, I have access to the code
  • yoeman – With node installed, just: npm install -g yo bower grunt-cli. This installs bower (dependency management) and grunt (a JS task runner) as well
  • CucumberJS Easy with node: npm install -g cucumber for any BDD testing needs

Then added yoeman generators: – npm install -g generator-webapp followed by yo webapp

The last step creates a scaffold on which to build your web app. Or whatever it is you’re doing. There are heaps of generators available.

I needed to manually install some grunt components due to permission issues with sudo on yo webapp

Seems that the bower install done as part of the yo install didn’t quite work (on linux; worked fine on OS X). The previous post is all about fixing that.

Once that’s done, cd into the app directory and grunt serve to start.

Grunt is pretty nifty. It’ll watch your application directory for any changes and automatically update the site. No need to run anything every time you save a change; grunt takes care of everything for you.

Bower gotcha

Found this problem while trying to get Bower to work with yeoman on Ubuntu. Turns out it’s the fun corporate proxy here but the problem isn’t insurmountable.

After installing jumping into the application directory and installing Bower with

sudo npm install bower -g

attempting to run

bower install

produces a bunch of connection related errors.

Find the port you’re proxying through by

env | grep -i proxy

Now that the port is known, edit .bowerrc in the application directory

nano .bowerrc

and add the following

   "directory": "bower_components",
   "proxy" : "http://localhost:<port>",
   "https-proxy" : "http://localhost:<port>",
   "strict-ssl": false

Save the .bowerrc file, close it and re-run the bower install.


The New Place

Names? Who needs names?

Three days here so far and I’m having a blast. Not honeymooning (too cynical now) but there’s a lot to like:

  • Practical use of git
  • New tools like Gradle (whatever happened to Maven?)
  • New concepts e.g. contracts testing
  • More technical testing than I’ve ever been able to do: automation, BDD, security, API’s
  • Many things being implemented and trialed
  • Angular and Protractor
  • Little “a” agility
  • Walls with cards, stories being progressed, get togethers around whiteboards to clarify things, developers, testers, designers and BA’s excited about what they’re doing and enthusiastic about overcoming challenges

In short, much more to learn in an environment I’m more comfortable in (agile) which makes me a happy tester :)