Thursday, 20 November 2008

Testing through the Credit Crunch - Part 1 - Development Environments

The credit crunch has gripped the world and not so long ago Gartner suggested that the investment in technology was going to drop. They have dropped the increase in spending from 5.8% down to 2.3%. This may not seem a lot but when companies spend millions on IT each year it adds up very quickly. Unfortunately past experience has shown that testing departments are the ones who suffer first.

More employers are predicting a rise in redundancies in the UK and the other week a politician predicted a run on British Pound.

This doesn't mean all doom and gloom for IT professionals. Over the next few weeks I am going be writing a series of posts with some best practices that I have found. Lets start this series by discussing the Environments we build and test software.

Environments

This is a very ambiguous term so lets split it into the 2 main things I mean. Development Methodology and Testing Environments.

Development Methodology

When creating products it is starting to become common practise to follow Total Quality Management (TQM). The idea is to make sure that quality is in every process of the organisation. By moving to your company to this principle you will be adding confidence to your product to all stakeholders. More confidence in your stakeholders will mean that your department will get a little more funding and since its the credit crunch it must be good!


A lot of companies actually practise this without realising it. The main thing to take away from TQM is that everyone in the company has a part to play in the quality of the product that is delivered!

Agile or Not!


My first few jobs were at financial institutions and thought it was normal to do testing at the end. I worked as a WinRunner Automated Tester. I then started working on some Open Source projects in Java and was asked "Can we see your unit tests? Did you use JUnit?".
I answered quite sheepishly "I tested it by checking that it did what it needed. I don't have any JUnit tests."


Obviously my code got rejected because it wasn't neat and didn't have proper unit tests. There was a few other issues that they raised and to be honest if I was doing the code review I would have rejected it too!

Now I work for an ASP/ SaaS and we do a little Agile. I have been able to see the value of being agile while developing software. The main thing that I have learnt is that Technical/Design debt is something that is inherently low in an Agile Evironment.


Technical debt is the idea that when you release software you go into debt. If you have cut corners it will affect the level of debt you have. If you leave these items in your code it will start gaining interest on your debt. So if you have any TODO's in there that is interest on your debt. If you have poorly designed interfaces then you have added interest on your debt. Putting testing at the end of a project will definitely add interest to your debt! Doing tests at the beginning of the development process will bring down the "interest" accrued against your debt in the development process.

So to help us get through this credit crunch we need to bring down the debt in our software. The best way to do this in my opinion is to achieve this is to move your development team to a Test Driven Development way of thinking. As I said above if you place your tests earlier in the process you will lessen your technical debt. The simple rule when it comes to testing is the earlier you test the cheaper it is to solve bugs. So putting in automated tests at the beginning of the development process will go far in bring down your actual development costs for that project but also for future developments.


In the next post I will discuss further the value of Test Driven Development.

Friday, 24 October 2008

GTAC 2008 - Day 2

Day 2 of GTAC 2008 has been quite interesting. The talks that have interested me were the talk on Context Driven Testing.

This talk, by Pete Schneider of F5, dealt with what context that tests were being created. It dealt with a common issue that testers and deverlopers have and most of them ignore. It was really interesting in seeing that they were 11 different applications that testers had created and were maintaining but there was a lot of overlap. They found that creating tests in the right context and with the right owners of tests has dramatically made a difference in getting their application tested.

The main thing that I took away from it is; When creating a testing framework ask yourself the following questions

  • Who is going to write the framework
  • Who is going to build and maintain it
  • How are you going to use it
  • How long will the tests live

The next talk that was really interesting was on Automated Model-based testing by Atif Memon and Oluwaseun Akinmade of University of Maryland. It was a really good talk on creating models for test cases, similar to my Graphical Test Strategy post from the beginning of the year. The difference between my post and this talk was the model is created on the fly by the test code that then builds a WebDriver test case. There is one draw back that I noticed and I know I wasn't the only one. This modelling works well on websites that don't have AJAX. Its a big draw back and they did mention that they are working to get it sorted.

Its value for Desktop applications is really good and I would definitely recommend it. It is able to recreate states for the test and make sure that works well and has good coverage.


The next talk was on the value of unit tests by Christopher Semturs. He was advocating the use of Mocks in your unit tests so that you can get better granularity of your tests. This is something that really interests me because I like making my tests fast because if a test is fast a developer is more likely to run the tests. He was advocating the idea of small,medium and large tests. Its an idea from some Google guys where you do unit tests in isolation and then do pair-wise integration tests. This means that you drop your large end to end tests number dramatically.


