I came across those two test development Behaviour-Driven Development and Test-Driven Development while I was developing framework. Mainly we can looking to those from two perspectives Language and scope
Firstly look for language.
In here you need to think who will be using you frame work (means who will write test, who we run to get the results)
- TDD assertEuqals(count,5) //much close to developer to under stand
TDD seem good if you test framework will be used by software developer.
- BDD $(count).should_be(5) // better for not for software developers but better for customers (Non technical person )
Focus sample for to understand the scope regard to test
Robotic (Robo )have to enter to the room from Door 1 and go out from Door2
There are for thinks you need to understand in here.
1 - specification (Problem domain,information that you have solve it, Information is enough for your task) For above sample yap, it is fine.
2- feedback (System able to monitor (Robo movements , entering to room and coming out from the room) Yap in here we can monitor those
3 - regression (System can be try for n time) Yap, sample can be try with n times
4 - granularity give information when test went fail (when/where test fails)
To do this test need to bring smaller then it faster to find issue
For above sample you can divide room to small part so when robo fail, it will be easy find where it went wrong
Now you can tell where robo went wrong such as ‘s1’ or ‘s2’ section in room rather tell robo went wrong in room.
TDD is much “locking implementation”, Think you did not get this read then read my sorting sample in this post.
Lot of people do not have much clear idea above post subject and what is different of both where is sorting sample for those.
Sorting sample for TDD and BDD
There are different type of sorting methods that we learn in universities.
Quicksort
Merge sort
In-place merge sort
Heapsort
Insertion sort
Selection sort
Shell sort
Bubble sort
Binary tree sort
Cocktail sort
Cycle sort
But all of them give same out put,
You ask to write test for this sample
- BDD will check only the out put after sorting
- TDD will check inside sorting function
for first sample regard to robo ‘change path’ of robo will be not find from BDD but TDD will therefore it is locking implementation
BDD focus not braking developing mainly when changing requirement.
Think you have much good idea on TDD and BDD.
Add a comment