Documentation of requirements in projects - BDD/Gherkin approach

Posted on 26/04/2024 by Rafał Kołakowski

At the beginning of the documentation, there should be an introduction that aims to present the purpose of creating the document, the scope of the project, and include a glossary of terms used in the rest of the document. This is crucial to ensure that all readers of the document have a common understanding of the concepts and definitions used.

Detailed functional and non-functional requirements form the heart of the documentation. Functional requirements describe the functions the system should offer, detailing the behavior of the application in various scenarios. Non-functional requirements, on the other hand, concern aspects such as performance, security, availability, and ease of maintenance—these are the criteria that define how the system should operate.

Another component is data models and management, which determine how information will be processed, stored, and secured in the system. At this point in the documentation, it is also necessary to consider limitations, whether technological, business, or legal, that may affect the realization of the project.

Risk analysis helps identify potential problems that may arise during the project implementation and propose strategies to minimize them. The documentation should be supplemented with appendices and references to auxiliary documentation that can provide additional information.

The history of changes is an essential element that documents the evolution of the document, allowing for tracking changes made over time. This is key for understanding how the project has developed and adapted to new requirements or conditions.

Requirements documentation is not a static collection of documents; it is a dynamic resource that evolves with the project. It is important to treat it as a living document that is regularly updated to reflect changing requirements and project conditions. Such an approach ensures that all stakeholders have a uniform and up-to-date understanding of the project, which is crucial for its success.

Effective management of requirements and their documentation not only facilitates better communication and collaboration between the team and stakeholders but also contributes to the quality of the final product, ensuring that it meets customer expectations and is tailored to their needs. This foundation helps teams respond quickly to changes, effectively manage the project, and deliver software that provides real value.

Typical challenges during the collection of requirements from clients

Collecting requirements for web applications is a challenging process that requires precision, good communication, and flexibility. One of the most common problems is the ambiguity of requirements, which can lead to different interpretations by the development team and stakeholders. This ambiguity often results in design and implementation errors, generating additional costs and delays.

Maintaining effective communication between the technical team and business stakeholders is also a key challenge. Insufficient information flow or its absence can result in missing important functionalities or allocating resources to develop unnecessary elements of the application. Additionally, project requirements often change as work progresses, which without proper management can lead to scope creep, budget overruns, and delays.

Understanding the needs of end users is also a challenge, especially when access to direct feedback is limited. Misunderstanding user expectations can result in creating features that are unintuitive or unnecessary, thus wasting valuable resources.

Prioritizing requirements is another crucial task that requires attention. Incorrect prioritization can lead to delays or the underdevelopment of the most critical aspects of the application. Moreover, designing applications with future needs and scalability in mind is difficult but necessary for long-term success. Improper planning in this regard can limit the possibilities for developing the application in the future.

Technical and security issues are often underestimated in the early stages of design. Overlooking these aspects can lead to performance problems, data security issues, and non-compliance with legal regulations, which in turn can have serious consequences for the project.

Verification and validation of collected requirements is another important step that is often overlooked. Ensuring that requirements are fully understood and can be technologically realized is key to preventing errors in implementation and avoiding the need for costly changes at later stages.

Ultimately, every project has its budgetary and time constraints, which affect the scope and quality of the final product. Finding a balance between expectations and available resources is a constant challenge for project teams.

As a result, effective management of the requirements collection process requires the application of good project management practices, including regular communication, iterative development, and adaptation to changes, as well as the use of methodologies that support these goals, such as Agile or BDD (Behavior-Driven Development). Only then is it possible to create an application that meets both business expectations and the needs of end users.

Application of Gherkin language and BDD methodology

The use of the Gherkin language and Behavior-Driven Development (BDD) methodology significantly impacts the quality of web application projects, improving communication between the team and the accuracy in defining requirements. Gherkin allows for describing system behaviors in scenarios understandable to all project participants, increasing transparency and minimizing the risk of errors in interpretation.

Example of BDD application

