# Observations on the testing culture of Test Driven Development

Mar 2, 2018 · 14 min read
`[KISS, Quality, YAGNI, ...] + [Testing, Specs, ...] == [TDD, ...]`

# 3. TDD Commands Thinking At Least Slightly Forward

`// A Test List// "" -> does not validate// "a" -> does not validate// "aa" -> validates// "racecar" -> validates// "Racecar" -> validates// print the validation// have a blueberry ale`

# 6: TDD Reveals Unit Test Frailty And Degenerative Implementation

`// Not an imperfect palindrome.@Testfun `Given "", then it does not validate`() {    "".validate().shouldBeFalse()}@Testfun `Given "a", then it does not validate`() {    "a".validate().shouldBeFalse()}@Testfun `Given "aa", then it validates`() {    "aa".validate().shouldBeTrue()}@Testfun `Given "abba", then it validates`() {    "abba".validate().shouldBeTrue()}@Testfun `Given "racecar", then it validates`() {    "racecar".validate().shouldBeTrue()}@Testfun `Given "Racecar", then it validates`() {    "Racecar".validate().shouldBeTrue()}`
`// Too generic of a solve based on tests providedfun String.validate() = if (isEmpty() || length == 1) false else toLowerCase() == toLowerCase().reversed()// Is the best implementation and solves all testsfun String.validate() = length > 1`

# 7: TDD Reveals Assertion Completion Feedback Loop

`// Print numbers 9 to 15. [OK]// For numbers divisible by 3, print Fizz instead of the number.// ...`
`@Testfun `Given numbers, replace those divisible by 3 with "Fizz"`() {    val machine = FizzBuzz()    assertEquals(machine.print(), "?")}class FizzBuzz {    fun print(): String {        var output = ""        for (i in 9..15) {            output += if (i % 3 == 0) {                "Fizz "            } else "\${i} "        }        return output.trim()    }}Expected <Fizz 10 11 Fizz 13 14 Fizz>, actual <?>.`

# Conclusion

`@Testfun `Given software, when we build, then we expect tests`() {    build(software) shoudHave tests}`

Written by

Written by