Category Archives: random

testing tangible assets

What do I mean by tangible assests?

Well, in the case of a web app, one of the most distinctive tangible assets is your domain name. How often have you heard of a company having trouble because their domain name didn’t get renewed in time, taken over by someone nasty or their registrar messed up?

One suggestion I saw recently was to add a test to your testsuite to make check the status of your domains along with other information such as which IP address it was pointed at, etc.

In the perl world, you can use Net::Whois::Raw to get information about the domain and check for renewal date. At some point I’d like to get a module up onto CPAN that will let me just ask for domain_ok('foobar.com'); but it will have to wait for a different day.

What other tangible assets do you test for?

(Slight advert)… Cloudtone Studios is an OpenSRS reseller and you can register domains through us with free privacy support and free DNS available at http://domains.cloudtone.ca/

test plan numbers

So I’m briefly going to talk about test plan numbers here, mainly in response to mst’s blog post, where he expresses his opinion that test plan numbers are bad. I happen to disagree with him in some respects and agree with him in others (we’ve also discussed on IRC briefly).

Matt’s verdict is that test plan counts don’t gain you anything as we don’t need to worry about arbitrary

`exit 0;`

showing up in CPAN code and the like. However, I think there’s a deeper problem with not using test plans as there is code that can happen in tests at runtime that wouldn’t show up as a failure in a test run.

Imagine the following scenario:

While this looks like it’ll run just fine, imagine that there was a bug in $obj->gain_results() that caused it to either return early, or something like an off-by-one error. Your test would run through, but you wouldn’t see the failure and ship buggy code to production. Now, the actual solution to this is to use the right tool for the job and use a test function like is_deeply() or something from Test::Deep or the like; but I’ve seen code like this in multitudes of test suites.

Using a test plan with your expected number of results would have thrown this test up as a failure, with perhaps some diving in to investigate the cause, but you’d at least know there was a regression. Personally I’ll use the right tool for the job and test plans as they give me something to fall back on.

Matt makes a very good point regarding merging of branches and test counts, but I think I’d rather take the hit at merge time, since I’d be dealing with merging issues anyway than have the prospect of a not-easily traceable regression on my hands. When I’m reviewing code changes, I also find it handy to see if tests have been added or removed to double check that I’m not re-covering the same code with the tests I’ve added.

Opinions?

Making perl tests more readable

How many times have you gone through a test script from an outside project, or an older project and read through the source and found that you couldn’t discern the meaning of the test? For me it’s been plenty of times and especially so with test automation using things like selenium. This is part of the reason that Test::A8N exists, to make test automation understandable, even over time and with changing implementations.

One of the simplest things to do to help improve the readability (and therefore maintainability) of your test code is this little tip that I picked up while working with my friend Luke Closs (thanks Luke!).

When writing your test code, simply wrap your related test code in a named block which describes what this part of your test script is testing. Here’s an example from the Net::API::RPX distribution I have on CPAN:

As you can see it’s a pretty simple thing to do and might not indicate much value. However, when your test script gets into the hundreds to over a thousand lines of code, it becomes quite easy to lose the meaning of the test in all that source code, especially when you start re-using variables and the like. As well as being more readable, the named block gives you a lexical scope so that you can be more strict about which variables are re-used between test cases.

I certainly found that writing my tests in this fashion have helped improve my tests and ability to maintain my tests many many times over. Hopefully you’ll find it useful too.

Testing and all things QA

I’ve been a longtime proponent of testing software products and have built up a lot of ideas and methodologies over time. When I’ve been consulting with clients, it’s been difficult to express these ideas and methodologies to people in a succinct and easy to digest way.

I’m going to start writing some articles on testing in a hope to help line these things up into a more digestible format and help firm up some of these ideas in my mind to make them easier to communicate to people, especially those who haven’t come from a testing background.

I’m sure that this will be a useful exercise for myself and also provide some interesting reading material for people. First post in the series later.

internet meme no. 1

I haven’t really been tagged for any of these internet memes, but Jen had an open challenge on her recent one, so I thought why not. The answers below are about Jo and I.

What are your middle names?

Mine is David and Johanna’s is Elizabeth. The whole “two middle names” thing seems pretty popular here in Canada, but it’s uncommon to have more than one back home.

How long have you been together?

We’ll have been together for 10 years in June and married for 4 in September.

How long did you know each other before you started dating?

We had met at my church about a year prior briefly, but it was a chance meeting at a mall in the centre of Belfast and a mutual friend that got us hooked up.

Who asked whom out?

I’m not entirely sure, I think I probably asked Johanna out as the traditional man thing to do.

How old are each of you?

We’re both 25 and Johanna’s the older (by a couple of months… that cradle snatcher!)

Whose siblings do you see the most?

In terms of “see”, probably Johanna’s as my sister refuses to get in front of cameras. In terms of “in person”, neither really, as any visit to see them is kind of a big deal for us and we’ll try to get to see all of them in a trip.

