Can You Afford to Not Automate Testing?

People often talk about Unit Testing, TDD, ATDD and BDD. Why should Agile practitioners use such methods? And why should Waterfall practitioners use them too?
This article will leave you thinking about the pros and cons of spending time designing and writing tests before even starting to write code.

Why Not Do Automated Testing

Developers Time is More Expensive than Testers
The average wages for testers is lower than for developers. Surely it's therefore more expensive for a developer to write test code, than for a tester to manually test it?

Imagine however that a manual test failed 1 hour after the developer checked the code in. The developer is now working on the next Story. There are a few issues here:
  • If the developer looks at the issue straight away, there is a context switch, that takes on average about 15 minutes(1). So handling it immediately costs 15 minutes of developer time plus 15 minutes to switch back once complete.
    This cost alone is perhaps equivalent to the saving by using a tester?
  • If the developer waits until the latest Story is complete (avoiding extra context switching), there will be:
    • Potential delay of 1 or 2 days before resolving the issue
    • Other issues may become visible after resolving the first one … and so comes a cycle of fix, wait for tester, test fails, wait for developer, fix,wait for tester …
    • Many more good reason to not wait(2)
If the developer was using automated testing, the results of the tests would be immediate and there would be no time wasted between identifying the bug and resolving it. The logic would be fresh in the developer's mind, making it quicker to fix too.

Development Takes Longer
There is often concern that writing a complete set of tests will be a big overhead, taking more and more time and therefore increasing costs. Admittedly developing good tests is an acquired skill, which at the start will take time and effort.

However, once the team gains experience in TDD, despite the extra work, there are usually significant improvements in productivity(3).

Tests Need to be Re-Written for Every Code Change
Another perceived risk with TDD is that changes to code (enhancements or refactoring) will require significant work re-writing tests.

Yes some tests are very likely to require rework, but most tests are at unit level, and are therefore unlikely to change(4).

And some failing is not a bad thing, as they act as a safety net. If a developer missed an area affected by the changes performed, the tests will quickly make the omission clear!

Why Should Testing be Automated?

I have covered why automated testing is perceived as a bad idea, and shown that in reality those costs are small and in most cases actually benefits. So what else is there to sell automated testing?

Design Improvements
Writing automated testing before starting to code means developers think more about what they are trying to achieve (5).

Reduce Risk
Imagine the code was originally tested and it passed first time. Now six months later enhancements are required. The original developer is on holiday and there are changes elsewhere in the code, which changes the logic, such that the previously perfect code no-longer behaves correctly – it happens. To catch this situation, the specific piece of code needs to be retested, even though it wasn’t modified, which of course is Regression Testing.

Thorough regression testing takes a lot of time, and many avenues are likely to be missed. If the tests are all automated, they will be swift, should catch most scenarios earlier in the cycle and will therefore be resolved with less effort (see the graph at the start of the article). This is safer and costs less.

I could write many more scenarios where risk is reduced, so I'll leave just one addition; a rapid fix is required to a critical situation. The fix is rushed and manual testing half-baked, leaving new errors (I'm sure we have all seen this scenario). Wouldn't it be better to know the full test suite can be run in minutes and provide a higher standard of QA?

Conclusion

There are some additional costs in automating testing, especially in the early days of adoption. But there are many more advantages, which when you consider all the scenarios leading to failure, make automated testing essential:

  • Faster development times
  • Higher quality code
  • Easier to track development progress
  • Lower risk of change
  • Reduced testing costs
  • Ability to turn emergency changes around very quickly and safely

Although automated testing covers so much, and is repeatable at negligible cost, it must not be considered a replacement for manual testing. Human testers will still be required for many reasons. Automation is an excellent tool to assist them in their job and allow you to provide higher quality code quicker at a lower cost.

