Writing non brittle cucumber tests
A few of my 7digital colleagues and I had a mini debate last week over the brittleness of cucumber tests.
Read more...7digital shared playlists built in node.js
7digital shared playlists is a real time web app I made that enables users to listen and add tracks to the same playlist. Please open it up a couple of browsers to see how the real time functionality works.
7digital shared playlists demo
It’s the result of maxing out my two days of innovation time this month at 7digital, plus a little extra over the weekend as two days never seems enough!
Read more...Removing non determinism from our acceptance tests
The web dev team at 7digital has been on quite the journey with our acceptance tests: automated regression tests based upon acceptance criteria. All began in good faith 18 months ago with the start of a new project – to create a brand new 7digital website with a completely new codebase, look and feel.
Read more...A framework for rapid application development of 7digital music stores
All 7digital music stores have similar functionality; it is often only the content, sitemap structure and styling which differs from one store to the next. Can the common elements of a 7digital music store therefore be abstracted into their own modular, reusable “functional parts”?
If we can do so, can we then also produce a framework in which there is so little configuration required that a UI developer can create a 7digital music store without any need for a web developer to get involved?
Ideally, all a UI developer would need to do to drop a piece of 7digital music store goodness into a site is to do something along these lines:
<div>@RenderArtistCharts();</div>
It was important to me that each functional part should be its own assembly and encapsulate all of the services, IOC, routes and views required. I decided that the views themselves should be part of the functional part itself – HTML is after all structural content markup; it should not be used for layout or styling purposes. Initially I looked at ways to build a custom MVC view engine that would take in views from different projects. From my initial research to see if anyone else had done anything similar, I found a perfect solution that the MVCContrib project already provided: MVC Portable Areas.
The essence of portable areas is that it packages an MVC area into its own assembly. Each portable area requires a class that derives from PortableAreaRegistration. MvcContrib automatically scans for and hooks up these portable areas by searching for this class. In this PortableAreaRegistration, we can define the Area Name and set up routes for our functional part.
Setting up the portable areas was fairly easy, and I was soon creating portable areas for artist charts, artist details, release details and a basket, each with their own controllers, views and routes. I used the 7digital Api Wrapper to consume the Api. All that is required to use a functional part inside of a music store is a reference to the dll and the use of an HtmlHelper inside of a view. An example html helper for the basket functional part is as follows:
Inside the 7digital music store view, all that is required to render the basket functional part is one line, which fulfils our original objective well.
@Html.Basket()
Read more...Feature Switching
We have recently implemented feature switching in our new 7digital site. Feature switching is the ability to turn certain parts of the site on or off, either globally or individually for a particular international territory. Each feature has a flag in a database that can be set as required to perform the switch. Each feature is a MVC partial view that is rendered via the Html.RenderAction helper method. These RenderActions display the response from a child action method in a controller. Normally, these child action methods return a PartialViewResult, which is then rendered using the MVC view engine. If the child action method returns a null response, then the partial view is not rendered, thus the feature is “switched off”. We wanted to separate the feature switching logic from our controller logic, and therefore we made an action filter to do the job for us. The OnActionExecuting method of an action filter is a hook that is executed before the controller method. This OnActionExecuting method has an ActionExecutingContext parameter which contains a Result property of type ActionResult. By setting the Result property, we can effectively bypass running any subsequent action filter and controller logic, and return the result given:
Read more...