Behavior driven development to the rescue?

Last Update: 13.04.2018. By Jens in Developers Life | Learning | Newsletter

Sandeep joins the discussion and comes up with a question regarding out-of-date documentation.

“Do you think behavior driven development can answer this question? ”

For those of you unfamiliar with BDD, it tries to describe unit and acceptance test in a more non-dev friendly manner. Basically, you describe the business case and what results you expect in certain scenarios in plain English.

Example with jbehave (one of the BDD frameworks):

Scenario: trader is not alerted below threshold

Given a stock of symbol STK1 and a threshold of 10.0
When the stock is traded at 5.0
Then the alert status should be OFF

Sorry, couldn’t come up with an example for Hotspots.

Good question. Let’s check what the main reasons are for outdated out-of-code documentation. From my experience, they are time constraints (deadline was yesterday and day for docs, tests and refactoring never comes), docs too fine-grained, no structure in the docs, duplicates the code (just different form), not part of the dev processes or the dev did not know they even exist.

BDD tests are essentially business use cases on a fine-grained detail level. They also drive the tests, so you always have the current truth for a particular part of the system. I think it could help with keeping certain docs up-to-date. With two caveats though, you actually do have to write them and you must be aware that they don’t help in understanding data or workflows and alike - they are two different kinds of docs.

What do you think? Can BDD solve the issue?