Testing U.K. Postcodes

posted in: Software Testing, Testing | 0

Testing a postcode input field sounds simple and yet, there are a few things that need to be understood in order to test it effectively. The simplest of tests are something like “Does the postcode have to have a space or not?” or “Will it accept both?”

We all have our ways of testing input fields, but I feel the postcode input field doesn’t always get the attention it deserves. Below are some examples of tests I think we should be adding to our test suite along with a list of unusual postcodes I have collected from other conversations on the subject as well as my own research.

Key Points

  1. 6 or 7 characters. 8 with a space | A UK postcode is a max of 7 characters in length; 8 with a space.
  2. Can the postcode have a space?
  3. Can the postcode not have a space?
  4. Is the postcode in the right sequence?
  5. Can the postcode field accept the odd postcodes like SW1?
  6. Can the postcode be sent in lower case?
  7. Can the postcode be sent in upper case?
  8. Can the postcode be sent in upper and lower case?
  9. You could go to the extremities of checking all 124 postcode areas in the U.K., but personally, I think this is a bit of an overkill.
  10. What you might want to also consider are other parts of the UK such as Northern Ireland and the channel islands. Should these postcodes be accepted? If yes to Northern Ireland for example, then does that mean you shouldn’t accept Southern Ireland postcodes?

 

Unusual postcodes used for Postcode input field testing.
PostcodesTown/Village
W1J 7NT149 Piccadilly, London. House of the Duke of Wellington
DE12 8HJ17 Burton Road Coton in the Elms, Derbyshire. The Black Horse Pub, possibly the furthest pub from the sea in the UK.
SW1A 1AABuckingham Palace
HD7 5UZcovers 7 streets; the most in the UK
CH5 3QWthe longest addresses in terms of numbers of elements
Anywhere in SA63the Post Town is CLARBESTON ROAD (Example - SA63 4QJ)
W2 1JBWhen all the premises get expanded you'll get the longest 'premise string' in the UK
PL7 1RFDevon and Cornwall Police vs Devon and Cornwall Constabulary
GIR 0AAspecial case Postcode for Girobank at Bootle
JE3 1EPYou will find that 'towns and large villages' are classed as Localities; Jersey; the Isle of Man and Guernsey are the Post Towns.
JE2 3XPYou will find that 'towns and large villages' are classed as Localities; Jersey; the Isle of Man and Guernsey are the Post Towns.
IM9 4EBYou will find that 'towns and large villages' are classed as Localities; Jersey; the Isle of Man and Guernsey are the Post Towns.
IM9 4AJhas no street
GY7 9YHYou will find that 'towns and large villages' are classed as Localities; Jersey; the Isle of Man and Guernsey are the Post Towns.
GY1 3EWThere is the strange case of the PO Box with no other identifying info
PL7 1RFAddress list includes ‘&’ ‘(‘ ‘-‘
IV27 4EG29 LAIRG - 29 Lochside

 

Leave a Reply