Behavior-Driven Development: An Evolution in Software Design

[article]

based on one of the contexts, or scenarios, your class will execute in. For example, defining the behavior of a Stack class:

class AnEmptyStack_TestCase inherits TestCase {...} 

2. Put 'should' in your test method names along with a short description of intended behavior: 

public void test_shouldHaveOneElementWhenAddedTo() {} 

By changing the language you use to think about the classes you write you'll start to change how you think about the behavior of your classes. Describing only the externally observed behavior will help you stop testing internal state, stop testing private methods, and stop trying to validate your code. 

No fancy tools needed. 


About the author
Bob Cotton is a Test Architect at Rally Software Development . With over 12 years of developing and testing web applications, Bob has extensive experience testing applications using open source testing tools. From unit, load, functional, and GUI testing Bob has applied many tools and techniques to testing large scale, SaaS (Software as a Service) applications. Most recently at Rally, Bob has helped shape an Agile software methodology by including unique approaches to software test automation. Automated testing, using tools such as FitNesse and Selenium, is integrated into the development process from the beginning of each iteration. Prior to joining Rally, Bob worked as the System Architect at SynXis Corp, where he helped build and test a high-volume hotel reservation system. Bob holds a B.S. in computer science from George Mason University.


[1] See {link broken] - www. behaviour-driven.org/Introduction

[2] See Wikipedia http://en.wikipedia.org/wiki/Sapir%E2%80%93Whorf_hypothesis 2007-08-24

[3] This is changing with newer test tools, such as JUnit 4 and TestNG.

[4] Dictionary.app Version 1.0.1. Apple OS X

[5] Dictionary.app. Version 1.0.1. Apple OS X

[6] From a presentation given to the Chicago Process Improvement Network, March 5, 2003.

[7] http://rspec.rubyforge.org/

About the author

TechWell Contributor's picture TechWell Contributor

The opinions and positions expressed within these guest posts are those of the author alone and do not represent those of the TechWell Community Sites. Guest authors represent that they have the right to distribute this content and that such content is not violating the legal rights of others. If you would like to contribute content to a TechWell Community Site, email editors@techwell.com.

AgileConnection is one of the growing communities of the TechWell network.

Featuring fresh, insightful stories, TechWell.com is the place to go for what is happening in software development and delivery.  Join the conversation now!

Upcoming Events

May 04
May 04
May 04
Jun 01