?

Test-Driven Development Lab: Build a To-Do API

Bookmark
14 Launches
Solution Overview

Learning Test-Driven Development (TDD) requires putting the technical concepts into practice. This lab provides a framework for you to build a full application using TDD. You will build a To-Do List application that is implemented as a RESTful service, with To-Do items persisting in a local database. The documentation provided will walk you through implementing the first two features of the application starting from a User Acceptance Test (UAT) and emerging into a multi-layer architecture that separates the various application concerns.

This lab is intended to be the conclusion of a series of labs that teach the concepts of TDD. If you have not yet worked through the other labs in the series, that would be a good place to start, however, it is not absolutely necessary. This lab will touch on the high-level concepts of TDD as you put them into practice.

Working through the documentation will leave you with two fully implemented features, and a series of requirements that are necessary to complete the application. You may finish as many of the remaining application features as you'd like in order to practice TDD on your own or add your own features if you wish. You have full access to update the application, including the database schema, as you see fit.

Prerequisites:

This lab requires a working knowledge of JavaScript (specifically ECMA Script 6) syntax. It can be launched by anyone who is interested in the content of the lab, however, it may be challenging to get the tests to pass without some prior debugging experience. There are a few key points in the lab where more complete code blocks are provided that should get you back on track if things are not working as expected.

Goals & Objectives

Through this lab you will put into practice a number of test-driven development concepts:

  • Using user-acceptance tests (UAT) to drive out the design of an application
  • Testing/implementing a multi-layer architecture with service-level and unit tests
  • Building a RESTful web service using Express
  • Implementing Sinon stubs to mock out the behavior of code dependencies
  • Sending/receiving information from an API using request and response objects
  • Routing API requests to the correct controller based on a path object
  • Working independently to analyze features and break them into descriptive tests/code

Hardware & Software

  • JavaScript (ECMA Script 6)
  • Node.js
  • Express.js
  • Mocha
  • Chai.js
  • Sinon.js
  • MySQL
What's Next?
Learn more about Application Development, stay up-to-date with the industry and the new technology we have at WWT.