Monday, May 9, 2011

Acceptance Tests in Scrum

"Acceptance tests are the tests that define the business value each story must deliver."

-       Lisa Crispen & Janet Gregory, "Agile Testing: A Practical Guide For Testers and Agile Teams"

 "Acceptance testing is the process of verifying that stories were developed such that each works exactly the way the customer team expected it to work."

-       Mike Cohn, "User Stories Applied For Agile Software Development"

 Acceptance tests, derived from the User Stories’ acceptance criteria, serve three purposes:

1.    Acceptance tests are used by the product owner to know that the acceptance criteria have been met and the User Story is “Done” to their satisfaction.
2.    Acceptance tests help drive development in an “Acceptance Test Driven Development” environment.
3.    Acceptance tests serve as the source of product regression tests.

Acceptance criteria are a list of the specified indicators or measures used in assessing the ability of the product to perform its intended function and add real business value to the product. Acceptance tests are written based on the acceptance criteria and validate that the product has the expected business value i.e., functionality, intended by the User Story. 
Acceptance test cases further serve as a source of product regression tests.  It’s to the company's advantage to have in-place a collection of tests covering all functionality and acceptance tests are the means to getting that coverage.  Once User Stories are "Done" (acceptance testing being a significant contributor), the User Story is delivered to the "always releasable" branch of the configuration management system.  Along with the delivery of the User Story, the acceptance tests are “delivered” to the configuration management system.

Some of the issues that may arise when adopting acceptance testing as a measure of “Done” are:

1.    Developers on the Scrum Team feel it’s “the testers” responsibility to write and run functional tests.

One of my favourite comments early in the company’s adoption of Scrum occurred when the ScrumMaster was saying unit testing wasn’t enough and the Scrum Team needed to validate the new functionality by running tests from the end-user’s perspective. One of the team members suggested that the company “hire more testers” if functional testing was required. This is not an uncommon reaction from developers especially when, prior to going Agile, developers were not held directly responsible for quality testing and the test team had been a separate entity in the organization.

To help the team recognize their testing responsibilities, the ScrumMaster began to specifically ask during the Daily Scrum meeting if functional testing had been done by the developer and one other member of the team before a requirement (the team wasn’t doing user stories yet) was considered “Done”. This made the Daily Scrum meeting slightly longer but it quickly sank into the team that they were responsible for functional testing. It wasn’t long before a new team member was prevented from completing a requirement because the team was concerned that the appropriate testing had not been carried out.

2.    When there is a “tester” in the Scrum Team, the tester is the only person writing and running Acceptance Tests.

In this scenario the Scrum Team has more or less continued the pre-agile practice of having a separate test team. This practice virtually guaranteed that functional testing would occur very late in the iteration resulting more often than not with User Stories not being “Done” at the end of the sprint.

The behaviour Agile encourages is the development team, as a whole, to feel responsible for the quality of the product and for meeting the User Stories’ acceptance criteria. Having a professional tester in the team when first adopting Scrum can prove too tempting for the team to heap all functional testing upon this individual. When I was in defence, test was a separate entity from development and this worked quite well owing to the detail of the well documented software requirements. Agile doesn’t share the same enthusiasm for documenting every detail but rather prefers face to face communication. The best scenario is for the tester to share their test philosophy with the developers and help build their competencies for functional testing.

Eventually all professional testers were pulled out the Scrum Teams to focus their efforts on testing the releases and creating automated functional tests for regression testing. The immediate result was the Scrum Team no longer felt they had “dedicated testers” on the team. However, during the sprint planning meeting the Scrum Team (developers and product owner) spent more time discussing how they would test the User Stories. During these discussions, acceptance criteria might be added, modified, or removed but in the end, the Scrum Team had a much clearer understanding of the User Stories.

Jeff Sutherland had this to say about the Nokia Test question on dedicated testers:

“Testing within a sprint - there must be testers on the team that complete testing at the feature level during the sprint, i.e. the acceptance tests defined by the Product Owner and enhanced by the testers are completed. Only stories with completed tests are DONE and count towards team velocity. On some teams developers test (but not the same developer that wrote the code). For other teams, it is essential to have professional testers when the consequences of failure are high - a production system for treating patients in a hospital, for example.”

