Wednesday, December 19, 2012

Proud to be a Java Code Geek!

Hi All,

Just to say I'm proud to be part of Java Code Geeks - if you are interested in all things Java, go take a look and learn how to code! I'm taking a look at Android Apps over Christmas!

Friday, December 7, 2012

Software testing is common sense - right?

I'm talking here about functional testing, not performance testing, automated testing or penetration testing where you may need specialist technical skills. I may be playing devil's advocate - I'll let you decide.

I read and hear zealots advocating various tools and techniques, plying their trade. Consultancies all have their own 'new', bespoke way of doing things. It's special and better than the rest - but it isn't cheap.

I sometimes wonder, does it all need to be this complicated? Do I need to learn these techniques to know what to do and how to behave?

I don't think so - there I have said it - what do you think?

I think there are a handful of things a tester needs to have at the forefront of their mind when testing:

  • what are the business (or otherwise) goals of the software?
  • what problem is the software trying to solve?
  • what risks are there - how likely are they and how serious are they?
  • have empathy with the customer/user - get inside their heads - behave like them
So, do testers need the latest new-fangled jargon and terminology? Well, I think you know where I stand. I think testers need:
  • To be intelligent
  • To have business acumen (when testing business software)
  • Common sense
  • Good communication skills
  • People skills
  • Attention to detail
  • (you can't make a silk purse out of a sow's ear no matter what framework you use)
Testers should free themselves from the processes sometimes imposed on them to focus the mind on the problem at hand - the software and the business goals of that software.

Tuesday, December 4, 2012

Is your website mission critical?

For some businesses, their website isn't just a static or even dynamic information giving tool. For some, it is more than just an advert providing information on how to get in touch. For some, it is the absolute life-blood of their business.

A few years back I worked for an airline. I can't remember the exact figures, but the website turned over approximately £300M per annum and that was approximately, for the sake of argument, 80% of the business.

If the website went down for any length of time, it was very serious indeed. In a very competitive market place where margins are tight, it could spell the end. Not only is there the immediate cost of lost sales and the added cost of having to increase the head count in the call-centre, but the damage to the brand is considerable. If customers have a bad experience, they can be quite unforgiving and go elsewhere.  The cost of trying to win back those customers is very high indeed, and may even be impossible if your competitors look after them right. Also, disgruntled customers tend to be more vocal than the happy ones - so you can be sure they will be telling anyone who will listen not to bother going to XYZ airlines!

So what can you do?

Well, I have blogged before about software testing and whether you need it or not. As the owner of a company which advocates and provides specialist software testing services, I would wouldn't I!?

So software testing can go a long way to avoid situations where your website, the life-blood of your company, is running smoothly.

However, it isn't the be all and end all. Sometimes, even the most robust software, well written and thoroughly tested can go down. Why? There are lots of reasons. Perhaps it relies on a flaky 3rd party service. Perhaps there is a power cut and the UPS only has 3 hours of juice in it. Maybe there is a hardware failure.

In these situations, day or night, you need to know about it, so you can fix it before your customers even notice if at all possible.

With it's expertise in test automation, my company can provide a bespoke system to monitor your e-commerce web site 24x7. In the case of an airline for example, we could drive bookings through the website, checking data returned during the booking process - did the seat assignment work, did the insurance booking work, did the car hire booking work, did the hotel booking work and of course, did the flight booking work! If any of these fail, an alert email and or text can be sent to the support desk and they can investigate. Get in touch if this is of interest to your business.


Monday, December 3, 2012

Twitter Scheduler Application

I'm quite new to Twitter, but believe it is a powerful tool for small businesses such as mine.  I wanted to make it even more powerful for my software testing consultancy business, without finding it taking up too much of my time.

The functionality I wanted was to be able to set up my planned tweets first thing in the morning, before the 'real' work began - and then leave some sort of application or robot working in the background to actually send the tweets when I wanted them sent.

This enables me to write a few tweets and get them sent at key points during the day (or night) for my target markets - for example when the West Coast USA is finishing the working day - I'm UK based.

There are commercial tools which have this functionality, but they are paid for and also I am told quite fiddly to set up.  Plus I wanted to write my own!

It turns out it is very easy....

I wrote the application in Java using the twitter4j library.  I needed only a handful of classes:

I had a Tweet class which had fields such as message, dateTimeToSend and hasBeenSent.

I had a TweetScheduleReader which utilised the Java CSV library.  This read in my planned tweets from a CSV file - reading in a list of messages, the time to send them and a flag as to whether they had been sent yet.  This gets converted into a List of Tweets held in memory.

Then there is a class with a main method which just called the TimerTask run method hence:

timer.schedule(timerTask, new Date(), DELAY);

So starting from the moment this line of code is called, every DELAY (in my case 1 minute), the timetask run method is scheduled.  So what gets run?  See below.

I had a class which extended TimerTask and the run method was this:


public void run() {

//Login to twitter
Twitter twitter = new TwitterFactory().getInstance();
twitter.setOAuthConsumer(CONSUMER_KEY, CONSUMER_KEY_SECRET);
String accessToken = getSavedAccessToken();
String accessTokenSecret = getSavedAccessTokenSecret();
AccessToken oathAccessToken = new AccessToken(accessToken,accessTokenSecret);

twitter.setOAuthAccessToken(oathAccessToken);

//read the list of tweets from CSV
List<Tweet> tweetsToSend = scheduleReader.getTweets();
if (tweetsToSend == null || tweetsToSend.size() == 0) {
scheduleReader.readTweetsFromCSV();
tweetsToSend = scheduleReader.getTweets();
}

Date currentTime = new Date();
List<Tweet> updatedTweetToSend = new ArrayList<Tweet>();
for (Tweet tweet : tweetsToSend) {
if (currentTime.after(tweet.getDateTimeToSend())) {
if (!tweet.isHasBeenSent()) {
//send it!
try {
                                                //I appended the date to make the tweet unique - else it gets rejected by             //Twitter
twitter.updateStatus(tweet.getMessage() + " " + new Date());
} catch (TwitterException e) {
e.printStackTrace();
}
//mark it as sent
tweet.setHasBeenSent(true);

}

}
updatedTweetToSend.add(tweet);
}

//update the tweets in memory marking them as sent if appropriate
scheduleReader.setTweets(updatedTweetToSend);

}

I found this tutorial very useful regarding the authorisation: http://www.javacodegeeks.com/2011/10/java-twitter-client-with-twitter4j.html