This page walks you through a simple TDD kata
Pre-requisite knowledge
How to install a the unit testing framework for the particular language
An understanding of why testing is important
How to write a unit test and run the test
The three A's (Arrange, Act, Assert)
Writing incremental tests and why this is important - one test, some production code, then next test and some production code
The problem statement
A user can send from a front end application a series of comma separated words to be logged as part of a wider application. You can assume that there already exists some code that sends a cleansed array of words to the business/database tier - these are referred to as tags. You must design an implementation class (the CUT) that splits that string into an array of strings. You will need to write the tests first, then the production code.
Overview
You are going to develop a small piece of code that accepts a comma delimited list of tags (words/tokens - characters, numbers, some symbols like $£%& but not a comma) and must return an array of tags. The preceding and proceeding commas should be removed, white spaces preceding the first tag must be removed, white spaces proceeding the last tag must be removed, contiguous series of words separated with spaces and ended with a comma should be treated as single tag
Examples of the rules are as follows
"" must return []
"java" must return ["java"]
" java,python" must return ["java", “python”]
"java byte code,python" must return must return ["java byte code", "python"]
Constructs your tests in the following order