GTAC 2008 has been really cool with a lot of clever people talking about different aspects of testing and describing what is needed from testing in the future. Its definitely been worth the jetlag!

GTAC 2008 - Day 1

Day one of GTAC has been really cool. There have been a number of really good talks. I will put links to the YouTube videos when I know them.

James Whittaker's opening talk was a really good start to the day. One of the main things he talked about was the visualization of testing for the future. He discussed the way that people can visualise when there are new code differences. This can be very useful in making sure that testers can see what is new and what should be concentrated on. I am always keen on using visual ways to test and make sure that the quality is high.

The next talk that caught my attention was "Advances in Automated Software Technologies". This talk discussed the idea of Autonomous Computing in software testing and the idea that you can auto generate test cases against APIs. It is an interesting idea but the way that it was put across was that you can only use this on items where the requirements are rock solid. This is not really something that can be applied to Agile developments.

The talk on Groovy was really good. I have started playing with Groovy when trying to automate SOA testing using SoapUI. Its a nice language that can be strong typed or weak typed at the same time and really useful for scripting. Since I haven't played with it a lot I did learn a lot like you can hook into all languages that use the JVM.

The next talk that really interested me was the last talk of the day. It was on the testability of code. It was looking to see how easy is it to test and making tests simpler. This is important because it means that your tests become manageable and supportable. Vishal Chowdhary was advocating SOCK:

  • Simplicity of your code
  • Observe how things work and interact
  • Control of your tests
  • Knowledge of what it should be done
He was also saying that we need to make sure that we don't overdesign software because this can add extra complexity when there doesn't need to be!

The talks have been very good and have stimulated some ideas that I want to take back to work! I am now off to the Google Seattle office for a tour the lightning talks.

Thursday, 16 October 2008

.Net Gem - How to Unit Test Internal Methods

I have recently started redoing unit tests for bit of code at work and came across a internal methods and classes that needed to be tested.


This posed a question of: how do I access the internal methods and classes to test them properly from an external assembly?

I found this little gem that a lot of the developers where I work had not heard of, this doesn't mean that its not common knowledge but thought I would share it a little more.

I have put a scenario below of how it might work.

Being a good TDD developer you decide that you want to write your unit tests for an internal method. You create your .Net Class Library structure so you know what your tests need to call to do your asserts. It may looks something like the image below.


So now you want to start writing your tests and notice that your intellisense is not bringing up your internal class. So what do you do next?

Open the AssemblyInfo.cs file that is in your Properties folder. Add the line [assembly:InternalsVisibleTo("Unit.Tests")] somewhere near the top.

Now your Internal Classes and methods are only visible to Unit.Tests assembly.

Your start writing your unit tests and intellisense should be playing Mr. Nice Guy and we should see something like below.




I hope that it has been useful!

Sunday, 21 September 2008

Are regression packs still worthwhile?

Recently I was on forum and noticed the thread "Why do we do Regression testing?". In it the person was complaining about their company's regression pack and asking if it was worth the effort of fixing it?

My answer was a little quick off the mark. I replied saying "Definitely! Its the backbone for each and every build!". But then this got me thinking, How many testers out there DO NOT practice Agile development? How many testers DO NOT work in an environment where automation of tests is 2nd nature?

I do not ask this question in a malicious way, I genuinely would like to know. When I go to SIGiST there are a number of questions in the presentations/workshops by people who have not worked in an Agile environment and, to be honest, seem scared by it. These are the same people when you mention something like "Continuous Integration" and they get that deer-in-headlights look on their face.

This leads me to my next question; Is there a "Rich get richer, Poor get poorer" divide happening in testing? People in conferences mention that the lines between development and testing is blurring. It's called grey-box testing. But your average manual tester in a large non-software institution (Banks, Insurance Companies, etc) have got their "break" in testing by being seconded to the test team for a project and never wanted to leave their secondment. They may not have been given opportunities to learn how to program or may not even have heard about concepts like Agile, TDD and all the other new ways testers do their jobs.


To these people; the answer to my original question is still the same: "Yes! Definitely! Otherwise things that used to work may not work anymore. I would also suggest trying to automate the regression pack as much as possible so that you can concentrate on making testing more efficient. Try automate as much as possible so that you can concentrate on doing testing on those hard to test areas. Quality of software is still the main objective of testing."

