Test-Driven Development + Continuous Integration using NodeJS and GitHub Hooks

Test-Driven Development + Continuous Integration using NodeJS and GitHub Hooks

What is Test-driven development?Typically as developers, we get requirements from our product owners and we start writing code but here we need to convert this user story to test cases. For this story, let's say these will be my test cases and all platforms should follow the same. By doing this we also ensure that its uniform across all platforms

Why test-driven development or unit testing?

  1. Test-driven development helps you reduce bugs as we predefine the test cases
  2. It helps you in code maintainability. Say a new developer comes and changes the code without having the product knowledge. Our test cases will fail which would help the new developer know where he went wrong
  3. Additional to above point these test cases can act as documentation and help the new developer understand the code better
  4. Test-driven development is adopted by agile software developers as it helps you with quick releases by using Continuers integration & Continues deployment (CI/CD)

In this article, let’s build a simple sign up service with Node using TTD. I will be using the same initial set up which I had earlier used in one of my articles to set up NodeJS using Kubernetes. If you are interested, please check out the article here. GitHub link for initial set up with express and typescript can be found here(Please ignore Docker and Kubernetes set up if you are not familiar with it as we won't be using it here).


Let's say we have a new user story where our product/customer wants to have a simple sign up page.

Typically as developers, we get requirements from our product owners and we start writing code but here we need to convert this user story to test cases. For this story, let's say these will be my test cases and all platforms should follow the same. By doing this we also ensure that its uniform across all platforms

  1. The first name should be mandatory
  2. An email has to be valid
  3. Password length has to a minimum of 6 characters
  4. Email Id and Password fields should be mandatory
  5. Password and Confirm password has to be same
  6. Duplicate emails should not be allowed
  7. Should allow to create a user with proper first name, last name email, password and confirm password
  8. Should allow creating a user without last name.

Now that we have our requirements ready let's build our application.

continuous-integration test-driven-development github ci ttd

Bootstrap 5 Complete Course with Examples

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

Building a simple Applications with Vue 3

Deno Crash Course: Explore Deno and Create a full REST API with Deno

How to Build a Real-time Chat App with Deno and WebSockets

Convert HTML to Markdown Online

HTML entity encoder decoder Online

Database Unit Testing and Test-Driven Database Development

How to implement database unit testing and test-driven, Behavior-Driven development with Selenium WebDriven and Apache JMeter

50+ Useful Kubernetes Tools for 2020 - Part 2

Our original Kubernetes tool list was so popular that we've curated another great list of tools to help you improve your functionality with the platform.

Test Driven and Behavior Driven Development.

Implementing Test Driven Development, Behavior Driven Development Principles and Implementation in Big Data and Acceptance Testing

Creating A Continuous Integration Test Workflow Using GitHub Actions

Learn how to create a continuous integration workflow for your Node JS REST API by using GitHub Actions as well as how to report test coverage with Coveralls.

Domain Driven Testing for Test Automation.

Overview of Domain driven testing and strategy in Automation, Implementing and Advantages for microservices architecture applications