BDD = 90% Cheaper SLDC

Behavior Driven Development [BDD] is an advanced technique used to build software. This tutorial will give you the basics!

 

System Architecting

When designing a system, BDD focuses on the behaviors of the various components, and the values those behaviors create. We work from the “outside in”, starting with broad strokes and then drilling down into the details. BDD is the best way for a business stakeholder, to communicate ideas to the developer.

Chicken Road Crossing System

 

System Actor

For each “feature” of the system, the primary “actor” must be identified. Who or what is doing something?

  • the user
  • the system
  • a customer
  • the plugin
  • a link
  • a chicken
The Chicken
The Chicken does something.
 

The “Should” Sentence

We first create a “should” sentence that describes the behavior of the system actor.

The chicken SHOULD cross the road.
 

The Reason Why

Explain the business value of the behavior.

So that it can get to the other side.
 

The Failing Test

Once we know what SHOULD be happening – but isn’t yet – then we can make a “failing test”. The failing test, indicated something that needs to happen, but isn’t happening now. It’s the thing that needs to be developed. If the test passed, it would already work the way we think it should work. By creating the failing test first, we indicate the thing that is missing in the world: the thing you and the developer are trying to create.

Is the chicken crossing the road? No. The chicken is FAILING to cross the road at this time.

Test examples:

  • Is the ladder strong enough?
  • Do we have enough inventory?
  • Is there money left in the account?
  • Can this feature handle this certain capacity?

function theChickenShouldCrossTheRoad(){
    if (made_it_to_the_other_side()){
      then return "PASS";
    }else{
      then return "FAIL";
    }
}
 

Automation

We use a machine to automate testing our feature. A failing test tells us that the feature isn’t ready yet.

A failing Codeception test
A failing Codeception test

 

WordPress Plugin Development with Tests = 90% CHEAPER!!

Now the programmer knows the “definition of done”. He must make the test pass! This is the key to reducing SLDC costs in WordPress. There are MILLIONS of cheap WordPress developers. All you have to do, is be able to describe “the definition of done”. The RED_FAIL / GREEN_PASS aspect of automated tests transcend cultures and language. With BDD in WordPress, we can finally outsource software development to offshore developers – AND COMMUNICATE EFFECTIVELY WITH THEM!


$Chicken = new Chicken;
$Chicken->crossTheRoad();
 

Passing Test

Now that the code is written properly, the test passes. The developer and the business stakeholder know they are done with this feature.

Codeception Test Suite
Codeception Test Suite

 

Contact John

What do you think I put this up here for my health? Contact me! I love talking about WordPress plugins and PHP.