Michael Whelan

behaviour driven blog

Selenium WebDriver and IE11

I was updating the browser WebDrivers for Seleno when I hit an issue with the InternetExplorerDriver. I was running Selenium WebDriver 2.43.1 on Windows 8.1 and using Internet Explorer 11. The test was just opening the google web page. Internet Explorer opened correctly and displayed the google page but then the test failed with the error:

OpenQA.Selenium.NoSuchWindowException : Unable to get browser

It turns out this is an issue with Internet Explorer 11 rather than the InternetExplorerDriver. This causes the InternetExplorerDriver to lose the connection to the instance of Internet Explorer it created.

Read more


Creating Test Data with Mockaroo

I'm currently working on a project that requires realistic test data. In the past, I've used tools such as RedGate's SQL Data Generator for this purpose, which is fantastic if you are looking for a commercial product. Recently, I came across Mockaroo, an online test data generator. It is currently free and lets you generate up to 100,000 rows of realistic test data in CSV, JSON, SQL, and Excel formats. If that's not enough data for you, there is also a Big Data Edition which lets you generate unlimited JSON and CSV data, leveraging multi-core cloud computing.

Read more


Restoring NuGet Packages in TeamCity

NuGet package restore used to be MSBuild-based and you would enable it by selecting Enable NuGet Package Restore in Visual Studio. Nowadays, it is recommended that you don't use this approach, but instead just set the option in Visual Studio to Allow NuGet to download missing packages. This works really well in Visual Studio, but when you select the Visual Studio build runner in TeamCity it does not go ahead and restore all the NuGet packages for you in the same way, so you get a compilation error. Instead, you have to explicitly create a separate step to run before the Visual Studio build step.

Read more


TDD Katas

A kata is a form of deliberate practice, with its roots in the martial arts world. It describes a choreographed pattern of movements used to train yourself to the level of muscle memory. In the world of programming, katas are small coding exercises that a programmer completes on a daily basis. They can be a great exercise for practicing TDD in particular.

Rather than attempt a new kata each day, it's recommended that you work on the same one repeatedly until completing it is almost like muscle memory. Katas can be a great way to try out a new programning language, or a new programming technique, or a new framework. For example, if you wanted to move from Moq to NSubstitute (which I recommend) you could replace Moq with NSubstitute when doing a familiar kata.

Read more


gitignore Files

There are a number of files that you don't want to store in your git repository. These could be binary files, such as the packages folder for Visual Studio applications or the node_modules folder for node projects, or automatically generated files such as ReSharper user files or files produced by the build system. If you create a file in your repository named .gitignore, Git uses the file patterns in it to determine which files and directories to ignore when you make a commit. You can also create a global .gitignore file, which is a list of rules for ignoring files in every Git repository on your computer. You can learn more about the file patterns from Pro Git.

Read more


Customizing the New Metro HTML Report in BDDfy v4

BDDfy v4 is out and it provides a new metro-style HTML report - thanks to Jason Roberts for this excellent contribution. It has the same functionality as the original HTML report, which is still available, so it just gives you another choice of style for your HTML report. And, of course, you can always customize the CSS and JavaScript of both reports if you want to create a new HTML report with your own look and feel. The way that you customize the metro report is slightly different from how you customize the classic HTML report so I thought I would document that here.

Read more


Deploying Sandra.Snow to GitHub Pages with Gulp

When I was planning a git work flow for my Sandra.Snow blog, which is hosted on GitHub Pages, I expected that I would store the project files in the master branch, then publish the site to the gh-pages branch. The point I overlooked is that this is the work flow for project sites, but user and organisation sites, like my blog, work slightly differently. With user and organisation sites you publish the website content to the master branch of your GitHub repository. This was far from ideal, as it meant that my content was mixed with the generated output. Even the slightest tweak to a post would lead to the whole site being generated, meaning monster commits and hiding the changes to the content. I suspect Sandra.Snow has a few solutions to this problem, but here is the solution I came up with.

Read more


Deleting Nested node_modules Folders

When using Node Package Manager (NPM) on Windows, it has an annoying habit of creating massively nested node_modules folders that exceed the 260 character path length limit. This makes it extremely painful to try to delete and causes problems with most windows tools. In Visual Studio, for example, I cannot Refresh Folder when I am in a website project (as opposed to a web application project).

Fortunately, the fix is pretty simple.

Read more


New Site Design

When I moved my blog to Snow I was lucky that it had a pretty nice theme out of the box - it is the same one that its creator Phillip Haydon uses on his blog. I have been doing a lot of front-end work lately though and I have some pretty strong preferences when I read blogs, so I couldn't resist the urge to style it up just the way I like it.

The theme uses Bootstrap 3 and is fully responsive. Actually, I had a bit of a problem with it displaying on my iPhone. First it would display some posts half width, then it was cutting off the sides. I discovered that the key is in the viewport setting. It seems it's not sufficient to set the viewport to device-width. You also have to set the initial-scale and the maximum-scale.

Read more


AngularJS Data Binding

Although AngularJS is a JavaScript framework, there is actually quite a lot you can do without writing any JavaScript at all. In my first look at Angular, I am going to focus on simple data binding with Angular directives. Directives are a mechanism that Angular uses to extend the capabilities of HTML. HTML is designed for static documents and directives help you extend it for dynamic views, letting you invent new HTML syntax, specific to your application.

Read more



Google