An architecture for behavior-driven development in Swift | by Manuel Meyer | September 2023


This article will show you how we can do Behavior Driven Development (BDD) in Swift — frictionless

picture by Christopher Gower on Unsplash

Behavior-driven development (BDD) is a software development process that encourages collaboration between developers, quality assurance experts, and customer representatives in a software project.

It encourages teams to use conversation and concrete examples to formalize a common understanding of application behavior. It came out of test-driven development (TDD).

Behavior-based development combines the general techniques and principles of TDD with ideas of domain-driven design And object-oriented analysis and design provide software development and management teams with shared tools and a shared process to collaborate on software development. (Wikipedia)

Simply put, BDD is a variation of TDD where the tests are not written by the developer but ideally by the customer or product owner. Therefore, these tests are also called “specifications”.

In this article, I will show how my “Khipu” architecture fits well with BDD tools Fast And Agile.

Quick is a dedicated BDD framework. Nimble is a matching framework, allowing tests that read like English sentences.

Suppose we are building a Point of Sale (POS) application to take and manage orders in a restaurant.

We meet with our product owner and he shares his specifications (abbreviated: specs) with us.

  • the application will be centered around Tables
  • Tables have a name and contain a Order
  • an order can be empty or contain several Positions
  • Positions contain a Article and a quantity

We prepare the specifications in Quick using the following code:

import Quick
import Nimble

final class TableSpecifications:QuickSpec {
override class func spec() {
describe("Table") {
context("creation") {
it("has an identifier") { expect(false).to(beTrue()) }
it("has a name" ) { expect(false).to(beTrue()) }
it("has no orders" ) {…


Source link

Related Articles

Back to top button