3.    The User Stories are written at an implementation level e.g. As a product owner, I want the SQL database to have a new table with fields x and y.

The thing we did short of having the product owners going on a User Story writing course was to have the development teams set the expectations using the INVEST qualities of a User Story – Independent, Negotiable, Valuable, Estimable, Small, Testable (I believe these were first defined by Bill Wake). And it wasn’t only the product owners put on the spot; the development team’s also needed to actively contribute to bettering the quality of User Stories.

4.    The Acceptance Tests are written after the code is completed and validate the result rather than the intent.

Following a “Test Last” approach is generally not a good choice. There are a couple of potential problems with testing last including:

·         Dropping acceptance test during crunch time. This could occur any time but is more likely to happen in a test last scenario.
·         The tests may be biased toward the solution rather testing the requirements.

The easiest way to avoid these pitfalls is to:

1.    Adopt a test first approach – write acceptance tests based upon the acceptance criteria before any code is written.  This will

·         ensure the acceptance tests  are written,
·         serve as an aid to design for the development team,
·         automated tests can be run daily with the daily build i.e. there would failures at first but when the tests all pass, the User Story is complete, and
·         give the product owner plenty of opportunity to review and comment on the test early in the User Story implementation.

2.    Get the product owner to review and approve the acceptance tests before writing any code. 

5.    Acceptance Tests are not automated.

It is sometimes difficult to convince the development team and product owner that automating acceptance tests (feature, function, or user tests) are worth the effort. This has been a common position taken by the Scrum Teams and although there is evidence showing that running regression tests would have caught problems later caught by customers, the Scrum Teams have remained unconvinced. The most common excuse I’ve heard is that it is “too much work”.  The reality is that teams do not re-run the manual product acceptance tests to ensure that previously implemented functionality still works so maybe the thinking goes, why automate tests that will never be run again.

Automated acceptance tests help increase quality by catching errors early in the development cycle. The product is improved by creating a "safety net" of tests which can be run during the daily build. The value of this is obvious, but what is not as obvious is that automated acceptance tests also reduce the time to market and cost of development by shortening the development time. This is accomplished by decreasing a developer's time in debugging loops by catching errors in the safety net of tests.

There are a couple of measures that could be taken to encourage Scrum Teams to develop automated acceptance tests and include:

·         Having a KPI that measures the percentage of automated tests per iteration.
·         Having the development team sit on the product support desk for two or three months doing root cause analysis on the customer issues. This may help them see where additional automated testing would be most helpful.

Once, when a delivery was made to a customer site and some fundamental functionality didn’t work, root cause analysis found that the problem had slipped through code reviews, unit tests and acceptance tests. The new functionality tested fine but in the process of implementing the new functionality, previously working functionality had unknowingly ceased working. Because any regression testing would have been manual and time to release was critical, no regression testing was identified. Had functional tests been automated as part of the daily build, no one would have been required to make the decision to skip regression testing and the problem would have been caught prior to release. 


Acceptance testing is a critical component to the definition of “Done” for Agile User Stories and is the product owners’ best means to ensure the desired functionality of the User Story is the development team’s primary focus. Acceptance testing, or more accurately, the writing of acceptance tests, can help the development team understand the software requirements of the User Story before any code is written. Acceptance tests also provide a legacy of regression tests that can be used to ensure the product hasn’t regressed in other areas when new User Stories are implemented.


  1. Great stuff Bob - good start to the blog

  2. Very interesting read Bob. Well written. Your depth of understanding and style compare well to the other blogs around.

  3. great post. I am a developer in scrum team and learning agile. there are very good explanations here.

  4. Hi friend iam providing the safe agile training of various online training.

  5. Hi friend iam providing thesafeagile training of various Certification trainings.

  6. This particular is usually apparently essential and moreover outstanding truth along with for sure fair-minded and moreover admittedly useful My business is looking to find in advance designed for this specific useful stuffs… Agile test automation