Unit Testing: The Basics

3rd May, 2009 @ 12:36pm UTC

Development, Python, Testing, Tools, Tutorials, Web / 0 Comments

As a web development manager, it’s part of my job to be involved in defining best practices for my team. This means defining a set of standard practices that will benefit the whole team throughout the entire development process. A good example of one such best practice would be code testing.

Testing, for web developers, is usually a fairly disorganised affair. Most of the time, we test “on the job”, i.e., we code something and then we run it; if it breaks, we fix it. In fact, often, the thought of actually structuring our testing process can seem somewhat of an over complication. This is certainly not the case.

The benefits of a structured testing process are legion, as any software engineer will attest. At the very least, it provides confidence in our code — something which can only be of incredible benefit when code is shared across a wider team. At its best, the tests we write can influence the way we develop the code being tested; and save effort, time, and money.

In this post I’m going to look at “unit testing”, and how it can be of benefit to web developers in general.

Read more of “Unit Testing: The Basics”…

Housekeeping

13th April, 2009 @ 11:14am UTC

Development, Site, Syndication, Tools, Web / 1 Comments

I’ve just completed some quick housekeeping on the site — mostly on my feed.

I noticed last night that Google had acquired Feedburner, and that I needed to port my feed over to my Google account. At the same time, I swapped the feed to use Atom instead of RSS. Having completed that, I decided to address a problem with my feed that’s been bugging me for some time:

My feed has always published only an excerpt of each post, instead of the full post. This is because I use the “more” break functionality in Wordpress for the introduction snippets in the bespoke home page theme files, instead of writing an entirely separate excerpt. On previous versions of Wordpress, this also limited the RSS feed regardless of whether you had specifically chosen the “display full article” option in the syndication settings. I’ve had a couple of complaints about this, since most developers seem to prefer reading articles in their feed readers — and so do I, for that matter.

Last time I needed to fix this problem, I had a hell of a time trying to find the offending code in the horrific Wordpress PHP. Thankfully, since then, the bug has been fixed so all I needed to do was update Wordpress. Having completed that update, my feed should now be working as intended originally.

The next step, it seems, will be getting off Wordpress to something home-grown.

A better OS X development environment

12th April, 2009 @ 10:41pm UTC

Apache, Development, Django, Linux, Mac OS X, MySQL, PHP, Python, Server, Tutorials, UNIX, Virtualisation, Web / 0 Comments

When I first began developing using a Mac I made use of the bundled versions of Apache and PHP that were included in OS X Tiger. This meant I only needed to install MySQL to be able to develop fairly complex websites.

However, as my requirements evolved, I discovered that recompiling PHP to include support for features such as HTML Tidy was going to be a pain in the proverbials. So, following advice from friends, I opted to install another version of Apache, PHP5, and MySQL using MacPorts package management. This required minimal configuration and allowed me to easily activate or deactivate features on install — and it also allowed me to add to my environment as I learnt new skills; including Python and Django.

Recently, however, this became an issue again, as I attempted to install mod_wsgi in the MacPorts Apache. No matter how hard I tried, I just couldn’t get it working with more complex Python scripts. At this point, I sought more help from my friends and, after a couple of attempts to rectify the problem, was suggested the movement of my entire development environment to a dedicated virtual machine.

So, thanks to Danny Amey and Brad Wright, I’m now running a proper Ubuntu server as my development environment and have just as much control over it as I do on my live web server. In fact, the two are pretty much identical; and, best of all, I have access to all the files on my dev server using VMWare shared folders, which means I can use all my favourite OS X tools to create and edit files. I really can’t advocate this method enough.

For more information on creating such an environment, I recommend reading Brad’s post, “development virtual machines on OS X using VMWare and Ubuntu“.

Previous Entries

Table of previous blog entries
Title Date Comments
Web Servers and Email: Postfix on Ubuntu 2009.04.11 0 Comments
Practical Django Projects and Django 1.0 2008.09.25 4 Comments
The Joy of UNIX 2008.09.23 7 Comments
Back on the horse 2008.08.10 4 Comments
JavaScript Module Pattern Variations 2007.08.31 5 Comments

© 2009 Tim Huegdon, All Rights Reserved / Website design and development by Nefarious Designs

Powered by Wordpress / Log in

Due to the dodgy manufacturing process, this website may contain traces of nuts!