Posts

Showing posts from April, 2023

Test Driven Development - As a Beginner

Image
  My Journey with Test-Driven Development Many years ago, when I started working on a new project, my Architect & the head of the Project wanted us to follow Test Driven Development (TDD) approach. That was the first time I heard about this concept. As with any other developer even I was in the mindset that writing a test first is not going to work and is very time-consuming. But, I wanted to give it a try. I started by writing a test for a simple method that I needed to implement in my code. Here's an example of the test that I started playing with TDD: public void testAddition () {      Calculator calculator = new Calculator ();      int result = calculator.add( 2 , 3 );      assertEquals( 5 , result); } This test checks that the add method of the Calculator class correctly adds two numbers together. The assertEquals method checks that the result is equal to the expected value, which is 5 i...