Sunday, November 27, 2011

Test Automation and the Art of Poetry

You never know where life will take you.  In college, I studied literature – and mostly stayed away from the math/computer science buildings on campus.  For some reason, I was interested in the early English Renaissance and Sir Philip Sidney.  In one of Sidney’s works, A Defence of Poesie (also known as The Defence of Poetry and An Apology for Poetry) , he writes about the purpose of poetry and his interpretation of art.

College was a long time ago, and I don’t remember a lot of my study of Sidney.  One thing I do remember is that Sidney wrote that the finest art hides its art.  The best art or poetry looks easy.  The finest art, the art that takes the greatest talent and the hardest work, looks simple when done well.  I like to think about this when I think about test automation.

A good test automation framework should look simple.  In fact, it should look stupid simple. It should be something that you can explain to someone without a lot of big words or long manuals.  It should be easy to read without having to think too hard.

With this as a guiding principle, I think a good automation program should rely on abstraction.  You can present complex ideas by breaking the ideas into simple, generalized parts.  The simpler parts are often easy to describe so that people can understand them.  Good test automation should be abstracted to the business level.  By abstracting to the business level, you increase readability and open your work to others. You don’t have to be specialist to understand what is going on --  just the same as you shouldn’t need to be a PhD literary critic to appreciate good poetry.

You may have some clever code and some complex code, but when it is implemented, it should look simple.  In an automation framework, the implementation should look simple.  In the actual code libraries that support your framework, the code should look simple.  If not, refactor.  We expect the application developers to do this with their code; we should do the same.

If it looks complex, it is probably either or bad automation or bad poetry. The next time you are looking for a  case for simplicity, look no further than Sir Philip Sidney.  Simplify, simplify, simplify!

1 comment:

  1. I think I understand what you tried to say using this article, a time before I have read "The art of Software Testing" by Myers G. I think you have points in common, one of the characteristics of a piece of art is its simplicity as well if it was made by looking for that...Writing code or automated tests should be simple so any person without further IT knowledge will be avaiable to understand it therefore When you understand something also you can improve it, of my point of view that is the key, Simplicity allows you to make automated tests better...nice blog Bob, thank you for sharing your knowledge and experience.