Sunday, 14 June 2015

A failure to do bva

Boundary value Analysis ...
... is a simple test technique.  It is taught on all introductory software testing courses.  The theory is that you split input data into sets of valid and invalid input and then test at the boundary between valid and invalid data.  Easy example, a function accepts an integer between 5 and 10.  Now ignoring the invalid sets as they approach the upper and lower limits of the integer data types you would use the following tests:
  • lower bound
    • 4 - invalid
    • 5 - valid
    • 6 - valid
  • upper bound
    • 9 - valid
    • 10 - valid
    • 11 - invalid
You obviously also test values in the middle of each set such as 3 or 7.  Assuming that the implementation of the function is approximate to the spec then this should be a reasonable set of tests to run.  Lets try a real world example:

A credit card company has a system that generates card security check (CSC) number (the last 3 numbers on the back of your card) and a system that checks that during a card not present transaction (like when you buy something online) the CSC is valid.  A CSC has the following properties:

  • 3 digits long
  • has a min value of 001
  • has a max value of 999
The test case of a CSC having the value of 000, is that valid or invalid? Not sure? well a test case you should try.

I recently got a new credit card to replace my older ones which were due to have a interest rate rise. The cards arrive and one has a CSC of 000.  I think no more about it apart from, wow that's going to be easy to remember.  Tonight my wife needed to make a purchase online.  Since it was for work I thought we would buy it on the credit card so that when she was reimbursed the money could be applied direct to the credit card.

To my concern the transaction was declined.  I checked online that there was ample credit for the purchase.  There was.  I called the company and asked why the card was declined.  Sanjay (the call taker) advised me that I had mistyped the card security number.  I mentioned that there was NO chance of that since it was so easy to remember (000).  He put me on hold.

