Tuesday, January 30, 2007

Testing With Sun Tzu - Chapter 1

Being somewhat of a historian I tend to look for parallels to things in the modern world with the past, perhaps its the illusion of connection or I am just bored, some days it is hard to say.  Still when I was driving around the mall this past weekend with my wife and son and looking for a parking space I started to think about a parking strategy, or was it tactics, then it hit me - what about my testing tactics or stragtegy?  Of course there are many parallels that work in the world of software and business, but I like Sun Tzu or Sun Zi, depending on your pronunciation.  I am sure this has been done before, but what the heck, I've never done it before.

Sun Zi is the man behind the treatise The Art of War.  While the Book of the 5 Rings by Miyamoto Musashi always has its place, I've also seen some use of the Art of War in planning testing, and its chapters line up well (while also giving me a lot of time to expound on them, think of it 13 more posts by me!).  But in the interest of history lets get things straight, Sun Tzu is actually a title that translates as Master Sun, his real name was Sun Wu, where Wu is the same character as martial (like Wu Shu or martial art), he lived by the Western calendar around 544-496 BCE.

Mind you these are my interpretations, your own my vary.

The first Chapter is about Laying Plans.  Preparing for battle and readying the army for conflict, but the most apt comment, and probably most used, is "All warfare is based on deception.".  Testing is finding deception, or the uncovering of deception if you will, faults lie hidden and must be brought out, the small bug may be a deception that requires more investigation to find the larger one hidden beneath.  Never let the enemy distract you, and yes I am referring only to the defects as the enemy not the person who created them, in my place of employment open warfare is discouraged, hopefully yours has the same policy.  Yes I know we have trebuchets in the QA area but those are strictly for amusement, we never launch them directly at people, on purpose.  Yet.

In Laying Plans there are 5 constant factors that are mentioned:
  1. Moral Law
  2. Heaven
  3. Earth
  4. The Commander
  5. Method and Discipline
So lets take these in order.

Moral Law refers more to the ruler and in the day of Sun Zi was more along the lines of harmony, especially among the ruler and his people.  Keep the people happy and content, and they will follow their ruler.  Focusing on harmony is useful here, in that the Test Strategy that has been defined keeps everything in play, while a Test Plan is written for one area it should be in harmony with the others.  Tests should be done so that individual pieces (Unit Testing) are complete as well as the entire structure is done (System Testing) so that no plan overlaps another, no need to run the exact same test twice, and cases done in one plan complement another.  Nothing gets lost, or missed hopefully, providing for more complete testing.

Heaven, in the treatise is a reference more to the environment such as night and day, hot and cold, times and seasons.  This is a bit ephemeral for use in a test environment, I could say infrastructure but wait on that one, still there are some uses here.  Consider the schedules, the times the software comes in, the time of year, the Friday at 4pm drops that may require work on the weekends or on the holiday or even that snow storm that started up while you were reading email or even that annoying person in the next cube who constantly checks voicemail on speakerphone.  Much like the armies in ancient China had no control over the elements neither do we, except the guy using the speakerphone, and like it or not they effect a persons mood, so try to leave what is not work related out of the scheme and focus on the task at hand.  If something is frustrating take a few deep breaths and get back to a calm state, don't let external factors you cannot control get in your way.

Earth is the physical realm, such as distances between the armies, chance in life or death, security and danger.  In a modern implementation the infrastructure fits nicely here, make sure you have the infrastructure to complete the tests that need to be done, is the lab equipped to handle the project?  Are there security concerns?  Are there chances being taken with the tests that are being done?  What is the overall risk of delivery?  If an external group is involved in the project are they being taken into consideration, and should there be additional time added to a schedule to handle them?  There are a lot of considerations on just the physcial aspects of a project, thinking through them all is a good exercise, taking some time early in the planning phase to mentally walk through the entire project is useful.  Take notes on how the flow would go through the entire project, what would be needed and when, get input from those involved.  Its a small amount of time to spend on something that could be a roadblock later on.

The Commander was used to represent the virtues of wisdom, sincerity, benevolence, courage and strictness.  Mostly this was to generate an image of a good military commander who understood and cared about his men, while being an apt leader who can bring them victory.  While not everyone needs to be a leader, someone needs to be part of the crowd following, its good to look at what it would take to be in charge, are there skills needed to be the lead in the project?  What are they?  Do you have them?  If not, how do you get them?  Again, this is all about planning, and planning the Lead is also important, a person cannot lead unless they do not know what they are leading people to, sure they could but its not really effective and let's face it those people usually bring disaster with them.  Have the wisdom to know what you do not know, the sincerity to ask questions and give answers, the benevolence to work with others, the courage to stand up when needed and when things are not going well and the strictness to keep things on track without meandering all over.

Method and Discipline, the last ones, refers to the generation of the army and its structure, in addition the supplies and supply lines necessary to keep the army in the field.  Just like in Earth where the infrastructure needed to be put in place, its needs to be properly maintained, if a server is being used and it crashes how will it be replaced?  Personally I have spent time in my labs learning what I need to do my own server rebuilds, how many servers I have killed I can't count, but I know how to regenerate them as needed.  Understand what the test lab structure is, how to get replacements and be on good terms with your IT staff, who can give you that all important image disk to rebuild the computer with.  Know who is working on the project, and in what capacity, finding the Subject Matter Experts and checking with them on issues, or changes, can be useful.  Just as an army always changes in battle, so does the test lab and the tests during a release to QA, know what is happening underneath you and avoid surprises.  If the database is being restored on Tuesday, its probably not the best day to do some UI testing that relies on data put in on Monday.

Hopefully, I've made you think about some of this I don't have all the answers, I have the wisdom to know I don't, but I try to find them.  Before they find me.

Thanks for reading, and there will be more of this.  12 chapters to go!