Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What steps would you recommend to move from TDD to BDD?

If you want to move your development process from Test-Driven Development to Behavior-Driven Development what path would you take or recommend?

What are the possible challenges that you might face? Moving the development process will be a huge task itself as the paradigm changes, a shift happens in the thought process and the outlook of project execution changes.

Did any one had a real experience in making this shift happens smoothly (hmm... may not be so smoothly)?

Or anyone trying to make this shift?

I understand this may not be applied to each and everything. But what would be the logical step in case if someone needs to move towards this.

I have only basic information about BDD from the following SO post. Primary differnce between TDD and BDD

The key points I am looking for are:

  • What kind of developer training is needed?
  • Is there any significant changes in the SDLC process?
  • What are the BDD tools you recommend (.net) ?
  • Good BDD resources (.net)

Thanks in advance.

EDIT:

Regarding BDD Framework for .NET, I came across this post in SO Most Mature BDD Framework for .NET

like image 767
rajesh pillai Avatar asked Jan 20 '09 18:01

rajesh pillai


People also ask

How do you choose between TDD and BDD?

BDD is designed to test an application's behavior from the end user's standpoint, whereas TDD is focused on testing smaller pieces of functionality in isolation.

Is BDD a replacement for TDD?

BDD is a replacement for both TDD and ATDD (and derived from them). The first ever tool for BDD, JBehave, actually started as a replacement for the unit-testing framework JUnit.

What are the 3 practices of BDD?

The BDD process moves through three phases—discovery, formulation, and automation—where the acceptance criteria are transformed into acceptance tests that are later automated.


1 Answers

When I started to look at BDD I investigated all the frameworks out there (for .net) and ended up using none of them. Main reason is I feel like the community hasn't settled on a syntax and best practises yet so instead I continued to use NUnit with a base class based on a blog post by Ben Scheirman. This worked out really well because BDD is not about the tooling but making the tests clean and understandable which is totally possible with normal tools like nunit.

Compared to my old unit tests the new style is much more readable and puts a lot more focus on naming and behavior. We're not that far from printing out the method names and have a discussion with the business people about the system.

Some additional reading by Scott Bellware: Behavior-Driven Development

Examle of a test:

public class WhenAddingLineItemToEmptyOrder : BDDBase
{
    Order order;

    [SetUp]
    public void Arrange()
    {
        order = new Order();
    }

    public void Act() // called by BDDBase
    {
        LintItem item = new LineItem();
        item.Quantity = 1;
        item.Price = 10;
        order.AddLineItem(item);
    }

    [Test]
    public void TotalPriceShouldBeUpdated()
    {
        Assert.AreEqual(10, order.TotalPrice);
    }

    [Test]
    public void OrderCanBeCheckedOut()
    {
        Assert.IsTrue(order.CanBeCheckedOut)
    }
}
like image 141
Dala Avatar answered Oct 20 '22 18:10

Dala