Unique Without Their Feature File

« Table of Contents »
Previous « Unique Within Their Feature File

The Behaviour Specification Handbook

Effective Behaviour Specification Descriptions

Unique Without Their Feature File

Test analysts in particular like to reference test cases and copy the Behaviour Specification Descriptions into test management tools, defect records and reports. Other team members also like to refer to specific Behaviour Specification Descriptions in Application Lifecycle Management (ALM) tools and other documentation. When there are many behaviours living in different feature files, how does one easily and unambiguously reference them?

A simple way to enable team members to uniquely identify, refer to and find the behaviours that may be scattered across different components or feature files is to ensure that each Behaviour Specification Description includes a unique identifier for the software component or feature file. I recommend prefixing each Behaviour Specification Description with the feature title/name (or a shortened and still unique version of the feature name) to ensure that when a team member uses the behaviour description outside of the context of the feature file, there is no question about where it originated from or where it should be found.


Next » Follow This Template

Use Present Tense

« Table of Contents »
Previous « Write One Specification For One Behaviour

The Behaviour Specification Handbook

General Tips

Use Present Tense

Behaviour Specification Descriptions and steps tend to make more logical sense when written in the present tense, because they are describing the most up-to-date, current, at the present time, expected behaviour. If a description or step is written in the past or future tense, then it does not represent the current, as-built, living documentation of the component.


Next » Avoid Generic Verbs

What Are Behaviour Specifications?

« Table of Contents »
Previous « Behaviour Specifications

The Behaviour Specification Handbook

Behaviour Specifications

What Are Behaviour Specifications?

Behaviour Specifications conveniently and efficiently fulfil multiple purposes:

  1. Written in everyday business language, they comprehensively and unambiguously specify the required functionality to be delivered, as agreed by the team;
  2. They are the specifications that developers should refer to when they write code. The only code that should be written by a developer is code to satisfy the Behaviour Specifications. Remember this little motto: “No Behaviour Specification? No Code! No Test!";
  3. They also represent the complete set of test cases that are needed for the given functionality;
  4. They are the living, up-to-date, as-built documentation, for the entire team (and potentially other parts of the business), about the functionality of each software component; and
  5. When implemented as automated tests, they are the executable documentation that becomes part of a suite of test assets.

Behaviour Specifications are NOT part of a formal requirements document or legal contract — they are as-built documentation and test assets. As discussed in Prerequisites, requirements are a prerequisite input for the process of specifying behaviours.


Next » No Other Test Cases Are Necessary!

What Is A Behaviour Specification Description?

« Table of Contents »
Previous « Feature Names

The Behaviour Specification Handbook

Behaviour Specifications

What Is A Behaviour Specification Description?

A Behaviour Specification Description (also known in Gherkin as a “Scenario” description) is a one-line, simple, precise summary of an expected behaviour of a software component. I recommend the description be worded in commonly accepted, everyday business language, without specifying internal technical implementation details. Each description must be sufficiently precise so that all the Behaviour Specifications of a given software component can be clearly differentiated.

Example Behaviour Specification Descriptions

As an example, say that there is a User Interface component that invokes a back-end service to perform validation of a postal address. The Behaviour Specification Descriptions of this User Interface component could include:

  • Positive - Should allow a specified postal address to be submitted for validation;
  • Positive - Should transform the submitted address data into a format that is required by the address validation service;
  • Positive - Should invoke the address validation service with the appropriately formatted address data;
  • Negative - Should provide a notification of a technical error when there is an issue communicating with the address validation service;
  • Positive - Should provide a notification of an invalid postal address when the address validation service determines the address is invalid; and
  • Positive - Should provide a notification of a valid postal address when the address validation service determines the address is valid.

The behaviours of this User Interface component explicitly do NOT include anything related to how the back-end service performs the validation. Those types of concerns are only the service’s behaviours and are not the concern of this User Interface component.

Please make a note of these example Behaviour Specification Descriptions, as they will be referred to in some of the following sections.


Next Chapter » The Behaviour Specification Writing Process

What Is A Software Component?

« Table of Contents »
Previous « Scaling To Large Solutions

The Behaviour Specification Handbook

Background

What Is A Software Component?

A software component is a logical grouping of functionality that is represented as an application, sub-system, service, micro-service, library, module, or any sort of implementation of part of an architectural layer. The granularity and boundaries between software components really depends on what makes logical sense. As a general guideline, a software component typically is larger than one class or module — although this guideline may not apply in the case of micro-services.

For example, a software component could be the functionality that provides the User Interface for a screen, or it could be the functionality of a back-end service operation. A software component also could be a specific part of a data access layer or repository.

