To view lecture notes for this course, please consult the github-pages.
Definition of BDD via Wikipedia
BDD (behavior-driven development) combines practices from TDD and from ATDD.[27] It includes the practice of writing tests first, but focuses on tests which describe behavior, rather than tests which test a unit of implementation. Tools such as Mspec and Specflow provide a syntax which allow non-programmers to define the behaviors which developers can then translate into automated tests. Behavior-driven development combines the general techniques and principles of TDD with ideas from domain-driven design and object-oriented analysis and design to provide software development and management teams with shared tools and a shared process to collaborate on software development.
The main difference is just the wording. BDD uses a more verbose style so that it can be read almost like a sentence.
In contrast to TDD, BDD is when we write behavior & specification that then drives our software development. The ability to read your tests like a sentence is a cognitive shift in how you will think about your tests. The argument is that if you can read your tests fluidly, you will naturally write better and more comprehensive tests.
Instructions for BDD Exercises: 1. Go to bdd folder cd bdd 2. Open program.test.js and go to each TODO block. 3. Complete each todo block by adding bdd style unit test. 4. In order to complete the exercises run the script npm run bdd:test
1. Unit Test the findIdx Function:
it('Unit test the Array.prototype.findIdx function', done => {constnumbers= [1,2,3,4,5];constexpected=2;expect(numbers.findIdx(val => val ===3)).to.eql(expected);constnames= [ { name:'Marcel' }, { name:'Leo' }, { name:'Dave' } ];constIDX=1;// TODO add assertions here:done(); });