Let's assume we are developing a project management application with a task adding feature. The BDD process might look like this:

  1. Defining meeting: A business analyst, tester, and developer together determine the expected behavior of the function, using natural language. Writing Gherkin scenarios.
  2. Writing Gherkin scenarios: Based on discussions, a scenario is created in Gherkin language that describes the expected behavior of the system.
  3. Software development: Developers create features based on scenarios. Tests are written simultaneously or even before the production code, allowing for quick verification that the developed feature meets the previously defined criteria.
  4. Refactoring and testing: After implementing the function, the code is tested and refactored to ensure high quality and compliance with the initial scenarios.

Examples of scenarios in Gherkin language

Example 1:

Feature: Logging into a web application

As a system user
I want to be able to log into the web application
So that I can access my personalized features


Scenario: Successful login with correct data

Given that there is a registered user with login "jan.kowalski" and password "bezpieczneHaslo123"

  • When the user enters the login "jan.kowalski"
  • And the user enters the password "bezpieczneHaslo123"
  • And the user presses the "Login" button
  • Then the user is redirected to the homepage
  • And the user sees the greeting "Welcome, Jan!"

Scenario: Unsuccessful login with incorrect password

Given that there is a registered user with login "jan.kowalski"

  • When the user enters the login "jan.kowalski"
  • And the user enters the password "zleHaslo"
  • And the user presses the "Login" button
  • Then the user sees an error message "Incorrect password, try again"

Example 2:

Feature: Adding tasks to a project

As a project manager
I want to be able to add new tasks to my project
So that I can track the progress of the project


Scenario: Adding a new task

Given that the user is logged in and has project manager permissions

  • When the user goes to the project page
  • And the user clicks the "Add Task" button
  • And the user enters "Prepare documentation" in the task name field
  • And the user clicks the "Save" button
  • Then the new task "Prepare documentation" is visible on the list;

The BDD methodology fosters continuous collaboration in the project, and regular reviews of Gherkin scenarios allow for aligning requirements with the expectations of end users. Using tools for automated testing based on BDD scenarios reduces testing time and improves product quality, speeding up its market introduction.

The application of Gherkin and BDD also creates living documentation that is always up-to-date and reflects the real state of the project. This not only facilitates the understanding of the project by new team members but also serves as a reference point for future system expansions and modifications.

Implementing these methodologies in system analysis and design brings numerous benefits, such as better understanding and fulfillment of both business and technical requirements of the application, as well as its flexibility and readiness for future changes.

Expected benefits from introducing Gherkin requirement descriptions

Introducing the Gherkin language into the requirement documentation process in web application projects comes with specific expectations for improvements. The goal is not only to enhance communication and understanding among all project participants but also to introduce more effective practices in testing and product development.

Firstly, it is expected that Gherkin will significantly reduce ambiguities in requirement recordings. Thanks to its precise nature, scenarios describing application functionalities will be unambiguous, which is crucial to avoid costly interpretative errors. Such clarity is invaluable as every project participant, regardless of their technical experience, should be able to easily understand and verify the documented requirements.

The second expectation concerns the possibility of defining a comprehensive list of use cases by the project team. The use of Gherkin should allow for a precise analysis and understanding of all potential user interactions with the system, ensuring that no feature is overlooked. This comprehensive approach ensures that the project is fully realized according to the client’s expectations.

The third expectation is to facilitate collaboration with the client in the requirements development process. Gherkin, as a tool supporting clear and open communication, should enable more effective and goal-oriented meetings with stakeholders. As a result, all requirements will be thoroughly understood and accepted by the client before moving to the project implementation phase.

The final expectation is related to preparing scenarios for manual and automated testing. Gherkin should provide a solid foundation for creating detailed test cases that can be easily automated. Such a process not only streamlines the testing phase but also contributes to improving the quality of the final product, which is a priority for every project.

In summary, it is expected that the application of the Gherkin language in web application projects will introduce significant improvements, from clear communication of requirements and precise definition of use cases to collaboration with the client and effective testing. These expectations contribute to the promise of a more efficient and effective software development process that is better able to meet user and business needs.