Behavior-Driven Development: An Evolution in Software Design


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.

[2] See Wikipedia 2007-08-24

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

[4] Version 1.0.1. Apple OS X

[5] Version 1.0.1. Apple OS X

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


About the author

AgileConnection is a TechWell community.

Through conferences, training, consulting, and online resources, TechWell helps you develop and deliver great software every day.