Build the right thing

@konrad_126

Can you build this?

SURE!

Can you build this?

SURE!

hmm... !?

here you go

Behaviour driven development

It's using examples to talk through how an application behaves...

AND HAVING CONVERSATIONS ABOUT THOSE EXAMPLES.

Dan north

It's using examples to talk through how an application behaves...

AND HAVING CONVERSATIONS ABOUT THOSE EXAMPLES.

Dan north

user story

working software

behaviour driven development

DISCOvery

DISCOvery

Formulation

DISCOvery

Formulation

automation

The HARDEST single part of building a software system is deciding precisely what to build.

Fred Brooks

discovery

discovery

discovery

FORMULATION

AUTOMATION

BEHAT

Feature: Real time update of Parking Lot occupancy
  In order to have accurate availability value for a parking lot,
  occupancy must be updated every time a driver enters a parking lot

  Scenario: Entering with First Come First Serve access type
    Given "Brussels Nord" parking lot has 53 available spots
    When a car enters "Brussels Nord" parking lot using "FCFS" access
    Then there are 52 available spots in "Brussels Nord" parking lot
Given "Brussels Nord" parking lot has 53 available spots
When a car enters "Brussels Nord" parking lot using "FCFS" access
Then there are 52 available spots in "Brussels Nord" parking lot
/**
* @Given :arg1 parking lot has :arg2 available spots
* @param mixed $arg1
* @param mixed $arg2
*/
public function parkingLotHasAvailableSpots($arg1, $arg2)
{
    throw new PendingException();
}
Given "Brussels Nord" parking lot has 53 available spots
When a car enters "Brussels Nord" parking lot using "FCFS" access
Then there are 52 available spots in "Brussels Nord" parking lot
/**
* @Given :arg1 parking lot has :arg2 available spots
* @param mixed $arg1
* @param mixed $arg2
*/
public function parkingLotHasAvailableSpots($arg1, $arg2)
{
    $parkingLot = new ParkingLot($arg1,$arg2);
    $this->parkingLots->save($parkingLot);
}
Given "Brussels Nord" parking lot has 53 available spots
When a car enters "Brussels Nord" parking lot using "FCFS" access
Then there are 52 available spots in "Brussels Nord" parking lot
/**
* @When a car enters :arg1 parking lot using :arg2 access
*/
public function aCarEntersParkingLotUsingAccess($arg1, $arg2)
{
    throw new PendingException();
}
Given "Brussels Nord" parking lot has 53 available spots
When a car enters "Brussels Nord" parking lot using "FCFS" access
Then there are 52 available spots in "Brussels Nord" parking lot
/**
* @When a car enters :arg1 parking lot using :arg2 access
*/
public function aCarEntersParkingLotUsingAccess($arg1, $arg2)
{
    $this->bus->dispatch(new EnterParkingLot($arg1,$arg2)));
}
Given "Brussels Nord" parking lot has 53 available spots
When a car enters "Brussels Nord" parking lot using "FCFS" access
Then there are 52 available spots in "Brussels Nord" parking lot
/**
* @Then there are :arg2 available spots in :arg1 parking lot
*/
public function thereAreAvailableSpotsInParkingLot2($arg1, $arg2)
{
    throw new PendingException();
}
Given "Brussels Nord" parking lot has 53 available spots
When a car enters "Brussels Nord" parking lot using "FCFS" access
Then there are 52 available spots in "Brussels Nord" parking lot
/**
* @Then there are :arg2 available spots in :arg1 parking lot
*/
public function thereAreAvailableSpotsInParkingLot($arg1, $arg2)
{
    $parkingLot = $this->parkingLots->findByName($arg2);
    Assert::equals($arg1, $parkingLot->capacity());
}

What? 

USER INTERFACE

business LOGIC

USER INTERFACE

business LOGIC

WHY?

Early learning/feedback

shared understanding

living documentation

less re-work

THANK YOU

@konrad_126

Build the right thing

By konrad 126

Build the right thing

  • 368