Tools for TDD

Mocha

Using Mocha for use as a framework for test driven development of your Node.JS apps.

Mocha is a feature-rich JavaScript test framework running on Node.js and the browser, making asynchronous testing simple and fun.

Agile methods today are very common among software projects. TDD is one of the main agile development techniques.

Installing Mocha:

$ npm install –g mocha

TDD

Test-driven development (TDD) is a software development process that based upon repetition of a very short development cycle.

The main idea behind TDD is to:

  1. Add and define the test.
  2. Implement the internal test logic.
  3. Check and validate that the test either passes or fails
  4. Write some code
  5. Run tests
  6. Refactor the code
  7. Repeat

Assersion libraries

  1. Assert built in module in Node
  2. Expect.JS
  3. Chai Assert

expect({ foo: 'baz' }).to.have.property('foo') .and.not.equal('bar');

results matching ""

    No results matching ""