Inspiration
Test Driven Development
or TDD
is something I was hearing a lot but didn't fully understand.
This little project is my way of exploring and learning it's fundamentals.
What it does
StringCalculatorTDD is a project created for TDD beginners as a solution for TDD Kata 1 - String Calculator.
Prerequisites
Before you begin, ensure you have met the following requirements:
- You have installed the latest version of
java, testng, maven
Exploring StringCalculatorTDD
To explore StringCalculatorTDD, follow these steps:
git clone https://github.com/2kabhishek/StringCalculatorTDD
cd StringCalculatorTDD
code . # Or any other of your favorite editor
Using StringCalculatorTDD
After cloning the project one good way to learn from it would be using git history.
Just do a git log
and look at the changes, you can go through the entire process of TDD one step at a time.
How it was built
StringCalculatorTDD was built using Java
and TestNG
, the IDE used was Eclipse
.
Challenges faced
Wrapping my head around the laws of TDD, which are:
- You are not allowed to write any production code unless it is to make a failing unit test pass.
- You are not allowed to write any more of a unit test than is sufficient to fail.
- You are not allowed to write any more production code than is sufficient to pass one failing test.
What I learned
I learned why TDD is used and how it helps us in producing, bug free maintainable code.
The cycle of TDD is somewhat as such:
- Write a failing unit test
- Write code to pass the test
- Refactor if necessary
I also learned about TestNG, which is a more feature rich equivalent of JUnit.
What's next
Probably use TDD in more of my future projects.
Hit the :star: button if you found this useful.