Whether running Agile or Waterfall, can you really afford to continue growing your code base without automated testing, and subsequently blow out the cost and time of the test and debug cycle? Even if you can afford a fully manual test, do you want to, when there is a better alternative?
------------
References
  1. Multitasking Gets You There Later
    https://www.infoq.com/articles/multitasking-problems
  2. Ten reasons why you fix bugs as soon as you find them
    https://www.ministryoftesting.com/2013/06/ten-reasons-why-you-fix-bugs-as-soon-as-you-find-them/
  3. Empirical Studies Show Test Driven Development Improves Quality
    https://www.infoq.com/news/2009/03/TDD-Improves-Quality
  4. The Forgotten Layer of the Test Automation Pyramid
    https://www.mountaingoatsoftware.com/blog/the-forgotten-layer-of-the-test-automation-pyramid
  5. Introduction to Test Driven Development (TDD)
    https://www.agiledata.org/essays/tdd.html#WhatIsTDD
Further Reading
Shantonu Sarker

SDET | Performance Engineer | Java Developer | DevOps Practitioner

9 年

Good one, But, I think feasibility part is missing. What to automate? following V diagram of testing, automation testing lead to all level of testing. And, automation refers to making a system that test a system which is hard and complex too. unless it is mission critical system, all automation tests are not a part of deliverable(usually). So, like as as Jim said, it is not Auto-magic. Feasible automation tests can make you project successful where bad automation planning leads to no automation. (roughly, a project may need 3.5 time more costs than development , to automate fully).

回复
Jim Hazen

Software Test Automation Architect and Performance Test

9 年

Hmm... As an Automation guy I have some different experience and views on the information. I'll comment later on. But what I've read from other comments I need to warn that Test Automation (at any level) isn't a complete solution like some want. There is still a lot of myth going around that needs to be fixed. As I'm fond to say "It's Automation, Not Automagic".

Ranga Ramasastry

Free Lance Agile Coach and Trainer

9 年

Absolutely. Without test automation it is very difficult to produce quality software , on time and ensure maintenance.

回复

I agree on this. Test automation is key to good, effective and efficient software development; I tested it in a small company where cost was key. Implementing Scrum and continuous integration/ continuous deployment with automated testiong increased our overall productivity and quality.

回复
Adrian Lander -Agile Practitioner, Coach, Board Advisor, Author

Independent Professional-, Agile & Senior Management Coach | Trusted Advisor | Founder & Co-Author Agnostic Agile (NPO) | Co-Founder & Co-Author Agile 2 | Change Catalyst | SW Developer | 15K+

9 年

I would add that test automation has other benefits and goes beyond TDD. I'd rather focus on Test First, which includes TDD, ATDD, BDD, SbE. Using Test First we may actually have more than TDD discoveries early on.

要查看或添加评论,请登录

Alan Taylor的更多文章

  • Women in Leadership shining a light on sustainable leadership

    Women in Leadership shining a light on sustainable leadership

    I had the great pleasure of attending an event this morning "CACC MELBOURNE Sustainable Leadership Breakfast", hosted…

  • Climate Coaching Supporting Opportunities and Growth

    Climate Coaching Supporting Opportunities and Growth

    Why We Want Climate Coaching We regularly see information about climate change and its impact, such as the…

    5 条评论
  • Amazing community spirit helping biodiversity thrive

    Amazing community spirit helping biodiversity thrive

    Our environment and climate change are huge daunting topics. A common theme in discussions is the perception that we…

    1 条评论
  • Learning to Grow Ourselves and Our Teams

    Learning to Grow Ourselves and Our Teams

    Agile adoption is continuing at an increasing pace. Organisations are hearing how agile practices are better suited to…

    2 条评论
  • Learn to Play & Play to Learn

    Learn to Play & Play to Learn

    Games are fun! We use them from childhood through to corporate events; and we often don’t realise that we’re learning…

    1 条评论
  • Businesses Ignore Lean and Agile at their Peril

    Businesses Ignore Lean and Agile at their Peril

    It has been demonstrated that Agile can deliver great things in IT projects, with greater client and employee…

    3 条评论
  • Agile - Essential Ingredients

    Agile - Essential Ingredients

    We know IT Projects have a history of high failure rates, so how can Agile address that (64% project success for Agile…

  • Agile - Embrace It

    Agile - Embrace It

    IT Projects have a history of high failure rates, and companies (& employees) want to change their processes to improve…

    2 条评论

社区洞察

其他会员也浏览了