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:
Thanks in advance.
Regarding BDD Framework for .NET, I came across this post in SO Most Mature BDD Framework for .NET
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.
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.
The BDD process moves through three phases—discovery, formulation, and automation—where the acceptance criteria are transformed into acceptance tests that are later automated.
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)
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With