Questions tagged [bdd]

BDD stands for Behavior Driven Development. It is related to, and derived from, TDD (Test Driven Development) and ATDD (Acceptance Test Driven Development). It differs from them in its language, preferring "example", "scenario" or "specification" to "test".

BDD stands for Behavior Driven Development.

It is related to, and derived from, TDD (Test Driven Development) and ATDD (Acceptance Test Driven Development). It differs from them in its language, preferring "example", "scenario" or "specification" to "test".

Unlike TDD, BDD is not focused on functionality but on behavior.

It improves communication between team members and it bridges the gap between non-technical and technical people working on the same project by using a common language. Whereas TDD focuses on "how" to implement the functionality, BDD explains "what" functionality to implement.

BDD is an Agile software development process...

...that encourages collaboration between developers, QA and business participants in a software project.

BDD is also known as...

... (Specification by Example) or (Acceptance Test Driven Development). It is derived from (Test Driven Development). It differs from them in its language, preferring example, scenario or specification to test. The language is intended to encourage questioning and conversation around the scenario or example, as BDD works from an assumption that we don't know enough to write an accurate test in the first place.

Scenario-based BDD tools use a Given / When / Then format to capture and automate the conversations. TDD and mocking tools are commonly used at a class level.

Tag questions about binary decision diagrams with . Tag questions about Microsoft's Business Desktop Deployment, now Microsoft Deployment Toolkit, with .

3390 questions
59
votes
1 answer

Mockito: given versus when

In order to stub methods when using JUnit and Mockito, it's possible to use two ways: when(foo.doSomething()).thenReturn(somethingElse); and given(foo.doSomething()).willReturn(somethingElse); Are there any differences between these two stubs?
Rollerball
  • 12,618
  • 23
  • 92
  • 161
57
votes
10 answers

TDD and BDD Differences

I honestly don't see the difference between BDD and TDD. I mean, both are just tests if what is expected happens. I've seen BDD Tests that are so fleshed out they practically count as TDD tests, and I've seen TDD tests that are so vague that they…
Jon Abaca
  • 821
  • 1
  • 9
  • 14
53
votes
8 answers

How can I see print() statements in behave (BDD)

Context: I am using Python with Behave (BDD). Whether I run my tests from the command line (behave) or from a custom main(), the behavior is the same: the test runs and the only output that I see in the console is the standard BDD report. My tests…
Ben
  • 1,205
  • 1
  • 9
  • 14
52
votes
3 answers

How to use RSpec without Rails?

What is the process for doing TDD in Ruby with RSpec without Rails? Do I need a Gemfile? Does it only need rspec in it? Ruby 1.9.3
B Seven
  • 44,484
  • 66
  • 240
  • 385
50
votes
5 answers

How to avoid anemic domain models, or when to move methods from the entities into services

I have a common scenario that I am looking for some guidance from people more experienced with DDD and Domain Modeling in general. Say I start out building a blog engine, and the first requirement is that after an Article is posted, users can start…
Matt Hidinger
  • 1,743
  • 16
  • 16
49
votes
14 answers

How to run unit-tests in all browsers?

I've never used Selenium but I guess it's for simulating user interaction in all browsers. That's like integration tests. But how do you test your js libraries/frameworks (unit testing) on all the browsers in an automated way?
ajsie
  • 77,632
  • 106
  • 276
  • 381
49
votes
4 answers

Cucumber vs Capybara

Can someone explain the difference between these two platforms? Are both part of BDD but why should I use one or other, or both together?
piermaria
  • 551
  • 1
  • 4
  • 6
48
votes
1 answer

How can I simulate the passing of time in Mocha tests so that setTimeout callbacks are called?

I need to test JavaScript code that relies on setTimeout in order to perform periodic tasks. How can I from my Mocha tests simulate the passing of time so that setTimeout callbacks gets called? I am basically asking for functionality similar to…
aknuds1
  • 65,625
  • 67
  • 195
  • 317
47
votes
7 answers

Are BDD tests acceptance tests?

Do you need something like Fitnesse, if you have BDD tests?
pondermatic
  • 6,453
  • 10
  • 48
  • 63
43
votes
3 answers

Outside-in BDD (with Specflow)

I'm new to BDD, but I found it very interesting and want to develop my next project using BDD. After googling and watching screencasts I still have lots of questions about BDD in real life. 1. Declarative or Imperative scenarios? Most of…
Sergey Berezovskiy
  • 232,247
  • 41
  • 429
  • 459
43
votes
5 answers

In behave, how do you run a scenario only?

I have a 'behave' feature that has a lot of tests on it. I only need to run a specific scenario for development needs. How do I do it? (preferably on the command line)
Mark Lopez
  • 770
  • 1
  • 6
  • 10
42
votes
3 answers

Complete rails json API example with Rspec tests

I'm looking for a good example repository of a Rails 3 project that implements a JSON API and has included RSpec tests. A full tutorial would be great but I'd settle for just a well commented example.
Christian Schlensker
  • 21,708
  • 19
  • 73
  • 121
42
votes
5 answers

In RSpec - how can I test if one attribute is less (or more) than another

In my app I want to have a Car model. It will have two fields among others: date_from and date_till (to specify a period of time someone was using it). And I want the model to validate that date_from should be less or equal than date_till. My…
Nikita Hismatov
  • 1,546
  • 1
  • 13
  • 30
40
votes
1 answer

Am I writing my first MSpec specifications correctly?

I'm writing my first MSpec specifications and I wanted some guidance. I left the specs in the "pending" state, but the context is filled out. Are there any improvements to be made? For reference, this is the story and first scenario: Story: "Blog…
Sekhat
  • 4,435
  • 6
  • 43
  • 50
39
votes
6 answers

Cuke4Nuke or SpecFlow?

I am trying to decide if I should use Cuke4Nuke or SpecFlow. What are the pro/cons of each? Opinions on which is better and why. Thanks!
Rich Blumer
  • 960
  • 1
  • 15
  • 26