BOC 1

Posted by Micah Mon, 13 Nov 2006 03:54:00 GMT

BOC (Build Operate Check) n. : The typical flow of an automated test*

BOC is a testing pattern that Unclebob briefly mentioned on fitnesse.org shortly after it was published. It describes the typical steps taken in an automated test.

Experienced test writer use BOC whether they know it or not. For new-commers to automated testing, BOC is lesson #1.

If you think about it, BOC is very logical. Every test is testing something; some Operation that the system under test (SUT) performs. That’s where the Operate step comes from.

In almost all cases, you can’t just invoke the operation. The automated test Builds a testable environment first. Maybe data needs to be put in a database, or a service layer needs to be started. Either way, the Build step comes first.

After invoking the Operation, a test needs to Check that it behaved as expected. Clearly, the Check step has to come last.

Example:

Consider a test for the Withdraw feature of an ATM machine.

Build:

  • You can’t withdraw money from an account unless there’s money in it. For the build step, add $500.00 to account 123.

Operate:

  • Perform a withdraw of $250.00 from account 123.

Check:

  • Check that the balance of account 123 is $250.00.

Next time you’re writing an automated test, think about it. More likely than not, you’re using BOC.

Comments

Leave a response

  1. David Chelimsky 2 months later:

    BDD is based on a similar triad - basically the same, but with different names: Given, When, Then. The nice thing about that is that customers and developers can talk about it and it means the same thing:

    Given an account with 500 bucks When you withdraw 250 Then there should still be 250

    It’s almost exactly the same, just possibly more customer friendly lingo.

Comments