At StarEast in May 2016, I was kindly invited to give a lightning keynote, which I did on this analogy. Hope you find it interesting and useful!
-----------------------------------------------------------------------
Automation
is SO easy.
Let me
rephrase that - automation often seems to be very easy.
When you
see your first demo, or run your first automated test, it’s like magic - wow, that’s
good, wish I could type that fast.
But good
automation is very different to that first test.
If you go into the garden and see a lovely juicy fruit hanging on a low branch,
and you reach out and pick it, you think, "Wow, that was easy - isn’t it good, lovely and
tasty".
But good
test automation is more like building an orchard to grow enough fruit to feed a
small town.
Where do
you start?
First you
need to know what kind of fruit you want to grow - apples? oranges? (oranges
would not be a good choice for the UK). You need to consider what kind of soil
you have, what kind of climate, and also what will the market be - you don’t
want to grow fruit that no one wants to buy or eat.
In
automation, first you need to know what kind of tests you want to automate, and
why. You need to consider the company culture, other tools, what the context
is, and what will bring lasting value to your business.
Growing pains?
Then you
need to grow your trees. Fortunately automation can grow a lot quicker than
trees, but it still takes time - it’s not instant.
While the
trees are growing, you need to prune them and prune them hard especially in the
first few years. Maybe you don’t allow them to fruit at all for the first 3
years - this way you are building a strong infrastructure for the trees so that
they will be stronger and healthier and will produce much more fruit later on.
You may also want to train them to grow into the structure that you want from
the trees when they are mature.
In
automation, you need to prune your tests - don’t just let them grow and grow
and get all straggly. You need to make sure that each test has earned its place
in your test suite, otherwise get rid of it. This way you will build a strong
infrastructure of worthwhile tests that will make your automation stronger and
healthier over the years, and it will bring good benefits to your organisation.
You need to structure your automation (a good testware architecture) so that it
will give lasting benefits.
Feeding, pests and diseases
Over time,
you need to fertilise the ground, so that the trees have the nourishment they
need to grow to be strong and healthy.
In
automation, you need to nourish the people who are working on the automation,
so that they will continue to improve and build stronger and healthier
automation. They need to keep learning, experimenting, and be encouraged to
make mistakes - in order to learn from them.
You need to
deal with pests - bugs - that might attack your trees and damage your fruit.
Is this
anything to do with automation? Are there bugs in automated scripts? In testing
tools? Of course there are, and you need to deal with them - be prepared to
look for them and eradicate them.
What about
diseases? What if one of your trees gets infected with some kind of blight, or
suddenly stops producing good fruit? You may need to chop down that infected
tree and burn it, because it you don’t, this blight might spread to your whole
orchard.
Does
automation get sick? Actually, a lot of automation efforts seem to decay over
time - they take more and more effort to maintain. technical debt builds up,
and often the automation dies. If you want your automation to live and produce
good results, you might need to take drastic action and re-factor the
architecture if it is causing problems. Because if you don’t, your whole
automation may die.
Picking and packing
What about
picking the fruit? I have seen machines that shake the trees so they can be
scooped up - that might be ok if you are making cider or applesauce, but I
wouldn’t want fruit picked in that way to be in my fruit bowl on the table. Manual
effort is still needed. The machines can help but not do everything (and
someone is driving the machines).
Test
execution tools don’t do testing, they just run stuff. The tools can help and
can very usefully do some things, but there are tests that should not be
automated and should be run manually. The tools don’t replace testers, they
support them.
We need to
pack the fruit so it will survive the journey to market, perhaps building a
structure to hold the fruit so it can be transported without damage.
Automation
needs to survive too - it needs to survive more than one release of the
application, more than one version of the tool, and may need to run on new
platforms. The structure of the automation, the testware architecture, is what
determines whether or not the automated tests survive these changes well.
Marketing, selling, roles and expectations
It is
important to do marketing and selling for our fruit - if no one buys it, we
will have a glut of rotting fruit on our hands.
Automation
needs to be marketed and sold as well - we need to make sure that our managers
and stakeholders are aware of the value that automation brings, so that they
want to keep buying it and supporting it over time.
By the way,
the people who are good at marketing and selling are probably not the same
people who are good at picking or packing or pruning - different roles are
needed. Of course the same is true for automation - different roles are needed:
tester, automator, automation architect, champion (who sells the benefits to
stakeholders and managers).
Finally, it
is important to set realistic expectations. If your local supermarket buyers have heard that eating your fruit will enable them to leap tall buildings at a single
bound, you will have a very easy sell for the first shipment of fruit, but when
they find out that it doesn’t meet those expectations, even if the fruit is
very good, it may be seen as worthless.
Setting
realistic expectations for automation is critical for long-term success and for
gaining long-term support; otherwise if the expectations aren’t met, the
automation may be seen as worthless, even if it is actually providing useful
benefits.
Summary
So if you
are growing your own automation, remember these things:
- - it
takes time to do it well
- - prepare
the ground
- - choose
the right tests to grow
- - be
prepared to prune / re-factor
- - deal
with pests and diseases (see previous point)
- - make
sure you have a good structure so the automation will survive change
- - different
roles are needed
- - sell
and market the automation and set realistic expectations
- - you
can achieve great results
I hope that
all of your automation efforts are very fruitful!