Thursday, 18 September 2008

Google Test Automation Conference 2008

I have just got back to work from my summer holidays to find a nice little gift waiting for me in my Inbox!

I have been given an invite to the Google Test Automation Conference(GTAC) in Seattle, USA! GTAC for those who don't know is the annual conference that Google hold. Its an invite only conference where people can just let their geekyness flow!

This year its being held in Seattle, USA. Last year it was held in New York and the year before that it was in London.

Below is a list of the presentations at the conference

Scheduled Presentations

* Atom Publishing Protocol, Testing a Server Implementation by David Calavera
* JInjector: a Coverage and End-To-End Testing Framework for J2ME and RIM by Julian Harty, Olivier Gaillard, and Michael Sama
* Advances in Automated Software Testing Technologies by Elfriede Dustin
* Taming the Beast: How to test an AJAX Application by Markus Clermont and John Thomas
* Automated Model-Based Testing of Web Applications by Oluwaseun Akinmade and Prof. Atif M Memon
* Boosting Your Testing Productivity with Groovy by Andres Almiray
* Practicing Testability in the Real World by Vishal Chowdhary
* The New Genomics: Software Development at Petabyte Scale by Matt Wood
* The Value of Small Tests by Christopher Semturs
* Deployment and Test Automation: Extending the Notion of 'Done' to 'System Tested on a Production Deployment' by Marc-Elian Begin

I am going to try my best to update my blog while I am there so people know how its going. If anyone reading my blog is going conference drop me an email so we can meet up and talk shop!

Thursday, 3 July 2008

Tester 2.0 - Definition of an Agile Tester

I have been to a number of SIGiST Conferences over the last year and have always been impressed by the calibre of the speakers there. There has been a theme lately talking about Agile Development and Agile Testing but the thing that always seems to missing is someone giving their interpretation on Agile Testing. To actually describe what an Agile Tester is! And what they should be doing.

Below I am going give my opinion of what an Agile Tester by describing skill set needed.We are after all only as good as our skill set! I am going to rate them from 1 to 10 with 10 being needed and 1 being desirable.












































Skill

Score

Reason

Creativity

10

A good tester needs to be extremely creative when trying to test applications. Developers like to think that they are clever and get all the bugs before its released. Unfortunately this is not true when a tester starts being creative in the way they test the application and breaks it very quickly!

Innovation

10

A good tester needs to be able to innovative with the tools that they have. An example would be in SaaS(Software as a Service) companies who constantly striving to be the next big thing and competing against the likes of Google, Microsoft, Salesforce, etc. This drives innovation in development which means that it drives innovation in testing!

Test Automation

9

Every Agile tester needs to be able to do some form of automated testing. I am not saying that the tester must know how to use every tool that is out there but they need to understand how to create the automated tests.

Exploratory Testing

7

Agile Testing tends to mean Exploratory testing. I know that some people will disagree with this but because testing tends to happen on the fly and appears ad hoc but it isn't. Exploratory testing does have a set of rules that need to be adhered and will mostly bring a number of bugs to the surface just as well as normal scripted testing.

Communication

7

One of the main pillars of Agile Development is communication. This is very important in my opinion because a good tester must be able to communicate bugs to developers and requirements to end users. A good tester will also be able to challenge technical architects on their ideas. I know the last sentence can be very hard to achieve in large organisations but it doesn't mean that you can't send them an email to make suggestions.

Development

5

An Agile Tester should not be afraid to look at a developers code and if need be, hopefully in extreme cases, go in and correct it. I am not suggesting for one minute that they must be able to code entire applications but must have the confidence to look at a bug, spot the error in the code and either write a unit test to break it or point out the line where they think the issue is.

An example of this is where doing Paired Programming with one developer we shaved of nearly 70% off the time it took to run a unit test test suite just by doing a one line change to their tests which got them to make one other small change.

Ability to work in pairs

3

I am a fan of being able to knock ideas off each other. I wouldn't do paired programming all the time but I like the concept and how it seems to get things done properly with little fuss.

This is not a comprehensive list but these for me are the most important things. Tester 2.0 is something that a number of testers need to strive for if they do not want to get left behind. There is a definite blurring of lines between development and testing. Gone are the days of "I have finished my part, over the wall it goes!". There is also a move to more "Grey Box" testing because of this blurring.