Successfully Implementing TDD/BDD to Enable Shift-Left Testing Approach

Listen on the go!

Today, when developers are using tools like J unit/N unit for testing their code, approaches such as test driven development (TDD) and behaviour driven development (BDD) focus on improving the quality of the code that is being written. Though the approaches require a different mind-set, the objective remains the same.

Usually Behaviour driven development is focused on the business behaviour of your code: the “why” behind the code. The focus is usually on the intent rather than process. It supports a team-centric (especially cross-functional) workflow. BDD works really well when a developer and either the agile product owner or a business analyst sit down together and write the pending specifications:

  • The business person specifies the exact functionality they want to see in the system.
  • The developer asks questions based on their understanding of the system, while also writing down additional behaviours needed from a development perspective.

Ideally, both parties can refer to the list of current system behaviours to see if this new feature will break existing features. This way quality comes first and the entire product is understood which decreases the defect entry into the development related to requirements or functionality of the system.

Test Driven development on the other hand focuses on implementation of the system. For example, writing a better quality code that helps in maintaining the health of the code with no nonsense into the system.

Approaches like TDD/BDD are used to understand the requirements clearly without any ambiguities and help developers to write tests in a way that makes code execution successful. These methods enable testers to think of solutions using a bottom up approach that helps prevention of defects in the later stages. This approach also helps clarify any ambiguities in the requirements early on in the software development lifecycle, before coding actually begins. With an increased level of understanding of the features and requirements, developers know what exactly needs to be coded, as also what needs to be included or excluded in the code, thereby preventing leakage of defects into the code in the later phases of development lifecycle. The mindset and ability to focus on producing quality product with minimum to no defects from inception/upstream process is enabled by these methods that complement the shift left approach.

While the development teams like this approach, the project teams blame the TDD/BDD process for slowing down the software development process. However, it has been realized that implementation of TDD/BDD practices in the initial development phases enables organizations face lower defects in the later stages. This helps in the maintenance of the code, increases the defect removal efficiency, and also reduces the time to market of the product. The TDD/BDD approach is also best suited for applications where the requirements undergo progressive elaboration. The frequently tested code has lesser defects and enables faster delivery of working software to the clients.

Practices like unit testing and adopting TDD/BDD provide high code coverage coupled with faster feedback regarding unexpected defects/surprises/issues and thus becomes an additive element in the reinforced process.

TDD/BDD practices also enhance practices like requirement management for covering the finer topics like requirement elicitation, requirements acceptance criteria, and requirements review prior to the development process. Requirement traceability is also enhanced when test cases are traced back to the requirements giving a picture of test coverage functionally.

A seamless implementation of both approaches identifies defects early on in the SDLC process, reduce risks, and reduce cost of rework which is a significant cost in software development process. TDD/BDD helps align the mind-set to the left focussing on quality from concept-to-cash for building the right product with the right intent in the best possible way.

In a nutshell, the BDD/TDD practices enable the following:

  • Move defect identification and prevention to the left (early stages of SDLC)
  • Reduce issues/surprises/incidents in the production
  • Help teams stay focused on Continuous Delivery
  • Compliment the agile/iterative development
  • Improve the overall build deployability by reduced lead times and increased quality
Pavan Rayaprolu- Lead Consultant at Cigniti TechnologiesAbout the Author: Pavan Rayaprolu is a Lead Consultant and an Agile evangelist. He is part of the Advisory and Transformation Services and has helped clients of Cigniti in terms of agile implementation and transformation. Has successfully deployed the Quality Culture through the organization, Process consulting for various clients and endeavored for Operational Excellence. He is a Certified Scrum Master and Scaled Agile Certified Product Manager/Product Owner.

Author

  • Cigniti Technologies

    Cigniti is the world’s leading AI & IP-led Digital Assurance and Digital Engineering services company with offices in India, the USA, Canada, the UK, the UAE, Australia, South Africa, the Czech Republic, and Singapore. We help companies accelerate their digital transformation journey across various stages of digital adoption and help them achieve market leadership.

    View all posts

Leave a Reply

Your email address will not be published. Required fields are marked *