Teams should carefully consider the design of their software components, as these choices affect later stages of the software development lifecycle. If a team ever struggles with maintaining a well structured Testing Pyramid, consider reviewing the boundaries of the software components. Splitting a large component into many, each with less responsibilities, could open the door to simplified Behaviour Specifications, a better Testing Pyramid, easier comprehension of functionality, and a lower total cost of ownership.


Next Chapter » Behaviour Specifications

What's Happening In Our Minds?

« Table of Contents »
Previous « Meeting Milestone 3 — Checkpoint

The Behaviour Specification Handbook

The Behaviour Specification Writing Process

What’s Happening In Our Minds?

Throughout all of the above overviews and discussions, each attendee has learned valuable implicit knowledge. Referring back to a previous point, this is the reason why the attendees should be the actual people who will do the development and testing — because throughout this meeting they are being transformed into the experts of this business functionality!

As the team next proceeds to write the behaviours of each software component, multiple team members from different roles and perspectives are mentally testing each behaviour against their understanding of the solution — fantastically optimizing the feedback loop and enabling the team to avoid mistakes and reduce costly, wasteful effort and rework!

The next steps of actually writing the Behaviour Specifications is an important time where the attendees actively engage their mind and further collaborate and communicate. The result of the attendees actively engaging in the process is the growth of their own tacit knowledge and expertise. Again, this is the reason why the attendees should be the developers and testers of this functionality, because they become the experts who can most effectively and efficiently perform the implementation work.


Next » Meeting Milestone 4 — Behaviour Identification

Work Backwards: Then-When-Given

« Table of Contents »
Previous « Effective Behaviour Specification Steps

The Behaviour Specification Handbook

Effective Behaviour Specification Steps

Work Backwards: Then-When-Given

Consider writing the Gherkin steps in reverse order. Write the “Then” steps first, followed by the “When” and finally elaborate on the “Given” steps.

The wording in the “Then” steps (and also some of the other steps) typically overlaps with part of the Behaviour Specification Description that already has been written. Starting with “Then” and copying and pasting the relevant text from the Behaviour Specification Description is a great way to focus on the goal and kick-start the process of specifying that particular behaviour. Sometimes doing this feels too easy, but it is a sound approach — and no one ever suggested that writing the steps has to be difficult!


Next » Avoid “I”

Write In Business Language

« Table of Contents »
Previous « Write In Everyday Business Language

The Behaviour Specification Handbook

General Tips

SpecFlow/Cucumber Is Only The Name Of A Tool

SpecFlow, Cucumber and the others are just tools that facilitate the creation and running of executable behaviour specifications, to be used when a team is focused on using Behaviour-Driven Development to mature their software development practices.

Too many times I have heard team members and managers with a low maturity in and understanding of BDD talk about “the specflows” or “the cucumbers”. Please, no, have some respect! Even though the developers and testers may use those tools, nobody in the team really should be focusing on or mentioning the names of those tools in their everyday conversations about software development. Instead of saying the tool’s name, they should be talking simply about “Behaviour Specifications”, “behaviours”, “specifications”, “specs” or “scenarios”.


Next » Have Different Feature Files For Different User Interfaces

Write In Everyday Business Language

« Table of Contents »
Previous « Avoid Generic Verbs

The Behaviour Specification Handbook

General Tips

Write In Everyday Business Language

A large focus of Behaviour-Driven Development (BDD) is about clear and effective team communication. Not all members of the team have or will have a deep technical understanding. It is in the best interest of the business if everyone is enabled and given the opportunity to understand the logical functionality of each software component.

On a daily basis, the team normally should be communicating with the rest of the business in commonly accepted business terminology. Similarly, the behaviours should be written — as much as possible — in the same accepted style of business language. By doing this, all members of a software development or solution delivery team, including developers, analysts and stakeholders, should be able to understand the Behaviour Specifications.

For instance, say that a business project team engages an internal software development team to develop a subset of a larger solution. The business project team certainly could be interested in reading and understanding the Behaviour Specifications (the test case suite) of the software components that the internal software development team authored. Whether other wider parts of a business would be interested is debatable, and I think that may only apply to businesses with quite a high degree of maturity.

Agree On Business Terminology

The team needs to have a clear understanding about what is commonly accepted business terminology versus technical terminology. In general, communication cannot take place effectively unless agreed protocols are followed. An agreed glossary of business terminology is the basis for an effective communication protocol within a business and is useful reference material — especially for on-boarding new employees.

Such an approach promotes more consistent communication within the solution delivery and support teams — and with wider parts of the business. One tangible, beneficial result of using commonly accepted business language is the minimisation of the costs to train new staff.

Be Professional

Some developers may initially consider working with the Gherkin language and the use of a feature file as a burden. These developers may argue that the usage of the feature file slows them down and that they can much more quickly write automated tests without Gherkin or Behaviour Specifications.

