Every time someone talks about a testing “phase”, a little part of me dies. The worst example I saw recently was a post on an agile group asking “how many days should we allow for testing? If something takes 10 days for development, should we allow 10 days for testing? Or maybe 15?”.
I’m not going to pick on people or name names. Everyone starts from somewhere and makes mistakes. But really, we need to clear this stuff up for good. Testing is not a phase and everyone needs to understand that.
In the bad old Waterfall days, testing was a big phase. Nobody did any testing until all of the development was done. Think about that for a moment: nobody tested ANYTHING until all the development was “finished”. There are of course two huge problems here:
There were huge problems resulting from this phased-based approach: testers doing not much (besides writing big useless documents) until code was “ready for testing”, handovers and phase-gates creating dependencies, work getting tied up and blocked while waiting for everything to be signed off, late testing and “integration hell”, manual instead of automated testing, and a resultant lack of quality and integrity.
So in the 1990s, agile software development came along with some clear answers to these questions.
Agile borrowed heavily from the ideas of Lean Manufacturing (which borrowed many ideas from D Edwards Deming). In Lean, quality is built into the system, not checked or tacked onto at the end. So agile software development sees testing as being a fundamental and integral part of development, not a quick “check” you do at the last minute.
Testing then stops being a phase, and becomes an activity occurring alongside and intertwined with development.
Agile encourages testing as early as possible. If you are doing some form of Test Driven Development (which you probably should be), then testing actually starts even before you start coding. That’s because TDD involves writing and running tests before the code to make the tests pass is written. So testing is one of the very first things you do, not one of the last.
Testing should be done very frequently, not once per sprint and definitely not once per release. If you are working in small batch sizes and making many small changes (which you should be), then you should be integrating often. Ideally once or more per day. And if you are integrating often, you will need to be testing often.
Continuous Integration involves making many small changes to a codebase, and for that to happen without risk of breaking things, you will need a lot of automated tests. And you will need to be running a lot of automated tests, very frequently. Unit tests take microseconds to run, so can and should be run hundreds or thousands of times per day. Integration and Acceptance tests are slower and more brittle so will be run less frequently, but should be still run at least once if not a few times per day.
Some people, especially those new to agile and choosing Scrum, simply copy their big Waterfall phases and squash a mini version of it down into a sprint.
They go from this:
Don’t do this! This is plagued by the same mistakes of the Waterfall system. Testers would be sitting around waiting for all the stories to be ready for testing, instead of testing from the very beginning. Quality would be left until the last minute, instead of being built in from the very beginning.
There are no phases inside a sprint. Each day, the team should be focused on doing whatever needs to be done to move small pieces of work through the system. Quality is a fundamental part and parcel of that process, and should never be thought of as a separate phase.