Yes Mr Yates.  There is a problem.  The CSC 000 is considered invalid by our system.  As a security precaution we have cancelled all of your cards.  We are sending you new ones in the post.
Excuse me! I replied.  Why is that number considered invalid when it was one of your systems that generated it and printed it onto a card?  Surely this is a boundary value that would have been tested?
Sanjay was very apologetic and credited me £25 in way of an apology (so that's the purchase paid for) and allowed me to use my wifes card to complete the purchase before he canceled all of the cards to process the request for new cards to be issued.

We all make mistakes but there is a compound failure here.  Should the value 000 being fed into the card processing system really cause all the cards associated with an account to be blocked?  I'm not saying who the company is but I wonder if someone else tried a card not present transaction using a CSC of 000 would all their cards be blocked as well?  I'm sure it was never tested as the CSC generation system should never have issued a card with a CSC of 000

So what have we got:
  • 2 systems that have the same spec of what should be valid and invalid, however different implementations.  One system considers the edge case 000 valid and the other invalid. 
  • A system that doesn't recover from a card not present transaction having a CSC of 000.  Instead defaulting to the 'safest' behavior of blocking all cards associated with the card 
  • Potential opening for a test consultant? 
So I am bit annoyed and inconvenienced and I acknowledge that the chance of a card being issued with a CSC is  1/1000 but if a simple test case has been written this wouldn't have been an issue.
Also means I now have a great example when teaching boundary value analysis.

Friday, 24 April 2015

Difference between load and stress - using a metaphor

Load or stress testing a component are two different test techniques that often get confused.  Here is an analogy which I have modified from a conversation I had with James O'Grady

A load test is driving the car for 874 miles at an average speed of 60mph, in 5th gear, while using the air conditioning, cruise control and CD player.  Using lots of the capabilities of the car at expected limits for a length of time.  During and at the end of the journey we would expect the car to still be operational and all the dials on the dashboard to be reading nominal values.  A stress test is a completely different type of test.

In a stress test we want to push the system beyond its limits.  Often the limits will not be clear and so often the test becomes exploratory or iterative in nature as the tester is pushing the system toward the limits.  If we reuse the driving analogy we might start the same journey but now drive at 70mph in 3rd gear.  Initially we think this might be enough to stress the car.  After 60 minutes we increase the stress by removing some of the car oil and deflating the tyres.  Now some of the dashboard lights are showing us that some of the car components are stressed.  We then remove some of the coolant fluid and remove a spark plug.  Now the car is seriously under stress.  All the lights are on and eventually the car gracefully stops operating and we are forced to steer to the hard shoulder.  Once safe we re-fill all the fluid and oil, re-inflate the tyres and repair the spark plug.  Now we are able to restart the car and resume our journey driving properly.

A stress test is pushing the system beyond the limits it is designed to run at either by restricting resources or by increasing the workload (or often both).  This is done until the system either gracefully shuts down or restricts further input until it is now longer under stress conditions.

Both tests are heavily contextual as it relies on a deep understanding on how the software will be used in the wild.  Will a customer use the software for a long period of time under a load condition or do they just use it in short bursts.  This question is more important when you consider software built in the cloud.

If your software is built in the cloud and you are re-deploying every 2 weeks then your view of load and stress testing will be different to testing an on prem application as the operational realities of using that software are contextually different.

Wednesday, 1 April 2015

I am a runner ...

I am still running.  Had a few weeks off while I recovered from chesty coughs and had to repeat a few weeks to regain fitness after the cough BUT.

I am a runner!

I know as Laura (the 'voice' of the NHS Couch to 5K podcasts) said I was.  She gives you this reward at the end of the last run of week 6 (25 mins of continuous running)  and it brings such a wave of emotion.  6 (or in my case a few more) weeks of hard physical exercise and mental fortitude to keep going finally pays off.  I am a runner.  I can run.  

I still have my goal of a 30 min 5K to achieve and I know to do that I have to build more pace and more stamina into each run.  However I have another 9 runs to do that in and it all feels achievable.  

Earlier in the course there are certain runs that fill you with horror as the length of time spent running is cruely ramped up.  The 3 min run in week 3, The 5 min run in week 4 and the largest of them all the first 20 min run at the end of week 5.  But I have conquered them and there are no more left, just a gentle increase in duration till we hit 30 mins.  Feel a little like Frodo after throwing the ring into mount doom.  The main obstacles have been completed.  Sure it is still a long way home to the Shire.  But I've got this far, I can keep going to the end.

I have also found out that sharing my progress has inspired two others to start running.  One is about to start week 4 and the other week 1.  I never EVER thought that me doing exercise would inspire someone else.  I was always the one that needed the inspiration to do anything physical.  

I've lost weight, my belts are all on the last hole and I need new trousers.  My shirts fasten around the collar and suit jackets are no longer straining the buttons.  This feels terrific.

If I ever meet Laura I owe her a drink.  The podcasts have tangibly changed my life and made me healthier where gyms and diets have failed.

Just need to keep running and finish what I started and do a sub 30min 5 K run.  But this is no longer a pipe dream.  It is realistic, the hard work is over I just need to keep going

Monday, 26 January 2015

Keep on Running

10 runs into the year and I am surprised that:

  1. I am still running even though
  2. I was surprised with how incredibly unfit I was and that surprises me that
  3. I am actually getting better
The couch to 5k programme that I am following now has me running for 3 minutes.  180 seconds of running doesn't seem a lot, but 10 runs ago I couldn't go for 60 seconds so this is a massive improvement.  My last run detailed here: was the first run that I didn't do as a loop.  I ran from the Mountbatten centre through to cosham centre.  Although not the greatest distance, mentally it felt great to start in one place with a certain destination in mind.  At this point in my training plan this has been very helpful.

As I said when I started this I have been gathering statistics on every run and averaging them out over each week of the C25K programme.  I've decided to make this public in case anyone is interested.  Apart from the raw data I have learnt a few other things:

  1. Running with spectacles, in the rain, while getting too warm means you spend way too long trying to wipe away the rain and haze.
  2. Hills are hard, but only in one direction
  3. Never judge a run by your heart.  I can feel that a run has gone badly but the realz of the stats show that the run was awesome
  4. Running makes me feel so much better

Sunday, 4 January 2015

1st run of the year

After my new years resolutions I had to commit and actually run.  Naturally being a nerd this activity required tracking and monitoring. I spent quite a bit of time working out how to track my run, what I was going to listen to and where I was going to run.

Tracking my run.
I have started using run keeper on my phone for this task.  It tracks my run via built in GPS, gives me details of my progress every 5 mins and then saves all the stats of my run to the cloud.  I did consider a fitbit or jawbone device but this app was free and seems to do a fine job.  The app also allowed me to design routes online and then view them on my phone.  Quite handy to see where I was going to be running and how far that was in advance rather than just be running aimlessly.

What to listen to.
Instead of just picking a random running album I decided to use the NHS free couch to 5km podcasts.  Each one uses intervals of running and walking to build up stamina over a period of 9 weeks where hopefully I should be able to run 5km.  I transferred the podcasts to google play and then stream them to my phone.  Having someone tell you when to run and when to walk was quite helpful

So no need for any new toys.  Amy had already bought me some trainers and I have clothes that I can run in.  However since my phone was going to be my tracker and music player I invested in a karrimor arm band to house my phone and a pair of runners headphones.  Both were half price.  The headphone were very comfy and the arm band although too tight to fit on my upper arm kept my phone safe on my lower arm.