In one of my recent projects the customer asked for a test case specification. After further inquiry, we learned that what they actually wanted was documentation of the systems latest agreed upon behavior, to help them with their acceptance tests for implementation sign-off. After a quick demo of SpecFlow+ Living Documentation rendered in Azure Devops and the Gherkin language, they agreed to having the documentation in this format to serve this need.
We had used Gherkin and Living Documentation in the past, but mostly for internal documentation that was only used within the development team. On a few occasions, where we used BDD scenarios in conversations with our customer, they were often received as “too technical”.
The problem was, that back then we looked at Gherkins mainly from an automation point of view. When a customer had a question about a certain behavior, anyone in the team could answer the question by checking our automated tests. We grouped examples for a better overview of our test coverage which was also reflected in our scenario titles.
Once we saw our features and scenarios rendered in a documentation view (see Screenshots further down), it was easy to spot our weak points. So, in order for our customers to use the systems Living Documentation as basis for their acceptance tests, we adjusted how we organised our feature files and most importantly our scenario titles.
After a first round of customer acceptance tests, we received the following feedback:
This was a total win for us. We achieved a Living Documentation that allowed not only the project team who created it, but also stakeholders, to quickly sift through a huge amount of information. They easily found the information they needed, without having to read and analyse every detail all the way down to the single examples. All this was possible because of how we organised our feature files, chose our scenario titles and had a way to provide our customer with an accessible render of it.
Now let us go back and take a closer look at what we did exactly that worked for all stakeholders of this project.
Gojkos Given-When-Then with Style Challenge #16 “How to organise feature files?” asks this exact question. We organised our feature files like described in Option 4.
“Option 4 – split by functional area, group by capability. Files are organised into directories by functional areas, scenarios are grouped into files by the user capability they provide.”
An example of that would be:
For the following example I used the SpecFlow Book Shop Example Project on Github and the LivingDoc CLI Generator which was very fast and I didn’t need to setup an Azure DevOps build just for demonstration purposes (which I am sure will also come in handy next time we want to clarify specifications with customers early on in this form).
In the Book Shop Example, the functional areas are:
With their capabilities or actions being:
To better demonstrate what needs to be done in your IDE to achieve the aforementioned structure, let me illustrate how source code files and feature file structure gets represented in SpecFlow+ LivingDoc.
Why we didn’t choose an iteration or user story based structure?
When we started with BDD and Living Documentation back in the days, we grouped by iteration and user stories. The reasons why we moved away from it are:
At the end of the day user stories are short lived. Once implemented we forget their IDs and stakeholders hardly ever knew them in the first place. What counts in the end is the behavior of the system and how we perceive and talk about it, which is usually by functional areas and capabilities.
Not part of the above mentioned Given-When-Then with Style challenge, but an integral part to a comprehensible Living Documentation are the scenario titles.
One approach we tried out was to use naming that allowed us to group our features and scenarios by implied test coverage. We ended up with scenario titles like:
Unfortunately, our customers found that too technical and not very useful to work with.
What worked much better was to formulate scenario titles as specifications. This resonated with them immediately.
Now by simply looking at the tree on the left side you can read how the system should behave, grouped by functional area and capability. This way our customers could easily use the Living Documentation as basis for their acceptance tests.
For our Living Documentation to be a full success for customer acceptance tests and to involve non-dev team stakeholders, we had to do a few more things. Which I will talk about in my follow up blog article “Avoid tedious test case documents through comprehensible living documentation – Part 2”.