tdd


Should TDD and BDD be used in conjunction?


I am coming from a TDD mindset into BDD. I understand that using BDD is to focus on ensuring the behaviours and business goals of software are being met.
What confuses me is that if I start using BDD in place of TDD, it seems I'm not able to test at such a low-level. For example, when writing a test with a TDD mindset, I might test that properties have been attached to the scope:
it('should attach properties to scope', function () {
expect(MainCtrl.items.length).toEqual(1);
});
In doing this, another developer knows the assignment to scope was expected and required for future use, saving them some debugging should they have removed the assignments or changed defaults etc.
This example doesn't define a behavior so can't be considered BDD. Of course, I could rewrite the test description to make it more behavior orientated, such as, "when the page loads, setup properties for later use so the user can do so and so..." but this seems too abstract.
Is it a done-thing to use both TDD and BDD at the same time? Have BDD available to define the behaviors for all parties involved in the project (including non-technical) and TDD specifically for developers?
Short answer, yes.
However, the distinction between BDD and TDD is not as you've mentioned and I'd like to clear up what "ensuring the behaviours and business goals of software are being met" really means :)
BDD precedes, envelopes and goes beyond the development stage. BDD is far more than a syntax and not just a change from the word "test" to the word "should". BDD is actually a paradigm to writing software that involves the end-to-end business. This page explains that:
BDD is a second-generation, outside–in, pull-based, multiple-stakeholder, multiple-scale, high-automation, agile methodology. It describes a cycle of interactions with well-defined outputs, resulting in the delivery of working, tested software that matters.
BDD starts with deliberate discovery, where a group of people get together and flesh out the details of a story using scenarios. The group of people is typically made up of 1+ of each of the following disciplines: product, development and QA - also referred to as the three amigos. This exercise precedes development and is very good at identifying defects before you even start development and it creates better specifications through a shared understanding.
Once you have a good story with good scenarios, you can drive development using an outside-in testing approach:
This means you start with the acceptance test (avoid the UI if you can), and as you drive development into the system, you employ TDD at the integration and unit levels for things like your services and domain objects. Here you can choose any syntax you like, and what you have used above with "should" is fine.
If you're using Javascript, we created an open source tool called Chimp to make the process of outside-in testing easy.
Finally, I recommend you look at the following links:
Specification by Example
Shallow Depth of Test

Related Links

How to practice TDD on a web app?
junit - share a fixture between testcase
How to use TDD correctly to implement a numerical method?
What is Best for Defect Rate Tracking? Defects per KLOC?
TDD with IronPython [closed]
Gallio Icarus vs. Testdriven.net [closed]
Can we come up with a better name for TDD?
TDD in an large project: How do you get started?
How do I get sufficient detail in planning and estimation when using TDD?
What design models to create before TDD?
BDD/TDD: can dependencies be a behavior?
What is the best description of TDD? [closed]
TDD and development time
When stop testing using TDD?
Is it normal to have a long list of arguments in the constructor of a Presenter class?
When to Expect and When to Stub?

Categories

HOME
pandas
ionic-framework
layout
fft
vmware
relay
spagobi
jsp-tags
sqlite-net-extensions
filtering
amazon-ecs
jsrender
awesome-wm
maude-system
adobe-analytics
handsontable
fortumo
msp430
caml
clojurescript
solaris-10
karma-jasmine
cx-freeze
realex-payments-api
emgucv
poltergeist
kannel
filezilla
greendao
publish
directx-10
binary-data
wallpaper
picasso
bower-install
ssjs
android-fingerprint-api
user-controls
.net-4.6.2
scorm
outlook-2013
xml-documentation
pnotify
datastax-startup
nsarray
namecoin
sqlbulkcopy
pearson
color-profile
pycaffe
yt-project
removechild
xml-attribute
flash-cs5
ios4
pyke
r-tree
wso2cloud
intellij-14
ruby-2.2
deis
mono-embedding
nsight
sniffer
angular-local-storage
dereference
device-orientation
operator-precedence
clicktag
cdt
rdtsc
wordpress-theme-customize
googlemock
has-many-through
uitouch
mysql-error-1062
kgdb
mbr
intentservice
spring-io
flash-builder4.5
shellexecute
mylyn
rabl
enterprisedb
itmstransporter
chuck
datawindow
automount
newtonscript
ohm
asyncfileupload
stage
xdomainrequest
android-sdk-2.1
html-input
cxxtest
fluent-interface
iweb
microsoft-virtualization
photoshop-cs4
defensive-programming

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App