Typically however, such developers are new to the use of Gherkin and have not proceeded past the learning curve. Additionally, some stereotypical technical people can have difficulty in translating technical functionality into common business language for discussion with non-technical people. Because of these reasons, some developers may find they are initially slower in this area, and that can be a cause of personal frustration.

We all need to remember to be professional and look after the best interest of the business. It is in the business’s best interest if the team writes behaviours in their business language, not just for the current set of skills in the team, but for the wide variation of skills that future team members may or may not have. The business language is the lowest common denominator language — not technical terminology.

If the business is primarily product focused or technical in nature, such as one that creates software languages or compilers, then the business language and technical language may be one and the same. By all means, write the behaviours in the business language, which in that case may be quite technical.

Use Natural Language

As a guideline, I highly recommend using the natural language, logical names of artefacts, as opposed to the technical, implementation-specific terminology.

For example, say there is a business service operation for processing credit card payments. In a specification, I recommend writing natural language such as “the service that processes a credit card payment” instead of a more technical implementation name such as “the CreditCardService.ProcessPayment operation”.

Similarly, to refer a particular system in a specification, such as a fictional system named “Insurance Policies 4 Me”, write a natural language, logical name that is appropriate for the business, such as “the insurance policy system”.

Some Technical Terminology Becomes Mainstream

At certain points in time, some terminology that originates from the technical realm does actually make its way into business and everyday, mainstream vernacular. The television and movie industry no doubt have played a huge role in helping to mainstream many technical concepts.

Nothing in the last decade highlights this better than the world of personal and mobile computing. The concept of an “app” or “application” is now common, mainstream vocabulary. From young children to retirees, almost everyone now has access to a mobile phone, tablet or personal computing device, and everyone is familiar with “apps” and an “app store”. Security mechanisms to ensure authorised access to a device — such as user credentials, pin numbers, and swipe patterns — also are now mainstream concepts.

A personally memorable example of this occurred many years ago with my dearly departed mother. One afternoon she came home from a training course at her workplace, and proudly boasted that she had learned how to use their computer system. She then started talking about her “lowgan”. I immediately stopped her and asked what she was talking about — what was this “lowgan”? We had a good laugh together when she said that she and some other staff members didn’t really know who this “lowgan” was, but she knew she had to enter her user name and password when “he” popped up! Of course, between fits of laughter, I quickly explained that it was a “log in”.

What Is Technical Terminology?

Noting that language and commonly accepted vocabulary changes over time, what is technical terminology, and what is not?

That is a good question! The answer is that it depends on each business. What might be considered “technical” in one business, at a specific moment in time, might be common business language right now at another business.

In addition, there are many concepts that began in and are commonly understood in real-life. Many real-life and mathematical concepts have been used as the basis for technical lingo. An example of this is a “queue” of items. A queue is a well understood, real-life concept. Many people stand and wait in queues or first-in-first-out (FIFO) lines at the shopping centre checkout on a regular basis. If a technical team determines that there are messages that need to be queued as part of a solution design, then please say that in the Behaviour Specification, as it is natural everyday language!

Human perception also adds complexity to the discussion. Different businesses, teams and people can have both valid and differing views about how “technical” some “technical terminology” actually is. Every individual has a different perspective and understanding of the world, and their level of tolerance for technical terminology differs.

The Art Of Writing

In the end, finding simple, intuitive and natural words to use when writing a Behaviour Specification sometimes can be thought of as an “art”. There can be a delicate balance between not using language that is too technical or specific, and at the other end of the spectrum, using language that is too generic such that the reader cannot grasp the essence or actual purpose of the behaviour. This balance can be a challenge, especially for novices — but is overcome with an agreed business terminology glossary, some good examples and a little practice.

Tip: It is always helpful to copy the style of existing behaviours that your team agrees are well-written. Take samples of these existing well-written Behaviour Specifications into each behaviour writing meeting and refer to them as necessary. It is often helpful to review these in the meeting to refresh everyone’s memory and help break through any mental blocks.


Next » SpecFlow/Cucumber Is Only The Name Of A Tool

Write One Specification For One Behaviour

« Table of Contents »
Previous « Specify Component Interaction Behaviours

The Behaviour Specification Handbook

General Tips

Write One Specification For One Behaviour

Generally, each Behaviour Specification should be focused on a single behaviour, purpose or business rule. By doing this, each behaviour becomes an independent building block of trusted, tested and verified functionality.

When each single-purpose Behaviour Specification is implemented as an automated test, the process of discovering the root cause of an issue is very quick — there is little analysis required because there is no ambiguity about which behaviour or functionality failed.

A “line of trust” forms out of the understanding that each behaviour is itself tested and verified. When writing each subsequent behaviour, be aware of and use this “line of trust” to your advantage. There is no need to duplicate or re-specify the functionality that is already specified in other Behaviour Specifications.


Next » Use Present Tense