On this article, we want to show you how to implement test driven development in Go Language with VS Codes.
What is Test Driven Development
Test Driven Development (TDD) is a programming technique when you do test first development. It is introduced in the era eXtreme Programming with their Agile process. The idea of test driven is like this
- Create the empty function with input and output.
- Create the unit test regarding the function
- Make it fail (yes, it shall fail since it's empty function)
- Correct the function
- Make it pass
It provides you an extra step, but it will make your code quality better
Before we start
Before we start you should install
- Visual Studio Codes
- Go Languages SDK
- Go extension in VS Codes
You can visit the tutorial here.
Demonstration
On this video demonstration, I will show you how to:
- Create a skeleton function
- Invoke the Test Generator to generate the test function
- Creating test case
- Invoke the unit test
- Fix the codes
- Rerun the test till pass