Which situation is the hardest on you as a couple?

Probably our tidiness or lack thereof, it can be a real source of strain. I think we also find not having our families close by is tough on us generally, though I now keep in far better contact with my family now than when I was living in the UK (phone call at least once a week, skype once a month or so).

Did you go to the same school?

Nope, Johanna went to school in her hometown and Edinburgh and I went to school in Belfast, Holywood and briefly in Johanna’s hometown.

Are you from the same home town?

No, but it’s close enough. I grew up in Belfast and Jo grew up in Bangor which is only a 20 minute drive or so.

Who is smarter?

I’m not keen on this question, but it’s totally me. I’m the more math-ey, science-ey of the pair of us, however Johanna’s the academic one, loves learning and reads pretty much non-stop. Actually I’ll change my answer… I think it’s Johanna, mainly because I want to be more like her in this regard.

Who is the most sensitive?

Johanna I think. I’m a bit more of a realist and it can definitely come across as a bit harsh.

Where do you eat out most as a couple?

Since starting the business we’ve generally stopped spending on ourselves and when we do go out it’s usually with friends so I can’t think of anywhere specific. Having a variable income really makes you sit down and take a more active role in monitoring your spending habits.

Where is the furthest you two have traveled together as a couple?

Canada/UK (depending on which direction you look at it from). Other than the emigration and obligitory trips back to the UK, the furthest we’ve been together, is the south of france where we went for our honeymoon. However we’re off to Europe this summer and we’ve got plans to get out to Japan for a big trip at some point in the next year or two.

Who has the craziest exes?

I was actually Johanna’s first boyfriend and I didn’t really “date” too much before I started going out with Johanna. So since I’m the only one with exes I suppose I’m the one with the craziest ones.

Who has the worst temper?

I think it’s probably Johanna, but I can be pretty bad at times. We don’t get into barneys that often but we can definitely rub each other up the wrong way in how we respond during one.

Who does the cooking?

Johanna… I can and do cook pretty well, but I don’t have the patience for it. I think because my mum cooked all day and then did an awesome job when she came home, I ended up as my own worst critic when it comes to cooking. However Johanna’s cooking has definitely improved a lot and I promised I’d cook more to give her a break.

Who is the neat-freak?

I am. Both Johanna and her sister, when they stay anywhere for long enough will “explode” all over a room; it’s a sight to behold. I tend to want everything to be super tidy, but I eventually give in and become messy too. When I decide everything is too messy I’ll go through a 3-4 day phase of just cleaning and it’ll be spotless… that tends to last for about a fortnight and then it’s back to messy. Ah, the circle of life.

Who is more stubborn?

Me. Once I’ve made my mind up about something, it’s pretty hard to change my mind, though I’ve been working on changing that a bit more.

Who hogs the bed?

Johanna. I tend to sleep on my stomach at the side of the bed so she just has more room available to her.

Who wakes up earlier?

We both have a hard time getting out of bed in the mornings, but when I do wake up naturally well slept, I’m the one who’ll jump out of bed at 6am or whatever, Jo’ll tend to want to just keep sleeping.

Where was your first date?

We went for a walk along the seafront in Bangor and then had food at her parents house. Nothing really able to do much fancy stuff at the age of 16.

Who is more jealous?

We’re not really the jealous type. While Johanna was at university there was one of her guy friends that I was pretty jealous of, but it was more about the amount of time he got to spend with her, while I was stuck down in England. I think Johanna tends to get jealous of people “checking me out”, which apparently I’m totally oblivious to.

How long did it take to get serious?

Probably about 2 years or so, which made the whole long distance thing so much more painful.

Who eats more?

I do. I used to not eat a lot, regularly skipping breakfast and often lunch (most that know me, would say I was pretty scrawny). However since taking some stress elements out of my life, I’ve started eating more regularly and have put a bunch of weight on (I’m estimating about 10 kilograms). Now I just need to get active and do some martial arts or the like.

Who does the laundry?

Johanna. Generally Johanna will do the cooking, laundry and the like and I’ll do the cleaning.

Who’s better with the computer

Me, though I’ve been trying to convince Johanna to learn some programming. Generally, this ploy isn’t working… though she has promised to read the new edition of Learning Perl that I bought recently.

Who drives when you are together?

I do. Johanna can’t drive, but we’re hoping to get her taught by the same guy who gave me a few lessons here. I once let Johanna drive the car in a car park and she can’t work a manual to save her life, so I’ll still need to teach her to drive a manual if she wants to drive in the UK (automatics aren’t common there).

linkedin blog linking

The LinkedIn blog link application requires an entry tagged with “LinkedIn” to allow me to add my blog. So here it is!

blogging

So,

I decided that I should really get back into blogging. These days I have a lot more things to talk about and generally I feel that it will be a good way for me to get my thoughts down onto virtual paper. Hopefully I can also write more about what I’m up to both personally, professionally and note some things of interest.

I’ll write up a longer entry later.